mirror of
https://github.com/MGislv/NekoX.git
synced 2024-07-02 10:33:36 +00:00
Settings
This commit is contained in:
parent
54ba1537ee
commit
cc5089caba
|
@ -9,6 +9,7 @@
|
|||
package org.telegram.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -26,22 +27,27 @@ import android.widget.FrameLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesStorage;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MessagesStorage;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
import org.telegram.ui.ActionBar.AlertDialog;
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||
import org.telegram.ui.Cells.HeaderCell;
|
||||
|
@ -49,8 +55,6 @@ import org.telegram.ui.Cells.NotificationsCheckCell;
|
|||
import org.telegram.ui.Cells.ShadowSectionCell;
|
||||
import org.telegram.ui.Cells.TextCheckCell;
|
||||
import org.telegram.ui.Cells.TextDetailSettingsCell;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
||||
import org.telegram.ui.Cells.TextSettingsCell;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
|
@ -60,8 +64,7 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
|
||||
public class NotificationsSettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
|
@ -574,12 +577,21 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
|||
}
|
||||
}
|
||||
} else if (position == notificationsServiceRow) {
|
||||
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
||||
enabled = preferences.getBoolean("pushService", getMessagesController().keepAliveService);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("pushService", !enabled);
|
||||
editor.commit();
|
||||
ApplicationLoader.startPushService();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
if (ApplicationLoader.isNotificationListenerEnabled()) {
|
||||
AlertUtil.showToast(LocaleController.getString("DisablePushAlert", R.string.DisablePushAlert));
|
||||
} else {
|
||||
AlertUtil.showToast(LocaleController.getString("EnablePushAlert", R.string.EnablePushAlert));
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(this::openNotificationListenSettings, 500L);
|
||||
} else {
|
||||
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
|
||||
enabled = preferences.getBoolean("pushService", getMessagesController().keepAliveService);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("pushService", !enabled);
|
||||
editor.apply();
|
||||
ApplicationLoader.startPushService();
|
||||
}
|
||||
} else if (position == callsVibrateRow) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
|
@ -630,6 +642,32 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
|||
return fragmentView;
|
||||
}
|
||||
|
||||
public boolean openNotificationListenSettings() {
|
||||
try {
|
||||
Intent intent;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
|
||||
} else {
|
||||
intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||
}
|
||||
getParentActivity().startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings$NotificationAccessSettingsActivity");
|
||||
intent.setComponent(cn);
|
||||
intent.putExtra(":settings:show_fragment", "NotificationAccessSettings");
|
||||
getParentActivity().startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
AlertsCreator.showSimpleToast(this, "Open NotificationAccessSettings Error");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
@ -823,7 +861,7 @@ public class NotificationsSettingsActivity extends BaseFragment implements Notif
|
|||
} else if (position == androidAutoAlertRow) {
|
||||
checkCell.setTextAndCheck("Android Auto", preferences.getBoolean("EnableAutoNotifications", false), true);
|
||||
} else if (position == notificationsServiceRow) {
|
||||
checkCell.setTextAndValueAndCheck(LocaleController.getString("NotificationsService", R.string.NotificationsService), LocaleController.getString("NotificationsServiceInfo", R.string.NotificationsServiceInfo), preferences.getBoolean("pushService", getMessagesController().keepAliveService), true, true);
|
||||
checkCell.setTextAndValueAndCheck(LocaleController.getString("NotificationsService", R.string.NotificationsService), LocaleController.getString("NotificationsServiceInfo", R.string.NotificationsServiceInfo), Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? ApplicationLoader.isNotificationListenerEnabled() : preferences.getBoolean("pushService", getMessagesController().keepAliveService), true, true);
|
||||
} else if (position == notificationsServiceConnectionRow) {
|
||||
checkCell.setTextAndValueAndCheck(LocaleController.getString("NotificationsServiceConnection", R.string.NotificationsServiceConnection), LocaleController.getString("NotificationsServiceConnectionInfo", R.string.NotificationsServiceConnectionInfo), preferences.getBoolean("pushConnection", getMessagesController().backgroundConnection), true, true);
|
||||
} else if (position == badgeNumberShowRow) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
|
@ -28,15 +27,8 @@ import android.graphics.PorterDuff;
|
|||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
|
@ -57,35 +49,43 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.BuildConfig;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.UserObject;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MessagesStorage;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.UserObject;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.messenger.browser.Browser;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.SerializedData;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MessagesStorage;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
||||
import org.telegram.ui.ActionBar.AlertDialog;
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.ActionBar.SimpleTextView;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||
import org.telegram.ui.Cells.EmptyCell;
|
||||
import org.telegram.ui.Cells.GraySectionCell;
|
||||
|
@ -95,28 +95,19 @@ import org.telegram.ui.Cells.ShadowSectionCell;
|
|||
import org.telegram.ui.Cells.TextCell;
|
||||
import org.telegram.ui.Cells.TextDetailCell;
|
||||
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
||||
import org.telegram.ui.Components.AlertsCreator;
|
||||
import org.telegram.ui.Components.AvatarDrawable;
|
||||
import org.telegram.ui.Components.BackupImageView;
|
||||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.EmptyTextProgressView;
|
||||
import org.telegram.ui.Components.ImageUpdater;
|
||||
import org.telegram.ui.Components.BackupImageView;
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Components.RadialProgressView;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.Components.voip.VoIPHelper;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -124,11 +115,23 @@ import java.util.HashMap;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import cn.hutool.core.util.RuntimeUtil;
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
import tw.nekomimi.nekogram.NekoXSettingActivity;
|
||||
import tw.nekomimi.nekogram.parts.UpdateChecksKt;
|
||||
import tw.nekomimi.nekogram.settings.NekoSettingsActivity;
|
||||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.EnvUtil;
|
||||
import tw.nekomimi.nekogram.utils.FileUtil;
|
||||
import tw.nekomimi.nekogram.utils.IoUtil;
|
||||
import tw.nekomimi.nekogram.utils.LangsKt;
|
||||
import tw.nekomimi.nekogram.utils.ShareUtil;
|
||||
import tw.nekomimi.nekogram.utils.ThreadUtil;
|
||||
import tw.nekomimi.nekogram.utils.UIUtil;
|
||||
|
||||
public class SettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ImageUpdater.ImageUpdaterDelegate {
|
||||
|
||||
|
@ -184,6 +187,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
private int privacyRow;
|
||||
private int dataRow;
|
||||
private int chatRow;
|
||||
private int stickersRow;
|
||||
private int filtersRow;
|
||||
private int devicesRow;
|
||||
private int nekoRow;
|
||||
|
@ -366,8 +370,8 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
|
||||
otherItem = menu.addItem(0, R.drawable.ic_ab_other);
|
||||
otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
|
||||
otherItem.addSubItem(edit_name, R.drawable.msg_edit, LocaleController.getString("EditName", R.string.EditName));
|
||||
otherItem.addSubItem(logout, R.drawable.msg_leave, LocaleController.getString("LogOut", R.string.LogOut));
|
||||
otherItem.addSubItem(edit_name, R.drawable.baseline_edit_24, LocaleController.getString("EditName", R.string.EditName));
|
||||
otherItem.addSubItem(logout, R.drawable.baseline_exit_to_app_24, LocaleController.getString("LogOut", R.string.LogOut));
|
||||
|
||||
int scrollTo;
|
||||
int scrollToPosition = 0;
|
||||
|
@ -445,58 +449,120 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
listView.setItemAnimator(null);
|
||||
listView.setLayoutAnimation(null);
|
||||
listView.setClipToPadding(false);
|
||||
listView.setOnItemClickListener((view, position) -> {
|
||||
if (position == notificationRow) {
|
||||
presentFragment(new NotificationsSettingsActivity());
|
||||
} else if (position == privacyRow) {
|
||||
presentFragment(new PrivacySettingsActivity());
|
||||
} else if (position == dataRow) {
|
||||
presentFragment(new DataSettingsActivity());
|
||||
} else if (position == chatRow) {
|
||||
presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC));
|
||||
} else if (position == filtersRow) {
|
||||
presentFragment(new FiltersSetupActivity());
|
||||
} else if (position == devicesRow) {
|
||||
presentFragment(new SessionsActivity(0));
|
||||
} else if (position == nekoRow) {
|
||||
presentFragment(new NekoSettingsActivity());
|
||||
} else if (position == questionRow) {
|
||||
showDialog(AlertsCreator.createSupportAlert(SettingsActivity.this));
|
||||
} else if (position == faqRow) {
|
||||
Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl));
|
||||
} else if (position == policyRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://nekogram.github.io/privacy.html");
|
||||
} else if (position == sendLogsRow) {
|
||||
sendLogs();
|
||||
} else if (position == clearLogsRow) {
|
||||
FileLog.cleanupLogs();
|
||||
} else if (position == switchBackendRow) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
|
||||
|
||||
private int pressCount = 0;
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
if (position == notificationRow) {
|
||||
presentFragment(new NotificationsSettingsActivity());
|
||||
} else if (position == privacyRow) {
|
||||
presentFragment(new PrivacySettingsActivity());
|
||||
} else if (position == dataRow) {
|
||||
presentFragment(new DataSettingsActivity());
|
||||
} else if (position == chatRow) {
|
||||
presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC));
|
||||
} else if (position == stickersRow) {
|
||||
presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE));
|
||||
} else if (position == filtersRow) {
|
||||
presentFragment(new FiltersSetupActivity());
|
||||
} else if (position == devicesRow) {
|
||||
presentFragment(new SessionsActivity(0));
|
||||
} else if (position == nekoRow) {
|
||||
presentFragment(new NekoSettingsActivity());
|
||||
} else if (position == questionRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://t.me/NekogramX");
|
||||
} else if (position == faqRow) {
|
||||
Browser.openUrl(getParentActivity(), NekoXConfig.FAQ_URL);
|
||||
} else if (position == policyRow) {
|
||||
Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl));
|
||||
} else if (position == sendLogsRow) {
|
||||
sendLogs();
|
||||
} else if (position == clearLogsRow) {
|
||||
AlertDialog pro = AlertUtil.showProgress(getParentActivity());
|
||||
pro.show();
|
||||
UIUtil.runOnIoDispatcher(() -> {
|
||||
FileUtil.delete(new File(EnvUtil.getTelegramPath(), "logs"));
|
||||
ThreadUtil.sleep(100L);
|
||||
LangsKt.uDismiss(pro);
|
||||
});
|
||||
} else if (position == switchBackendRow) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity());
|
||||
builder1.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
|
||||
builder1.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder1.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
|
||||
SharedConfig.pushAuthKey = null;
|
||||
SharedConfig.pushAuthKeyId = null;
|
||||
SharedConfig.saveConfig();
|
||||
ConnectionsManager.getInstance(currentAccount).switchBackend();
|
||||
});
|
||||
builder1.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder1.create());
|
||||
} else if (position == languageRow) {
|
||||
presentFragment(new LanguageSelectActivity());
|
||||
} else if (position == usernameRow) {
|
||||
presentFragment(new ChangeUsernameActivity());
|
||||
} else if (position == bioRow) {
|
||||
if (userInfo != null) {
|
||||
presentFragment(new ChangeBioActivity());
|
||||
}
|
||||
} else if (position == numberRow) {
|
||||
presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
|
||||
} else if (position == versionRow) {
|
||||
TextInfoPrivacyCell cell = (TextInfoPrivacyCell) view;
|
||||
pressCount++;
|
||||
if (pressCount == 8) {
|
||||
NekoXConfig.developerModeEntrance = true;
|
||||
}
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
builder.addTitle(cell.getTextView().getText().toString(), false);
|
||||
builder.addItem(LocaleController.getString("CopyDetails", R.string.CopyDetails), R.drawable.baseline_content_copy_24, (it) -> {
|
||||
builder.dismiss();
|
||||
AndroidUtilities.addToClipboard(cell.getTextView().getText().toString());
|
||||
AlertUtil.showToast(LocaleController.getString("TextCopied", R.string.TextCopied));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.addItem(BuildVars.DEBUG_VERSION ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs), R.drawable.baseline_bug_report_24, (it) -> {
|
||||
builder.dismiss();
|
||||
BuildVars.DEBUG_VERSION = !BuildVars.DEBUG_VERSION;
|
||||
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
||||
sharedPreferences.edit().putBoolean("logsEnabled", BuildVars.DEBUG_VERSION).apply();
|
||||
updateRows();
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
if (!BuildVars.isUnknown) {
|
||||
builder.addItem(LocaleController.getString("CheckUpdate", R.string.CheckUpdate), R.drawable.baseline_system_update_24, (it) -> {
|
||||
builder.dismiss();
|
||||
UpdateChecksKt.checkUpdate(getParentActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
builder.addItem(LocaleController.getString("SwitchVersion", R.string.SwitchVersion), R.drawable.baseline_replay_24, (it) -> {
|
||||
builder.dismiss();
|
||||
UpdateChecksKt.switchVersion(getParentActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
if (NekoXConfig.developerModeEntrance || NekoXConfig.developerMode) {
|
||||
builder.addItem(LocaleController.getString("DeveloperSettings", R.string.DeveloperSettings), R.drawable.baseline_developer_mode_24, (it) -> {
|
||||
builder.dismiss();
|
||||
BottomBuilder devBuilder = new BottomBuilder(getParentActivity());
|
||||
devBuilder.addTitle(LocaleController.getString("DevModeTitle", R.string.DevModeTitle), LocaleController.getString("DevModeNotice", R.string.DevModeNotice));
|
||||
devBuilder.addItem(LocaleController.getString("Continue", R.string.Continue), R.drawable.baseline_warning_24, true, (__) -> {
|
||||
devBuilder.dismiss();
|
||||
presentFragment(new NekoXSettingActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
devBuilder.addCancelItem();
|
||||
devBuilder.show();
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
builder.show();
|
||||
}
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity());
|
||||
builder1.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
|
||||
builder1.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder1.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
|
||||
SharedConfig.pushAuthKey = null;
|
||||
SharedConfig.pushAuthKeyId = null;
|
||||
SharedConfig.saveConfig();
|
||||
ConnectionsManager.getInstance(currentAccount).switchBackend();
|
||||
});
|
||||
builder1.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder1.create());
|
||||
} else if (position == languageRow) {
|
||||
presentFragment(new LanguageSelectActivity());
|
||||
} else if (position == usernameRow) {
|
||||
presentFragment(new ChangeUsernameActivity());
|
||||
} else if (position == bioRow) {
|
||||
if (userInfo != null) {
|
||||
presentFragment(new ChangeBioActivity());
|
||||
}
|
||||
} else if (position == numberRow) {
|
||||
presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
|
||||
} else if (position == versionRow) {
|
||||
MessagesController.getInstance(currentAccount).openByUserName("Zuragram", SettingsActivity.this, 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -506,6 +572,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
|
||||
@Override
|
||||
public boolean onItemClick(View view, int position) {
|
||||
if (!NekoXConfig.developerMode) return false;
|
||||
if (position == versionRow) {
|
||||
pressCount++;
|
||||
if (pressCount >= 2 || BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||
|
@ -517,15 +584,12 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
LocaleController.getString("DebugMenuReloadContacts", R.string.DebugMenuReloadContacts),
|
||||
LocaleController.getString("DebugMenuResetContacts", R.string.DebugMenuResetContacts),
|
||||
LocaleController.getString("DebugMenuResetDialogs", R.string.DebugMenuResetDialogs),
|
||||
BuildVars.LOGS_ENABLED ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs),
|
||||
NekoConfig.residentNotification ? LocaleController.getString("DisableResidentNotification", R.string.DisableResidentNotification) : LocaleController.getString("EnableResidentNotification", R.string.EnableResidentNotification),
|
||||
BuildVars.DEBUG_VERSION ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs),
|
||||
null,
|
||||
LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache),
|
||||
LocaleController.getString("DebugMenuCallSettings", R.string.DebugMenuCallSettings),
|
||||
null,
|
||||
BuildVars.DEBUG_PRIVATE_VERSION ? "Check for app updates" : null,
|
||||
LocaleController.getString("DebugMenuReadAllDialogs", R.string.DebugMenuReadAllDialogs),
|
||||
SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic),
|
||||
BuildVars.DEBUG_VERSION && !AndroidUtilities.isTablet() && Build.VERSION.SDK_INT >= 23 ? (SharedConfig.smoothKeyboard ? LocaleController.getString("DebugMenuDisableSmoothKeyboard", R.string.DebugMenuDisableSmoothKeyboard) : LocaleController.getString("DebugMenuEnableSmoothKeyboard", R.string.DebugMenuEnableSmoothKeyboard)) : null
|
||||
SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic)
|
||||
};
|
||||
builder.setItems(items, (dialog, which) -> {
|
||||
if (which == 0) {
|
||||
|
@ -539,35 +603,21 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
} else if (which == 3) {
|
||||
MessagesController.getInstance(currentAccount).forceResetDialogs();
|
||||
} else if (which == 4) {
|
||||
BuildVars.LOGS_ENABLED = !BuildVars.LOGS_ENABLED;
|
||||
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
||||
sharedPreferences.edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED).commit();
|
||||
updateRows();
|
||||
} else if (which == 5) {
|
||||
NekoConfig.toggleResidentNotification();
|
||||
} else if (which == 6) {
|
||||
} else if (which == 5) {
|
||||
MessagesStorage.getInstance(currentAccount).clearSentMedia();
|
||||
SharedConfig.setNoSoundHintShowed(false);
|
||||
SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit();
|
||||
editor.remove("archivehint").remove("archivehint_l").remove("gifhint").remove("soundHint").remove("themehint").remove("filterhint").commit();
|
||||
editor.remove("archivehint").remove("archivehint_l").remove("gifhint").remove("soundHint").remove("themehint").remove("filterhint").apply();
|
||||
SharedConfig.textSelectionHintShows = 0;
|
||||
SharedConfig.lockRecordAudioVideoHint = 0;
|
||||
SharedConfig.stickersReorderingHintUsed = false;
|
||||
} else if (which == 7) {
|
||||
} else if (which == 6) {
|
||||
VoIPHelper.showCallDebugSettings(getParentActivity());
|
||||
} else if (which == 8) {
|
||||
SharedConfig.toggleRoundCamera16to9();
|
||||
} else if (which == 9) {
|
||||
((LaunchActivity) getParentActivity()).checkAppUpdate(true);
|
||||
} else if (which == 10) {
|
||||
} else if (which == 7) {
|
||||
MessagesStorage.getInstance(currentAccount).readAllDialogs(-1);
|
||||
} else if (which == 11) {
|
||||
} else if (which == 8) {
|
||||
SharedConfig.togglePauseMusicOnRecord();
|
||||
} else if (which == 12) {
|
||||
SharedConfig.toggleSmoothKeyboard();
|
||||
if (SharedConfig.smoothKeyboard && getParentActivity() != null) {
|
||||
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
|
@ -592,6 +642,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
searchListView.setVerticalScrollBarEnabled(false);
|
||||
searchListView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
||||
searchListView.setGlowColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
|
||||
|
@ -639,7 +690,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
return false;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
builder.setTitle(LocaleController.getString("NekoX", R.string.NekoX));
|
||||
builder.setMessage(LocaleController.getString("ClearSearch", R.string.ClearSearch));
|
||||
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> searchAdapter.clearRecent());
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
|
@ -708,7 +759,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
titleTextView.setGravity(Gravity.LEFT);
|
||||
titleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
|
||||
titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
titleTextView.setText(BuildVars.DEBUG_VERSION ? "Telegram Beta" : LocaleController.getString("AppName", R.string.AppName));
|
||||
titleTextView.setText(LocaleController.getString("NekoX", R.string.NekoX));
|
||||
titleTextView.setAlpha(0.0f);
|
||||
frameLayout.addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
|
||||
|
||||
|
@ -747,17 +798,18 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
frameLayout.addView(idTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0));
|
||||
|
||||
writeButton = new ImageView(context);
|
||||
|
||||
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground));
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
|
||||
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
|
||||
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.SRC_IN));
|
||||
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
|
||||
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
||||
drawable = combinedDrawable;
|
||||
}
|
||||
writeButton.setBackgroundDrawable(drawable);
|
||||
writeButton.setImageResource(R.drawable.menu_camera_av);
|
||||
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY));
|
||||
writeButton.setImageResource(R.drawable.baseline_edit_24);
|
||||
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.SRC_IN));
|
||||
writeButton.setScaleType(ImageView.ScaleType.CENTER);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
StateListAnimator animator = new StateListAnimator();
|
||||
|
@ -821,49 +873,40 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
rowCount = 0;
|
||||
emptyRow = rowCount++;
|
||||
numberSectionRow = rowCount++;
|
||||
if (!NekoConfig.hidePhone) {
|
||||
numberRow = rowCount++;
|
||||
}
|
||||
numberRow = rowCount++;
|
||||
usernameRow = rowCount++;
|
||||
bioRow = rowCount++;
|
||||
settingsSectionRow = rowCount++;
|
||||
settingsSectionRow2 = rowCount++;
|
||||
notificationRow = rowCount++;
|
||||
privacyRow = rowCount++;
|
||||
dataRow = rowCount++;
|
||||
privacyRow = rowCount++;
|
||||
chatRow = rowCount++;
|
||||
if (true || getMessagesController().filtersEnabled || !getMessagesController().dialogFilters.isEmpty()) {
|
||||
filtersRow = rowCount++;
|
||||
} else {
|
||||
filtersRow = -1;
|
||||
}
|
||||
devicesRow = rowCount++;
|
||||
stickersRow = rowCount++;
|
||||
filtersRow = rowCount++;
|
||||
devicesRow = -1;
|
||||
nekoRow = rowCount++;
|
||||
languageRow = rowCount++;
|
||||
devicesSectionRow = rowCount++;
|
||||
devicesSectionRow = -1;
|
||||
helpHeaderRow = rowCount++;
|
||||
questionRow = rowCount++;
|
||||
questionRow = -1;
|
||||
faqRow = rowCount++;
|
||||
policyRow = rowCount++;
|
||||
if (BuildVars.LOGS_ENABLED || BuildVars.DEBUG_VERSION) {
|
||||
policyRow = -1;
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
helpSectionCell = rowCount++;
|
||||
debugHeaderRow = rowCount++;
|
||||
} else {
|
||||
helpSectionCell = -1;
|
||||
debugHeaderRow = -1;
|
||||
}
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
sendLogsRow = rowCount++;
|
||||
clearLogsRow = rowCount++;
|
||||
} else {
|
||||
sendLogsRow = -1;
|
||||
clearLogsRow = -1;
|
||||
}
|
||||
if (BuildVars.DEBUG_VERSION) {
|
||||
switchBackendRow = rowCount++;
|
||||
} else {
|
||||
switchBackendRow = -1;
|
||||
}
|
||||
switchBackendRow = -1;
|
||||
versionRow = rowCount++;
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
@ -1422,9 +1465,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
float scale = 1.0f + 0.12f * diff;
|
||||
nameTextView.setScaleX(scale);
|
||||
nameTextView.setScaleY(scale);
|
||||
idTextView.setTranslationX( -21 * AndroidUtilities.density * diff);
|
||||
idTextView.setTranslationY( (float) Math.floor(avatarY) + AndroidUtilities.dp(32) + (float)Math.floor(22 * AndroidUtilities.density) * diff);
|
||||
if (diff > 0.85 && !searchMode) {
|
||||
idTextView.setTranslationX(-21 * AndroidUtilities.density * diff);
|
||||
idTextView.setTranslationY((float) Math.floor(avatarY) + AndroidUtilities.dp(32) + (float) Math.floor(22 * AndroidUtilities.density) * diff);
|
||||
if (diff > 0.85 && !searchMode && NekoConfig.showIdAndDc) {
|
||||
idTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
idTextView.setVisibility(View.GONE);
|
||||
|
@ -1515,7 +1558,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
if (user.photo != null && user.photo.dc_id != 0) {
|
||||
idTextView.setText("ID: " + user.id + ", DC: " + user.photo.dc_id);
|
||||
} else {
|
||||
idTextView.setText("ID: " + user.id);
|
||||
idTextView.setText("ID: " + user.id + ", DC: " + getMessagesController().thisDc);
|
||||
}
|
||||
int finalId = user.id;
|
||||
idTextView.setOnLongClickListener(v -> {
|
||||
|
@ -1536,73 +1579,18 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
}
|
||||
|
||||
private void sendLogs() {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3);
|
||||
progressDialog.setCanCacnel(false);
|
||||
progressDialog.show();
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
try {
|
||||
File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null);
|
||||
File dir = new File(sdCard.getAbsolutePath() + "/logs");
|
||||
|
||||
File zipFile = new File(dir, "logs.zip");
|
||||
if (zipFile.exists()) {
|
||||
zipFile.delete();
|
||||
}
|
||||
|
||||
File[] files = dir.listFiles();
|
||||
|
||||
boolean[] finished = new boolean[1];
|
||||
|
||||
BufferedInputStream origin = null;
|
||||
ZipOutputStream out = null;
|
||||
try {
|
||||
FileOutputStream dest = new FileOutputStream(zipFile);
|
||||
out = new ZipOutputStream(new BufferedOutputStream(dest));
|
||||
byte[] data = new byte[1024 * 64];
|
||||
FileUtil.delete(logcatFile);
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
FileInputStream fi = new FileInputStream(files[i]);
|
||||
origin = new BufferedInputStream(fi, data.length);
|
||||
try {
|
||||
|
||||
ZipEntry entry = new ZipEntry(files[i].getName());
|
||||
out.putNextEntry(entry);
|
||||
int count;
|
||||
while ((count = origin.read(data, 0, data.length)) != -1) {
|
||||
out.write(data, 0, count);
|
||||
}
|
||||
if (origin != null) {
|
||||
origin.close();
|
||||
origin = null;
|
||||
}
|
||||
}
|
||||
finished[0] = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (origin != null) {
|
||||
origin.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
Process process = RuntimeUtil.exec("logcat", "-d");
|
||||
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
try {
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
if (finished[0]) {
|
||||
Uri uri;
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
uri = FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", zipFile);
|
||||
} else {
|
||||
uri = Uri.fromFile(zipFile);
|
||||
}
|
||||
IoUtil.copy(process, logcatFile);
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
|
@ -1776,89 +1764,89 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
}
|
||||
}),
|
||||
|
||||
new SearchResult(1, LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(2, LocaleController.getString("NotificationsPrivateChats", R.string.NotificationsPrivateChats), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_PRIVATE, new ArrayList<>(), true))),
|
||||
new SearchResult(3, LocaleController.getString("NotificationsGroups", R.string.NotificationsGroups), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_GROUP, new ArrayList<>(), true))),
|
||||
new SearchResult(4, LocaleController.getString("NotificationsChannels", R.string.NotificationsChannels), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_CHANNEL, new ArrayList<>(), true))),
|
||||
new SearchResult(5, LocaleController.getString("VoipNotificationSettings", R.string.VoipNotificationSettings), "callsSectionRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(6, LocaleController.getString("BadgeNumber", R.string.BadgeNumber), "badgeNumberSection", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(7, LocaleController.getString("InAppNotifications", R.string.InAppNotifications), "inappSectionRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(8, LocaleController.getString("ContactJoined", R.string.ContactJoined), "contactJoinedRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(9, LocaleController.getString("PinnedMessages", R.string.PinnedMessages), "pinnedMessageRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(10, LocaleController.getString("ResetAllNotifications", R.string.ResetAllNotifications), "resetNotificationsRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(1, LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(2, LocaleController.getString("NotificationsPrivateChats", R.string.NotificationsPrivateChats), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_PRIVATE, new ArrayList<>(), true))),
|
||||
new SearchResult(3, LocaleController.getString("NotificationsGroups", R.string.NotificationsGroups), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_GROUP, new ArrayList<>(), true))),
|
||||
new SearchResult(4, LocaleController.getString("NotificationsChannels", R.string.NotificationsChannels), LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsCustomSettingsActivity(NotificationsController.TYPE_CHANNEL, new ArrayList<>(), true))),
|
||||
new SearchResult(5, LocaleController.getString("VoipNotificationSettings", R.string.VoipNotificationSettings), "callsSectionRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(6, LocaleController.getString("BadgeNumber", R.string.BadgeNumber), "badgeNumberSection", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(7, LocaleController.getString("InAppNotifications", R.string.InAppNotifications), "inappSectionRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(8, LocaleController.getString("ContactJoined", R.string.ContactJoined), "contactJoinedRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(9, LocaleController.getString("PinnedMessages", R.string.PinnedMessages), "pinnedMessageRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
new SearchResult(10, LocaleController.getString("ResetAllNotifications", R.string.ResetAllNotifications), "resetNotificationsRow", LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, () -> presentFragment(new NotificationsSettingsActivity())),
|
||||
|
||||
new SearchResult(100, LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(101, LocaleController.getString("BlockedUsers", R.string.BlockedUsers), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyUsersActivity())),
|
||||
new SearchResult(105, LocaleController.getString("PrivacyPhone", R.string.PrivacyPhone), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHONE, true))),
|
||||
new SearchResult(102, LocaleController.getString("PrivacyLastSeen", R.string.PrivacyLastSeen), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_LASTSEEN, true))),
|
||||
new SearchResult(103, LocaleController.getString("PrivacyProfilePhoto", R.string.PrivacyProfilePhoto), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHOTO, true))),
|
||||
new SearchResult(104, LocaleController.getString("PrivacyForwards", R.string.PrivacyForwards), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_FORWARDS, true))),
|
||||
new SearchResult(105, LocaleController.getString("PrivacyP2P", R.string.PrivacyP2P), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_P2P, true))),
|
||||
new SearchResult(106, LocaleController.getString("Calls", R.string.Calls), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_CALLS, true))),
|
||||
new SearchResult(107, LocaleController.getString("GroupsAndChannels", R.string.GroupsAndChannels), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_INVITE, true))),
|
||||
new SearchResult(108, LocaleController.getString("Passcode", R.string.Passcode), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PasscodeActivity(SharedConfig.passcodeHash.length() > 0 ? 2 : 0))),
|
||||
new SearchResult(109, LocaleController.getString("TwoStepVerification", R.string.TwoStepVerification), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new TwoStepVerificationActivity())),
|
||||
new SearchResult(110, LocaleController.getString("SessionsTitle", R.string.SessionsTitle), R.drawable.menu_secret, () -> presentFragment(new SessionsActivity(0))),
|
||||
new SearchResult(111, LocaleController.getString("PrivacyDeleteCloudDrafts", R.string.PrivacyDeleteCloudDrafts), "clearDraftsRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(112, LocaleController.getString("DeleteAccountIfAwayFor2", R.string.DeleteAccountIfAwayFor2), "deleteAccountRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(113, LocaleController.getString("PrivacyPaymentsClear", R.string.PrivacyPaymentsClear), "paymentsClearRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(114, LocaleController.getString("WebSessionsTitle", R.string.WebSessionsTitle), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new SessionsActivity(1))),
|
||||
new SearchResult(115, LocaleController.getString("SyncContactsDelete", R.string.SyncContactsDelete), "contactsDeleteRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(116, LocaleController.getString("SyncContacts", R.string.SyncContacts), "contactsSyncRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(117, LocaleController.getString("SuggestContacts", R.string.SuggestContacts), "contactsSuggestRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(118, LocaleController.getString("MapPreviewProvider", R.string.MapPreviewProvider), "secretMapRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(119, LocaleController.getString("SecretWebPage", R.string.SecretWebPage), "secretWebpageRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(120, LocaleController.getString("Devices", R.string.Devices), R.drawable.menu_secret, () -> presentFragment(new SessionsActivity(0))),
|
||||
new SearchResult(100, LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(101, LocaleController.getString("BlockedUsers", R.string.BlockedUsers), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyUsersActivity())),
|
||||
new SearchResult(105, LocaleController.getString("PrivacyPhone", R.string.PrivacyPhone), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHONE, true))),
|
||||
new SearchResult(102, LocaleController.getString("PrivacyLastSeen", R.string.PrivacyLastSeen), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_LASTSEEN, true))),
|
||||
new SearchResult(103, LocaleController.getString("PrivacyProfilePhoto", R.string.PrivacyProfilePhoto), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_PHOTO, true))),
|
||||
new SearchResult(104, LocaleController.getString("PrivacyForwards", R.string.PrivacyForwards), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_FORWARDS, true))),
|
||||
new SearchResult(105, LocaleController.getString("PrivacyP2P", R.string.PrivacyP2P), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_P2P, true))),
|
||||
new SearchResult(106, LocaleController.getString("Calls", R.string.Calls), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_CALLS, true))),
|
||||
new SearchResult(107, LocaleController.getString("GroupsAndChannels", R.string.GroupsAndChannels), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacyControlActivity(ContactsController.PRIVACY_RULES_TYPE_INVITE, true))),
|
||||
new SearchResult(108, LocaleController.getString("Passcode", R.string.Passcode), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PasscodeActivity(SharedConfig.passcodeHash.length() > 0 ? 2 : 0))),
|
||||
new SearchResult(109, LocaleController.getString("TwoStepVerification", R.string.TwoStepVerification), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new TwoStepVerificationActivity())),
|
||||
new SearchResult(110, LocaleController.getString("SessionsTitle", R.string.SessionsTitle), R.drawable.baseline_security_24, () -> presentFragment(new SessionsActivity(0))),
|
||||
new SearchResult(111, LocaleController.getString("PrivacyDeleteCloudDrafts", R.string.PrivacyDeleteCloudDrafts), "clearDraftsRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(112, LocaleController.getString("DeleteAccountIfAwayFor2", R.string.DeleteAccountIfAwayFor2), "deleteAccountRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(113, LocaleController.getString("PrivacyPaymentsClear", R.string.PrivacyPaymentsClear), "paymentsClearRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(114, LocaleController.getString("WebSessionsTitle", R.string.WebSessionsTitle), LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new SessionsActivity(1))),
|
||||
new SearchResult(115, LocaleController.getString("SyncContactsDelete", R.string.SyncContactsDelete), "contactsDeleteRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(116, LocaleController.getString("SyncContacts", R.string.SyncContacts), "contactsSyncRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(117, LocaleController.getString("SuggestContacts", R.string.SuggestContacts), "contactsSuggestRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(118, LocaleController.getString("MapPreviewProvider", R.string.MapPreviewProvider), "secretMapRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(119, LocaleController.getString("SecretWebPage", R.string.SecretWebPage), "secretWebpageRow", LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_security_24, () -> presentFragment(new PrivacySettingsActivity())),
|
||||
new SearchResult(120, LocaleController.getString("Devices", R.string.Devices), R.drawable.baseline_security_24, () -> presentFragment(new SessionsActivity(0))),
|
||||
|
||||
new SearchResult(200, LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(201, LocaleController.getString("DataUsage", R.string.DataUsage), "usageSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(202, LocaleController.getString("StorageUsage", R.string.StorageUsage), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(203, LocaleController.getString("KeepMedia", R.string.KeepMedia), "keepMediaRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.menu_data, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(204, LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), "cacheRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.menu_data, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(205, LocaleController.getString("LocalDatabase", R.string.LocalDatabase), "databaseRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.menu_data, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(206, LocaleController.getString("NetworkUsage", R.string.NetworkUsage), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataUsageActivity())),
|
||||
new SearchResult(207, LocaleController.getString("AutomaticMediaDownload", R.string.AutomaticMediaDownload), "mediaDownloadSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(208, LocaleController.getString("WhenUsingMobileData", R.string.WhenUsingMobileData), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataAutoDownloadActivity(0))),
|
||||
new SearchResult(209, LocaleController.getString("WhenConnectedOnWiFi", R.string.WhenConnectedOnWiFi), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataAutoDownloadActivity(1))),
|
||||
new SearchResult(210, LocaleController.getString("WhenRoaming", R.string.WhenRoaming), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataAutoDownloadActivity(2))),
|
||||
new SearchResult(211, LocaleController.getString("ResetAutomaticMediaDownload", R.string.ResetAutomaticMediaDownload), "resetDownloadRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(212, LocaleController.getString("AutoplayMedia", R.string.AutoplayMedia), "autoplayHeaderRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(213, LocaleController.getString("AutoplayGIF", R.string.AutoplayGIF), "autoplayGifsRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(214, LocaleController.getString("AutoplayVideo", R.string.AutoplayVideo), "autoplayVideoRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(215, LocaleController.getString("Streaming", R.string.Streaming), "streamSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(216, LocaleController.getString("EnableStreaming", R.string.EnableStreaming), "enableStreamRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(217, LocaleController.getString("Calls", R.string.Calls), "callsSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(218, LocaleController.getString("VoipUseLessData", R.string.VoipUseLessData), "useLessDataForCallsRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(219, LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies), "quickRepliesRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(220, LocaleController.getString("ProxySettings", R.string.ProxySettings), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, () -> presentFragment(new ProxyListActivity())),
|
||||
new SearchResult(221, LocaleController.getString("UseProxyForCalls", R.string.UseProxyForCalls), "callsRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("ProxySettings", R.string.ProxySettings), R.drawable.menu_data, () -> presentFragment(new ProxyListActivity())),
|
||||
new SearchResult(200, LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(201, LocaleController.getString("DataUsage", R.string.DataUsage), "usageSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(202, LocaleController.getString("StorageUsage", R.string.StorageUsage), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(203, LocaleController.getString("KeepMedia", R.string.KeepMedia), "keepMediaRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.baseline_data_usage_24, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(204, LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), "cacheRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.baseline_data_usage_24, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(205, LocaleController.getString("LocalDatabase", R.string.LocalDatabase), "databaseRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("StorageUsage", R.string.StorageUsage), R.drawable.baseline_data_usage_24, () -> presentFragment(new CacheControlActivity())),
|
||||
new SearchResult(206, LocaleController.getString("NetworkUsage", R.string.NetworkUsage), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataUsageActivity())),
|
||||
new SearchResult(207, LocaleController.getString("AutomaticMediaDownload", R.string.AutomaticMediaDownload), "mediaDownloadSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(208, LocaleController.getString("WhenUsingMobileData", R.string.WhenUsingMobileData), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataAutoDownloadActivity(0))),
|
||||
new SearchResult(209, LocaleController.getString("WhenConnectedOnWiFi", R.string.WhenConnectedOnWiFi), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataAutoDownloadActivity(1))),
|
||||
new SearchResult(210, LocaleController.getString("WhenRoaming", R.string.WhenRoaming), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataAutoDownloadActivity(2))),
|
||||
new SearchResult(211, LocaleController.getString("ResetAutomaticMediaDownload", R.string.ResetAutomaticMediaDownload), "resetDownloadRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(212, LocaleController.getString("AutoplayMedia", R.string.AutoplayMedia), "autoplayHeaderRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(213, LocaleController.getString("AutoplayGIF", R.string.AutoplayGIF), "autoplayGifsRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(214, LocaleController.getString("AutoplayVideo", R.string.AutoplayVideo), "autoplayVideoRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(215, LocaleController.getString("Streaming", R.string.Streaming), "streamSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(216, LocaleController.getString("EnableStreaming", R.string.EnableStreaming), "enableStreamRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(217, LocaleController.getString("Calls", R.string.Calls), "callsSectionRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(218, LocaleController.getString("VoipUseLessData", R.string.VoipUseLessData), "useLessDataForCallsRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(219, LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies), "quickRepliesRow", LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new DataSettingsActivity())),
|
||||
new SearchResult(220, LocaleController.getString("ProxySettings", R.string.ProxySettings), LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new ProxyListActivity())),
|
||||
new SearchResult(221, LocaleController.getString("UseProxyForCalls", R.string.UseProxyForCalls), "callsRow", LocaleController.getString("DataSettings", R.string.DataSettings), LocaleController.getString("ProxySettings", R.string.ProxySettings), R.drawable.baseline_data_usage_24, () -> presentFragment(new ProxyListActivity())),
|
||||
|
||||
new SearchResult(300, LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(301, LocaleController.getString("TextSizeHeader", R.string.TextSizeHeader), "textSizeHeaderRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(302, LocaleController.getString("ChatBackground", R.string.ChatBackground), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_ALL))),
|
||||
new SearchResult(303, LocaleController.getString("SetColor", R.string.SetColor), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("ChatBackground", R.string.ChatBackground), R.drawable.menu_chats, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_COLOR))),
|
||||
new SearchResult(304, LocaleController.getString("ResetChatBackgrounds", R.string.ResetChatBackgrounds), "resetRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("ChatBackground", R.string.ChatBackground), R.drawable.menu_chats, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_ALL))),
|
||||
new SearchResult(305, LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_NIGHT))),
|
||||
new SearchResult(306, LocaleController.getString("ColorTheme", R.string.ColorTheme), "themeHeaderRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(307, LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), "customTabsRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(308, LocaleController.getString("DirectShare", R.string.DirectShare), "directShareRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(309, LocaleController.getString("EnableAnimations", R.string.EnableAnimations), "enableAnimationsRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(310, LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), "raiseToSpeakRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(311, LocaleController.getString("SendByEnter", R.string.SendByEnter), "sendByEnterRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(312, LocaleController.getString("SaveToGallerySettings", R.string.SaveToGallerySettings), "saveToGalleryRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(312, LocaleController.getString("DistanceUnits", R.string.DistanceUnits), "distanceRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(313, LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(314, LocaleController.getString("SuggestStickers", R.string.SuggestStickers), "suggestRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.menu_chats, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(315, LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.menu_chats, () -> presentFragment(new FeaturedStickersActivity())),
|
||||
new SearchResult(316, LocaleController.getString("Masks", R.string.Masks), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.menu_chats, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_MASK))),
|
||||
new SearchResult(317, LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.menu_chats, () -> presentFragment(new ArchivedStickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(317, LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.menu_chats, () -> presentFragment(new ArchivedStickersActivity(MediaDataController.TYPE_MASK))),
|
||||
new SearchResult(300, LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(301, LocaleController.getString("TextSizeHeader", R.string.TextSizeHeader), "textSizeHeaderRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(302, LocaleController.getString("ChatBackground", R.string.ChatBackground), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_ALL))),
|
||||
new SearchResult(303, LocaleController.getString("SetColor", R.string.SetColor), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("ChatBackground", R.string.ChatBackground), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_COLOR))),
|
||||
new SearchResult(304, LocaleController.getString("ResetChatBackgrounds", R.string.ResetChatBackgrounds), "resetRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("ChatBackground", R.string.ChatBackground), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new WallpapersListActivity(WallpapersListActivity.TYPE_ALL))),
|
||||
new SearchResult(305, LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_NIGHT))),
|
||||
new SearchResult(306, LocaleController.getString("ColorTheme", R.string.ColorTheme), "themeHeaderRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(307, LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), "customTabsRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(308, LocaleController.getString("DirectShare", R.string.DirectShare), "directShareRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(309, LocaleController.getString("EnableAnimations", R.string.EnableAnimations), "enableAnimationsRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(310, LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), "raiseToSpeakRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(311, LocaleController.getString("SendByEnter", R.string.SendByEnter), "sendByEnterRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(312, LocaleController.getString("SaveToGallerySettings", R.string.SaveToGallerySettings), "saveToGalleryRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(312, LocaleController.getString("DistanceUnits", R.string.DistanceUnits), "distanceRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC))),
|
||||
new SearchResult(313, LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(314, LocaleController.getString("SuggestStickers", R.string.SuggestStickers), "suggestRow", LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(315, LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new FeaturedStickersActivity())),
|
||||
new SearchResult(316, LocaleController.getString("Masks", R.string.Masks), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new StickersActivity(MediaDataController.TYPE_MASK))),
|
||||
new SearchResult(317, LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ArchivedStickersActivity(MediaDataController.TYPE_IMAGE))),
|
||||
new SearchResult(317, LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks), null, LocaleController.getString("ChatSettings", R.string.ChatSettings), LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.baseline_chat_bubble_24, () -> presentFragment(new ArchivedStickersActivity(MediaDataController.TYPE_MASK))),
|
||||
|
||||
new SearchResult(400, LocaleController.getString("Language", R.string.Language), R.drawable.menu_language, () -> presentFragment(new LanguageSelectActivity())),
|
||||
new SearchResult(400, LocaleController.getString("Language", R.string.Language), R.drawable.baseline_language_24, () -> presentFragment(new LanguageSelectActivity())),
|
||||
|
||||
new SearchResult(402, LocaleController.getString("AskAQuestion", R.string.AskAQuestion), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.menu_help, () -> showDialog(AlertsCreator.createSupportAlert(SettingsActivity.this))),
|
||||
new SearchResult(403, LocaleController.getString("TelegramFAQ", R.string.TelegramFAQ), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.menu_help, () -> Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl))),
|
||||
new SearchResult(404, LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.menu_help, () -> Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl))),
|
||||
new SearchResult(402, LocaleController.getString("AskAQuestion", R.string.AskAQuestion), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.baseline_help_24, () -> showDialog(AlertsCreator.createSupportAlert(SettingsActivity.this))),
|
||||
new SearchResult(403, LocaleController.getString("TelegramFAQ", R.string.TelegramFAQ), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.baseline_help_24, () -> Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl))),
|
||||
new SearchResult(404, LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), LocaleController.getString("SettingsHelp", R.string.SettingsHelp), R.drawable.baseline_help_24, () -> Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl))),
|
||||
};
|
||||
private ArrayList<FaqSearchResult> faqSearchArray = new ArrayList<>();
|
||||
|
||||
|
@ -1931,7 +1919,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
}
|
||||
loadingFaqPage = true;
|
||||
final TLRPC.TL_messages_getWebPage req2 = new TLRPC.TL_messages_getWebPage();
|
||||
req2.url = LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl);
|
||||
req2.url = NekoXConfig.FAQ_URL;
|
||||
req2.hash = 0;
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response2, error2) -> {
|
||||
if (response2 instanceof TLRPC.WebPage) {
|
||||
|
@ -2253,33 +2241,31 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
case 2: {
|
||||
TextCell textCell = (TextCell) holder.itemView;
|
||||
if (position == languageRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Language", R.string.Language), R.drawable.menu_language, false);
|
||||
textCell.setTextAndIcon(LocaleController.getString("Language", R.string.Language), R.drawable.baseline_language_24, false);
|
||||
} else if (position == notificationRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.menu_notifications, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), R.drawable.baseline_notifications_24, true);
|
||||
} else if (position == privacyRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.menu_secret, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), R.drawable.baseline_lock_24, true);
|
||||
} else if (position == dataRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.menu_data, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("DataSettings", R.string.DataSettings), R.drawable.baseline_data_usage_24, true);
|
||||
} else if (position == chatRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.menu_chats, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("ChatSettings", R.string.ChatSettings), R.drawable.baseline_palette_24, true);
|
||||
} else if (position == stickersRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("StickersAndMasks", R.string.StickersAndMasks), R.drawable.deproko_baseline_stickers_24, true);
|
||||
} else if (position == nekoRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("NekoSettings", R.string.NekoSettings), R.drawable.menu_settings, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NekoSettings", R.string.NekoSettings), R.drawable.baseline_extension_24, true);
|
||||
} else if (position == filtersRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Filters", R.string.Filters), R.drawable.menu_folders, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("Filters", R.string.Filters), R.drawable.baseline_folder_24, true);
|
||||
} else if (position == questionRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("AskAQuestion", R.string.AskAQuestion), R.drawable.menu_support2, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NekoXUpdatesChannel", R.string.NekoXUpdatesChannel), R.drawable.baseline_bullhorn_24, true);
|
||||
} else if (position == faqRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("TelegramFAQ", R.string.TelegramFAQ), R.drawable.menu_help, true);
|
||||
} else if (position == policyRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), R.drawable.menu_policy, false);
|
||||
textCell.setTextAndIcon(LocaleController.getString("NekoXFaq", R.string.NekoXFaq), R.drawable.baseline_help_24, true);
|
||||
} else if (position == sendLogsRow) {
|
||||
textCell.setText(LocaleController.getString("DebugSendLogs", R.string.DebugSendLogs), true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("DebugSendLogs", R.string.DebugSendLogs), R.drawable.baseline_bug_report_24, true);
|
||||
} else if (position == clearLogsRow) {
|
||||
textCell.setText(LocaleController.getString("DebugClearLogs", R.string.DebugClearLogs), switchBackendRow != -1);
|
||||
textCell.setTextAndIcon(LocaleController.getString("DebugClearLogs", R.string.DebugClearLogs), R.drawable.baseline_delete_sweep_24, switchBackendRow != -1);
|
||||
} else if (position == switchBackendRow) {
|
||||
textCell.setText("Switch Backend", false);
|
||||
} else if (position == devicesRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Devices", R.string.Devices), R.drawable.menu_devices, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2338,7 +2324,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
int position = holder.getAdapterPosition();
|
||||
return position == notificationRow || position == numberRow || position == privacyRow ||
|
||||
position == languageRow || position == usernameRow || position == bioRow ||
|
||||
position == versionRow || position == dataRow || position == chatRow ||
|
||||
position == versionRow || position == dataRow || position == chatRow || position == stickersRow ||
|
||||
position == questionRow || position == devicesRow || position == filtersRow ||
|
||||
position == faqRow || position == policyRow || position == sendLogsRow ||
|
||||
position == clearLogsRow || position == switchBackendRow || position == nekoRow;
|
||||
|
@ -2371,36 +2357,9 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
cell.getTextView().setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText3));
|
||||
cell.getTextView().setMovementMethod(null);
|
||||
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
int code = pInfo.versionCode / 10;
|
||||
String abi = "";
|
||||
switch (pInfo.versionCode % 10) {
|
||||
case 1:
|
||||
case 3:
|
||||
abi = "arm-v7a";
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
abi = "x86";
|
||||
break;
|
||||
case 5:
|
||||
case 7:
|
||||
abi = "arm64-v8a";
|
||||
break;
|
||||
case 6:
|
||||
case 8:
|
||||
abi = "x86_64";
|
||||
break;
|
||||
case 0:
|
||||
case 9:
|
||||
abi = "universal " + Build.CPU_ABI + " " + Build.CPU_ABI2;
|
||||
break;
|
||||
}
|
||||
cell.setText(String.format("%1$s %2$s", LocaleController.getString("Nekogram", R.string.Nekogram), String.format(Locale.US, "v%s (%d) %s", pInfo.versionName, code, abi)));
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
||||
String abi = FileUtil.getAbi();
|
||||
cell.setText(String.format("%1$s %2$s", LocaleController.getString("NekoX", R.string.NekoX), String.format(Locale.US, "v%s %s %s", BuildConfig.VERSION_NAME, abi, BuildConfig.BUILD_TYPE)));
|
||||
cell.getTextView().setPadding(0, AndroidUtilities.dp(14), 0, AndroidUtilities.dp(14));
|
||||
view = cell;
|
||||
Drawable drawable = Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
|
||||
|
@ -2427,7 +2386,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
position == dataRow || position == chatRow || position == questionRow ||
|
||||
position == devicesRow || position == filtersRow || position == faqRow ||
|
||||
position == policyRow || position == sendLogsRow || position == clearLogsRow ||
|
||||
position == switchBackendRow || position == nekoRow) {
|
||||
position == switchBackendRow || position == nekoRow || position == stickersRow) {
|
||||
return 2;
|
||||
} else if (position == versionRow) {
|
||||
return 5;
|
||||
|
@ -2440,6 +2399,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,10 @@ import org.telegram.ui.Components.SeekBarView;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.NekoXConfig;
|
||||
import tw.nekomimi.nekogram.utils.PopupBuilder;
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
public class NekoChatSettingsActivity extends BaseFragment {
|
||||
|
@ -58,8 +61,12 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
|
||||
private int chatRow;
|
||||
private int ignoreBlockedRow;
|
||||
private int ignoreMutedCountRow;
|
||||
private int disableChatActionRow;
|
||||
private int disablePhotoSideActionRow;
|
||||
private int hideKeyboardOnChatScrollRow;
|
||||
private int skipOpenLinkConfirmRow;
|
||||
|
||||
private int rearVideoMessagesRow;
|
||||
private int confirmAVRow;
|
||||
private int mapPreviewRow;
|
||||
|
@ -128,37 +135,36 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
((TextCheckCell) view).setChecked(NekoConfig.ignoreBlocked);
|
||||
}
|
||||
} else if (position == mapPreviewRow) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("MapPreviewProviderTelegram", R.string.MapPreviewProviderTelegram));
|
||||
types.add(0);
|
||||
arrayList.add(LocaleController.getString("MapPreviewProviderYandex", R.string.MapPreviewProviderYandex));
|
||||
types.add(1);
|
||||
arrayList.add(LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody));
|
||||
types.add(2);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("MapPreviewProviderTitle", R.string.MapPreviewProviderTitle));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.mapPreviewProvider == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setMapPreviewProvider(types.get(which));
|
||||
listAdapter.notifyItemChanged(mapPreviewRow);
|
||||
builder.getDismissRunnable().run();
|
||||
});
|
||||
builder.setItems(new String[]{
|
||||
LocaleController.getString("MapPreviewProviderTelegram", R.string.MapPreviewProviderTelegram),
|
||||
LocaleController.getString("MapPreviewProviderYandex", R.string.MapPreviewProviderYandex),
|
||||
LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody)
|
||||
}, (i, __) -> {
|
||||
NekoConfig.setMapPreviewProvider(i);
|
||||
listAdapter.notifyItemChanged(position);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
} else if (position == disableChatActionRow) {
|
||||
NekoConfig.toggleDisableChatAction();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.disableChatAction);
|
||||
}
|
||||
} else if (position == skipOpenLinkConfirmRow) {
|
||||
NekoConfig.toggleSkipOpenLinkConfirm();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.skipOpenLinkConfirm);
|
||||
}
|
||||
} else if (position == ignoreMutedCountRow) {
|
||||
NekoConfig.toggleIgnoredMutedCount();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.ignoreMutedCount);
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (position == messageMenuRow) {
|
||||
showMessageMenuAlert();
|
||||
} else if (position == disablePhotoSideActionRow) {
|
||||
|
@ -188,39 +194,26 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
}
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
} else if (position == tabsTitleTypeRow) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("TabTitleTypeText", R.string.TabTitleTypeText));
|
||||
types.add(NekoConfig.TITLE_TYPE_TEXT);
|
||||
arrayList.add(LocaleController.getString("TabTitleTypeIcon", R.string.TabTitleTypeIcon));
|
||||
types.add(NekoConfig.TITLE_TYPE_ICON);
|
||||
arrayList.add(LocaleController.getString("TabTitleTypeMix", R.string.TabTitleTypeMix));
|
||||
types.add(NekoConfig.TITLE_TYPE_MIX);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("TabTitleType", R.string.TabTitleType));
|
||||
builder.setMessage(LocaleController.getString("TabTitleTypeTip", R.string.TabTitleTypeTip));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
builder.setItems(new String[]{
|
||||
|
||||
LocaleController.getString("TabTitleTypeText", R.string.TabTitleTypeText),
|
||||
LocaleController.getString("TabTitleTypeIcon", R.string.TabTitleTypeIcon),
|
||||
LocaleController.getString("TabTitleTypeMix", R.string.TabTitleTypeMix)
|
||||
|
||||
}, (i, __) -> {
|
||||
|
||||
NekoConfig.setTabsTitleType(i);
|
||||
listAdapter.notifyItemChanged(tabsTitleTypeRow);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.tabsTitleType == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setTabsTitleType(types.get(which));
|
||||
listAdapter.notifyItemChanged(tabsTitleTypeRow);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated);
|
||||
builder.getDismissRunnable().run();
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (position == confirmAVRow) {
|
||||
NekoConfig.toggleConfirmAVMessage();
|
||||
if (view instanceof TextCheckCell) {
|
||||
|
@ -248,8 +241,13 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
|
||||
chatRow = rowCount++;
|
||||
ignoreBlockedRow = rowCount++;
|
||||
|
||||
ignoreMutedCountRow = rowCount++;
|
||||
disableChatActionRow = rowCount++;
|
||||
|
||||
disablePhotoSideActionRow = rowCount++;
|
||||
hideKeyboardOnChatScrollRow = rowCount++;
|
||||
skipOpenLinkConfirmRow = rowCount ++;
|
||||
rearVideoMessagesRow = rowCount++;
|
||||
confirmAVRow = rowCount++;
|
||||
mapPreviewRow = rowCount++;
|
||||
|
@ -323,7 +321,7 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
linearLayoutInviteContainer.setOrientation(LinearLayout.VERTICAL);
|
||||
linearLayout.addView(linearLayoutInviteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
int count = 10;
|
||||
int count = NekoXConfig.developerMode ? 9 : 8;
|
||||
for (int a = 0; a < count; a++) {
|
||||
TextCheckCell textCell = new TextCheckCell(context);
|
||||
switch (a) {
|
||||
|
@ -340,30 +338,26 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
break;
|
||||
}
|
||||
case 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Prpr", R.string.Prpr), NekoConfig.showPrPr, false);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ViewHistory", R.string.ViewHistory), NekoConfig.showViewHistory, false);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
case 4: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("Translate", R.string.Translate), NekoConfig.showTranslate, false);
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
case 5: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ReportChat", R.string.ReportChat), NekoConfig.showReport, false);
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
case 6: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("EditAdminRights", R.string.EditAdminRights), NekoConfig.showAdminActions, false);
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
case 7: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ChangePermissions", R.string.ChangePermissions), NekoConfig.showChangePermissions, false);
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
case 8: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("MessageDetails", R.string.MessageDetails), NekoConfig.showMessageDetails, false);
|
||||
break;
|
||||
}
|
||||
|
@ -390,36 +384,31 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
break;
|
||||
}
|
||||
case 3: {
|
||||
NekoConfig.toggleShowPrPr();
|
||||
textCell.setChecked(NekoConfig.showPrPr);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
NekoConfig.toggleShowViewHistory();
|
||||
textCell.setChecked(NekoConfig.showViewHistory);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
case 4: {
|
||||
NekoConfig.toggleShowTranslate();
|
||||
textCell.setChecked(NekoConfig.showTranslate);
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
case 5: {
|
||||
NekoConfig.toggleShowReport();
|
||||
textCell.setChecked(NekoConfig.showReport);
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
case 6: {
|
||||
NekoConfig.toggleShowAdminActions();
|
||||
textCell.setChecked(NekoConfig.showAdminActions);
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
case 7: {
|
||||
NekoConfig.toggleShowChangePermissions();
|
||||
textCell.setChecked(NekoConfig.showChangePermissions);
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
case 8: {
|
||||
NekoConfig.toggleShowMessageDetails();
|
||||
textCell.setChecked(NekoConfig.showMessageDetails);
|
||||
break;
|
||||
|
@ -557,6 +546,12 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
textCell.setEnabled(true, null);
|
||||
if (position == ignoreBlockedRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("IgnoreBlocked", R.string.IgnoreBlocked), LocaleController.getString("IgnoreBlockedAbout", R.string.IgnoreBlockedAbout), NekoConfig.ignoreBlocked, true, true);
|
||||
} else if (position == ignoreMutedCountRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("IgnoreMutedCount", R.string.IgnoreMutedCount), NekoConfig.ignoreMutedCount, true);
|
||||
} else if (position == skipOpenLinkConfirmRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SkipOpenLinkConfirm", R.string.SkipOpenLinkConfirm), NekoConfig.skipOpenLinkConfirm, true);
|
||||
} else if (position == disableChatActionRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisableChatAction", R.string.DisableChatAction), NekoConfig.disableChatAction, true);
|
||||
} else if (position == disablePhotoSideActionRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisablePhotoViewerSideAction", R.string.DisablePhotoViewerSideAction), NekoConfig.disablePhotoSideAction, true);
|
||||
} else if (position == hideKeyboardOnChatScrollRow) {
|
||||
|
@ -639,15 +634,12 @@ public class NekoChatSettingsActivity extends BaseFragment {
|
|||
return 1;
|
||||
} else if (position == mapPreviewRow || position == messageMenuRow || position == tabsTitleTypeRow) {
|
||||
return 2;
|
||||
} else if (position == ignoreBlockedRow || position == disablePhotoSideActionRow || position == hideKeyboardOnChatScrollRow ||
|
||||
position == showTabsOnForwardRow || position == rearVideoMessagesRow || position == hideAllTabRow || position == confirmAVRow) {
|
||||
return 3;
|
||||
} else if (position == chatRow || position == foldersRow || position == stickerSizeHeaderRow) {
|
||||
return 4;
|
||||
} else if (position == stickerSizeRow) {
|
||||
return 8;
|
||||
}
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,11 @@ import android.animation.AnimatorSet;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -32,7 +30,6 @@ import org.telegram.ui.ActionBar.ThemeDescription;
|
|||
import org.telegram.ui.Cells.EmptyCell;
|
||||
import org.telegram.ui.Cells.HeaderCell;
|
||||
import org.telegram.ui.Cells.NotificationsCheckCell;
|
||||
import org.telegram.ui.Cells.RadioColorCell;
|
||||
import org.telegram.ui.Cells.ShadowSectionCell;
|
||||
import org.telegram.ui.Cells.TextCheckCell;
|
||||
import org.telegram.ui.Cells.TextDetailSettingsCell;
|
||||
|
@ -47,7 +44,6 @@ import java.util.ArrayList;
|
|||
|
||||
import tw.nekomimi.nekogram.MessageHelper;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.translator.Translator;
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
public class NekoExperimentalSettingsActivity extends BaseFragment {
|
||||
|
@ -64,7 +60,6 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
private int experimentRow;
|
||||
private int smoothKeyboardRow;
|
||||
private int mediaPreviewRow;
|
||||
private int saveCacheToPrivateDirectoryRow;
|
||||
private int disableFilteringRow;
|
||||
private int unlimitedFavedStickersRow;
|
||||
private int unlimitedPinnedDialogsRow;
|
||||
|
@ -75,47 +70,6 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
|
||||
private UndoView tooltip;
|
||||
|
||||
static public AlertDialog getTranslationProviderAlert(Context context) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate));
|
||||
types.add(Translator.PROVIDER_GOOGLE);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN));
|
||||
types.add(Translator.PROVIDER_GOOGLE_CN);
|
||||
arrayList.add(LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud));
|
||||
types.add(Translator.PROVIDER_LINGO);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb));
|
||||
types.add(Translator.PROVIDER_GOOGLE_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb));
|
||||
types.add(Translator.PROVIDER_GOOGLE_CN_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb));
|
||||
types.add(Translator.PROVIDER_BAIDU_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb));
|
||||
types.add(Translator.PROVIDER_DEEPL_WEB);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("TranslationProvider", R.string.TranslationProvider));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.translationProvider == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setTranslationProvider(types.get(which));
|
||||
builder.getDismissRunnable().run();
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
|
@ -155,14 +109,7 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
||||
listView.setAdapter(listAdapter);
|
||||
listView.setOnItemClickListener((view, position, x, y) -> {
|
||||
if (position == saveCacheToPrivateDirectoryRow) {
|
||||
NekoConfig.toggleSaveCacheToPrivateDirectory();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.saveCacheToPrivateDirectory);
|
||||
}
|
||||
tooltip.setInfoText(LocaleController.formatString("RestartAppToTakeEffect", R.string.RestartAppToTakeEffect));
|
||||
tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
|
||||
} else if (position == disableFilteringRow) {
|
||||
if (position == disableFilteringRow) {
|
||||
sensitiveEnabled = !sensitiveEnabled;
|
||||
TLRPC.TL_account_setContentSettings req = new TLRPC.TL_account_setContentSettings();
|
||||
req.sensitive_enabled = sensitiveEnabled;
|
||||
|
@ -268,11 +215,6 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.unlimitedPinnedDialogs);
|
||||
}
|
||||
} else if (position == shouldNOTTrustMeRow) {
|
||||
NekoConfig.toggleShouldNOTTrustMe();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.shouldNOTTrustMe);
|
||||
}
|
||||
} else if (position == mediaPreviewRow) {
|
||||
NekoConfig.toggleMediaPreview();
|
||||
if (view instanceof TextCheckCell) {
|
||||
|
@ -306,13 +248,11 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
experimentRow = rowCount++;
|
||||
smoothKeyboardRow = !AndroidUtilities.isTablet() ? rowCount++ : -1;
|
||||
mediaPreviewRow = rowCount++;
|
||||
saveCacheToPrivateDirectoryRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? rowCount++ : -1;
|
||||
disableFilteringRow = rowCount++;
|
||||
unlimitedFavedStickersRow = rowCount++;
|
||||
unlimitedPinnedDialogsRow = rowCount++;
|
||||
deleteAccountRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
deleteAccountRow = rowCount++;
|
||||
experiment2Row = rowCount++;
|
||||
shouldNOTTrustMeRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
if (listAdapter != null) {
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -440,9 +380,7 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
case 3: {
|
||||
TextCheckCell textCell = (TextCheckCell) holder.itemView;
|
||||
textCell.setEnabled(true, null);
|
||||
if (position == saveCacheToPrivateDirectoryRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SaveCacheToPrivateDirectory", R.string.SaveCacheToPrivateDirectory), NekoConfig.saveCacheToPrivateDirectory, true);
|
||||
} else if (position == disableFilteringRow) {
|
||||
if (position == disableFilteringRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("SensitiveDisableFiltering", R.string.SensitiveDisableFiltering), LocaleController.getString("SensitiveAbout", R.string.SensitiveAbout), sensitiveEnabled, true, true);
|
||||
textCell.setEnabled(sensitiveCanChange, null);
|
||||
} else if (position == unlimitedFavedStickersRow) {
|
||||
|
@ -451,9 +389,7 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnableSmoothKeyboard", R.string.DebugMenuEnableSmoothKeyboard), SharedConfig.smoothKeyboard, true);
|
||||
} else if (position == unlimitedPinnedDialogsRow) {
|
||||
textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, deleteAccountRow != -1);
|
||||
} else if (position == shouldNOTTrustMeRow) {
|
||||
textCell.setTextAndCheck("Don't trust me", NekoConfig.shouldNOTTrustMe, false);
|
||||
} else if (position == mediaPreviewRow) {
|
||||
} else if (position == mediaPreviewRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("MediaPreview", R.string.MediaPreview), NekoConfig.mediaPreview, true);
|
||||
}
|
||||
break;
|
||||
|
@ -517,8 +453,8 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
|
|||
return 1;
|
||||
} else if (position == deleteAccountRow) {
|
||||
return 2;
|
||||
} else if (position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow || position == disableFilteringRow ||
|
||||
position == smoothKeyboardRow || position == unlimitedPinnedDialogsRow || position == shouldNOTTrustMeRow || position == mediaPreviewRow) {
|
||||
} else if (position == unlimitedFavedStickersRow || position == disableFilteringRow ||
|
||||
position == smoothKeyboardRow || position == unlimitedPinnedDialogsRow || position == mediaPreviewRow) {
|
||||
return 3;
|
||||
} else if (position == experimentRow) {
|
||||
return 4;
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.os.Build;
|
|||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
@ -13,6 +14,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
|
@ -29,7 +32,6 @@ import org.telegram.ui.ActionBar.ThemeDescription;
|
|||
import org.telegram.ui.Cells.EmptyCell;
|
||||
import org.telegram.ui.Cells.HeaderCell;
|
||||
import org.telegram.ui.Cells.NotificationsCheckCell;
|
||||
import org.telegram.ui.Cells.RadioColorCell;
|
||||
import org.telegram.ui.Cells.ShadowSectionCell;
|
||||
import org.telegram.ui.Cells.TextCheckCell;
|
||||
import org.telegram.ui.Cells.TextDetailSettingsCell;
|
||||
|
@ -40,9 +42,16 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
import org.telegram.ui.Components.UndoView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.BottomBuilder;
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import tw.nekomimi.nekogram.translator.Translator;
|
||||
import tw.nekomimi.nekogram.transtale.Translator;
|
||||
import tw.nekomimi.nekogram.transtale.TranslatorKt;
|
||||
import tw.nekomimi.nekogram.utils.EnvUtil;
|
||||
import tw.nekomimi.nekogram.utils.PopupBuilder;
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
public class NekoGeneralSettingsActivity extends BaseFragment {
|
||||
|
@ -54,76 +63,55 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
|
||||
private int connectionRow;
|
||||
private int ipv6Row;
|
||||
private int disableProxyWhenVpnEnabledRow;
|
||||
private int useProxyItemRow;
|
||||
private int hideProxyByDefaultRow;
|
||||
private int connection2Row;
|
||||
|
||||
private int transRow;
|
||||
private int translationProviderRow;
|
||||
private int translateToLangRow;
|
||||
private int translateInputToLangRow;
|
||||
private int googleCloudTranslateKeyRow;
|
||||
private int trans2Row;
|
||||
|
||||
private int dialogsRow;
|
||||
private int sortMenuRow;
|
||||
private int dialogs2Row;
|
||||
|
||||
private int appearanceRow;
|
||||
private int typefaceRow;
|
||||
private int useDefaultThemeRow;
|
||||
private int useSystemEmojiRow;
|
||||
private int transparentStatusBarRow;
|
||||
private int forceTabletRow;
|
||||
private int avatarAsDrawerBackgroundRow;
|
||||
private int removeTitleEmojiRow;
|
||||
private int eventTypeRow;
|
||||
private int newYearRow;
|
||||
private int actionBarDecorationRow;
|
||||
private int appBarShadowRow;
|
||||
private int appearance2Row;
|
||||
|
||||
private int privacyRow;
|
||||
private int disableSystemAccountRow;
|
||||
private int privacy2Row;
|
||||
|
||||
private int generalRow;
|
||||
private int cachePathRow;
|
||||
private int hidePhoneRow;
|
||||
private int disableUndoRow;
|
||||
private int showIdAndDcRow;
|
||||
private int inappCameraRow;
|
||||
private int hideProxySponsorChannelRow;
|
||||
private int askBeforeCallRow;
|
||||
private int disableNumberRoundingRow;
|
||||
private int openArchiveOnPullRow;
|
||||
private int translationProviderRow;
|
||||
private int nameOrderRow;
|
||||
private int general2Row;
|
||||
|
||||
private UndoView restartTooltip;
|
||||
|
||||
static public AlertDialog getTranslationProviderAlert(Context context) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate));
|
||||
types.add(Translator.PROVIDER_GOOGLE);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN));
|
||||
types.add(Translator.PROVIDER_GOOGLE_CN);
|
||||
arrayList.add(LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud));
|
||||
types.add(Translator.PROVIDER_LINGO);
|
||||
arrayList.add(LocaleController.getString("ProviderYandex", R.string.ProviderYandex));
|
||||
types.add(Translator.PROVIDER_YANDEX);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb));
|
||||
types.add(Translator.PROVIDER_GOOGLE_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb));
|
||||
types.add(Translator.PROVIDER_GOOGLE_CN_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb));
|
||||
types.add(Translator.PROVIDER_BAIDU_WEB);
|
||||
arrayList.add(LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb));
|
||||
types.add(Translator.PROVIDER_DEEPL_WEB);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("TranslationProvider", R.string.TranslationProvider));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.translationProvider == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setTranslationProvider(types.get(which));
|
||||
builder.getDismissRunnable().run();
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
super.onFragmentCreate();
|
||||
|
@ -173,22 +161,47 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
ConnectionsManager.native_setUseIpv6(a, NekoConfig.useIPv6);
|
||||
}
|
||||
}
|
||||
} else if (position == disableProxyWhenVpnEnabledRow) {
|
||||
NekoConfig.toggleDisableProxyWhenVpnEnabled();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.disableProxyWhenVpnEnabled);
|
||||
}
|
||||
} else if (position == useProxyItemRow) {
|
||||
NekoConfig.toggleUseProxyItem();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.useProxyItem);
|
||||
}
|
||||
} else if (position == hideProxyByDefaultRow) {
|
||||
NekoConfig.toggleHideProxyByDefault();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.hideProxyByDefault);
|
||||
}
|
||||
} else if (position == hidePhoneRow) {
|
||||
NekoConfig.toggleHidePhone();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.hidePhone);
|
||||
}
|
||||
} else if (position == disableUndoRow) {
|
||||
NekoConfig.toggleDisableUndo();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.disableUndo);
|
||||
}
|
||||
} else if (position == useDefaultThemeRow) {
|
||||
NekoConfig.toggleUseDefaultTheme();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.useDefaultTheme);
|
||||
}
|
||||
} else if (position == inappCameraRow) {
|
||||
SharedConfig.toggleInappCamera();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(SharedConfig.inappCamera);
|
||||
}
|
||||
|
||||
} else if (position == forceTabletRow) {
|
||||
NekoConfig.toggleForceTablet();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.forceTablet);
|
||||
}
|
||||
restartTooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
|
||||
} else if (position == transparentStatusBarRow) {
|
||||
NekoConfig.toggleTransparentStatusBar();
|
||||
if (view instanceof TextCheckCell) {
|
||||
|
@ -215,123 +228,227 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.typeface == 1);
|
||||
}
|
||||
parentLayout.rebuildAllFragmentViews(true, true);
|
||||
|
||||
} else if (position == nameOrderRow) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("FirstLast", R.string.FirstLast));
|
||||
types.add(1);
|
||||
arrayList.add(LocaleController.getString("LastFirst", R.string.LastFirst));
|
||||
types.add(2);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("NameOrder", R.string.NameOrder));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
builder.setItems(new String[]{
|
||||
LocaleController.getString("FirstLast", R.string.FirstLast),
|
||||
LocaleController.getString("LastFirst", R.string.LastFirst)
|
||||
}, (i, __) -> {
|
||||
NekoConfig.setNameOrder(i + 1);
|
||||
listAdapter.notifyItemChanged(position);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.nameOrder == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setNameOrder(types.get(which));
|
||||
listAdapter.notifyItemChanged(nameOrderRow);
|
||||
builder.getDismissRunnable().run();
|
||||
parentLayout.rebuildAllFragmentViews(false, false);
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (position == eventTypeRow) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate));
|
||||
types.add(0);
|
||||
arrayList.add(LocaleController.getString("Christmas", R.string.Christmas));
|
||||
types.add(1);
|
||||
arrayList.add(LocaleController.getString("Valentine", R.string.Valentine));
|
||||
types.add(2);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("EventType", R.string.EventType));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
builder.setItems(new String[]{
|
||||
LocaleController.getString("DependsOnDate", R.string.DependsOnDate),
|
||||
LocaleController.getString("Christmas", R.string.Christmas),
|
||||
LocaleController.getString("Valentine", R.string.Valentine)
|
||||
}, (i, __) -> {
|
||||
NekoConfig.setEventType(i);
|
||||
listAdapter.notifyItemChanged(position);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.eventType == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setEventType(types.get(which));
|
||||
listAdapter.notifyItemChanged(eventTypeRow);
|
||||
builder.getDismissRunnable().run();
|
||||
restartTooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (position == actionBarDecorationRow) {
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
ArrayList<Integer> types = new ArrayList<>();
|
||||
arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate));
|
||||
types.add(0);
|
||||
arrayList.add(LocaleController.getString("Snowflakes", R.string.Snowflakes));
|
||||
types.add(1);
|
||||
arrayList.add(LocaleController.getString("Fireworks", R.string.Fireworks));
|
||||
types.add(2);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration));
|
||||
final LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
builder.setView(linearLayout);
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
builder.setItems(new String[]{
|
||||
LocaleController.getString("DependsOnDate", R.string.DependsOnDate),
|
||||
LocaleController.getString("Snowflakes", R.string.Snowflakes),
|
||||
LocaleController.getString("Fireworks", R.string.Fireworks)
|
||||
}, (i, __) -> {
|
||||
|
||||
NekoConfig.setActionBarDecoration(i);
|
||||
listAdapter.notifyItemChanged(position);
|
||||
|
||||
return null;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
} else if (position == cachePathRow) {
|
||||
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
|
||||
builder.addTitle(LocaleController.getString("CachePath", R.string.CachePath));
|
||||
|
||||
AtomicReference<String> target = new AtomicReference<>();
|
||||
|
||||
builder.addRadioItems(EnvUtil.getAvailableDirectories(),
|
||||
(index, path) -> path.equals(NekoConfig.cachePath), (__, path, cell) -> {
|
||||
|
||||
target.set(path);
|
||||
builder.doRadioCheck(cell);
|
||||
|
||||
return null;
|
||||
|
||||
});
|
||||
|
||||
builder.addCancelButton();
|
||||
builder.addOkButton((it) -> {
|
||||
|
||||
if (target.get() != null) {
|
||||
|
||||
NekoConfig.setCachePath(target.get());
|
||||
ImageLoader.getInstance().checkMediaPaths();
|
||||
listAdapter.notifyItemChanged(position);
|
||||
|
||||
}
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
for (int a = 0; a < arrayList.size(); a++) {
|
||||
RadioColorCell cell = new RadioColorCell(context);
|
||||
cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0);
|
||||
cell.setTag(a);
|
||||
cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
|
||||
cell.setTextAndValue(arrayList.get(a), NekoConfig.actionBarDecoration == types.get(a));
|
||||
linearLayout.addView(cell);
|
||||
cell.setOnClickListener(v -> {
|
||||
Integer which = (Integer) v.getTag();
|
||||
NekoConfig.setActionBarDecoration(types.get(which));
|
||||
listAdapter.notifyItemChanged(actionBarDecorationRow);
|
||||
builder.getDismissRunnable().run();
|
||||
restartTooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
|
||||
});
|
||||
}
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
} else if (position == newYearRow) {
|
||||
NekoConfig.toggleNewYear();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.newYear);
|
||||
}
|
||||
restartTooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
|
||||
} else if (position == translationProviderRow) {
|
||||
showDialog(getTranslationProviderAlert(context)).setOnDismissListener(dialog1 -> listAdapter.notifyItemChanged(translationProviderRow));
|
||||
|
||||
PopupBuilder builder = new PopupBuilder(view);
|
||||
|
||||
builder.setItems(new String[]{
|
||||
LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate),
|
||||
LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN),
|
||||
LocaleController.getString("ProviderYandexTranslate", R.string.ProviderYandexTranslate),
|
||||
LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud),
|
||||
|
||||
LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb),
|
||||
LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb),
|
||||
LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb),
|
||||
LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb)
|
||||
|
||||
}, (i, __) -> {
|
||||
|
||||
int target;
|
||||
|
||||
if (i < 4) {
|
||||
target = i + 1;
|
||||
} else {
|
||||
target = -i + 3;
|
||||
}
|
||||
|
||||
NekoConfig.setTranslationProvider(target);
|
||||
listAdapter.notifyItemChanged(translationProviderRow);
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
} else if (position == translateToLangRow || position == translateInputToLangRow) {
|
||||
|
||||
Translator.showTargetLangSelect(view, position == translateInputToLangRow, (locale) -> {
|
||||
|
||||
if (position == translateToLangRow) {
|
||||
|
||||
NekoConfig.setTranslateToLang(TranslatorKt.getLocale2code(locale));
|
||||
|
||||
} else {
|
||||
|
||||
NekoConfig.setTranslateInputToLang(TranslatorKt.getLocale2code(locale));
|
||||
|
||||
}
|
||||
|
||||
listAdapter.notifyItemChanged(position);
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
} else if (position == googleCloudTranslateKeyRow) {
|
||||
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
|
||||
builder.addTitle(
|
||||
LocaleController.getString("GoogleCloudTransKey", R.string.GoogleCloudTransKey),
|
||||
LocaleController.getString("GoogleCloudTransKeyNotice", R.string.GoogleCloudTransKeyNotice)
|
||||
);
|
||||
|
||||
EditText keyField = builder.addEditText("Key");
|
||||
|
||||
if (StrUtil.isNotBlank(NekoConfig.googleCloudTranslateKey)) {
|
||||
|
||||
keyField.setText(NekoConfig.googleCloudTranslateKey);
|
||||
|
||||
}
|
||||
|
||||
builder.addCancelButton();
|
||||
|
||||
builder.addOkButton((it) -> {
|
||||
|
||||
String key = keyField.getText().toString();
|
||||
|
||||
if (StrUtil.isBlank(key)) key = null;
|
||||
|
||||
NekoConfig.setGoogleTranslateKey(key);
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
keyField.requestFocus();
|
||||
AndroidUtilities.showKeyboard(keyField);
|
||||
|
||||
} else if (position == openArchiveOnPullRow) {
|
||||
NekoConfig.toggleOpenArchiveOnPull();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.openArchiveOnPull);
|
||||
}
|
||||
} else if (position == sortMenuRow) {
|
||||
showSortMenuAlert();
|
||||
} else if (position == disableSystemAccountRow) {
|
||||
NekoConfig.toggleDisableSystemAccount();
|
||||
if (NekoConfig.disableSystemAccount) {
|
||||
getContactsController().deleteUnknownAppAccounts();
|
||||
} else {
|
||||
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
||||
ContactsController.getInstance(a).checkAppAccount();
|
||||
}
|
||||
}
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.disableSystemAccount);
|
||||
}
|
||||
} else if (position == avatarAsDrawerBackgroundRow) {
|
||||
NekoConfig.toggleAvatarAsDrawerBackground();
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
NotificationCenter.getInstance(UserConfig.selectedAccount).postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.avatarAsDrawerBackground);
|
||||
}
|
||||
} else if (position == removeTitleEmojiRow) {
|
||||
NekoConfig.toggleRemoveTitleEmoji();
|
||||
NotificationCenter.getInstance(UserConfig.selectedAccount).postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.removeTitleEmoji);
|
||||
}
|
||||
} else if (position == showIdAndDcRow) {
|
||||
NekoConfig.toggleShowIdAndDc();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.showIdAndDc);
|
||||
}
|
||||
} else if (position == askBeforeCallRow) {
|
||||
NekoConfig.toggleAskBeforeCall();
|
||||
if (view instanceof TextCheckCell) {
|
||||
|
@ -359,6 +476,84 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
return fragmentView;
|
||||
}
|
||||
|
||||
private void showSortMenuAlert() {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
Context context = getParentActivity();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(LocaleController.getString("SortMenu", R.string.SortMenu));
|
||||
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
LinearLayout linearLayoutInviteContainer = new LinearLayout(context);
|
||||
linearLayoutInviteContainer.setOrientation(LinearLayout.VERTICAL);
|
||||
linearLayout.addView(linearLayoutInviteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
int count = 4;
|
||||
for (int a = 0; a < count; a++) {
|
||||
TextCheckCell textCell = new TextCheckCell(context);
|
||||
switch (a) {
|
||||
case 0: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SortByUnread", R.string.SortByUnread), NekoConfig.sortByUnread, false);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SortByUnmuted", R.string.SortByUnmuted), NekoConfig.sortByUnmuted, false);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SortByUser", R.string.SortByUser), NekoConfig.sortByUser, false);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
textCell.setTextAndCheck(LocaleController.getString("SortByContacts", R.string.SortByContacts), NekoConfig.sortByContacts, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
textCell.setTag(a);
|
||||
textCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
||||
linearLayoutInviteContainer.addView(textCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
textCell.setOnClickListener(view -> {
|
||||
Integer tag = (Integer) view.getTag();
|
||||
switch (tag) {
|
||||
case 0: {
|
||||
NekoConfig.toggleSortByUnread();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.sortByUnread);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
NekoConfig.toggleSortByUnmuted();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.sortByUnmuted);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
NekoConfig.toggleSortByUser();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.sortByUser);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
NekoConfig.toggleSortByContacts();
|
||||
if (view instanceof TextCheckCell) {
|
||||
((TextCheckCell) view).setChecked(NekoConfig.sortByContacts);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
||||
builder.setView(linearLayout);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -372,29 +567,50 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
|
||||
connectionRow = rowCount++;
|
||||
ipv6Row = rowCount++;
|
||||
disableProxyWhenVpnEnabledRow = rowCount++;
|
||||
useProxyItemRow = rowCount++;
|
||||
hideProxyByDefaultRow = rowCount++;
|
||||
connection2Row = rowCount++;
|
||||
|
||||
transRow = rowCount++;
|
||||
translationProviderRow = rowCount++;
|
||||
translateToLangRow = rowCount++;
|
||||
translateInputToLangRow = rowCount++;
|
||||
googleCloudTranslateKeyRow = rowCount++;
|
||||
trans2Row = rowCount++;
|
||||
|
||||
dialogsRow = rowCount++;
|
||||
sortMenuRow = rowCount++;
|
||||
dialogs2Row = rowCount++;
|
||||
|
||||
appearanceRow = rowCount++;
|
||||
typefaceRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? rowCount++ : -1;
|
||||
useDefaultThemeRow = rowCount++;
|
||||
useSystemEmojiRow = rowCount++;
|
||||
transparentStatusBarRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? rowCount++ : -1;
|
||||
forceTabletRow = rowCount++;
|
||||
avatarAsDrawerBackgroundRow = rowCount++;
|
||||
appBarShadowRow = rowCount++;
|
||||
eventTypeRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
newYearRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
actionBarDecorationRow = NekoConfig.showHiddenFeature ? rowCount++ : -1;
|
||||
removeTitleEmojiRow = rowCount++;
|
||||
eventTypeRow = rowCount++;
|
||||
newYearRow = rowCount++;
|
||||
actionBarDecorationRow = rowCount++;
|
||||
appearance2Row = rowCount++;
|
||||
|
||||
privacyRow = rowCount++;
|
||||
disableSystemAccountRow = rowCount++;
|
||||
privacy2Row = rowCount++;
|
||||
|
||||
generalRow = rowCount++;
|
||||
cachePathRow = rowCount++;
|
||||
hidePhoneRow = rowCount++;
|
||||
disableUndoRow = rowCount++;
|
||||
showIdAndDcRow = rowCount++;
|
||||
inappCameraRow = rowCount++;
|
||||
hideProxySponsorChannelRow = rowCount++;
|
||||
askBeforeCallRow = rowCount++;
|
||||
disableNumberRoundingRow = rowCount++;
|
||||
openArchiveOnPullRow = rowCount++;
|
||||
translationProviderRow = rowCount++;
|
||||
nameOrderRow = rowCount++;
|
||||
general2Row = rowCount++;
|
||||
|
||||
|
@ -461,11 +677,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
switch (holder.getItemViewType()) {
|
||||
case 1: {
|
||||
if (position == general2Row) {
|
||||
holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
} else {
|
||||
holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
|
||||
}
|
||||
holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
|
@ -482,7 +694,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
value = LocaleController.getString("FirstLast", R.string.FirstLast);
|
||||
break;
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, false);
|
||||
textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, eventTypeRow != -1);
|
||||
} else if (position == eventTypeRow) {
|
||||
String value;
|
||||
switch (NekoConfig.eventType) {
|
||||
|
@ -511,46 +723,72 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate);
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration), value, false);
|
||||
} else if (position == sortMenuRow) {
|
||||
textCell.setText(LocaleController.getString("SortMenu", R.string.SortMenu), true);
|
||||
} else if (position == translateToLangRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("TransToLang", R.string.TransToLang), NekoConfig.formatLang(NekoConfig.translateToLang), true);
|
||||
} else if (position == translateInputToLangRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("TransInputToLang", R.string.TransInputToLang), NekoConfig.formatLang(NekoConfig.translateInputLang), true);
|
||||
} else if (position == translationProviderRow) {
|
||||
String value;
|
||||
switch (NekoConfig.translationProvider) {
|
||||
case Translator.PROVIDER_GOOGLE:
|
||||
case 1:
|
||||
value = LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate);
|
||||
break;
|
||||
case Translator.PROVIDER_GOOGLE_WEB:
|
||||
case -1:
|
||||
value = LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb);
|
||||
break;
|
||||
case Translator.PROVIDER_GOOGLE_CN:
|
||||
case 2:
|
||||
value = LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN);
|
||||
break;
|
||||
case Translator.PROVIDER_GOOGLE_CN_WEB:
|
||||
case -2:
|
||||
value = LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb);
|
||||
break;
|
||||
case Translator.PROVIDER_BAIDU_WEB:
|
||||
case -3:
|
||||
value = LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb);
|
||||
break;
|
||||
case Translator.PROVIDER_DEEPL_WEB:
|
||||
case -4:
|
||||
value = LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb);
|
||||
break;
|
||||
case Translator.PROVIDER_YANDEX:
|
||||
value = LocaleController.getString("ProviderYandex", R.string.ProviderYandex);
|
||||
case 3:
|
||||
value = LocaleController.getString("ProviderYandexTranslate", R.string.ProviderYandexTranslate);
|
||||
break;
|
||||
case Translator.PROVIDER_LINGO:
|
||||
default:
|
||||
case 4:
|
||||
value = LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud);
|
||||
break;
|
||||
default:
|
||||
value = "Unknown";
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), value, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
TextDetailSettingsCell textCell = (TextDetailSettingsCell) holder.itemView;
|
||||
if (position == googleCloudTranslateKeyRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("GoogleCloudTransKey", R.string.GoogleCloudTransKey), StrUtil.isNotBlank(NekoConfig.googleCloudTranslateKey) ? NekoConfig.googleCloudTranslateKey : LocaleController.getString("GoogleCloudTransKeyNotice", R.string.GoogleCloudTransKeyNotice), true);
|
||||
} else if (position == cachePathRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("CachePath", R.string.CachePath), NekoConfig.cachePath, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3: {
|
||||
TextCheckCell textCell = (TextCheckCell) holder.itemView;
|
||||
textCell.setEnabled(true, null);
|
||||
if (position == ipv6Row) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("IPv6", R.string.IPv6), NekoConfig.useIPv6, false);
|
||||
textCell.setTextAndCheck(LocaleController.getString("IPv6", R.string.IPv6), NekoConfig.useIPv6, true);
|
||||
} else if (position == disableProxyWhenVpnEnabledRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisableProxyWhenVpnEnabled", R.string.DisableProxyWhenVpnEnabled), NekoConfig.disableProxyWhenVpnEnabled, true);
|
||||
} else if (position == useProxyItemRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("UseProxyItem", R.string.UseProxyItem), NekoConfig.useProxyItem, true);
|
||||
} else if (position == hideProxyByDefaultRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("HideProxyByDefault", R.string.HideProxyByDefault), NekoConfig.hideProxyByDefault, false);
|
||||
} else if (position == hidePhoneRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("HidePhone", R.string.HidePhone), NekoConfig.hidePhone, true);
|
||||
} else if (position == disableUndoRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisableUndo", R.string.DisableUndo), NekoConfig.disableUndo, true);
|
||||
} else if (position == useDefaultThemeRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("UseDefaultTheme", R.string.UseDefaultTheme), NekoConfig.useDefaultTheme, true);
|
||||
} else if (position == inappCameraRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera), SharedConfig.inappCamera, true);
|
||||
} else if (position == transparentStatusBarRow) {
|
||||
|
@ -567,8 +805,14 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
textCell.setTextAndCheck(LocaleController.getString("ChristmasHat", R.string.ChristmasHat), NekoConfig.newYear, true);
|
||||
} else if (position == openArchiveOnPullRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("OpenArchiveOnPull", R.string.OpenArchiveOnPull), NekoConfig.openArchiveOnPull, true);
|
||||
} else if (position == disableSystemAccountRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("DisableSystemAccount", R.string.DisableSystemAccount), NekoConfig.disableSystemAccount, true);
|
||||
} else if (position == avatarAsDrawerBackgroundRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("UseAvatarAsDrawerBackground", R.string.UseAvatarAsDrawerBackground), NekoConfig.avatarAsDrawerBackground, true);
|
||||
} else if (position == removeTitleEmojiRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("RemoveTitleEmoji", R.string.RemoveTitleEmoji), NekoConfig.removeTitleEmoji, true);
|
||||
} else if (position == showIdAndDcRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ShowIdAndDc", R.string.ShowIdAndDc), NekoConfig.showIdAndDc, true);
|
||||
} else if (position == askBeforeCallRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("AskBeforeCalling", R.string.AskBeforeCalling), NekoConfig.askBeforeCall, true);
|
||||
} else if (position == disableNumberRoundingRow) {
|
||||
|
@ -586,6 +830,12 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
headerCell.setText(LocaleController.getString("Connection", R.string.Connection));
|
||||
} else if (position == appearanceRow) {
|
||||
headerCell.setText(LocaleController.getString("Appearance", R.string.Appearance));
|
||||
} else if (position == transRow) {
|
||||
headerCell.setText(LocaleController.getString("Translate", R.string.Translate));
|
||||
} else if (position == dialogsRow) {
|
||||
headerCell.setText(LocaleController.getString("DialogsSettings", R.string.DialogsSettings));
|
||||
} else if (position == privacyRow) {
|
||||
headerCell.setText(LocaleController.getString("PrivacyTitle", R.string.PrivacyTitle));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -595,7 +845,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
@Override
|
||||
public boolean isEnabled(RecyclerView.ViewHolder holder) {
|
||||
int type = holder.getItemViewType();
|
||||
return type == 2 || type == 3;
|
||||
return type == 2 || type == 3 || type == 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -637,19 +887,18 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == connection2Row || position == appearance2Row || position == general2Row) {
|
||||
if (position == connection2Row || position == dialogs2Row || position == trans2Row || position == privacy2Row ||
|
||||
position == general2Row || position == appearance2Row) {
|
||||
return 1;
|
||||
} else if (position == nameOrderRow || position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow) {
|
||||
} else if (position == nameOrderRow || position == sortMenuRow || position == translateToLangRow || position == translateInputToLangRow ||
|
||||
position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow) {
|
||||
return 2;
|
||||
} else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow || position == transparentStatusBarRow ||
|
||||
position == hideProxySponsorChannelRow || position == useSystemEmojiRow || position == typefaceRow || position == forceTabletRow ||
|
||||
position == newYearRow || position == openArchiveOnPullRow || position == avatarAsDrawerBackgroundRow || position == askBeforeCallRow ||
|
||||
position == disableNumberRoundingRow || position == appBarShadowRow) {
|
||||
return 3;
|
||||
} else if (position == generalRow || position == connectionRow || position == appearanceRow) {
|
||||
} else if (position == connectionRow || position == transRow || position == dialogsRow || position == privacyRow || position == generalRow || position == appearanceRow) {
|
||||
return 4;
|
||||
} else if (position == googleCloudTranslateKeyRow || position == cachePathRow) {
|
||||
return 6;
|
||||
}
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package tw.nekomimi.nekogram.settings;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -34,7 +33,8 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tw.nekomimi.nekogram.NekoConfig;
|
||||
import kotlin.Unit;
|
||||
import tw.nekomimi.nekogram.BottomBuilder;
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
public class NekoSettingsActivity extends BaseFragment {
|
||||
|
@ -55,7 +55,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
private int sourceCodeRow;
|
||||
private int translationRow;
|
||||
private int donateRow;
|
||||
private int sponsorRow;
|
||||
private int about2Row;
|
||||
|
||||
@Override
|
||||
|
@ -104,30 +103,26 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
} else if (position == experimentRow) {
|
||||
presentFragment(new NekoExperimentalSettingsActivity());
|
||||
} else if (position == channelRow) {
|
||||
MessagesController.getInstance(currentAccount).openByUserName(LocaleController.getString("OfficialChannelUsername", R.string.OfficialChannelUsername), this, 1);
|
||||
MessagesController.getInstance(currentAccount).openByUserName("NekogramX", this, 1);
|
||||
} else if (position == donateRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://nekogram.github.io/donation.html");
|
||||
Browser.openUrl(getParentActivity(), "https://patreon.com/NekoXDev");
|
||||
} else if (position == translationRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://neko.crowdin.com/nekogram");
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
builder.addItem(LocaleController.getString("NekoTrans", R.string.NekoTrans), (__) -> {
|
||||
Browser.openUrl(getParentActivity(), "https://neko.crowdin.com/nekogram");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.addItem(LocaleController.getString("NekoXTrans", R.string.NekoXTrans), (__) -> {
|
||||
Browser.openUrl(getParentActivity(), "https://nekox.crowdin.com/nekox");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.show();
|
||||
} else if (position == googlePlayRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://play.google.com/store/apps/details?id=tw.nekomimi.nekogram");
|
||||
Browser.openUrl(getParentActivity(), "https://play.google.com/store/apps/details?id=nekox.messenger");
|
||||
} else if (position == sourceCodeRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://github.com/Nekogram/Nekogram");
|
||||
} else if (position == sponsorRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://console.argo.moe/auth/register?code=nekogram");
|
||||
Browser.openUrl(getParentActivity(), "https://github.com/NekoX-Dev/NekoX");
|
||||
}
|
||||
});
|
||||
listView.setOnItemLongClickListener((view, position) -> {
|
||||
if (position == experimentRow) {
|
||||
NekoConfig.toggleShowHiddenFeature();
|
||||
listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
if (NekoConfig.showHiddenFeature) {
|
||||
AndroidUtilities.shakeView(view, 2, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
@ -154,11 +149,6 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
sourceCodeRow = rowCount++;
|
||||
translationRow = rowCount++;
|
||||
donateRow = rowCount++;
|
||||
if (!LocaleController.getString("SponsorTitle", R.string.SponsorTitle).equals("dummy")) {
|
||||
sponsorRow = rowCount++;
|
||||
} else {
|
||||
sponsorRow = -1;
|
||||
}
|
||||
about2Row = rowCount++;
|
||||
|
||||
if (listAdapter != null) {
|
||||
|
@ -234,22 +224,24 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
case 2: {
|
||||
TextCell textCell = (TextCell) holder.itemView;
|
||||
if (position == chatRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Chat", R.string.Chat), R.drawable.menu_chats, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("Chat", R.string.Chat), R.drawable.baseline_chat_bubble_24, true);
|
||||
} else if (position == generalRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("General", R.string.General), R.drawable.msg_theme, true);
|
||||
textCell.setTextAndIcon(LocaleController.getString("General", R.string.General), R.drawable.baseline_palette_24, true);
|
||||
} else if (position == experimentRow) {
|
||||
textCell.setTextAndIcon(LocaleController.getString("Experiment", R.string.Experiment), R.drawable.msg_fave, false);
|
||||
textCell.setTextAndIcon(LocaleController.getString("Experiment", R.string.Experiment), R.drawable.baseline_star_24, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
|
||||
if (position == channelRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("OfficialChannel", R.string.OfficialChannel), "@" + LocaleController.getString("OfficialChannelUsername", R.string.OfficialChannelUsername), true);
|
||||
textCell.setTextAndValue(LocaleController.getString("OfficialChannel", R.string.OfficialChannel), "@NekogramX", true);
|
||||
} else if (position == googlePlayRow) {
|
||||
textCell.setText(LocaleController.getString("GooglePlay", R.string.GooglePlay), true);
|
||||
} else if (position == sourceCodeRow) {
|
||||
textCell.setText(LocaleController.getString("SourceCode", R.string.SourceCode), true);
|
||||
} else if (position == translationRow) {
|
||||
textCell.setText(LocaleController.getString("TransSite", R.string.TransSite), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -264,12 +256,8 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
}
|
||||
case 6: {
|
||||
TextDetailSettingsCell textCell = (TextDetailSettingsCell) holder.itemView;
|
||||
if (position == translationRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Translation", R.string.Translation), LocaleController.getString("TranslationAbout", R.string.TranslationAbout), true);
|
||||
} else if (position == donateRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Donate", R.string.Donate), LocaleController.getString("DonateAbout", R.string.DonateAbout), sponsorRow != -1);
|
||||
} else if (position == sponsorRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("SponsorTitle", R.string.SponsorTitle), LocaleController.getString("SponsorContent", R.string.SponsorContent), false);
|
||||
if (position == donateRow) {
|
||||
textCell.setTextAndValue(LocaleController.getString("Donate", R.string.Donate), LocaleController.getString("DonateAbout", R.string.DonateAbout), false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -325,11 +313,11 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
return 1;
|
||||
} else if (position == chatRow || position == generalRow || position == experimentRow) {
|
||||
return 2;
|
||||
} else if (position == googlePlayRow || position == channelRow || position == sourceCodeRow) {
|
||||
} else if (position == googlePlayRow || position == channelRow || position == sourceCodeRow || position == translationRow) {
|
||||
return 3;
|
||||
} else if (position == categoriesRow || position == aboutRow) {
|
||||
return 4;
|
||||
} else if (position == translationRow || position == donateRow || position == sponsorRow) {
|
||||
} else if (position == donateRow) {
|
||||
return 6;
|
||||
}
|
||||
return 2;
|
||||
|
|
Loading…
Reference in New Issue
Block a user