Browse Source

Show if primary account is connected

main
M66B 6 years ago
parent
commit
13ed886739
3 changed files with 14 additions and 1 deletions
  1. +3
    -0
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  2. +10
    -0
      app/src/main/res/drawable/baseline_folder_open_24.xml
  3. +1
    -1
      app/src/main/res/menu/menu_list.xml

+ 3
- 0
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -80,6 +80,7 @@ public class FragmentMessages extends FragmentEx {
private String search = null; private String search = null;
private long primary = -1; private long primary = -1;
private boolean connected = false;
private AdapterMessage adapter; private AdapterMessage adapter;
private AdapterMessage.ViewType viewType; private AdapterMessage.ViewType viewType;
@ -400,6 +401,7 @@ public class FragmentMessages extends FragmentEx {
@Override @Override
public void onChanged(EntityAccount account) { public void onChanged(EntityAccount account) {
primary = (account == null ? -1 : account.id); primary = (account == null ? -1 : account.id);
connected = (account != null && "connected".equals(account.state));
getActivity().invalidateOptionsMenu(); getActivity().invalidateOptionsMenu();
} }
}); });
@ -587,6 +589,7 @@ public class FragmentMessages extends FragmentEx {
menu.findItem(R.id.menu_search).setVisible(folder >= 0 && search == null); menu.findItem(R.id.menu_search).setVisible(folder >= 0 && search == null);
menu.findItem(R.id.menu_sort_on).setVisible(TextUtils.isEmpty(search)); menu.findItem(R.id.menu_sort_on).setVisible(TextUtils.isEmpty(search));
menu.findItem(R.id.menu_folders).setVisible(primary >= 0); menu.findItem(R.id.menu_folders).setVisible(primary >= 0);
menu.findItem(R.id.menu_folders).setIcon(connected ? R.drawable.baseline_folder_24 : R.drawable.baseline_folder_open_24);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String sort = prefs.getString("sort", "time"); String sort = prefs.getString("sort", "time");


+ 10
- 0
app/src/main/res/drawable/baseline_folder_open_24.xml View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,6h-8l-2,-2L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,8c0,-1.1 -0.9,-2 -2,-2zM20,18L4,18L4,8h16v10z"/>
</vector>

+ 1
- 1
app/src/main/res/menu/menu_list.xml View File

@ -31,7 +31,7 @@
<item <item
android:id="@+id/menu_folders" android:id="@+id/menu_folders"
android:icon="@drawable/baseline_folder_24"
android:icon="@drawable/baseline_folder_open_24"
android:title="@string/title_folder_primary" android:title="@string/title_folder_primary"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>

Loading…
Cancel
Save