Added test switches

pull/194/merge
M66B 4 years ago
parent 2ed79b7d7e
commit b93263f000

@ -146,6 +146,7 @@ android {
productFlavors {
github {
dimension "all"
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
@ -157,6 +158,7 @@ android {
}
fdroid {
dimension "all"
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
@ -169,6 +171,7 @@ android {
play {
dimension "all"
//minSdkVersion 23
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "true"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
@ -181,6 +184,7 @@ android {
amazon {
dimension "all"
//minSdkVersion 23
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "true"

@ -127,6 +127,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swProtocol;
private SwitchCompat swLogInfo;
private SwitchCompat swDebug;
private SwitchCompat swTest1;
private SwitchCompat swTest2;
private SwitchCompat swTest3;
private Button btnRepair;
private SwitchCompat swAutostart;
@ -170,6 +173,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvPermissions;
private Group grpUpdates;
private Group grpTest;
private CardView cardDebug;
private NumberFormat NF = NumberFormat.getNumberInstance();
@ -182,7 +186,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"language", "deepl_enabled", "watchdog",
"updates", "weekly", "show_changelog",
"experiments", "crash_reports", "cleanup_attachments",
"protocol", "debug", "log_level",
"protocol", "debug", "log_level", "test1", "test2", "test3",
"query_threads", "wal", "checkpoints", "sqlite_cache",
"chunk_size", "webview_legacy",
"use_modseq", "perform_expunge", "uid_expunge",
@ -266,6 +270,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swProtocol = view.findViewById(R.id.swProtocol);
swLogInfo = view.findViewById(R.id.swLogInfo);
swDebug = view.findViewById(R.id.swDebug);
swTest1 = view.findViewById(R.id.swTest1);
swTest2 = view.findViewById(R.id.swTest2);
swTest3 = view.findViewById(R.id.swTest3);
btnRepair = view.findViewById(R.id.btnRepair);
swAutostart = view.findViewById(R.id.swAutostart);
@ -309,6 +316,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvPermissions = view.findViewById(R.id.tvPermissions);
grpUpdates = view.findViewById(R.id.grpUpdates);
grpTest = view.findViewById(R.id.grpTest);
cardDebug = view.findViewById(R.id.cardDebug);
setOptions();
@ -661,6 +669,27 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swTest1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("test1", checked).apply();
}
});
swTest2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("test2", checked).apply();
}
});
swTest3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("test3", checked).apply();
}
});
btnRepair.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -1175,6 +1204,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
grpUpdates.setVisibility(!BuildConfig.DEBUG &&
(Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext()))
? View.GONE : View.VISIBLE);
grpTest.setVisibility(BuildConfig.TEST_RELEASE ? View.VISIBLE : View.GONE);
setLastCleanup(prefs.getLong("last_cleanup", -1));
@ -1368,6 +1398,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swProtocol.setChecked(prefs.getBoolean("protocol", false));
swLogInfo.setChecked(prefs.getInt("log_level", Log.getDefaultLogLevel()) <= android.util.Log.INFO);
swDebug.setChecked(prefs.getBoolean("debug", false));
swTest1.setChecked(prefs.getBoolean("test1", false));
swTest2.setChecked(prefs.getBoolean("test2", false));
swTest3.setChecked(prefs.getBoolean("test3", false));
swAutostart.setChecked(Helper.isComponentEnabled(getContext(), ReceiverAutoStart.class));

@ -580,11 +580,50 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDebug" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTest1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_test1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDebugHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTest2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_test2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTest1"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swTest3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_test3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swTest2"
app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpUpdates"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swUpdates,swWeekly" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpTest"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swTest1,swTest2,swTest3" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

@ -674,6 +674,9 @@
<string name="title_advanced_protocol">Protocol logging</string>
<string name="title_advanced_log_info">Debug logging</string>
<string name="title_advanced_debug">Debug mode</string>
<string name="title_advanced_test1" translatable="false">Test #1</string>
<string name="title_advanced_test2" translatable="false">Test #2</string>
<string name="title_advanced_test3" translatable="false">Test #3</string>
<string name="title_advanced_repair" translatable="false">Repair</string>
<string name="title_advanced_autostart" translatable="false">Autostart</string>
<string name="title_advanced_room_query_threads" translatable="false">ROOM query threads: %1$s</string>

Loading…
Cancel
Save