add option of disable auto update

This commit is contained in:
onlymash authored and seven332 committed 2018-05-02 13:03:56 +08:00
1 parent 30ca44b9c6
commit 8bad20e58c
7 files changed
+18 -2

No files matched your search

@@ -61,6 +61,7 @@ public class EhApplication extends RecordingApplication implements Thread.Uncaug
private static final String TAG = EhApplication.class.getSimpleName();
public static final boolean BETA = false;
public static final boolean AUTO_UPDATE = true;
private static final boolean DEBUG_CONACO = false;
private static final boolean DEBUG_PRINT_NATIVE_MEMORY = false;
@@ -949,6 +949,8 @@ public class Settings {
********************/
private static final String KEY_BETA_UPDATE_CHANNEL = "beta_update_channel";
private static final boolean DEFAULT_BETA_UPDATE_CHANNEL = EhApplication.BETA;
private static final String KEY_AUTO_CHECK_FOR_UPDATES = "auto_check_for_updates";
private static final boolean DEFAULT_AUTO_CHECK_FOR_UPDATES = EhApplication.AUTO_UPDATE;
public static boolean getBetaUpdateChannel() {
return getBoolean(KEY_BETA_UPDATE_CHANNEL, DEFAULT_BETA_UPDATE_CHANNEL);
@@ -958,6 +960,10 @@ public class Settings {
putBoolean(KEY_BETA_UPDATE_CHANNEL, value);
}
public static boolean getAutoCheckUpdateEnable() {
return getBoolean(KEY_AUTO_CHECK_FOR_UPDATES, DEFAULT_AUTO_CHECK_FOR_UPDATES);
}
/********************
****** Crash
********************/
@@ -331,7 +331,9 @@ public final class MainActivity extends StageActivity
if (savedInstanceState == null) {
onInit();
CommonOperations.checkUpdate(this, false);
if (Settings.getAutoCheckUpdateEnable()) {
CommonOperations.checkUpdate(this, false);
}
checkDownloadLocation();
if (Settings.getCellularNetworkWarning()) {
checkCellularNetwork();
@@ -527,6 +527,7 @@
<string name="settings_privacy_about_analytics">关于数据统计</string>
<string name="settings_about_version">版本号</string>
<string name="settings_about_check_for_updates">检查更新</string>
<string name="settings_about_auto_check_for_updates">自动检查更新</string>
<string name="settings_about_beta_update_channel">更新测试版</string>
<string name="settings_about_beta_update_channel_summary">测试版可能在你的设备上出现不可预知的错误</string>
+1 -1
View File
@@ -19,5 +19,5 @@
<bool name="beta">false</bool>
<bool name="dad_spin_bars">true</bool>
<bool name="auto_check_update">true</bool>
</resources>
+1
View File
@@ -572,6 +572,7 @@
<string name="settings_privacy_about_analytics">About analytics</string>
<string name="settings_about_version">Build version</string>
<string name="settings_about_check_for_updates">Check for updates</string>
<string name="settings_about_auto_check_for_updates">Auto check for updates</string>
<string name="settings_about_beta_update_channel">Beta update channel</string>
<string name="settings_about_beta_update_channel_summary">Beta release might be broken on your devices</string>
+5
View File
@@ -72,6 +72,11 @@
android:summary="@string/settings_about_beta_update_channel_summary"
android:defaultValue="@bool/beta"/>
<com.hippo.preference.SwitchPreference
android:key="auto_check_for_updates"
android:title="@string/settings_about_auto_check_for_updates"
android:defaultValue="@bool/auto_check_update"/>
<Preference
android:key="donate"
android:title="@string/settings_about_donate"/>