Added quick folder expand/collapse

pull/197/head
M66B 4 years ago
parent a1cb4e86d8
commit 8a9f0ebda3

@ -102,6 +102,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private RecyclerView rvAccount;
private ImageButton ibExpanderUnified;
private RecyclerView rvUnified;
private ImageButton ibExpanderFolder;
private RecyclerView rvFolder;
private RecyclerView rvMenu;
private ImageButton ibExpanderExtra;
@ -321,11 +322,28 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
});
// Navigation folders
ibExpanderFolder = drawerContainer.findViewById(R.id.ibExpanderFolder);
rvFolder = drawerContainer.findViewById(R.id.rvFolder);
rvFolder.setLayoutManager(new LinearLayoutManager(this));
adapterNavFolder = new AdapterNavFolder(this, this);
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.setLayoutManager(new LinearLayoutManager(this));
adapterNavMenu = new AdapterNavMenu(this, this);

@ -65,6 +65,17 @@
app:layout_constraintStart_toStartOf="parent"
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
android:id="@+id/rvFolder"
android:layout_width="0dp"
@ -73,7 +84,7 @@
android:nestedScrollingEnabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorUnified" />
app:layout_constraintTop_toBottomOf="@id/ibExpanderFolder" />
<View
android:id="@+id/vSeparatorFolder"

Loading…
Cancel
Save