Added option to disable conversation actionbar

pull/146/head
M66B 7 years ago
parent d543a10b88
commit 71b9165925

@ -96,8 +96,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
"avatars".equals(key) || "avatars".equals(key) ||
"identicons".equals(key) || "identicons".equals(key) ||
"preview".equals(key) || "preview".equals(key) ||
"actionbar".equals(key) ||
"confirm".equals(key) || "confirm".equals(key) ||
"navigation".equals(key) ||
"debug".equals(key))) "debug".equals(key)))
finish(); finish();
} }

@ -95,6 +95,7 @@ public class FragmentMessages extends FragmentEx {
private boolean found = false; private boolean found = false;
private String search = null; private String search = null;
private boolean actionbar = false;
private boolean autoclose = false; private boolean autoclose = false;
private long primary = -1; private long primary = -1;
@ -137,6 +138,7 @@ public class FragmentMessages extends FragmentEx {
search = args.getString("search"); search = args.getString("search");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
actionbar = prefs.getBoolean("actionbar", true);
autoclose = prefs.getBoolean("autoclose", false); autoclose = prefs.getBoolean("autoclose", false);
if (TextUtils.isEmpty(search)) if (TextUtils.isEmpty(search))
@ -965,7 +967,8 @@ public class FragmentMessages extends FragmentEx {
else else
fabMore.hide(); fabMore.hide();
if (viewType == AdapterMessage.ViewType.THREAD) if (viewType == AdapterMessage.ViewType.THREAD) {
if (actionbar)
db.folder().liveSystemFolders(account).observe(getViewLifecycleOwner(), new Observer<List<EntityFolder>>() { db.folder().liveSystemFolders(account).observe(getViewLifecycleOwner(), new Observer<List<EntityFolder>>() {
@Override @Override
public void onChanged(@Nullable List<EntityFolder> folders) { public void onChanged(@Nullable List<EntityFolder> folders) {
@ -989,7 +992,7 @@ public class FragmentMessages extends FragmentEx {
bottom_navigation.setVisibility(View.VISIBLE); bottom_navigation.setVisibility(View.VISIBLE);
} }
}); });
else { } else {
db.account().liveAccountDraft(account < 0 ? null : account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() { db.account().liveAccountDraft(account < 0 ? null : account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
@Override @Override
public void onChanged(EntityAccount account) { public void onChanged(EntityAccount account) {

@ -49,6 +49,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swLight; private SwitchCompat swLight;
private SwitchCompat swBrowse; private SwitchCompat swBrowse;
private SwitchCompat swSwipe; private SwitchCompat swSwipe;
private SwitchCompat swActionbar;
private SwitchCompat swAutoclose; private SwitchCompat swAutoclose;
private SwitchCompat swConfirm; private SwitchCompat swConfirm;
private SwitchCompat swSender; private SwitchCompat swSender;
@ -73,6 +74,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swLight = view.findViewById(R.id.swLight); swLight = view.findViewById(R.id.swLight);
swBrowse = view.findViewById(R.id.swBrowse); swBrowse = view.findViewById(R.id.swBrowse);
swSwipe = view.findViewById(R.id.swSwipe); swSwipe = view.findViewById(R.id.swSwipe);
swActionbar = view.findViewById(R.id.swActionbar);
swAutoclose = view.findViewById(R.id.swAutoclose); swAutoclose = view.findViewById(R.id.swAutoclose);
swConfirm = view.findViewById(R.id.swConfirm); swConfirm = view.findViewById(R.id.swConfirm);
swSender = view.findViewById(R.id.swSender); swSender = view.findViewById(R.id.swSender);
@ -183,11 +185,11 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
} }
}); });
swConfirm.setChecked(prefs.getBoolean("confirm", false)); swActionbar.setChecked(prefs.getBoolean("actionbar", true));
swConfirm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm", checked).apply(); prefs.edit().putBoolean("actionbar", checked).apply();
} }
}); });
@ -199,6 +201,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
} }
}); });
swConfirm.setChecked(prefs.getBoolean("confirm", false));
swConfirm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm", checked).apply();
}
});
swSender.setChecked(prefs.getBoolean("sender", false)); swSender.setChecked(prefs.getBoolean("sender", false));
swSender.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swSender.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override

@ -83,6 +83,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBrowse" /> app:layout_constraintTop_toBottomOf="@id/swBrowse" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swActionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_actionbar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSwipe" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoclose" android:id="@+id/swAutoclose"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -90,7 +99,7 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_advanced_autoclose" android:text="@string/title_advanced_autoclose"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSwipe" /> app:layout_constraintTop_toBottomOf="@id/swActionbar" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swConfirm" android:id="@+id/swConfirm"

@ -104,6 +104,7 @@
<string name="title_advanced_light">Use notification light</string> <string name="title_advanced_light">Use notification light</string>
<string name="title_advanced_browse">Browse messages on the server</string> <string name="title_advanced_browse">Browse messages on the server</string>
<string name="title_advanced_swipe">Swipe actions</string> <string name="title_advanced_swipe">Swipe actions</string>
<string name="title_advanced_actionbar">Conversation action bar</string>
<string name="title_advanced_autoclose">Automatically close conversations</string> <string name="title_advanced_autoclose">Automatically close conversations</string>
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string> <string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
<string name="title_advanced_sender">Allow editing sender address</string> <string name="title_advanced_sender">Allow editing sender address</string>

Loading…
Cancel
Save