Added junk hint

pull/207/head
M66B 3 years ago
parent bfc9b0cee8
commit ea019c5f21

@ -259,6 +259,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private ImageButton ibHintSupport;
private ImageButton ibHintSwipe;
private ImageButton ibHintSelect;
private ImageButton ibHintJunk;
private TextView tvNoEmail;
private TextView tvNoEmailHint;
private FixedRecyclerView rvMessage;
@ -279,6 +280,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private Group grpHintSupport;
private Group grpHintSwipe;
private Group grpHintSelect;
private Group grpHintJunk;
private Group grpReady;
private Group grpOutbox;
private FloatingActionButton fabReply;
@ -512,6 +514,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ibHintSupport = view.findViewById(R.id.ibHintSupport);
ibHintSwipe = view.findViewById(R.id.ibHintSwipe);
ibHintSelect = view.findViewById(R.id.ibHintSelect);
ibHintJunk = view.findViewById(R.id.ibHintJunk);
tvNoEmail = view.findViewById(R.id.tvNoEmail);
tvNoEmailHint = view.findViewById(R.id.tvNoEmailHint);
rvMessage = view.findViewById(R.id.rvMessage);
@ -533,6 +536,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
grpHintSupport = view.findViewById(R.id.grpHintSupport);
grpHintSwipe = view.findViewById(R.id.grpHintSwipe);
grpHintSelect = view.findViewById(R.id.grpHintSelect);
grpHintJunk = view.findViewById(R.id.grpHintJunk);
grpReady = view.findViewById(R.id.grpReady);
grpOutbox = view.findViewById(R.id.grpOutbox);
@ -591,6 +595,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
ibHintJunk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
prefs.edit().putBoolean("message_junk", true).apply();
grpHintJunk.setVisibility(View.GONE);
}
});
rvMessage.setHasFixedSize(false);
int threads = prefs.getInt("query_threads", DB.DEFAULT_QUERY_THREADS);
@ -4205,15 +4217,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
boolean hints = (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
boolean junk = EntityFolder.JUNK.equals(type);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean app_support = prefs.getBoolean("app_support", false);
boolean message_swipe = prefs.getBoolean("message_swipe", false);
boolean message_select = prefs.getBoolean("message_select", false);
boolean message_junk = prefs.getBoolean("message_junk", false);
boolean send_pending = prefs.getBoolean("send_pending", true);
grpHintSupport.setVisibility(app_support || !hints ? View.GONE : View.VISIBLE);
grpHintSwipe.setVisibility(message_swipe || !hints ? View.GONE : View.VISIBLE);
grpHintSelect.setVisibility(message_select || !hints ? View.GONE : View.VISIBLE);
grpHintSupport.setVisibility(app_support || !hints || junk ? View.GONE : View.VISIBLE);
grpHintSwipe.setVisibility(message_swipe || !hints || junk ? View.GONE : View.VISIBLE);
grpHintSelect.setVisibility(message_select || !hints || junk ? View.GONE : View.VISIBLE);
grpHintJunk.setVisibility(message_junk || !junk ? View.GONE : View.VISIBLE);
final DB db = DB.getInstance(getContext());

@ -127,7 +127,9 @@ public class FragmentOptions extends FragmentBase {
));
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"first", "app_support", "notify_archive",
"message_swipe", "message_select", "message_junk",
"folder_actions", "folder_sync",
"subscriptions",
"check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist",
"send_pending",

@ -215,7 +215,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
};
private final static String[] RESET_QUESTIONS = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"first", "app_support", "notify_archive",
"message_swipe", "message_select", "message_junk",
"folder_actions", "folder_sync",
"crash_reports_asked", "review_asked", "review_later", "why",
"reply_hint", "html_always_images", "open_full_confirmed", "open_amp_confirmed",
"ask_images", "ask_html",

@ -135,6 +135,39 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHintSelect" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvHintJunk"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="36dp"
android:padding="6dp"
android:text="@string/title_hint_message_junk"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toStartOf="@+id/ibHintJunk"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
<eu.faircode.email.FixedImageButton
android:id="@+id/ibHintJunk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_close_hint"
android:padding="9dp"
app:layout_constraintBottom_toBottomOf="@id/tvHintJunk"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tvHintJunk"
app:srcCompat="@drawable/twotone_close_24" />
<View
android:id="@+id/vSeparatorHintJunk"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHintJunk" />
<include
android:id="@+id/inGroup"
layout="@layout/item_group"
@ -142,7 +175,7 @@
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintJunk" />
<eu.faircode.email.ViewTextDelayed
android:id="@+id/tvNoEmail"
@ -390,6 +423,12 @@
android:layout_height="0dp"
app:constraint_referenced_ids="tvHintSelect,ibHintSelect,vSeparatorHintSelect" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpHintJunk"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvHintJunk,ibHintJunk,vSeparatorHintJunk" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpReady"
android:layout_width="0dp"

@ -1766,6 +1766,7 @@
<string name="title_hint_support">If you have a question or a problem, please use the support menu to get help</string>
<string name="title_hint_message_actions">Swipe left to trash; Swipe right to archive (if available); The swipe actions can be configured in the account settings</string>
<string name="title_hint_message_selection">Long press a message to start selecting multiple messages; Hold and swipe up or down to select more messages</string>
<string name="title_hint_message_junk">These messages are in the spam folder of the email server. Obviously, the app cannot prevent spam messages from being sent to you.</string>
<string name="title_hint_important">Important</string>
<string name="title_hint_sync">Downloading messages can take some time, depending on the speed of the provider, internet connection, the device and on the number of messages. While downloading messages the app might respond slower.</string>
<string name="title_hint_sync_note">By default, not all messages will be downloaded to limit storage space and battery and data usage. You can change this by long pressing a folder in the folder list and selecting \'Synchronize more\'.</string>

Loading…
Cancel
Save