Merge branch 'working' into 'develop'
confirm before unfollow See merge request tom79/fedilab!653
This commit is contained in:
commit
3d63381d12
|
@ -332,6 +332,15 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}else {
|
||||
changeDrawableColor(getApplicationContext(), R.drawable.ic_lock_outline,R.color.mastodonC3);
|
||||
}
|
||||
|
||||
int style;
|
||||
if (theme == Helper.THEME_LIGHT)
|
||||
style = R.style.Dialog;
|
||||
else if (theme == Helper.THEME_BLACK)
|
||||
style = R.style.DialogBlack;
|
||||
else
|
||||
style = R.style.DialogDark;
|
||||
|
||||
String accountIdRelation = accountId;
|
||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
|
||||
accountIdRelation = account.getAcct();
|
||||
|
@ -839,8 +848,31 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.FOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}else if( doAction == action.UNFOLLOW){
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
boolean confirm_unfollow = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
|
||||
if (confirm_unfollow) {
|
||||
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(ShowAccountActivity.this, style);
|
||||
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
|
||||
unfollowConfirm.setMessage(account.getAcct());
|
||||
unfollowConfirm.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
unfollowConfirm.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
unfollowConfirm.show();
|
||||
} else {
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNFOLLOW, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
}else if( doAction == action.UNBLOCK){
|
||||
account_follow.setEnabled(false);
|
||||
new PostActionAsyncTask(getApplicationContext(), API.StatusAction.UNBLOCK, finalTarget, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
|
|
@ -833,6 +833,19 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
|||
set_display_timeline_in_list_text.setOnClickListener(v -> set_display_timeline_in_list.performClick());
|
||||
|
||||
|
||||
boolean unfollow_validation = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
|
||||
final CheckBox set_unfollow_validation = rootView.findViewById(R.id.set_unfollow_validation);
|
||||
set_unfollow_validation.setChecked(unfollow_validation);
|
||||
|
||||
set_unfollow_validation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_UNFOLLOW_VALIDATION, set_unfollow_validation.isChecked());
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
boolean send_crash_reports = sharedpreferences.getBoolean(Helper.SET_SEND_CRASH_REPORTS, false);
|
||||
final CheckBox set_enable_crash_report = rootView.findViewById(R.id.set_enable_crash_report);
|
||||
|
|
|
@ -371,6 +371,7 @@ public class Helper {
|
|||
public static final String SET_BLUR_SENSITIVE = "set_blur_sensitive";
|
||||
public static final String SET_LONG_PRESS_MEDIA = "set_long_press_media";
|
||||
public static final String SET_DISPLAY_TIMELINE_IN_LIST = "set_display_timeline_in_list";
|
||||
public static final String SET_UNFOLLOW_VALIDATION = "set_unfollow_validation";
|
||||
public static final String SET_ONION_SCHEME = "set_onion_scheme";
|
||||
public static final String SET_REMEMBER_POSITION_HOME = "set_remember_position";
|
||||
public static final String SET_DISPLAY_ADMIN_MENU = "set_display_admin_menu";
|
||||
|
|
|
@ -1048,7 +1048,14 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/set_unfollow_validation"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginTop="@dimen/settings_checkbox_margin"
|
||||
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||
android:text="@string/set_unfollow_validation"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/set_backup"
|
||||
|
|
|
@ -1204,6 +1204,8 @@
|
|||
<string name="set_allow_live_notifications_indication">Live notifications will be enabled for this account.</string>
|
||||
<string name="set_clear_cache_exit">Clear cache when leaving</string>
|
||||
<string name="set_clear_cache_exit_indication">The cache (media, cached messages, data from the built-in browser) will be automatically cleared when leaving the application.</string>
|
||||
<string name="unfollow_confirm">Do you want to unfollow this account?</string>
|
||||
<string name="set_unfollow_validation">Show confirmation dialog before unfollowing</string>
|
||||
<string name="set_invidious">Replace Youtube with Invidio.us</string>
|
||||
<string name="set_invidious_indication">Invidious is an alternative front-end to YouTube</string>
|
||||
<string name="set_invidious_host">Enter your custom host or leave blank for using invidio.us</string>
|
||||
|
|
Loading…
Reference in New Issue