Added filters active hint

pull/162/head
M66B 5 years ago
parent ba8047b219
commit a1fd7bd511

@ -162,6 +162,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private ImageButton ibHintSwipe;
private ImageButton ibHintSelect;
private TextView tvNoEmail;
private TextView tvNoEmailHint;
private FixedRecyclerView rvMessage;
private View vwAnchor;
private SeekBar sbThread;
@ -358,6 +359,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
ibHintSelect = view.findViewById(R.id.ibHintSelect);
tvNoEmail = view.findViewById(R.id.tvNoEmail);
tvNoEmailHint = view.findViewById(R.id.tvNoEmailHint);
rvMessage = view.findViewById(R.id.rvMessage);
vwAnchor = view.findViewById(R.id.vwAnchor);
sbThread = view.findViewById(R.id.sbThread);
@ -888,6 +890,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
tvNoEmail.setVisibility(View.GONE);
tvNoEmailHint.setVisibility(View.GONE);
sbThread.setVisibility(View.GONE);
ibDown.setVisibility(View.GONE);
ibUp.setVisibility(View.GONE);
@ -2910,8 +2913,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
public void onLoading() {
loading = true;
pbWait.setVisibility(View.VISIBLE);
if (viewType == AdapterMessage.ViewType.SEARCH)
if (viewType == AdapterMessage.ViewType.SEARCH) {
tvNoEmail.setVisibility(View.GONE);
tvNoEmailHint.setVisibility(View.GONE);
}
}
@Override
@ -2921,7 +2926,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (initialized && SimpleTask.getCount() == 0)
pbWait.setVisibility(View.GONE);
tvNoEmail.setVisibility(fetched == 0 ? View.VISIBLE : View.GONE);
boolean none = (fetched == 0);
tvNoEmail.setVisibility(none ? View.VISIBLE : View.GONE);
tvNoEmail.setVisibility(none && filterActive() ? View.VISIBLE : View.GONE);
}
@Override
@ -2979,8 +2986,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (!loading && SimpleTask.getCount() == 0)
pbWait.setVisibility(View.GONE);
if (viewType != AdapterMessage.ViewType.SEARCH)
tvNoEmail.setVisibility(messages.size() == 0 && !loading ? View.VISIBLE : View.GONE);
if (viewType != AdapterMessage.ViewType.SEARCH) {
boolean none = (messages.size() == 0 && !loading);
tvNoEmail.setVisibility(none ? View.VISIBLE : View.GONE);
tvNoEmailHint.setVisibility(none && filterActive() ? View.VISIBLE : View.GONE);
}
grpReady.setVisibility(View.VISIBLE);
}
};
@ -3483,6 +3493,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return TextUtils.join(", ", displays);
}
private boolean filterActive() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean filter_seen = prefs.getBoolean("filter_seen", false);
boolean filter_unflagged = prefs.getBoolean("filter_unflagged", false);
return (filter_seen || filter_unflagged);
}
private ActivityBase.IBackPressedListener onBackPressedListener = new ActivityBase.IBackPressedListener() {
@Override
public boolean onBackPressed() {

@ -140,6 +140,16 @@
app:layout_constraintStart_toStartOf="@+id/rvMessage"
app:layout_constraintTop_toTopOf="@+id/rvMessage" />
<TextView
android:id="@+id/tvNoEmailHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_filters_active"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="@+id/rvMessage"
app:layout_constraintStart_toStartOf="@+id/rvMessage"
app:layout_constraintTop_toBottomOf="@+id/tvNoEmail" />
<eu.faircode.email.FixedRecyclerView
android:id="@+id/rvMessage"
android:layout_width="0dp"

@ -471,8 +471,9 @@
<string name="title_folder_user">User</string>
<string name="title_folder_primary">Folders primary account</string>
<string name="title_folders_unified">Unified inbox folders</string>
<string name="title_no_messages">No messages</string>
<string name="title_no_folders">No folders</string>
<string name="title_no_messages">No messages</string>
<string name="title_filters_active">One or more filters active</string>
<string name="title_subject_reply">Re: %1$s</string>
<string name="title_subject_forward">Fwd: %1$s</string>

Loading…
Cancel
Save