Moved update check option to general

This commit is contained in:
M66B 2018-12-28 07:47:51 +00:00
parent 7affd43df9
commit 70ab587d78
2 changed files with 25 additions and 25 deletions

View File

@ -52,6 +52,7 @@ import static android.app.Activity.RESULT_OK;
public class FragmentOptions extends FragmentEx implements SharedPreferences.OnSharedPreferenceChangeListener { public class FragmentOptions extends FragmentEx implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swEnabled; private SwitchCompat swEnabled;
private SwitchCompat swUpdates;
private SwitchCompat swMetered; private SwitchCompat swMetered;
private Spinner spDownload; private Spinner spDownload;
@ -75,7 +76,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swConfirm; private SwitchCompat swConfirm;
private SwitchCompat swSender; private SwitchCompat swSender;
private SwitchCompat swUpdates;
private SwitchCompat swDebug; private SwitchCompat swDebug;
private Group grpNotification; private Group grpNotification;
@ -90,6 +90,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
// Get controls // Get controls
swEnabled = view.findViewById(R.id.swEnabled); swEnabled = view.findViewById(R.id.swEnabled);
swUpdates = view.findViewById(R.id.swUpdates);
swMetered = view.findViewById(R.id.swMetered); swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload); spDownload = view.findViewById(R.id.spDownload);
@ -113,7 +114,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swConfirm = view.findViewById(R.id.swConfirm); swConfirm = view.findViewById(R.id.swConfirm);
swSender = view.findViewById(R.id.swSender); swSender = view.findViewById(R.id.swSender);
swUpdates = view.findViewById(R.id.swUpdates);
swDebug = view.findViewById(R.id.swDebug); swDebug = view.findViewById(R.id.swDebug);
grpNotification = view.findViewById(R.id.grpNotification); grpNotification = view.findViewById(R.id.grpNotification);
@ -131,6 +131,15 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
} }
}); });
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("updates", checked).apply();
}
});
swUpdates.setVisibility(Helper.isPlayStoreInstall(getContext()) ? View.GONE : View.VISIBLE);
swMetered.setChecked(prefs.getBoolean("metered", true)); swMetered.setChecked(prefs.getBoolean("metered", true));
swMetered.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swMetered.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
@ -325,15 +334,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
} }
}); });
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("updates", checked).apply();
}
});
swUpdates.setVisibility(Helper.isPlayStoreInstall(getContext()) ? View.GONE : View.VISIBLE);
swDebug.setChecked(prefs.getBoolean("debug", false)); swDebug.setChecked(prefs.getBoolean("debug", false));
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override

View File

@ -56,6 +56,18 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swEnabled" /> app:layout_constraintTop_toBottomOf="@id/swEnabled" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUpdates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_updates"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvEnabledHint"
app:switchPadding="12dp" />
<TextView <TextView
android:id="@+id/tvSectionConnection" android:id="@+id/tvSectionConnection"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -65,7 +77,7 @@
android:text="@string/title_advanced_section_connection" android:text="@string/title_advanced_section_connection"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvEnabledHint" /> app:layout_constraintTop_toBottomOf="@id/swUpdates" />
<View <View
android:id="@+id/vSeparator2" android:id="@+id/vSeparator2"
@ -441,18 +453,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSectionMisc" /> app:layout_constraintTop_toBottomOf="@id/tvSectionMisc" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUpdates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_updates"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparator5"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDebug" android:id="@+id/swDebug"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -463,7 +463,7 @@
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:text="@string/title_advanced_debug" android:text="@string/title_advanced_debug"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swUpdates" app:layout_constraintTop_toBottomOf="@id/vSeparator5"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group