0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

replaced drawer style

This commit is contained in:
TrianguloY 2023-06-28 22:25:26 +02:00
parent bf6d25fb3c
commit 78ffa67c5c
2 changed files with 37 additions and 11 deletions

View File

@ -40,10 +40,11 @@ public class DrawerModule extends AModuleData {
}
class DrawerDialog extends AModuleDialog {
private ImageView button;
private MainDialog dialog;
private ImageView buttonL;
private ImageView buttonR;
private final MainDialog dialog;
public DrawerDialog(MainDialog dialog){
public DrawerDialog(MainDialog dialog) {
super(dialog);
this.dialog = dialog;
}
@ -55,11 +56,14 @@ class DrawerDialog extends AModuleDialog {
@Override
public void onInitialize(View views) {
button = views.findViewById(R.id.drawerButton);
button.setOnClickListener(v -> {
buttonL = views.findViewById(R.id.drawerL);
buttonR = views.findViewById(R.id.drawerR);
var parent = views.findViewById(R.id.parent);
parent.setOnClickListener(v -> {
dialog.toggleDrawer();
updateMoreIndicator();
});
parent.getBackground().setAlpha(25);
updateMoreIndicator();
}
@ -69,7 +73,9 @@ class DrawerDialog extends AModuleDialog {
}
void updateMoreIndicator() {
button.setImageResource(dialog.getDrawerVisibility() == View.VISIBLE ?
buttonL.setImageResource(dialog.getDrawerVisibility() == View.VISIBLE ?
R.drawable.arrow_down : R.drawable.arrow_right);
buttonR.setImageResource(dialog.getDrawerVisibility() == View.VISIBLE ?
R.drawable.arrow_down : R.drawable.arrow_right);
}
}

View File

@ -1,15 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
android:layout_gravity="center_horizontal"
android:layout_marginStart="@dimen/padding"
android:layout_marginLeft="@dimen/padding"
android:layout_marginTop="@dimen/smallPadding"
android:layout_marginEnd="@dimen/padding"
android:layout_marginRight="@dimen/padding"
android:layout_marginBottom="@dimen/smallPadding"
android:background="@drawable/round_box"
android:backgroundTint="?attr/colorAccent"
android:gravity="center|center_vertical"
android:weightSum="2">
<ImageView
android:id="@+id/drawerButton"
android:layout_width="match_parent"
android:id="@+id/drawerL"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/smallPadding"
android:layout_weight="1"
android:src="@drawable/arrow_down"
android:tint="?attr/colorAccent" />
<ImageView
android:id="@+id/drawerR"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleX="-1"
android:src="@drawable/arrow_down"
android:tint="?attr/colorAccent" />
</LinearLayout>