This commit is contained in:
gdlbo
2022-06-13 22:40:10 +03:00
parent dd5963b172
commit 41f558c34c
3 changed files with 16 additions and 15 deletions
@@ -8,7 +8,7 @@ import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Globals.getUserId;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import static ru.vtosters.lite.utils.Globals.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Preferences.devmenu;
import static ru.vtosters.lite.utils.Themes.applyTheme;
import static ru.vtosters.lite.utils.Themes.getDarkTheme;
@@ -19,7 +19,6 @@ import static ru.vtosters.lite.utils.Themes.getLightTheme;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.vk.about.AboutAppFragment;
import com.vk.core.ui.themes.VKThemeHelper;
@@ -40,7 +39,7 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
String keyVKAccount = getCurrentAccount().getString("key_vk_account", "");
String avatarUrl = withRegex(keyVKAccount, ".*\"photo\":\\{.*?:\"(.*?)\"\\}.*", "https://vk.com/images/camera_200.png").replace("\\/", "/");
String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", "");
String id = "id" + Integer.toString(getUserId());
String id = "@id" + Integer.toString(getUserId());
int vtosterXml = getIdentifier("empty", "xml");
this.a(vtosterXml);
@@ -64,26 +63,20 @@ public class VKMeSettings extends MaterialPreferenceToolbarFragment {
VKThemeHelper.a(this.p());
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
restartApplication();
}
}, 500);
restartApplicationWithTimer();
return true;
});
PreferencesUtil.addPreferenceCategory(this, getString("notification_settings"));
PreferencesUtil.addPreference(this, "", getString("vtlmessages"), "", "ic_message_28", preference -> {
PreferencesUtil.addPreference(this, "", getString("vtlmessages"), "", "ic_message_24", preference -> {
Context context = getContext();
Intent a2 = new Navigator(MessagesFragment.class).a(context);
context.startActivity(a2);
return false;
});
PreferencesUtil.addPreference(this, "", getString("vtlactivity"), "", "ic_write_28", preference -> {
PreferencesUtil.addPreference(this, "", getString("vtlactivity"), "", "ic_write_24", preference -> {
Context context = getContext();
Intent a2 = new Navigator(ActivityFragment.class).a(context);
context.startActivity(a2);
@@ -24,6 +24,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -150,6 +151,15 @@ public class Globals {
Runtime.getRuntime().exit(0);
} // Application restart (works on sdk 29+ too)
public static void restartApplicationWithTimer() {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
restartApplication();
}
}, 500);
}
public static void restartApplicationInto(Class Class) {
Context ctx = getContext();
PackageManager pm = ctx.getPackageManager();
@@ -85,9 +85,7 @@
invoke-static {v0}, Lcom/vtosters/lite/fragments/SettingsListFragment;->b(Lcom/vtosters/lite/fragments/SettingsListFragment;)V
const-string v0, "\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435!"
invoke-static {v0}, Lcom/vk/core/util/ToastUtils;->a(Ljava/lang/CharSequence;)V
invoke-static {}, Lru/vtosters/lite/utils/Globals;->restartApplicationWithTimer()V
return-void
.end method