Added quick folder expand/collapse

This commit is contained in:
M66B 2021-04-07 18:42:16 +02:00
parent a1cb4e86d8
commit 8a9f0ebda3
2 changed files with 30 additions and 1 deletions

View File

@ -102,6 +102,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private RecyclerView rvAccount; private RecyclerView rvAccount;
private ImageButton ibExpanderUnified; private ImageButton ibExpanderUnified;
private RecyclerView rvUnified; private RecyclerView rvUnified;
private ImageButton ibExpanderFolder;
private RecyclerView rvFolder; private RecyclerView rvFolder;
private RecyclerView rvMenu; private RecyclerView rvMenu;
private ImageButton ibExpanderExtra; private ImageButton ibExpanderExtra;
@ -321,11 +322,28 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}); });
// Navigation folders // Navigation folders
ibExpanderFolder = drawerContainer.findViewById(R.id.ibExpanderFolder);
rvFolder = drawerContainer.findViewById(R.id.rvFolder); rvFolder = drawerContainer.findViewById(R.id.rvFolder);
rvFolder.setLayoutManager(new LinearLayoutManager(this)); rvFolder.setLayoutManager(new LinearLayoutManager(this));
adapterNavFolder = new AdapterNavFolder(this, this); adapterNavFolder = new AdapterNavFolder(this, this);
rvFolder.setAdapter(adapterNavFolder); rvFolder.setAdapter(adapterNavFolder);
boolean nav_folder = prefs.getBoolean("nav_folder", true);
ibExpanderFolder.setImageLevel(nav_folder ? 0 /* less */ : 1 /* more */);
rvFolder.setVisibility(nav_folder ? View.VISIBLE : View.GONE);
ibExpanderFolder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean nav_folder = !prefs.getBoolean("nav_folder", true);
prefs.edit().putBoolean("nav_folder", nav_folder).apply();
ibExpanderFolder.setImageLevel(nav_folder ? 0 /* less */ : 1 /* more */);
rvFolder.setVisibility(nav_folder ? View.VISIBLE : View.GONE);
}
});
// Menus
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);

View File

@ -65,6 +65,17 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rvUnified" /> app:layout_constraintTop_toBottomOf="@id/rvUnified" />
<ImageButton
android:id="@+id/ibExpanderFolder"
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/vSeparatorUnified"
app:srcCompat="@drawable/expander" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFolder" android:id="@+id/rvFolder"
android:layout_width="0dp" android:layout_width="0dp"
@ -73,7 +84,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/vSeparatorUnified" /> app:layout_constraintTop_toBottomOf="@id/ibExpanderFolder" />
<View <View
android:id="@+id/vSeparatorFolder" android:id="@+id/vSeparatorFolder"