Allow to disable confirm messages

This commit is contained in:
tom79 2019-07-06 16:17:13 +02:00
parent 34c57939a9
commit 4bcdcc03c6
4 changed files with 29 additions and 1 deletions

View File

@ -801,6 +801,19 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
}
});
boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true);
final CheckBox set_display_confirm = rootView.findViewById(R.id.set_display_confirm);
set_display_confirm.setChecked(display_confirm);
set_display_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISPLAY_CONFIRM, set_display_confirm.isChecked());
editor.apply();
}
});
boolean quick_reply = sharedpreferences.getBoolean(Helper.SET_QUICK_REPLY, true);
final CheckBox set_quick_reply = rootView.findViewById(R.id.set_quick_reply);
set_quick_reply.setChecked(quick_reply);

View File

@ -409,6 +409,7 @@ public class Helper {
public static final String SET_DISPLAY_FOLLOW_INSTANCE = "set_display_follow_instance";
public static final String SET_DISPLAY_NEW_BADGE = "set_display_new_badge";
public static final String SET_DISPLAY_BOT_ICON = "set_display_bot_icon";
public static final String SET_DISPLAY_CONFIRM = "set_display_confirm";
public static final String SET_QUICK_REPLY = "set_quick_reply";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
@ -902,7 +903,9 @@ public class Helper {
*/
public static void manageMessageStatusCode(Context context, int statusCode, API.StatusAction statusAction){
String message = "";
if( statusCode >= 200 && statusCode < 400){
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean display_confirm = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CONFIRM, true);
if( statusCode >= 200 && statusCode < 400 && display_confirm){
if( statusAction == API.StatusAction.BLOCK){
message = context.getString(R.string.toast_block);
}else if(statusAction == API.StatusAction.UNBLOCK){

View File

@ -222,6 +222,17 @@
android:textSize="16sp"
android:layout_height="wrap_content" />
<!-- DISPLAY BOT ICON -->
<CheckBox
android:id="@+id/set_display_confirm"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_confirm"
android:textSize="16sp"
android:layout_height="wrap_content" />
<!-- DISPLAY QUICK REPLY -->
<LinearLayout
android:layout_width="match_parent"

View File

@ -1111,6 +1111,7 @@
<string name="folder">Folder</string>
<string name="create_folder">Create folder</string>
<string name="custom_tabs_indication">Use your favourite browser inside the application. By disabling, links will be opened externally</string>
<string name="set_display_confirm">Display a toast message after an action has been completed (boost, fav, etc.)?</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>