mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Prepare long press folders action bar
This commit is contained in:
parent
856327e889
commit
011e75e65a
3 changed files with 25 additions and 3 deletions
|
@ -1981,6 +1981,21 @@ public class FragmentMessages extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
menu.findItem(R.id.menu_folders).setActionView(R.layout.action_button);
|
||||
ImageButton ib = (ImageButton) menu.findItem(R.id.menu_folders).getActionView();
|
||||
ib.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onMenuFolders();
|
||||
}
|
||||
});
|
||||
ib.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
@ -1992,7 +2007,8 @@ public class FragmentMessages extends FragmentBase {
|
|||
viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
|
||||
|
||||
menu.findItem(R.id.menu_folders).setVisible(viewType == AdapterMessage.ViewType.UNIFIED && primary >= 0);
|
||||
menu.findItem(R.id.menu_folders).setIcon(connected
|
||||
ImageButton ib = (ImageButton) menu.findItem(R.id.menu_folders).getActionView();
|
||||
ib.setImageResource(connected
|
||||
? R.drawable.baseline_folder_special_24 : R.drawable.baseline_folder_open_24);
|
||||
|
||||
menu.findItem(R.id.menu_sort_on).setVisible(
|
||||
|
@ -2031,8 +2047,8 @@ public class FragmentMessages extends FragmentBase {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_folders:
|
||||
// Obsolete
|
||||
onMenuFolders();
|
||||
loadMessages();
|
||||
return true;
|
||||
|
||||
case R.id.menu_sort_on_time:
|
||||
|
|
6
app/src/main/res/layout/action_button.xml
Normal file
6
app/src/main/res/layout/action_button.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/baseline_folder_24" />
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/menu_folders"
|
||||
android:icon="@drawable/baseline_folder_open_24"
|
||||
android:actionLayout="@layout/action_button"
|
||||
android:title="@string/title_folder_primary"
|
||||
app:showAsAction="always" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue