QoL: make the settings button easier to click

Bigger hitbox, but not visually
This commit is contained in:
Mathias-Boulay 2024-11-29 18:22:39 +01:00
parent d5fd73c9e9
commit 29605ed6b7
3 changed files with 11 additions and 10 deletions

View File

@ -16,23 +16,22 @@ public class DrawerPullButton extends View {
public DrawerPullButton(Context context) {super(context); init();} public DrawerPullButton(Context context) {super(context); init();}
public DrawerPullButton(Context context, @Nullable AttributeSet attrs) {super(context, attrs); init();} public DrawerPullButton(Context context, @Nullable AttributeSet attrs) {super(context, attrs); init();}
private final Paint mPaint = new Paint(); private final Paint mBackgroundPaint = new Paint();
private VectorDrawableCompat mDrawable; private VectorDrawableCompat mDrawable;
private void init(){ private void init(){
mDrawable = VectorDrawableCompat.create(getContext().getResources(), R.drawable.ic_sharp_settings_24, null); mDrawable = VectorDrawableCompat.create(getContext().getResources(), R.drawable.ic_sharp_settings_24, null);
setAlpha(0.33f); setAlpha(0.33f);
mBackgroundPaint.setColor(Color.BLACK);
} }
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
mPaint.setColor(Color.BLACK); canvas.drawArc(getPaddingLeft(),-getHeight() + getPaddingBottom(),getWidth() - getPaddingRight(), getHeight() - getPaddingBottom(), 0, 180, true, mBackgroundPaint);
canvas.drawArc(0,-getHeight(),getWidth(), getHeight(), 0, 180, true, mPaint);
mPaint.setColor(Color.WHITE); mDrawable.setBounds(getPaddingLeft()/2, getPaddingTop()/2, getHeight() - getPaddingRight()/2, getHeight() - getPaddingBottom()/2);
mDrawable.setBounds(0, 0, getHeight(), getHeight());
canvas.save(); canvas.save();
canvas.translate((getWidth()-getHeight())/2f, 0); canvas.translate((getWidth()-getHeight())/2f, -getPaddingBottom()/2f);
mDrawable.draw(canvas); mDrawable.draw(canvas);
canvas.restore(); canvas.restore();
} }

View File

@ -51,8 +51,9 @@
<net.kdt.pojavlaunch.customcontrols.handleview.DrawerPullButton <net.kdt.pojavlaunch.customcontrols.handleview.DrawerPullButton
android:id="@+id/drawer_button" android:id="@+id/drawer_button"
android:layout_width="24dp" android:layout_width="40dp"
android:layout_height="12dp" android:layout_height="20dp"
android:padding="8dp"
android:elevation="10dp" android:elevation="10dp"
android:layout_gravity="center_horizontal"/> android:layout_gravity="center_horizontal"/>
<net.kdt.pojavlaunch.customcontrols.mouse.HotbarView <net.kdt.pojavlaunch.customcontrols.mouse.HotbarView

View File

@ -15,8 +15,9 @@
<net.kdt.pojavlaunch.customcontrols.handleview.DrawerPullButton <net.kdt.pojavlaunch.customcontrols.handleview.DrawerPullButton
android:id="@+id/drawer_button" android:id="@+id/drawer_button"
android:layout_width="32dp" android:layout_width="40dp"
android:layout_height="16dp" android:layout_height="20dp"
android:padding="6dp"
android:elevation="10dp" android:elevation="10dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"