Added nav menu expander

pull/197/head
M66B 4 years ago
parent a63795d9bc
commit 541a52ea4b

@ -104,6 +104,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private RecyclerView rvUnified; private RecyclerView rvUnified;
private ImageButton ibExpanderFolder; private ImageButton ibExpanderFolder;
private RecyclerView rvFolder; private RecyclerView rvFolder;
private ImageButton ibExpanderMenu;
private RecyclerView rvMenu; private RecyclerView rvMenu;
private ImageButton ibExpanderExtra; private ImageButton ibExpanderExtra;
private RecyclerView rvMenuExtra; private RecyclerView rvMenuExtra;
@ -344,11 +345,27 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}); });
// Menus // Menus
ibExpanderMenu = drawerContainer.findViewById(R.id.ibExpanderMenu);
rvMenu = drawerContainer.findViewById(R.id.rvMenu); rvMenu = drawerContainer.findViewById(R.id.rvMenu);
rvMenu.setLayoutManager(new LinearLayoutManager(this)); rvMenu.setLayoutManager(new LinearLayoutManager(this));
adapterNavMenu = new AdapterNavMenu(this, this); adapterNavMenu = new AdapterNavMenu(this, this);
rvMenu.setAdapter(adapterNavMenu); rvMenu.setAdapter(adapterNavMenu);
boolean nav_menu = prefs.getBoolean("nav_menu", true);
ibExpanderMenu.setImageLevel(nav_menu ? 0 /* less */ : 1 /* more */);
rvMenu.setVisibility(nav_menu ? View.VISIBLE : View.GONE);
ibExpanderMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean nav_menu = !prefs.getBoolean("nav_menu", true);
prefs.edit().putBoolean("nav_menu", nav_menu).apply();
ibExpanderMenu.setImageLevel(nav_menu ? 0 /* less */ : 1 /* more */);
rvMenu.setVisibility(nav_menu ? View.VISIBLE : View.GONE);
}
});
// Extra menus // Extra menus
ibExpanderExtra = drawerContainer.findViewById(R.id.ibExpanderExtra); ibExpanderExtra = drawerContainer.findViewById(R.id.ibExpanderExtra);

@ -95,6 +95,17 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rvFolder" /> app:layout_constraintTop_toBottomOf="@id/rvFolder" />
<ImageButton
android:id="@+id/ibExpanderMenu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/title_legend_expander"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorFolder"
app:srcCompat="@drawable/expander" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvMenu" android:id="@+id/rvMenu"
android:layout_width="0dp" android:layout_width="0dp"
@ -103,7 +114,7 @@
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorFolder" /> app:layout_constraintTop_toBottomOf="@id/ibExpanderMenu" />
<View <View
android:id="@+id/vSeparatorMenu" android:id="@+id/vSeparatorMenu"

Loading…
Cancel
Save