diff --git a/app/src/main/java/app/fedilab/android/activities/ShowAccountActivity.java b/app/src/main/java/app/fedilab/android/activities/ShowAccountActivity.java
index 81a02e010..26b168d96 100644
--- a/app/src/main/java/app/fedilab/android/activities/ShowAccountActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/ShowAccountActivity.java
@@ -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);
diff --git a/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java b/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java
index 7cc5ad44d..60496828b 100644
--- a/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java
+++ b/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java
@@ -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);
diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java
index c95b30b48..c6dfecd8a 100644
--- a/app/src/main/java/app/fedilab/android/helper/Helper.java
+++ b/app/src/main/java/app/fedilab/android/helper/Helper.java
@@ -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";
diff --git a/app/src/main/res/layout/fragment_settings_reveal.xml b/app/src/main/res/layout/fragment_settings_reveal.xml
index e596686df..a29d97378 100644
--- a/app/src/main/res/layout/fragment_settings_reveal.xml
+++ b/app/src/main/res/layout/fragment_settings_reveal.xml
@@ -1048,7 +1048,14 @@
-
+
Live notifications will be enabled for this account.
Clear cache when leaving
The cache (media, cached messages, data from the built-in browser) will be automatically cleared when leaving the application.
+ Do you want to unfollow this account?
+ Show confirmation dialog before unfollowing
Replace Youtube with Invidio.us
Invidious is an alternative front-end to YouTube
Enter your custom host or leave blank for using invidio.us