Fixes issue #300: Default post visibility for locked accounts

This commit is contained in:
stom79 2018-02-09 08:39:54 +01:00
parent 4c2237b371
commit 84fc31d2a4
2 changed files with 18 additions and 32 deletions

View File

@ -414,37 +414,22 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
if (!sharedUri.isEmpty()) { if (!sharedUri.isEmpty()) {
uploadSharedImage(sharedUri); uploadSharedImage(sharedUri);
} }
String visibilityCheck = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), "public"); String defaultVisibility = account.isLocked()?"private":"public";
boolean isAccountPrivate = (account.isLocked() || visibilityCheck.equals("private")); if( tootReply == null){
if(isAccountPrivate){ visibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
if( tootReply == null) { switch (visibility) {
visibility = "private"; case "public":
toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot); toot_visibility.setImageResource(R.drawable.ic_public_toot);
}else { break;
if( visibility.equals("direct") ){ case "unlisted":
toot_visibility.setImageResource(R.drawable.ic_mail_outline_toot); toot_visibility.setImageResource(R.drawable.ic_lock_open_toot);
}else{ break;
visibility = "private"; case "private":
toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot); toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot);
} break;
} case "direct":
}else { toot_visibility.setImageResource(R.drawable.ic_mail_outline_toot);
if( tootReply == null){ break;
visibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), "public");
switch (visibility) {
case "public":
toot_visibility.setImageResource(R.drawable.ic_public_toot);
break;
case "unlisted":
toot_visibility.setImageResource(R.drawable.ic_lock_open_toot);
break;
case "private":
toot_visibility.setImageResource(R.drawable.ic_lock_outline_toot);
break;
case "direct":
toot_visibility.setImageResource(R.drawable.ic_mail_outline_toot);
break;
}
} }
} }
toot_sensitive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { toot_sensitive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

View File

@ -434,8 +434,9 @@ public class SettingsFragment extends Fragment {
changeDrawableColor(context, set_toot_visibility, R.color.white); changeDrawableColor(context, set_toot_visibility, R.color.white);
} }
//Only displayed for non locked accounts //Only displayed for non locked accounts
if (account != null && !account.isLocked()) { if (account != null ) {
String tootVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), "public"); String defaultVisibility = account.isLocked()?"private":"public";
String tootVisibility = sharedpreferences.getString(Helper.SET_TOOT_VISIBILITY + "@" + account.getAcct() + "@" + account.getInstance(), defaultVisibility);
switch (tootVisibility) { switch (tootVisibility) {
case "public": case "public":
set_toot_visibility.setImageResource(R.drawable.ic_public); set_toot_visibility.setImageResource(R.drawable.ic_public);