some migration to VkAlertDialog
This commit is contained in:
@@ -107,14 +107,14 @@ public class DockBarEditorManager {
|
||||
Globals.getPreferences().edit().putString("dockbar_tabs", mSelectedTabs.stream()
|
||||
.map(tab -> tab.tag)
|
||||
.collect(Collectors.joining(",")))
|
||||
.commit();
|
||||
.apply();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
Globals.getPreferences()
|
||||
.edit()
|
||||
.putString("dockbar_tabs", "tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
|
||||
.commit();
|
||||
.apply();
|
||||
}
|
||||
|
||||
public List<DockBarTab> getSelectedTabs() {
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.OEMDetector;
|
||||
|
||||
public class DisableBattery{
|
||||
@@ -21,27 +23,21 @@ public class DisableBattery{
|
||||
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && getBoolValue("showDoze", true)) {
|
||||
final Context context = getContext();
|
||||
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("batteryissuetitle"));
|
||||
builder.setMessage(getString("batteryissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("batteryissuebtn1"), new DialogInterface.OnClickListener(){
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("package:");
|
||||
sb.append(context.getPackageName());
|
||||
intent.setData(Uri.parse(sb.toString()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("batteryissuebtn2"), new DialogInterface.OnClickListener(){
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showDoze", false).apply();
|
||||
}
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setPositiveButton(getString("batteryissuebtn1"), (dialogInterface, i) -> {
|
||||
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("package:");
|
||||
sb.append(context.getPackageName());
|
||||
intent.setData(Uri.parse(sb.toString()));
|
||||
context.startActivity(intent);
|
||||
});
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("batteryissuebtn2"), (dialogInterface, i) -> edit().putBoolean("showDoze", false).apply());
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
@@ -19,27 +20,17 @@ import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
public class InstallGMS{
|
||||
public static void alert(final Activity activity){
|
||||
if (!isGmsInstalled()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getString("gmsissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("gmsissuebtn1"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("gmsissuebtn2"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = getContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
}
|
||||
builder.setPositiveButton(getString("gmsissuebtn1"), (dialogInterface, i) -> edit().putBoolean("showAlertGms", false).apply());
|
||||
builder.setNeutralButton(getString("gmsissuebtn2"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = getContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
});
|
||||
if (getBoolValue("showAlertGms", true)) {
|
||||
builder.show();
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.OEMDetector;
|
||||
|
||||
public class Start{
|
||||
@@ -18,24 +20,16 @@ public class Start{
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
activity.requestPermissions(new String[] {"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getWelcome());
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("startbtn2"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("startbtn1"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
}
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setPositiveButton(getString("startbtn2"), (dialogInterface, i) -> edit().putBoolean("showAlert", false).apply());
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("startbtn1"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
});
|
||||
if (getBoolValue("showAlert", true)) {
|
||||
builder.show();
|
||||
|
||||
@@ -8,13 +8,14 @@ import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.utils.VKUIwrapper;
|
||||
|
||||
public class VKIDProtection{
|
||||
public static void alert(final Activity activity){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getString("vkidsumm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -12,6 +12,7 @@ import static ru.vtosters.lite.utils.SettBackup.backupSettings;
|
||||
import static ru.vtosters.lite.utils.SettBackup.deletePrefs;
|
||||
import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
|
||||
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.Themes.getTextAttr;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
@@ -19,16 +20,19 @@ import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.auth.api.VKAccount;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
||||
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||
@@ -206,7 +210,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
var arr = SettBackup.getBackupsNames();
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
||||
new AlertDialog.Builder(getContext(), getAlertStyle())
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle("Выберите бэкап")
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -95,7 +97,7 @@ public class ServerDialog{
|
||||
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
builder.setCancelable(cancelable);
|
||||
|
||||
Reference in New Issue
Block a user