fixed alert dialogs
This commit is contained in:
@@ -18,6 +18,7 @@ import java.io.File;
|
||||
import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.ui.activities.APKInstallActivity;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class OTADownloader {
|
||||
|
||||
@@ -72,7 +73,7 @@ public class OTADownloader {
|
||||
manager.enqueue(request);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
alertDialog.setTitle(AndroidUtils.getString("update_error"));
|
||||
alertDialog.setMessage(AndroidUtils.getString("update_error_text"));
|
||||
alertDialog.setPositiveButton(AndroidUtils.getString("no"), (dialog, which) -> {
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
@@ -143,7 +144,7 @@ public class FoafBase {
|
||||
matcher2.find();
|
||||
String normalHumanDate = getNormalHumanDate(Objects.requireNonNull(matcher.group(1)));
|
||||
getNormalHumanDate(Objects.requireNonNull(matcher2.group(1)));
|
||||
VkAlertDialog.Builder a2 = new VkAlertDialog.Builder(context).setTitle(getIdentifier("addinf", "string"));
|
||||
VkAlertDialog.Builder a2 = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle()).setTitle(getIdentifier("addinf", "string"));
|
||||
a2.setMessage(getString("foafid") + " " + i + getString("foafregdate") + " " + normalHumanDate + getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).setPositiveButton(17039370, null).create().show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.getCurrentActivity;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -16,8 +15,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
|
||||
@@ -26,6 +23,7 @@ import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.encryption.EncryptProvider;
|
||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class CryptImHook {
|
||||
public static boolean isPrivateProcessor(int peerID) {
|
||||
@@ -66,7 +64,7 @@ public class CryptImHook {
|
||||
return;
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle())
|
||||
.setTitle(getString("encryption_sett"))
|
||||
.setSingleChoiceItems(titles, enabledPosition, (dialog, which) -> {
|
||||
if (which == 0) {
|
||||
@@ -131,13 +129,15 @@ public class CryptImHook {
|
||||
editText.setText(key == null ? "" : key);
|
||||
|
||||
IMProcessor finalEnabled = enabled;
|
||||
new AlertDialog.Builder(ctx, getAlertStyle())
|
||||
var alert = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle())
|
||||
.setTitle(getString("encryption_enter_key"))
|
||||
.setMessage(String.format(getString("encryption_current_algorithm_title"), enabled.getUIName()))
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
Editable edit = editText.getText();
|
||||
finalEnabled.setEncryptionKeyFor(peerId, edit == null ? null : edit.toString());
|
||||
}).setNegativeButton(android.R.string.cancel, null).create().show();
|
||||
}).setNegativeButton(android.R.string.cancel, null)
|
||||
.create();
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
@@ -6,27 +6,25 @@ import static ru.vtosters.lite.proxy.ProxyUtils.isZaboronaEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
|
||||
import com.vk.auth.ui.VkAuthTextView;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.ProxySettingsFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ProxyHook {
|
||||
public static void hookAuth(View v) {
|
||||
@@ -73,10 +71,9 @@ public class ProxyHook {
|
||||
rgRandomProxy.setChecked(isRandomProxyEnabled());
|
||||
rgVika.setChecked(isVikaProxyEnabled());
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
var builder = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("vtlproxy"));
|
||||
builder.setMessage(AndroidUtils.getString("proxy_warning"));
|
||||
builder.setView(rg);
|
||||
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> { // Применить
|
||||
if (rgZaborona.isChecked()) {
|
||||
edit().putString("proxy", "zaborona").commit();
|
||||
@@ -100,10 +97,7 @@ public class ProxyHook {
|
||||
}));
|
||||
|
||||
var alert = builder.create();
|
||||
|
||||
alert.setView(rg);
|
||||
alert.show();
|
||||
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.preference.PreferenceManager;
|
||||
@@ -24,11 +22,14 @@ import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class PreferencesUtil {
|
||||
|
||||
public static void addListPreference(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, CharSequence[] entries, CharSequence[] entriesValue) {
|
||||
@@ -178,9 +179,8 @@ public class PreferencesUtil {
|
||||
margin.setMargins(dp2px(20f), 0, dp2px(20f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getContext());
|
||||
var builder = new VkAlertDialog.Builder(fragment.getContext(), ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(title);
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||
boolean change = editTextPrefChangeListener.onChanged(preference, editText.getText().toString());
|
||||
if (!change)
|
||||
@@ -193,8 +193,8 @@ public class PreferencesUtil {
|
||||
});
|
||||
|
||||
var alert = builder.create();
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
return false;
|
||||
}); // preference.setOnPreferenceClickListener(listener)
|
||||
|
||||
|
||||
@@ -15,13 +15,14 @@ import android.os.PowerManager;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class DisableBattery {
|
||||
public static void alert(Activity activity) {
|
||||
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && getBoolValue("showDoze", true)) {
|
||||
final Context context = getGlobalContext();
|
||||
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(getString("batteryissuetitle"));
|
||||
builder.setMessage(getString("batteryissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -14,11 +14,12 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class InstallGMS {
|
||||
public static void alert(final Activity activity) {
|
||||
if (!isGmsInstalled()) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getString("gmsissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LayoutUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MessageSettings {
|
||||
public static Boolean isSilentEnabled = false;
|
||||
@@ -104,7 +105,7 @@ public class MessageSettings {
|
||||
mContainer.addView(rg, LayoutUtils.createLinear(-1, -2));
|
||||
mContainer.addView(silentSwitch, LayoutUtils.createLinear(-1, -2));
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("message_send_settings_title"));
|
||||
builder.setMessage(AndroidUtils.getString("silent_messages_time_select"));
|
||||
builder.setCancelable(true);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LayoutUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class RoundingSeekbarDialog {
|
||||
public static void dialog(Context context) {
|
||||
@@ -25,7 +26,7 @@ public class RoundingSeekbarDialog {
|
||||
|
||||
mContainer.addView(seek, LayoutUtils.createLinear(-1, -2));
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("pic_rounding_title"));
|
||||
builder.setMessage(AndroidUtils.getString("pic_rounding_info"));
|
||||
builder.setCancelable(true);
|
||||
|
||||
@@ -23,6 +23,7 @@ import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ServerDialog {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
@@ -95,7 +96,7 @@ public class ServerDialog {
|
||||
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
builder.setCancelable(cancelable);
|
||||
|
||||
@@ -12,13 +12,14 @@ import android.os.Build;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class Start {
|
||||
public static void alert(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
activity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getWelcome());
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -10,11 +10,12 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
|
||||
import ru.vtosters.lite.hooks.VKUIHook;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ThemeChanging {
|
||||
public static void changeTheme(Activity activity, float[] f) {
|
||||
if (getBoolValue("systemtheme", true)) {
|
||||
new VkAlertDialog.Builder(activity)
|
||||
new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle())
|
||||
.setTitle(getString("warning"))
|
||||
.setMessage(getString("system_theme_warning"))
|
||||
.setCancelable(false)
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class Translate {
|
||||
public static void showTranslatedText(Context context, String text) {
|
||||
@@ -27,7 +28,7 @@ public class Translate {
|
||||
}
|
||||
|
||||
private static void showDialog(Context context, String text) {
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
alertDialog.setTitle(AndroidUtils.getString("translator_title"));
|
||||
alertDialog.setMessage(text);
|
||||
alertDialog.setPositiveButton(AndroidUtils.getString("close"), (dialog, which) -> {
|
||||
|
||||
@@ -13,10 +13,11 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.VKUIwrapper;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VKIDProtection {
|
||||
public static void alert(final Activity activity) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getString("vkidsumm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.ui.components.NewsfeedListManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
@@ -93,7 +94,7 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
private void remdialog(String key, Context context) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage(AndroidUtils.getString("delete_elements_confirm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -15,13 +15,10 @@ import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.preferences;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
@@ -30,13 +27,14 @@ import android.util.TypedValue;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@@ -73,9 +71,8 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
rgVK.setChecked(defname.contains("standard"));
|
||||
rgDefault.setChecked(defname.contains("vt") || defname.isEmpty());
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
var builder = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("app_name_select_title"));
|
||||
builder.setView(rg);
|
||||
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> {
|
||||
if (rgDefault.isChecked()) {
|
||||
edit().putString("appname", "vt").commit();
|
||||
@@ -99,11 +96,8 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
}));
|
||||
|
||||
var alert = builder.create();
|
||||
|
||||
alert.setView(rg);
|
||||
alert.show();
|
||||
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getAccentColor());
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
|
||||
@@ -11,23 +11,22 @@ import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
@@ -50,26 +49,28 @@ import ru.vtosters.lite.music.Scrobbler;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public static void download(Context ctx) {
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
var alertDialog = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
alertDialog.setTitle(AndroidUtils.getString("video_dl_enter_link"));
|
||||
|
||||
final EditText input = new EditText(ctx);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
input.setLayoutParams(lp);
|
||||
var lp = new FrameLayout.LayoutParams(-1, -2);
|
||||
lp.leftMargin = AndroidUtils.dp2px(16);
|
||||
lp.rightMargin = AndroidUtils.dp2px(16);
|
||||
lp.gravity = Gravity.CENTER;
|
||||
input.setTextColor(getTextAttr());
|
||||
input.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
alertDialog.setView(input);
|
||||
var container = new FrameLayout(ctx);
|
||||
container.addView(input, lp);
|
||||
alertDialog.setPositiveButton(AndroidUtils.getString("download"), (dialog, which) -> VideoDownloader.parseVideoLink(input.getText().toString(), ctx));
|
||||
var alert = alertDialog.create();
|
||||
alert.setView(container);
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +138,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("microsoft", "drawable"), "Bing")
|
||||
);
|
||||
|
||||
var alert = new VkAlertDialog.Builder(getActivity())
|
||||
var alert = new VkAlertDialog.Builder(getActivity(), ThemesUtils.getAlertStyle())
|
||||
.create();
|
||||
|
||||
var listView = (ListView) LayoutInflater.from(getContext()).inflate(com.vtosters.lite.R.layout.abc_select_dialog_material, null, false);
|
||||
@@ -178,10 +179,9 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
ln.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ln.setLayoutParams(margin);
|
||||
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
var alertDialog = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
alertDialog.setTitle(AndroidUtils.getString("lastfm_enter_credentials"));
|
||||
|
||||
alertDialog.setView(linearLayout);
|
||||
alertDialog.setPositiveButton(AndroidUtils.getString("lastfm_enter"), (dialog, which) -> {
|
||||
String login = fn.getText().toString();
|
||||
String pass = ln.getText().toString();
|
||||
@@ -189,12 +189,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
Scrobbler.auth(login, pass);
|
||||
});
|
||||
var alert = alertDialog.create();
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
}
|
||||
|
||||
private void logout(Context ctx) {
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(ctx);
|
||||
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
alertDialog.setTitle(AndroidUtils.getString("lastfm_logout_title"));
|
||||
alertDialog.setMessage(AndroidUtils.getString("lastfm_logout_confirm"));
|
||||
alertDialog.setPositiveButton(AndroidUtils.getString("vkim_yes"), (dialog, which) -> {
|
||||
@@ -205,8 +205,8 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
var alert = alertDialog.create();
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getResources().getColor(com.vtosters.lite.R.color.red));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void delcache(Context ctx) {
|
||||
@@ -221,8 +221,8 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
var alert = alertDialog.create();
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getResources().getColor(com.vtosters.lite.R.color.red));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void dlaudio(Context ctx) {
|
||||
@@ -237,8 +237,8 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
var alert = alertDialog.create();
|
||||
alert.show();
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getAccentColor());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deleteVideoHistory() {
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Arrays;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
@@ -51,7 +52,7 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
// new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("ic_deepl_logo_icon", "drawable"), "DeepL")
|
||||
);
|
||||
|
||||
var alert = new VkAlertDialog.Builder(getActivity())
|
||||
var alert = new VkAlertDialog.Builder(getActivity(), ThemesUtils.getAlertStyle())
|
||||
.create();
|
||||
|
||||
var listView = (ListView) LayoutInflater.from(getContext()).inflate(com.vtosters.lite.R.layout.abc_select_dialog_material, null, false);
|
||||
|
||||
@@ -56,6 +56,7 @@ import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.ui.components.BackupManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ContactsUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
@@ -193,7 +194,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
four.setChecked(val == 4);
|
||||
five.setChecked(val == 5);
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext());
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("cache_clean_title"));
|
||||
builder.setMessage(AndroidUtils.getString("cache_select_size"));
|
||||
builder.setCancelable(true);
|
||||
@@ -229,7 +230,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
private void cacheCleanDialog() {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext());
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("select_which_clean"));
|
||||
builder.setItems(AndroidUtils.getArray("cache_cleaner"), (dialog, which) -> {
|
||||
switch (which) {
|
||||
@@ -278,7 +279,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
private void delprefs(Context context) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage(AndroidUtils.getString("settings_reset_confirm"));
|
||||
builder.setCancelable(false);
|
||||
@@ -364,7 +365,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
var arr = BackupManager.getBackupsNames();
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle())
|
||||
.setTitle(AndroidUtils.getString("select_backup"))
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
|
||||
@@ -70,6 +70,7 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.CacheUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.SSFSUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
public static String getValAsString(String stringid, Boolean value) {
|
||||
@@ -178,7 +179,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
final var isDarkTheme = !switchPreference.isChecked();
|
||||
|
||||
if (Preferences.systemtheme()) {
|
||||
new VkAlertDialog.Builder(requireActivity())
|
||||
new VkAlertDialog.Builder(requireActivity(), ThemesUtils.getAlertStyle())
|
||||
.setTitle(AndroidUtils.getString("warning"))
|
||||
.setMessage(AndroidUtils.getString("system_theme_warning"))
|
||||
.setCancelable(false)
|
||||
|
||||
@@ -10,11 +10,9 @@ import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -38,6 +36,7 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import java.io.File;
|
||||
@@ -47,6 +46,7 @@ import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
import ru.vtosters.lite.ui.components.StickerTouchHelperCallback;
|
||||
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class StickersFragment extends BaseToolbarFragment {
|
||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||
@@ -182,10 +182,9 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
margin.setMargins(dp2px(24f), 0, dp2px(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
var dlg = new AlertDialog.Builder(getContext());
|
||||
var dlg = new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle());
|
||||
dlg.setTitle(AndroidUtils.getString("stickershelp1"));
|
||||
dlg.setMessage(AndroidUtils.getString("stickershelp2"));
|
||||
dlg.setView(linearLayout);
|
||||
dlg.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
String pack = editText.getText().toString();
|
||||
if (!pack.startsWith("https://")) {
|
||||
@@ -201,11 +200,11 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
});
|
||||
|
||||
var alert = dlg.create();
|
||||
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
|
||||
|
||||
|
||||
};
|
||||
if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(callback));
|
||||
else checkApiKey(callback);
|
||||
@@ -246,16 +245,15 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
margin.setMargins(dp2px(24f), 0, dp2px(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
AlertDialog alert = new AlertDialog.Builder(getContext())
|
||||
var alert = new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle())
|
||||
.setTitle(AndroidUtils.getString("stickersapi8"))
|
||||
.setMessage(AndroidUtils.getString("stickersapi9") +
|
||||
AndroidUtils.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||
.create();
|
||||
|
||||
var dlg = new AlertDialog.Builder(getContext());
|
||||
var dlg = new VkAlertDialog.Builder(getContext(), ThemesUtils.getAlertStyle());
|
||||
dlg.setTitle(AndroidUtils.getString("stickersapi5"));
|
||||
dlg.setMessage(AndroidUtils.getString("stickersapi6"));
|
||||
dlg.setView(linearLayout);
|
||||
dlg.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
setTGBotKey(editText.getText().toString());
|
||||
if (r != null) r.run();
|
||||
@@ -265,12 +263,8 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
});
|
||||
dlg.setNeutralButton(AndroidUtils.getString("stickersapi7"), (dialog, which) -> alert.show());
|
||||
var alerts = dlg.create();
|
||||
|
||||
alerts.setView(linearLayout);
|
||||
alerts.show();
|
||||
|
||||
alerts.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alerts.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
|
||||
alerts.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getAccentColor());
|
||||
}
|
||||
|
||||
private void checkApiKey(Runnable callback) {
|
||||
@@ -300,7 +294,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
@Override
|
||||
public void onNetError() {
|
||||
progressDialog.dismiss();
|
||||
new AlertDialog.Builder(context)
|
||||
new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle())
|
||||
.setMessage(AndroidUtils.getString("stickersapi3"))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(AndroidUtils.getString("stickersapi4"), (arg0, arg1) -> checkApiKey(callback))
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ContactsUtils {
|
||||
|
||||
boolean enabledsync = resp.equals("contact");
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(ctx);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(ctx, ThemesUtils.getAlertStyle());
|
||||
builder.setTitle(getString("contact_sync_title"));
|
||||
builder.setMessage(getString("contact_sync_state") + ": " + getString(enabledsync ? "contact_sync_enabled" : "contact_sync_disabled"));
|
||||
builder.setCancelable(true);
|
||||
|
||||
@@ -6,13 +6,13 @@ import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.dto.common.VideoFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -63,7 +63,7 @@ public class ExternalLinkParser {
|
||||
startExternalVideo((String) qualities.values().toArray()[0], context);
|
||||
} else {
|
||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||
new AlertDialog.Builder(context)
|
||||
new VkAlertDialog.Builder(context, ThemesUtils.getAlertStyle())
|
||||
.setItems(titles, ((dialog, which) -> startExternalVideo(qualities.get(titles[which]), context)))
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
@@ -21,9 +20,9 @@ import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.util.Pair;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.dto.user.UserProfile;
|
||||
import com.vk.im.engine.models.users.User;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
@@ -177,32 +176,31 @@ public class RenameTool {
|
||||
|
||||
int id = AccountManagerUtils.getUserID(profile);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("rename_title"));
|
||||
builder.setMessage(AndroidUtils.getString("rename_message"));
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||
String firstName = fn.getText().toString();
|
||||
String lastName = ln.getText().toString();
|
||||
SQLiteDatabase writableDatabase = getHelper().getWritableDatabase();
|
||||
try {
|
||||
if (isChangedName(id)) {
|
||||
writableDatabase.execSQL(String.format("UPDATE %s SET %s='%s', %s='%s' WHERE %s='%s'", TABLE_NAME, COLUMN_FIRSTNAME, URLEncoder.encode(firstName, "UTF-8"), COLUMN_LASTNAME, URLEncoder.encode(lastName, "UTF-8"), COLUMN_VKID, id));
|
||||
} else {
|
||||
writableDatabase.execSQL(String.format("INSERT INTO %s (%s, %s, %s) VALUES (%s, '%s', '%s')", TABLE_NAME, COLUMN_VKID, COLUMN_FIRSTNAME, COLUMN_LASTNAME, id, URLEncoder.encode(firstName, "UTF-8"), URLEncoder.encode(lastName, "UTF-8")));
|
||||
}
|
||||
updateRequested = true;
|
||||
if (id == AccountManagerUtils.getUserId()) {
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.USER_NAME_CHANGED"));
|
||||
}
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
|
||||
var builder = new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("rename_title"))
|
||||
.setMessage(AndroidUtils.getString("rename_message"))
|
||||
.setPositiveButton("OK", (dialog, which) -> {
|
||||
String firstName = fn.getText().toString();
|
||||
String lastName = ln.getText().toString();
|
||||
SQLiteDatabase writableDatabase = getHelper().getWritableDatabase();
|
||||
try {
|
||||
if (isChangedName(id)) {
|
||||
writableDatabase.execSQL(String.format("UPDATE %s SET %s='%s', %s='%s' WHERE %s='%s'", TABLE_NAME, COLUMN_FIRSTNAME, URLEncoder.encode(firstName, "UTF-8"), COLUMN_LASTNAME, URLEncoder.encode(lastName, "UTF-8"), COLUMN_VKID, id));
|
||||
} else {
|
||||
writableDatabase.execSQL(String.format("INSERT INTO %s (%s, %s, %s) VALUES (%s, '%s', '%s')", TABLE_NAME, COLUMN_VKID, COLUMN_FIRSTNAME, COLUMN_LASTNAME, id, URLEncoder.encode(firstName, "UTF-8"), URLEncoder.encode(lastName, "UTF-8")));
|
||||
}
|
||||
updateRequested = true;
|
||||
if (id == AccountManagerUtils.getUserId()) {
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.USER_NAME_CHANGED"));
|
||||
}
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
|
||||
|
||||
sendToast(AndroidUtils.getString("rename_success"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendToast(AndroidUtils.getString("rename_error"));
|
||||
}
|
||||
});
|
||||
sendToast(AndroidUtils.getString("rename_success"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendToast(AndroidUtils.getString("rename_error"));
|
||||
}
|
||||
});
|
||||
if (isChangedName(id))
|
||||
builder.setNeutralButton(AndroidUtils.getString("rename_reset"), (dialog, which) -> {
|
||||
getHelper().getWritableDatabase().execSQL(String.format("DELETE FROM %s WHERE %s='%s'", TABLE_NAME, COLUMN_VKID, id));
|
||||
@@ -215,11 +213,8 @@ public class RenameTool {
|
||||
});
|
||||
|
||||
var alert = builder.create();
|
||||
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getResources().getColor(com.vtosters.lite.R.color.red));
|
||||
}
|
||||
|
||||
public static void createDialogGroup(ExtendedCommunityProfile eup, final Context ctx) {
|
||||
@@ -245,10 +240,9 @@ public class RenameTool {
|
||||
|
||||
final int id = fid;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
var builder = new VkAlertDialog.Builder(ctx);
|
||||
builder.setTitle(AndroidUtils.getString("rename_title"));
|
||||
builder.setMessage(AndroidUtils.getString("rename_message"));
|
||||
builder.setView(linearLayout);
|
||||
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||
String firstName = fn.getText().toString();
|
||||
SQLiteDatabase writableDatabase = getHelper().getWritableDatabase();
|
||||
@@ -272,11 +266,11 @@ public class RenameTool {
|
||||
});
|
||||
|
||||
var alert = builder.create();
|
||||
|
||||
alert.setView(linearLayout);
|
||||
alert.show();
|
||||
|
||||
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
|
||||
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getResources().getColor(com.vtosters.lite.R.color.red));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static boolean isChangedName(int uid) {
|
||||
|
||||
@@ -326,8 +326,7 @@ public class ThemesUtils {
|
||||
} // Android Support color injector + accent color checker
|
||||
|
||||
public static int getAlertStyle() {
|
||||
if (isDarkTheme()) return R.style.Theme_MaterialComponents_Dialog_Alert;
|
||||
return R.style.Theme_MaterialComponents_Light_Dialog_Alert;
|
||||
return getIdentifier(isDarkTheme() ? "VkAlertDialogThemeDark" : "VkAlertDialogTheme", "style");
|
||||
}
|
||||
|
||||
public static String getBackgroundStickers() {
|
||||
|
||||
@@ -7376,6 +7376,15 @@
|
||||
<item name="textColorAlertDialogListItem">?text_primary</item>
|
||||
</style>
|
||||
|
||||
<style name="VkAlertDialogThemeDark" parent="@style/Theme.AppCompat.Dialog.Alert">
|
||||
<item name="android:textColorSecondary">?selection_off_icon</item>
|
||||
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
|
||||
<item name="buttonBarNeutralButtonStyle">@style/NeutralButtonStyle</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
|
||||
<item name="colorAccent">?accent</item>
|
||||
<item name="textColorAlertDialogListItem">?text_primary</item>
|
||||
</style>
|
||||
|
||||
<style name="VkAuth" />
|
||||
|
||||
<style name="VkAuth.BottomSheetAnimationStyle" parent="@style/Widget.Design.BottomSheet.Modal">
|
||||
|
||||
Reference in New Issue
Block a user