Disable instead of hide Android version specific options

pull/193/head
M66B 4 years ago
parent 2575139c9d
commit aed476ddfb

@ -46,7 +46,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle;
import androidx.preference.PreferenceManager;
@ -83,7 +82,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoUnflag;
private SwitchCompat swAutoImportant;
private SwitchCompat swResetImportance;
private Group grpConversationActions;
private final static String[] RESET_OPTIONS = new String[]{
"sync_on_launch", "double_back", "conversation_actions", "conversation_actions_replies", "language_detection",
@ -134,7 +132,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag = view.findViewById(R.id.swAutoUnflag);
swAutoImportant = view.findViewById(R.id.swAutoImportant);
swResetImportance = view.findViewById(R.id.swResetImportance);
grpConversationActions = view.findViewById(R.id.grpConversationActions);
setOptions();
@ -156,6 +153,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swConversationActions.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
swConversationActions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -164,6 +162,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swConversationActionsReplies.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
swConversationActionsReplies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -171,6 +170,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swLanguageDetection.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
swLanguageDetection.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -489,8 +489,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoUnflag.setChecked(prefs.getBoolean("autounflag", false));
swAutoImportant.setChecked(prefs.getBoolean("auto_important", false));
swResetImportance.setChecked(prefs.getBoolean("reset_importance", false));
grpConversationActions.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? View.VISIBLE : View.GONE);
}
public static class FragmentDialogSwipes extends FragmentDialogBase {

@ -231,7 +231,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
swIncognitoKeyboard.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
swIncognitoKeyboard.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
swIncognitoKeyboard.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -267,7 +267,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
grpSafeBrowsing.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? View.GONE : View.VISIBLE);
grpSafeBrowsing.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
ibDisconnectBlacklist.setOnClickListener(new View.OnClickListener() {
@Override

@ -487,11 +487,5 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAutoImportant"
app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpConversationActions"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swConversationActions,swConversationActionsReplies,swLanguageDetection,tvDelayHint" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

Loading…
Cancel
Save