This commit is contained in:
gdlbo
2022-06-15 17:13:18 +03:00
parent 0b4e3c6303
commit c98609db5d
9 changed files with 41 additions and 14 deletions
+1 -1
View File
@@ -15007,7 +15007,7 @@ public final class R {
public static final int dockbar_save = 0x7f11123b;
public static final int dockbar_selected_items = 0x7f11123c;
public static final int dockbar_unselected_items = 0x7f11123d;
public static final int download_latest_vtl = 0x7f11123e;
public static final int checkforupdates = 0x7f11123e;
public static final int other_fix_dynamic_colors = 0x7f11123f;
public static final int other_reset_settings = 0x7f111240;
public static final int other_reset_settings_summary = 0x7f111241;
@@ -1,8 +1,6 @@
package ru.vtosters.lite.ui.fragments;
package ru.vtosters.lite.ui.dialogs;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.Toast;
import com.vk.core.dialogs.VKProgressDialog;
@@ -56,6 +56,7 @@ import com.vtosters.lite.fragments.k.BlacklistFragment;
import com.vtosters.lite.fragments.money.music.control.subscription.MusicSubscriptionControlFragment;
import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.ui.dialogs.OTADialog;
import ru.vtosters.lite.ui.fragments.dockbar.DockBarFragment;
import ru.vtosters.lite.ui.fragments.dockbar.DockBarManager;
import ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountFragment;
@@ -336,11 +337,20 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
return false;
});
PreferencesUtil.addPreference(this, "", getString("download_latest_vtl"), "", "ic_download_24", preference -> {
// getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://github.com/vtosters/lite/releases/latest")));
PreferencesUtil.addPreferenceCategory(this, getString("updates"));
PreferencesUtil.addPreference(this, "", getString("checkforupdates"), "", "ic_download_24", preference -> {
OTADialog.checkUpdates(p());
return false;
});
PreferencesUtil.addMaterialSwitchPreference(this, "checkupdates", getString("checkupdates"), "", "ic_recent_24", true, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("checkupdates", value).commit();
return true;
});
}
public static String getValAsString(String stringid, Boolean value) {
@@ -1,6 +1,7 @@
package ru.vtosters.lite.utils;
import static androidx.core.content.ContextCompat.getDrawable;
import static ru.vtosters.lite.utils.Preferences.checkupdates;
import static ru.vtosters.lite.utils.Preferences.getLocale;
import static ru.vtosters.lite.utils.Preferences.preferences;
import static ru.vtosters.lite.utils.Themes.isDarkTheme;
@@ -49,6 +50,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import ru.vtosters.lite.ui.dialogs.DisableBattery;
import ru.vtosters.lite.ui.dialogs.InstallGMS;
import ru.vtosters.lite.ui.dialogs.Start;
import ru.vtosters.lite.ui.dialogs.OTADialog;
public class Globals {
private static final List<Activity> activities = new ArrayList<>();
@@ -57,6 +63,14 @@ public class Globals {
return preferences;
}
public static void MainActivityInit(Activity activity) {
if(checkupdates())
OTADialog.checkUpdates(activity);
Start.alert(activity);
InstallGMS.alert(activity);
DisableBattery.alert(activity);
}
public static void componentSwitcher(String component, Boolean enabled) {
var packageManager = getContext().getPackageManager();
packageManager.setComponentEnabledSetting(new ComponentName(getPackageName(), getPackageName() + "." + component), enabled? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
@@ -361,6 +361,10 @@ public class Preferences {
return getBoolValue("roundedmsgs", false);
}
public static boolean checkupdates() {
return getBoolValue("checkupdates", true);
}
public static boolean disableanimstickers() {
return getBoolValue("disableanimstickers", true);
}