| 1 | package tw.nekomimi.nekogram; |
| 2 | |
| 3 | import android.animation.Animator; |
| 4 | import android.animation.AnimatorListenerAdapter; |
| 5 | import android.animation.AnimatorSet; |
| 6 | import android.annotation.SuppressLint; |
| 7 | import android.content.Context; |
| 8 | import android.content.DialogInterface; |
| 9 | import android.graphics.Canvas; |
| 10 | import android.graphics.Paint; |
| 11 | import android.os.Build; |
| 12 | import android.text.TextPaint; |
| 13 | import android.view.Gravity; |
| 14 | import android.view.View; |
| 15 | import android.view.ViewGroup; |
| 16 | import android.view.WindowManager; |
| 17 | import android.widget.FrameLayout; |
| 18 | import android.widget.LinearLayout; |
| 19 | import android.widget.TextView; |
| 20 | |
| 21 | import androidx.recyclerview.widget.LinearLayoutManager; |
| 22 | import androidx.recyclerview.widget.RecyclerView; |
| 23 | |
| 24 | import org.telegram.messenger.AndroidUtilities; |
| 25 | import org.telegram.messenger.FileLog; |
| 26 | import org.telegram.messenger.LocaleController; |
| 27 | import org.telegram.messenger.MessagesController; |
| 28 | import org.telegram.messenger.NotificationCenter; |
| 29 | import org.telegram.messenger.R; |
| 30 | import org.telegram.messenger.SharedConfig; |
| 31 | import org.telegram.messenger.UserConfig; |
| 32 | import org.telegram.tgnet.ConnectionsManager; |
| 33 | import org.telegram.tgnet.TLRPC; |
| 34 | import org.telegram.ui.ActionBar.ActionBar; |
| 35 | import org.telegram.ui.ActionBar.ActionBarMenuItem; |
| 36 | import org.telegram.ui.ActionBar.AlertDialog; |
| 37 | import org.telegram.ui.ActionBar.BaseFragment; |
| 38 | import org.telegram.ui.ActionBar.BottomSheet; |
| 39 | import org.telegram.ui.ActionBar.Theme; |
| 40 | import org.telegram.ui.ActionBar.ThemeDescription; |
| 41 | import org.telegram.ui.Cells.EmptyCell; |
| 42 | import org.telegram.ui.Cells.HeaderCell; |
| 43 | import org.telegram.ui.Cells.NotificationsCheckCell; |
| 44 | import org.telegram.ui.Cells.RadioColorCell; |
| 45 | import org.telegram.ui.Cells.ShadowSectionCell; |
| 46 | import org.telegram.ui.Cells.TextCheckCell; |
| 47 | import org.telegram.ui.Cells.TextDetailSettingsCell; |
| 48 | import org.telegram.ui.Cells.TextInfoPrivacyCell; |
| 49 | import org.telegram.ui.Cells.TextSettingsCell; |
| 50 | import org.telegram.ui.Components.AlertsCreator; |
| 51 | import org.telegram.ui.Components.LayoutHelper; |
| 52 | import org.telegram.ui.Components.RecyclerListView; |
| 53 | import org.telegram.ui.Components.SeekBarView; |
| 54 | |
| 55 | import java.util.ArrayList; |
| 56 | |
| 57 | @SuppressLint("RtlHardcoded") |
| 58 | public class NekoSettingsActivity extends BaseFragment { |
| 59 | |
| 60 | private RecyclerListView listView; |
| 61 | private ListAdapter listAdapter; |
| 62 | private AnimatorSet animatorSet; |
| 63 | |
| 64 | private boolean sensitiveCanChange = false; |
| 65 | private boolean sensitiveEnabled = false; |
| 66 | |
| 67 | private int rowCount; |
| 68 | |
| 69 | private int connectionRow; |
| 70 | private int ipv6Row; |
| 71 | private int connection2Row; |
| 72 | |
| 73 | private int chatRow; |
| 74 | private int inappCameraRow; |
| 75 | private int useSystemEmojiRow; |
| 76 | private int ignoreBlockedRow; |
| 77 | private int hideProxySponsorChannelRow; |
| 78 | private int saveCacheToPrivateDirectoryRow; |
| 79 | private int pauseMusicOnRecordRow; |
| 80 | private int disablePhotoSideActionRow; |
| 81 | private int hideKeyboardOnChatScrollRow; |
| 82 | private int rearVideoMessagesRow; |
| 83 | private int hideAllTabRow; |
| 84 | private int mapPreviewRow; |
| 85 | private int stickerSizeRow; |
| 86 | private int translationProviderRow; |
| 87 | private int messageMenuRow; |
| 88 | private int chat2Row; |
| 89 | |
| 90 | private int settingsRow; |
| 91 | private int typefaceRow; |
| 92 | private int hidePhoneRow; |
| 93 | private int nameOrderRow; |
| 94 | private int transparentStatusBarRow; |
| 95 | private int forceTabletRow; |
| 96 | private int openArchiveOnPullRow; |
| 97 | private int avatarAsDrawerBackgroundRow; |
| 98 | private int showTabsOnForwardRow; |
| 99 | private int eventTypeRow; |
| 100 | private int newYearRow; |
| 101 | private int actionBarDecorationRow; |
| 102 | private int needRestartRow; |
| 103 | |
| 104 | private int experimentRow; |
| 105 | private int smoothKeyboardRow; |
| 106 | private int chatMessageAnimationRow; |
| 107 | private int disableFilteringRow; |
| 108 | private int unlimitedFavedStickersRow; |
| 109 | private int unlimitedPinnedDialogsRow; |
| 110 | private int deleteAccountRow; |
| 111 | private int experiment2Row; |
| 112 | |
| 113 | @Override |
| 114 | public boolean onFragmentCreate() { |
| 115 | super.onFragmentCreate(); |
| 116 | |
| 117 | updateRows(); |
| 118 | |
| 119 | return true; |
| 120 | } |
| 121 | |
| 122 | @SuppressLint("NewApi") |
| 123 | @Override |
| 124 | public View createView(Context context) { |
| 125 | actionBar.setBackButtonImage(R.drawable.ic_ab_back); |
| 126 | actionBar.setTitle(LocaleController.getString("NekoSettings", R.string.NekoSettings)); |
| 127 | |
| 128 | if (AndroidUtilities.isTablet()) { |
| 129 | actionBar.setOccupyStatusBar(false); |
| 130 | } |
| 131 | actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { |
| 132 | @Override |
| 133 | public void onItemClick(int id) { |
| 134 | if (id == -1) { |
| 135 | finishFragment(); |
| 136 | } |
| 137 | } |
| 138 | }); |
| 139 | |
| 140 | listAdapter = new ListAdapter(context); |
| 141 | |
| 142 | fragmentView = new FrameLayout(context); |
| 143 | fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); |
| 144 | FrameLayout frameLayout = (FrameLayout) fragmentView; |
| 145 | |
| 146 | listView = new RecyclerListView(context); |
| 147 | listView.setVerticalScrollBarEnabled(false); |
| 148 | listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); |
| 149 | frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); |
| 150 | listView.setAdapter(listAdapter); |
| 151 | listView.setOnItemClickListener((view, position, x, y) -> { |
| 152 | if (position == ipv6Row) { |
| 153 | NekoConfig.toggleIPv6(); |
| 154 | if (view instanceof TextCheckCell) { |
| 155 | ((TextCheckCell) view).setChecked(NekoConfig.useIPv6); |
| 156 | } |
| 157 | for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { |
| 158 | if (UserConfig.getInstance(a).isClientActivated()) { |
| 159 | ConnectionsManager.native_setUseIpv6(a, NekoConfig.useIPv6); |
| 160 | } |
| 161 | } |
| 162 | } else if (position == hidePhoneRow) { |
| 163 | NekoConfig.toggleHidePhone(); |
| 164 | if (view instanceof TextCheckCell) { |
| 165 | ((TextCheckCell) view).setChecked(NekoConfig.hidePhone); |
| 166 | } |
| 167 | } else if (position == inappCameraRow) { |
| 168 | SharedConfig.toggleInappCamera(); |
| 169 | if (view instanceof TextCheckCell) { |
| 170 | ((TextCheckCell) view).setChecked(SharedConfig.inappCamera); |
| 171 | } |
| 172 | } else if (position == forceTabletRow) { |
| 173 | NekoConfig.toggleForceTablet(); |
| 174 | if (view instanceof TextCheckCell) { |
| 175 | ((TextCheckCell) view).setChecked(NekoConfig.forceTablet); |
| 176 | } |
| 177 | } else if (position == ignoreBlockedRow) { |
| 178 | NekoConfig.toggleIgnoreBlocked(); |
| 179 | if (view instanceof TextCheckCell) { |
| 180 | ((TextCheckCell) view).setChecked(NekoConfig.ignoreBlocked); |
| 181 | } |
| 182 | } else if (position == transparentStatusBarRow) { |
| 183 | NekoConfig.toggleTransparentStatusBar(); |
| 184 | if (view instanceof TextCheckCell) { |
| 185 | ((TextCheckCell) view).setChecked(NekoConfig.transparentStatusBar); |
| 186 | } |
| 187 | AndroidUtilities.runOnUIThread(() -> NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewTheme, false)); |
| 188 | } else if (position == hideProxySponsorChannelRow) { |
| 189 | NekoConfig.toggleHideProxySponsorChannel(); |
| 190 | if (view instanceof TextCheckCell) { |
| 191 | ((TextCheckCell) view).setChecked(NekoConfig.hideProxySponsorChannel); |
| 192 | } |
| 193 | for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { |
| 194 | if (UserConfig.getInstance(a).isClientActivated()) { |
| 195 | MessagesController.getInstance(a).checkProxyInfo(true); |
| 196 | } |
| 197 | } |
| 198 | } else if (position == saveCacheToPrivateDirectoryRow) { |
| 199 | NekoConfig.toggleSaveCacheToPrivateDirectory(); |
| 200 | if (view instanceof TextCheckCell) { |
| 201 | ((TextCheckCell) view).setChecked(NekoConfig.saveCacheToPrivateDirectory); |
| 202 | } |
| 203 | } else if (position == useSystemEmojiRow) { |
| 204 | NekoConfig.toggleUseSystemEmoji(); |
| 205 | if (view instanceof TextCheckCell) { |
| 206 | ((TextCheckCell) view).setChecked(NekoConfig.useSystemEmoji); |
| 207 | } |
| 208 | } else if (position == typefaceRow) { |
| 209 | NekoConfig.toggleTypeface(); |
| 210 | if (view instanceof TextCheckCell) { |
| 211 | ((TextCheckCell) view).setChecked(NekoConfig.typeface == 1); |
| 212 | } |
| 213 | } else if (position == mapPreviewRow) { |
| 214 | ArrayList<String> arrayList = new ArrayList<>(); |
| 215 | ArrayList<Integer> types = new ArrayList<>(); |
| 216 | arrayList.add(LocaleController.getString("MapPreviewProviderTelegram", R.string.MapPreviewProviderTelegram)); |
| 217 | types.add(0); |
| 218 | arrayList.add(LocaleController.getString("MapPreviewProviderYandex", R.string.MapPreviewProviderYandex)); |
| 219 | types.add(1); |
| 220 | arrayList.add(LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody)); |
| 221 | types.add(2); |
| 222 | |
| 223 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 224 | builder.setTitle(LocaleController.getString("MapPreviewProviderTitle", R.string.MapPreviewProviderTitle)); |
| 225 | final LinearLayout linearLayout = new LinearLayout(context); |
| 226 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 227 | builder.setView(linearLayout); |
| 228 | |
| 229 | for (int a = 0; a < arrayList.size(); a++) { |
| 230 | RadioColorCell cell = new RadioColorCell(context); |
| 231 | cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); |
| 232 | cell.setTag(a); |
| 233 | cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); |
| 234 | cell.setTextAndValue(arrayList.get(a), NekoConfig.mapPreviewProvider == types.get(a)); |
| 235 | linearLayout.addView(cell); |
| 236 | cell.setOnClickListener(v -> { |
| 237 | Integer which = (Integer) v.getTag(); |
| 238 | NekoConfig.setMapPreviewProvider(types.get(which)); |
| 239 | listAdapter.notifyItemChanged(mapPreviewRow); |
| 240 | builder.getDismissRunnable().run(); |
| 241 | }); |
| 242 | } |
| 243 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 244 | showDialog(builder.create()); |
| 245 | } else if (position == nameOrderRow) { |
| 246 | ArrayList<String> arrayList = new ArrayList<>(); |
| 247 | ArrayList<Integer> types = new ArrayList<>(); |
| 248 | arrayList.add(LocaleController.getString("FirstLast", R.string.FirstLast)); |
| 249 | types.add(1); |
| 250 | arrayList.add(LocaleController.getString("LastFirst", R.string.LastFirst)); |
| 251 | types.add(2); |
| 252 | |
| 253 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 254 | builder.setTitle(LocaleController.getString("NameOrder", R.string.NameOrder)); |
| 255 | final LinearLayout linearLayout = new LinearLayout(context); |
| 256 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 257 | builder.setView(linearLayout); |
| 258 | |
| 259 | for (int a = 0; a < arrayList.size(); a++) { |
| 260 | RadioColorCell cell = new RadioColorCell(context); |
| 261 | cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); |
| 262 | cell.setTag(a); |
| 263 | cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); |
| 264 | cell.setTextAndValue(arrayList.get(a), NekoConfig.nameOrder == types.get(a)); |
| 265 | linearLayout.addView(cell); |
| 266 | cell.setOnClickListener(v -> { |
| 267 | Integer which = (Integer) v.getTag(); |
| 268 | NekoConfig.setNameOrder(types.get(which)); |
| 269 | listAdapter.notifyItemChanged(nameOrderRow); |
| 270 | builder.getDismissRunnable().run(); |
| 271 | }); |
| 272 | } |
| 273 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 274 | showDialog(builder.create()); |
| 275 | } else if (position == eventTypeRow) { |
| 276 | ArrayList<String> arrayList = new ArrayList<>(); |
| 277 | ArrayList<Integer> types = new ArrayList<>(); |
| 278 | arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate)); |
| 279 | types.add(0); |
| 280 | arrayList.add(LocaleController.getString("Christmas", R.string.Christmas)); |
| 281 | types.add(1); |
| 282 | arrayList.add(LocaleController.getString("Valentine", R.string.Valentine)); |
| 283 | types.add(2); |
| 284 | |
| 285 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 286 | builder.setTitle(LocaleController.getString("EventType", R.string.EventType)); |
| 287 | final LinearLayout linearLayout = new LinearLayout(context); |
| 288 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 289 | builder.setView(linearLayout); |
| 290 | |
| 291 | for (int a = 0; a < arrayList.size(); a++) { |
| 292 | RadioColorCell cell = new RadioColorCell(context); |
| 293 | cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); |
| 294 | cell.setTag(a); |
| 295 | cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); |
| 296 | cell.setTextAndValue(arrayList.get(a), NekoConfig.eventType == types.get(a)); |
| 297 | linearLayout.addView(cell); |
| 298 | cell.setOnClickListener(v -> { |
| 299 | Integer which = (Integer) v.getTag(); |
| 300 | NekoConfig.setEventType(types.get(which)); |
| 301 | listAdapter.notifyItemChanged(eventTypeRow); |
| 302 | builder.getDismissRunnable().run(); |
| 303 | }); |
| 304 | } |
| 305 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 306 | showDialog(builder.create()); |
| 307 | } else if (position == actionBarDecorationRow) { |
| 308 | ArrayList<String> arrayList = new ArrayList<>(); |
| 309 | ArrayList<Integer> types = new ArrayList<>(); |
| 310 | arrayList.add(LocaleController.getString("DependsOnDate", R.string.DependsOnDate)); |
| 311 | types.add(0); |
| 312 | arrayList.add(LocaleController.getString("Snowflakes", R.string.Snowflakes)); |
| 313 | types.add(1); |
| 314 | arrayList.add(LocaleController.getString("Fireworks", R.string.Fireworks)); |
| 315 | types.add(2); |
| 316 | |
| 317 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 318 | builder.setTitle(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration)); |
| 319 | final LinearLayout linearLayout = new LinearLayout(context); |
| 320 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 321 | builder.setView(linearLayout); |
| 322 | |
| 323 | for (int a = 0; a < arrayList.size(); a++) { |
| 324 | RadioColorCell cell = new RadioColorCell(context); |
| 325 | cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); |
| 326 | cell.setTag(a); |
| 327 | cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); |
| 328 | cell.setTextAndValue(arrayList.get(a), NekoConfig.actionBarDecoration == types.get(a)); |
| 329 | linearLayout.addView(cell); |
| 330 | cell.setOnClickListener(v -> { |
| 331 | Integer which = (Integer) v.getTag(); |
| 332 | NekoConfig.setActionBarDecoration(types.get(which)); |
| 333 | listAdapter.notifyItemChanged(actionBarDecorationRow); |
| 334 | builder.getDismissRunnable().run(); |
| 335 | }); |
| 336 | } |
| 337 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 338 | showDialog(builder.create()); |
| 339 | } else if (position == newYearRow) { |
| 340 | NekoConfig.toggleNewYear(); |
| 341 | if (view instanceof TextCheckCell) { |
| 342 | ((TextCheckCell) view).setChecked(NekoConfig.newYear); |
| 343 | } |
| 344 | } else if (position == disableFilteringRow) { |
| 345 | sensitiveEnabled = !sensitiveEnabled; |
| 346 | TLRPC.TL_account_setContentSettings req = new TLRPC.TL_account_setContentSettings(); |
| 347 | req.sensitive_enabled = sensitiveEnabled; |
| 348 | AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3); |
| 349 | progressDialog.show(); |
| 350 | getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { |
| 351 | progressDialog.dismiss(); |
| 352 | if (error == null) { |
| 353 | if (response instanceof TLRPC.TL_boolTrue && view instanceof TextCheckCell) { |
| 354 | ((TextCheckCell) view).setChecked(sensitiveEnabled); |
| 355 | } |
| 356 | } else { |
| 357 | AndroidUtilities.runOnUIThread(() -> AlertsCreator.processError(currentAccount, error, this, req)); |
| 358 | } |
| 359 | })); |
| 360 | } else if (position == stickerSizeRow) { |
| 361 | showStickerSizeAlert(); |
| 362 | } else if (position == unlimitedFavedStickersRow) { |
| 363 | NekoConfig.toggleUnlimitedFavedStickers(); |
| 364 | if (view instanceof TextCheckCell) { |
| 365 | ((TextCheckCell) view).setChecked(NekoConfig.unlimitedFavedStickers); |
| 366 | } |
| 367 | } else if (position == messageMenuRow) { |
| 368 | showMessageMenuAlert(); |
| 369 | } else if (position == deleteAccountRow) { |
| 370 | AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); |
| 371 | builder.setMessage(LocaleController.getString("TosDeclineDeleteAccount", R.string.TosDeclineDeleteAccount)); |
| 372 | builder.setTitle(LocaleController.getString("DeleteAccount", R.string.DeleteAccount)); |
| 373 | builder.setPositiveButton(LocaleController.getString("Deactivate", R.string.Deactivate), (dialog, which) -> { |
| 374 | ArrayList<TLRPC.Dialog> dialogs = new ArrayList<>(getMessagesController().getAllDialogs()); |
| 375 | for (TLRPC.Dialog TLdialog : dialogs) { |
| 376 | if (TLdialog instanceof TLRPC.TL_dialogFolder) { |
| 377 | continue; |
| 378 | } |
| 379 | TLRPC.Peer peer = getMessagesController().getPeer((int) TLdialog.id); |
| 380 | if (peer.channel_id != 0) { |
| 381 | TLRPC.Chat chat = getMessagesController().getChat(peer.channel_id); |
| 382 | if (!chat.broadcast) { |
| 383 | MessageHelper.getInstance(currentAccount).deleteUserChannelHistoryWithSearch(TLdialog.id, getMessagesController().getUser(getUserConfig().clientUserId)); |
| 384 | } |
| 385 | } |
| 386 | if (peer.user_id != 0) { |
| 387 | getMessagesController().deleteDialog(TLdialog.id, 0, true); |
| 388 | } |
| 389 | } |
| 390 | AlertDialog.Builder builder12 = new AlertDialog.Builder(getParentActivity()); |
| 391 | builder12.setMessage(LocaleController.getString("TosDeclineDeleteAccount", R.string.TosDeclineDeleteAccount)); |
| 392 | builder12.setTitle(LocaleController.getString("DeleteAccount", R.string.DeleteAccount)); |
| 393 | builder12.setPositiveButton(LocaleController.getString("Deactivate", R.string.Deactivate), (dialogInterface, i) -> { |
| 394 | final AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3); |
| 395 | progressDialog.setCanCacnel(false); |
| 396 | |
| 397 | TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount(); |
| 398 | req.reason = "Meow"; |
| 399 | getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { |
| 400 | try { |
| 401 | progressDialog.dismiss(); |
| 402 | } catch (Exception e) { |
| 403 | FileLog.e(e); |
| 404 | } |
| 405 | if (response instanceof TLRPC.TL_boolTrue) { |
| 406 | getMessagesController().performLogout(0); |
| 407 | } else if (error == null || error.code != -1000) { |
| 408 | String errorText = LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred); |
| 409 | if (error != null) { |
| 410 | errorText += "\n" + error.text; |
| 411 | } |
| 412 | AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity()); |
| 413 | builder1.setTitle(LocaleController.getString("AppName", R.string.AppName)); |
| 414 | builder1.setMessage(errorText); |
| 415 | builder1.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); |
| 416 | builder1.show(); |
| 417 | } |
| 418 | })); |
| 419 | progressDialog.show(); |
| 420 | }); |
| 421 | builder12.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 422 | AlertDialog dialog12 = builder12.create(); |
| 423 | showDialog(dialog12); |
| 424 | TextView button = (TextView) dialog12.getButton(DialogInterface.BUTTON_POSITIVE); |
| 425 | if (button != null) { |
| 426 | button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); |
| 427 | } |
| 428 | }); |
| 429 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 430 | builder.show(); |
| 431 | AlertDialog dialog = builder.create(); |
| 432 | showDialog(dialog); |
| 433 | TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE); |
| 434 | if (button != null) { |
| 435 | button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); |
| 436 | } |
| 437 | } else if (position == translationProviderRow) { |
| 438 | ArrayList<String> arrayList = new ArrayList<>(); |
| 439 | ArrayList<Integer> types = new ArrayList<>(); |
| 440 | arrayList.add(LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate)); |
| 441 | types.add(1); |
| 442 | arrayList.add(LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN)); |
| 443 | types.add(2); |
| 444 | arrayList.add(LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud)); |
| 445 | types.add(3); |
| 446 | arrayList.add(LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb)); |
| 447 | types.add(-1); |
| 448 | arrayList.add(LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb)); |
| 449 | types.add(-2); |
| 450 | arrayList.add(LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb)); |
| 451 | types.add(-3); |
| 452 | arrayList.add(LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb)); |
| 453 | types.add(-4); |
| 454 | |
| 455 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 456 | builder.setTitle(LocaleController.getString("TranslationProvider", R.string.TranslationProvider)); |
| 457 | final LinearLayout linearLayout = new LinearLayout(context); |
| 458 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 459 | builder.setView(linearLayout); |
| 460 | |
| 461 | for (int a = 0; a < arrayList.size(); a++) { |
| 462 | RadioColorCell cell = new RadioColorCell(context); |
| 463 | cell.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); |
| 464 | cell.setTag(a); |
| 465 | cell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked)); |
| 466 | cell.setTextAndValue(arrayList.get(a), NekoConfig.translationProvider == types.get(a)); |
| 467 | linearLayout.addView(cell); |
| 468 | cell.setOnClickListener(v -> { |
| 469 | Integer which = (Integer) v.getTag(); |
| 470 | NekoConfig.setTranslationProvider(types.get(which)); |
| 471 | listAdapter.notifyItemChanged(translationProviderRow); |
| 472 | builder.getDismissRunnable().run(); |
| 473 | }); |
| 474 | } |
| 475 | builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); |
| 476 | showDialog(builder.create()); |
| 477 | } else if (position == pauseMusicOnRecordRow) { |
| 478 | SharedConfig.togglePauseMusicOnRecord(); |
| 479 | if (view instanceof TextCheckCell) { |
| 480 | ((TextCheckCell) view).setChecked(SharedConfig.pauseMusicOnRecord); |
| 481 | } |
| 482 | } else if (position == smoothKeyboardRow) { |
| 483 | SharedConfig.toggleSmoothKeyboard(); |
| 484 | if (view instanceof TextCheckCell) { |
| 485 | ((TextCheckCell) view).setChecked(SharedConfig.smoothKeyboard); |
| 486 | } |
| 487 | if (SharedConfig.smoothKeyboard && getParentActivity() != null) { |
| 488 | getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); |
| 489 | } |
| 490 | } else if (position == disablePhotoSideActionRow) { |
| 491 | NekoConfig.toggleDisablePhotoSideAction(); |
| 492 | if (view instanceof TextCheckCell) { |
| 493 | ((TextCheckCell) view).setChecked(NekoConfig.disablePhotoSideAction); |
| 494 | } |
| 495 | } else if (position == unlimitedPinnedDialogsRow) { |
| 496 | NekoConfig.toggleUnlimitedPinnedDialogs(); |
| 497 | if (view instanceof TextCheckCell) { |
| 498 | ((TextCheckCell) view).setChecked(NekoConfig.unlimitedPinnedDialogs); |
| 499 | } |
| 500 | } else if (position == openArchiveOnPullRow) { |
| 501 | NekoConfig.toggleOpenArchiveOnPull(); |
| 502 | if (view instanceof TextCheckCell) { |
| 503 | ((TextCheckCell) view).setChecked(NekoConfig.openArchiveOnPull); |
| 504 | } |
| 505 | } else if (position == experimentRow) { |
| 506 | NekoConfig.toggleShowHiddenFeature(); |
| 507 | updateRows(); |
| 508 | } else if (position == hideKeyboardOnChatScrollRow) { |
| 509 | NekoConfig.toggleHideKeyboardOnChatScroll(); |
| 510 | if (view instanceof TextCheckCell) { |
| 511 | ((TextCheckCell) view).setChecked(NekoConfig.hideKeyboardOnChatScroll); |
| 512 | } |
| 513 | } else if (position == avatarAsDrawerBackgroundRow) { |
| 514 | NekoConfig.toggleAvatarAsDrawerBackground(); |
| 515 | NotificationCenter.getInstance(UserConfig.selectedAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); |
| 516 | if (view instanceof TextCheckCell) { |
| 517 | ((TextCheckCell) view).setChecked(NekoConfig.avatarAsDrawerBackground); |
| 518 | } |
| 519 | } else if (position == showTabsOnForwardRow) { |
| 520 | NekoConfig.toggleShowTabsOnForward(); |
| 521 | if (view instanceof TextCheckCell) { |
| 522 | ((TextCheckCell) view).setChecked(NekoConfig.showTabsOnForward); |
| 523 | } |
| 524 | } else if (position == chatMessageAnimationRow) { |
| 525 | NekoConfig.toggleChatMessageAnimation(); |
| 526 | if (view instanceof TextCheckCell) { |
| 527 | ((TextCheckCell) view).setChecked(NekoConfig.chatMessageAnimation); |
| 528 | } |
| 529 | } else if (position == rearVideoMessagesRow) { |
| 530 | NekoConfig.toggleRearVideoMessages(); |
| 531 | if (view instanceof TextCheckCell) { |
| 532 | ((TextCheckCell) view).setChecked(NekoConfig.rearVideoMessages); |
| 533 | } |
| 534 | } else if (position == hideAllTabRow) { |
| 535 | NekoConfig.toggleHideAllTab(); |
| 536 | if (view instanceof TextCheckCell) { |
| 537 | ((TextCheckCell) view).setChecked(NekoConfig.hideAllTab); |
| 538 | } |
| 539 | getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated); |
| 540 | } |
| 541 | |
| 542 | }); |
| 543 | |
| 544 | return fragmentView; |
| 545 | } |
| 546 | |
| 547 | @Override |
| 548 | public void onResume() { |
| 549 | super.onResume(); |
| 550 | if (listAdapter != null) { |
| 551 | checkSensitive(); |
| 552 | listAdapter.notifyDataSetChanged(); |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | private void updateRows() { |
| 557 | rowCount = 0; |
| 558 | connectionRow = rowCount++; |
| 559 | ipv6Row = rowCount++; |
| 560 | connection2Row = rowCount++; |
| 561 | chatRow = rowCount++; |
| 562 | inappCameraRow = rowCount++; |
| 563 | useSystemEmojiRow = rowCount++; |
| 564 | ignoreBlockedRow = rowCount++; |
| 565 | hideProxySponsorChannelRow = rowCount++; |
| 566 | saveCacheToPrivateDirectoryRow = NekoConfig.showHiddenFeature && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? rowCount++ : -1; |
| 567 | pauseMusicOnRecordRow = rowCount++; |
| 568 | disablePhotoSideActionRow = rowCount++; |
| 569 | hideKeyboardOnChatScrollRow = rowCount++; |
| 570 | rearVideoMessagesRow = rowCount++; |
| 571 | hideAllTabRow = rowCount++; |
| 572 | mapPreviewRow = rowCount++; |
| 573 | stickerSizeRow = rowCount++; |
| 574 | messageMenuRow = rowCount++; |
| 575 | translationProviderRow = rowCount++; |
| 576 | chat2Row = rowCount++; |
| 577 | settingsRow = rowCount++; |
| 578 | hidePhoneRow = rowCount++; |
| 579 | typefaceRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? rowCount++ : -1; |
| 580 | transparentStatusBarRow = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? rowCount++ : -1; |
| 581 | forceTabletRow = rowCount++; |
| 582 | openArchiveOnPullRow = rowCount++; |
| 583 | avatarAsDrawerBackgroundRow = rowCount++; |
| 584 | showTabsOnForwardRow = rowCount++; |
| 585 | nameOrderRow = rowCount++; |
| 586 | eventTypeRow = NekoConfig.showHiddenFeature ? rowCount++ : -1; |
| 587 | newYearRow = NekoConfig.showHiddenFeature ? rowCount++ : -1; |
| 588 | actionBarDecorationRow = NekoConfig.showHiddenFeature ? rowCount++ : -1; |
| 589 | needRestartRow = rowCount++; |
| 590 | experimentRow = rowCount++; |
| 591 | smoothKeyboardRow = !AndroidUtilities.isTablet() ? rowCount++ : -1; |
| 592 | chatMessageAnimationRow = rowCount++; |
| 593 | disableFilteringRow = rowCount++; |
| 594 | unlimitedFavedStickersRow = rowCount++; |
| 595 | unlimitedPinnedDialogsRow = rowCount++; |
| 596 | deleteAccountRow = NekoConfig.showHiddenFeature ? rowCount++ : -1; |
| 597 | experiment2Row = rowCount++; |
| 598 | if (listAdapter != null) { |
| 599 | listAdapter.notifyDataSetChanged(); |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | @Override |
| 604 | public ThemeDescription[] getThemeDescriptions() { |
| 605 | return new ThemeDescription[]{ |
| 606 | new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{EmptyCell.class, TextSettingsCell.class, TextCheckCell.class, HeaderCell.class, TextDetailSettingsCell.class, NotificationsCheckCell.class}, null, null, null, Theme.key_windowBackgroundWhite), |
| 607 | new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray), |
| 608 | |
| 609 | new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue), |
| 610 | new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue), |
| 611 | new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_avatar_actionBarIconBlue), |
| 612 | new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle), |
| 613 | new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_avatar_actionBarSelectorBlue), |
| 614 | new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground), |
| 615 | new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem), |
| 616 | |
| 617 | new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector), |
| 618 | |
| 619 | new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider), |
| 620 | |
| 621 | new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow), |
| 622 | |
| 623 | new ThemeDescription(listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText), |
| 624 | new ThemeDescription(listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText), |
| 625 | |
| 626 | new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText), |
| 627 | new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2), |
| 628 | new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack), |
| 629 | new ThemeDescription(listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked), |
| 630 | |
| 631 | new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText), |
| 632 | new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2), |
| 633 | new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack), |
| 634 | new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked), |
| 635 | |
| 636 | new ThemeDescription(listView, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader), |
| 637 | |
| 638 | new ThemeDescription(listView, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText), |
| 639 | new ThemeDescription(listView, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2), |
| 640 | }; |
| 641 | } |
| 642 | |
| 643 | private void checkSensitive() { |
| 644 | TLRPC.TL_account_getContentSettings req = new TLRPC.TL_account_getContentSettings(); |
| 645 | getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { |
| 646 | if (error == null) { |
| 647 | TLRPC.TL_account_contentSettings settings = (TLRPC.TL_account_contentSettings) response; |
| 648 | sensitiveEnabled = settings.sensitive_enabled; |
| 649 | sensitiveCanChange = settings.sensitive_can_change; |
| 650 | int count = listView.getChildCount(); |
| 651 | ArrayList<Animator> animators = new ArrayList<>(); |
| 652 | for (int a = 0; a < count; a++) { |
| 653 | View child = listView.getChildAt(a); |
| 654 | RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.getChildViewHolder(child); |
| 655 | int position = holder.getAdapterPosition(); |
| 656 | if (position == disableFilteringRow) { |
| 657 | TextCheckCell checkCell = (TextCheckCell) holder.itemView; |
| 658 | checkCell.setChecked(sensitiveEnabled); |
| 659 | checkCell.setEnabled(sensitiveCanChange, animators); |
| 660 | if (sensitiveCanChange) { |
| 661 | if (!animators.isEmpty()) { |
| 662 | if (animatorSet != null) { |
| 663 | animatorSet.cancel(); |
| 664 | } |
| 665 | animatorSet = new AnimatorSet(); |
| 666 | animatorSet.playTogether(animators); |
| 667 | animatorSet.addListener(new AnimatorListenerAdapter() { |
| 668 | @Override |
| 669 | public void onAnimationEnd(Animator animator) { |
| 670 | if (animator.equals(animatorSet)) { |
| 671 | animatorSet = null; |
| 672 | } |
| 673 | } |
| 674 | }); |
| 675 | animatorSet.setDuration(150); |
| 676 | animatorSet.start(); |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | } |
| 681 | } |
| 682 | } else { |
| 683 | AndroidUtilities.runOnUIThread(() -> AlertsCreator.processError(currentAccount, error, this, req)); |
| 684 | } |
| 685 | })); |
| 686 | } |
| 687 | |
| 688 | private void showMessageMenuAlert() { |
| 689 | if (getParentActivity() == null) { |
| 690 | return; |
| 691 | } |
| 692 | Context context = getParentActivity(); |
| 693 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
| 694 | builder.setTitle(LocaleController.getString("MessageMenu", R.string.MessageMenu)); |
| 695 | |
| 696 | LinearLayout linearLayout = new LinearLayout(context); |
| 697 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 698 | |
| 699 | LinearLayout linearLayoutInviteContainer = new LinearLayout(context); |
| 700 | linearLayoutInviteContainer.setOrientation(LinearLayout.VERTICAL); |
| 701 | linearLayout.addView(linearLayoutInviteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); |
| 702 | |
| 703 | int count = 10; |
| 704 | for (int a = 0; a < count; a++) { |
| 705 | TextCheckCell textCell = new TextCheckCell(context); |
| 706 | switch (a) { |
| 707 | case 0: { |
| 708 | textCell.setTextAndCheck(LocaleController.getString("DeleteDownloadedFile", R.string.DeleteDownloadedFile), NekoConfig.showDeleteDownloadedFile, false); |
| 709 | break; |
| 710 | } |
| 711 | case 1: { |
| 712 | textCell.setTextAndCheck(LocaleController.getString("AddToSavedMessages", R.string.AddToSavedMessages), NekoConfig.showAddToSavedMessages, false); |
| 713 | break; |
| 714 | } |
| 715 | case 2: { |
| 716 | textCell.setTextAndCheck(LocaleController.getString("Repeat", R.string.Repeat), NekoConfig.showRepeat, false); |
| 717 | break; |
| 718 | } |
| 719 | case 3: { |
| 720 | textCell.setTextAndCheck(LocaleController.getString("Prpr", R.string.Prpr), NekoConfig.showPrPr, false); |
| 721 | break; |
| 722 | } |
| 723 | case 4: { |
| 724 | textCell.setTextAndCheck(LocaleController.getString("ViewHistory", R.string.ViewHistory), NekoConfig.showViewHistory, false); |
| 725 | break; |
| 726 | } |
| 727 | case 5: { |
| 728 | textCell.setTextAndCheck(LocaleController.getString("Translate", R.string.Translate), NekoConfig.showTranslate, false); |
| 729 | break; |
| 730 | } |
| 731 | case 6: { |
| 732 | textCell.setTextAndCheck(LocaleController.getString("ReportChat", R.string.ReportChat), NekoConfig.showReport, false); |
| 733 | break; |
| 734 | } |
| 735 | case 7: { |
| 736 | textCell.setTextAndCheck(LocaleController.getString("EditAdminRights", R.string.EditAdminRights), NekoConfig.showAdminActions, false); |
| 737 | break; |
| 738 | } |
| 739 | case 8: { |
| 740 | textCell.setTextAndCheck(LocaleController.getString("ChangePermissions", R.string.ChangePermissions), NekoConfig.showChangePermissions, false); |
| 741 | break; |
| 742 | } |
| 743 | case 9: { |
| 744 | textCell.setTextAndCheck(LocaleController.getString("MessageDetails", R.string.MessageDetails), NekoConfig.showMessageDetails, false); |
| 745 | break; |
| 746 | } |
| 747 | } |
| 748 | textCell.setTag(a); |
| 749 | textCell.setBackground(Theme.getSelectorDrawable(false)); |
| 750 | linearLayoutInviteContainer.addView(textCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); |
| 751 | textCell.setOnClickListener(v2 -> { |
| 752 | Integer tag = (Integer) v2.getTag(); |
| 753 | switch (tag) { |
| 754 | case 0: { |
| 755 | NekoConfig.toggleShowDeleteDownloadedFile(); |
| 756 | textCell.setChecked(NekoConfig.showDeleteDownloadedFile); |
| 757 | break; |
| 758 | } |
| 759 | case 1: { |
| 760 | NekoConfig.toggleShowAddToSavedMessages(); |
| 761 | textCell.setChecked(NekoConfig.showAddToSavedMessages); |
| 762 | break; |
| 763 | } |
| 764 | case 2: { |
| 765 | NekoConfig.toggleShowRepeat(); |
| 766 | textCell.setChecked(NekoConfig.showRepeat); |
| 767 | break; |
| 768 | } |
| 769 | case 3: { |
| 770 | NekoConfig.toggleShowPrPr(); |
| 771 | textCell.setChecked(NekoConfig.showPrPr); |
| 772 | break; |
| 773 | } |
| 774 | case 4: { |
| 775 | NekoConfig.toggleShowViewHistory(); |
| 776 | textCell.setChecked(NekoConfig.showViewHistory); |
| 777 | break; |
| 778 | } |
| 779 | case 5: { |
| 780 | NekoConfig.toggleShowTranslate(); |
| 781 | textCell.setChecked(NekoConfig.showTranslate); |
| 782 | break; |
| 783 | } |
| 784 | case 6: { |
| 785 | NekoConfig.toggleShowReport(); |
| 786 | textCell.setChecked(NekoConfig.showReport); |
| 787 | break; |
| 788 | } |
| 789 | case 7: { |
| 790 | NekoConfig.toggleShowAdminActions(); |
| 791 | textCell.setChecked(NekoConfig.showAdminActions); |
| 792 | break; |
| 793 | } |
| 794 | case 8: { |
| 795 | NekoConfig.toggleShowChangePermissions(); |
| 796 | textCell.setChecked(NekoConfig.showChangePermissions); |
| 797 | break; |
| 798 | } |
| 799 | case 9: { |
| 800 | NekoConfig.toggleShowMessageDetails(); |
| 801 | textCell.setChecked(NekoConfig.showMessageDetails); |
| 802 | break; |
| 803 | } |
| 804 | } |
| 805 | }); |
| 806 | } |
| 807 | builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); |
| 808 | builder.setView(linearLayout); |
| 809 | showDialog(builder.create()); |
| 810 | } |
| 811 | |
| 812 | private void showStickerSizeAlert() { |
| 813 | if (getParentActivity() == null) { |
| 814 | return; |
| 815 | } |
| 816 | Context context = getParentActivity(); |
| 817 | BottomSheet.Builder builder = new BottomSheet.Builder(context); |
| 818 | builder.setApplyTopPadding(false); |
| 819 | builder.setApplyBottomPadding(false); |
| 820 | |
| 821 | LinearLayout linearLayout = new LinearLayout(context); |
| 822 | linearLayout.setOrientation(LinearLayout.VERTICAL); |
| 823 | |
| 824 | FrameLayout titleLayout = new FrameLayout(context); |
| 825 | linearLayout.addView(titleLayout); |
| 826 | |
| 827 | HeaderCell headerCell = new HeaderCell(context, Theme.key_windowBackgroundWhiteBlueHeader, 23, 15, false); |
| 828 | headerCell.setHeight(47); |
| 829 | headerCell.setText(LocaleController.getString("StickerSize", R.string.StickerSize)); |
| 830 | titleLayout.addView(headerCell); |
| 831 | |
| 832 | ActionBarMenuItem optionsButton = new ActionBarMenuItem(context, null, 0, Theme.getColor(Theme.key_sheet_other)); |
| 833 | optionsButton.setLongClickEnabled(false); |
| 834 | optionsButton.setSubMenuOpenSide(2); |
| 835 | optionsButton.setIcon(R.drawable.ic_ab_other); |
| 836 | optionsButton.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_player_actionBarSelector), 1)); |
| 837 | optionsButton.addSubItem(1, R.drawable.msg_reset, LocaleController.getString("Reset", R.string.Reset)); |
| 838 | optionsButton.setOnClickListener(v -> optionsButton.toggleSubMenu()); |
| 839 | optionsButton.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions)); |
| 840 | titleLayout.addView(optionsButton, LayoutHelper.createFrame(40, 40, Gravity.TOP | Gravity.RIGHT, 0, 8, 5, 0)); |
| 841 | |
| 842 | LinearLayout linearLayoutInviteContainer = new LinearLayout(context); |
| 843 | linearLayoutInviteContainer.setOrientation(LinearLayout.VERTICAL); |
| 844 | linearLayout.addView(linearLayoutInviteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); |
| 845 | StickerSizeCell stickerSizeCell = new StickerSizeCell(context); |
| 846 | optionsButton.setDelegate(id -> { |
| 847 | if (id == 1) { |
| 848 | NekoConfig.setStickerSize(14.0f); |
| 849 | stickerSizeCell.invalidate(); |
| 850 | } |
| 851 | }); |
| 852 | linearLayoutInviteContainer.addView(stickerSizeCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); |
| 853 | builder.setCustomView(linearLayout); |
| 854 | showDialog(builder.create()); |
| 855 | } |
| 856 | |
| 857 | private class StickerSizeCell extends FrameLayout { |
| 858 | |
| 859 | private StickerSizePreviewMessagesCell messagesCell; |
| 860 | private SeekBarView sizeBar; |
| 861 | private int startStickerSize = 2; |
| 862 | private int endStickerSize = 20; |
| 863 | |
| 864 | private TextPaint textPaint; |
| 865 | |
| 866 | public StickerSizeCell(Context context) { |
| 867 | super(context); |
| 868 | |
| 869 | setWillNotDraw(false); |
| 870 | |
| 871 | textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); |
| 872 | textPaint.setTextSize(AndroidUtilities.dp(16)); |
| 873 | |
| 874 | sizeBar = new SeekBarView(context); |
| 875 | sizeBar.setReportChanges(true); |
| 876 | sizeBar.setDelegate(new SeekBarView.SeekBarViewDelegate() { |
| 877 | @Override |
| 878 | public void onSeekBarDrag(boolean stop, float progress) { |
| 879 | NekoConfig.setStickerSize(startStickerSize + (endStickerSize - startStickerSize) * progress); |
| 880 | StickerSizeCell.this.invalidate(); |
| 881 | } |
| 882 | |
| 883 | @Override |
| 884 | public void onSeekBarPressed(boolean pressed) { |
| 885 | |
| 886 | } |
| 887 | }); |
| 888 | addView(sizeBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.LEFT | Gravity.TOP, 9, 5, 43, 11)); |
| 889 | |
| 890 | messagesCell = new StickerSizePreviewMessagesCell(context, parentLayout); |
| 891 | addView(messagesCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 0, 53, 0, 0)); |
| 892 | } |
| 893 | |
| 894 | @Override |
| 895 | protected void onDraw(Canvas canvas) { |
| 896 | textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText)); |
| 897 | canvas.drawText("" + Math.round(NekoConfig.stickerSize), getMeasuredWidth() - AndroidUtilities.dp(39), AndroidUtilities.dp(28), textPaint); |
| 898 | } |
| 899 | |
| 900 | @Override |
| 901 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 902 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| 903 | sizeBar.setProgress((NekoConfig.stickerSize - startStickerSize) / (float) (endStickerSize - startStickerSize)); |
| 904 | } |
| 905 | |
| 906 | @Override |
| 907 | public void invalidate() { |
| 908 | super.invalidate(); |
| 909 | listAdapter.notifyItemChanged(stickerSizeRow); |
| 910 | messagesCell.invalidate(); |
| 911 | sizeBar.invalidate(); |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | private class ListAdapter extends RecyclerListView.SelectionAdapter { |
| 916 | |
| 917 | private Context mContext; |
| 918 | |
| 919 | public ListAdapter(Context context) { |
| 920 | mContext = context; |
| 921 | } |
| 922 | |
| 923 | @Override |
| 924 | public int getItemCount() { |
| 925 | return rowCount; |
| 926 | } |
| 927 | |
| 928 | @Override |
| 929 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { |
| 930 | switch (holder.getItemViewType()) { |
| 931 | case 1: { |
| 932 | if (position == experiment2Row) { |
| 933 | holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); |
| 934 | } else { |
| 935 | holder.itemView.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); |
| 936 | } |
| 937 | break; |
| 938 | } |
| 939 | case 2: { |
| 940 | TextSettingsCell textCell = (TextSettingsCell) holder.itemView; |
| 941 | textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); |
| 942 | if (position == nameOrderRow) { |
| 943 | String value; |
| 944 | switch (NekoConfig.nameOrder) { |
| 945 | case 2: |
| 946 | value = LocaleController.getString("LastFirst", R.string.LastFirst); |
| 947 | break; |
| 948 | case 1: |
| 949 | default: |
| 950 | value = LocaleController.getString("FirstLast", R.string.FirstLast); |
| 951 | break; |
| 952 | } |
| 953 | textCell.setTextAndValue(LocaleController.getString("NameOrder", R.string.NameOrder), value, eventTypeRow != -1); |
| 954 | } else if (position == mapPreviewRow) { |
| 955 | String value; |
| 956 | switch (NekoConfig.mapPreviewProvider) { |
| 957 | case 0: |
| 958 | value = LocaleController.getString("MapPreviewProviderTelegram", R.string.MapPreviewProviderTelegram); |
| 959 | break; |
| 960 | case 1: |
| 961 | value = LocaleController.getString("MapPreviewProviderYandex", R.string.MapPreviewProviderYandex); |
| 962 | break; |
| 963 | case 2: |
| 964 | default: |
| 965 | value = LocaleController.getString("MapPreviewProviderNobody", R.string.MapPreviewProviderNobody); |
| 966 | } |
| 967 | textCell.setTextAndValue(LocaleController.getString("MapPreviewProvider", R.string.MapPreviewProvider), value, true); |
| 968 | } else if (position == eventTypeRow) { |
| 969 | String value; |
| 970 | switch (NekoConfig.eventType) { |
| 971 | case 1: |
| 972 | value = LocaleController.getString("Christmas", R.string.Christmas); |
| 973 | break; |
| 974 | case 2: |
| 975 | value = LocaleController.getString("Valentine", R.string.Valentine); |
| 976 | break; |
| 977 | case 0: |
| 978 | default: |
| 979 | value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate); |
| 980 | } |
| 981 | textCell.setTextAndValue(LocaleController.getString("EventType", R.string.EventType), value, true); |
| 982 | } else if (position == actionBarDecorationRow) { |
| 983 | String value; |
| 984 | switch (NekoConfig.actionBarDecoration) { |
| 985 | case 1: |
| 986 | value = LocaleController.getString("Snowflakes", R.string.Snowflakes); |
| 987 | break; |
| 988 | case 2: |
| 989 | value = LocaleController.getString("Fireworks", R.string.Fireworks); |
| 990 | break; |
| 991 | case 0: |
| 992 | default: |
| 993 | value = LocaleController.getString("DependsOnDate", R.string.DependsOnDate); |
| 994 | } |
| 995 | textCell.setTextAndValue(LocaleController.getString("ActionBarDecoration", R.string.ActionBarDecoration), value, false); |
| 996 | } else if (position == stickerSizeRow) { |
| 997 | textCell.setTextAndValue(LocaleController.getString("StickerSize", R.string.StickerSize), String.valueOf(Math.round(NekoConfig.stickerSize)), true); |
| 998 | } else if (position == messageMenuRow) { |
| 999 | textCell.setText(LocaleController.getString("MessageMenu", R.string.MessageMenu), true); |
| 1000 | } else if (position == deleteAccountRow) { |
| 1001 | textCell.setText(LocaleController.getString("DeleteAccount", R.string.DeleteAccount), false); |
| 1002 | textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText)); |
| 1003 | } else if (position == translationProviderRow) { |
| 1004 | String value; |
| 1005 | switch (NekoConfig.translationProvider) { |
| 1006 | case 1: |
| 1007 | value = LocaleController.getString("ProviderGoogleTranslate", R.string.ProviderGoogleTranslate); |
| 1008 | break; |
| 1009 | case -1: |
| 1010 | value = LocaleController.getString("ProviderGoogleTranslateWeb", R.string.ProviderGoogleTranslateWeb); |
| 1011 | break; |
| 1012 | case 2: |
| 1013 | value = LocaleController.getString("ProviderGoogleTranslateCN", R.string.ProviderGoogleTranslateCN); |
| 1014 | break; |
| 1015 | case -2: |
| 1016 | value = LocaleController.getString("ProviderGoogleTranslateCNWeb", R.string.ProviderGoogleTranslateCNWeb); |
| 1017 | break; |
| 1018 | case -3: |
| 1019 | value = LocaleController.getString("ProviderBaiduFanyiWeb", R.string.ProviderBaiduFanyiWeb); |
| 1020 | break; |
| 1021 | case -4: |
| 1022 | value = LocaleController.getString("ProviderDeepLWeb", R.string.ProviderDeepLWeb); |
| 1023 | break; |
| 1024 | case 3: |
| 1025 | default: |
| 1026 | value = LocaleController.getString("ProviderLingocloud", R.string.ProviderLingocloud); |
| 1027 | break; |
| 1028 | } |
| 1029 | textCell.setTextAndValue(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), value, false); |
| 1030 | } |
| 1031 | break; |
| 1032 | } |
| 1033 | case 3: { |
| 1034 | TextCheckCell textCell = (TextCheckCell) holder.itemView; |
| 1035 | textCell.setEnabled(true, null); |
| 1036 | if (position == ipv6Row) { |
| 1037 | textCell.setTextAndCheck(LocaleController.getString("IPv6", R.string.IPv6), NekoConfig.useIPv6, false); |
| 1038 | } else if (position == hidePhoneRow) { |
| 1039 | textCell.setTextAndCheck(LocaleController.getString("HidePhone", R.string.HidePhone), NekoConfig.hidePhone, true); |
| 1040 | } else if (position == inappCameraRow) { |
| 1041 | textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera), SharedConfig.inappCamera, true); |
| 1042 | } else if (position == transparentStatusBarRow) { |
| 1043 | textCell.setTextAndCheck(LocaleController.getString("TransparentStatusBar", R.string.TransparentStatusBar), NekoConfig.transparentStatusBar, true); |
| 1044 | } else if (position == hideProxySponsorChannelRow) { |
| 1045 | textCell.setTextAndCheck(LocaleController.getString("HideProxySponsorChannel", R.string.HideProxySponsorChannel), NekoConfig.hideProxySponsorChannel, true); |
| 1046 | } else if (position == saveCacheToPrivateDirectoryRow) { |
| 1047 | textCell.setTextAndCheck(LocaleController.getString("SaveCacheToPrivateDirectory", R.string.SaveCacheToPrivateDirectory), NekoConfig.saveCacheToPrivateDirectory, true); |
| 1048 | } else if (position == useSystemEmojiRow) { |
| 1049 | textCell.setTextAndCheck(LocaleController.getString("EmojiUseDefault", R.string.EmojiUseDefault), NekoConfig.useSystemEmoji, true); |
| 1050 | } else if (position == typefaceRow) { |
| 1051 | textCell.setTextAndCheck(LocaleController.getString("TypefaceUseDefault", R.string.TypefaceUseDefault), NekoConfig.typeface == 1, true); |
| 1052 | } else if (position == ignoreBlockedRow) { |
| 1053 | textCell.setTextAndCheck(LocaleController.getString("IgnoreBlocked", R.string.IgnoreBlocked), NekoConfig.ignoreBlocked, true); |
| 1054 | } else if (position == forceTabletRow) { |
| 1055 | textCell.setTextAndCheck(LocaleController.getString("ForceTabletMode", R.string.ForceTabletMode), NekoConfig.forceTablet, true); |
| 1056 | } else if (position == newYearRow) { |
| 1057 | textCell.setTextAndCheck(LocaleController.getString("ChristmasHat", R.string.ChristmasHat), NekoConfig.newYear, true); |
| 1058 | } else if (position == disableFilteringRow) { |
| 1059 | textCell.setTextAndValueAndCheck(LocaleController.getString("SensitiveDisableFiltering", R.string.SensitiveDisableFiltering), LocaleController.getString("SensitiveAbout", R.string.SensitiveAbout), sensitiveEnabled, true, true); |
| 1060 | textCell.setEnabled(sensitiveCanChange, null); |
| 1061 | } else if (position == unlimitedFavedStickersRow) { |
| 1062 | textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedFavoredStickers", R.string.UnlimitedFavoredStickers), LocaleController.getString("UnlimitedFavoredStickersAbout", R.string.UnlimitedFavoredStickersAbout), NekoConfig.unlimitedFavedStickers, true, true); |
| 1063 | } else if (position == pauseMusicOnRecordRow) { |
| 1064 | textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic), SharedConfig.pauseMusicOnRecord, true); |
| 1065 | } else if (position == smoothKeyboardRow) { |
| 1066 | textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnableSmoothKeyboard", R.string.DebugMenuEnableSmoothKeyboard), SharedConfig.smoothKeyboard, true); |
| 1067 | } else if (position == disablePhotoSideActionRow) { |
| 1068 | textCell.setTextAndCheck(LocaleController.getString("DisablePhotoViewerSideAction", R.string.DisablePhotoViewerSideAction), NekoConfig.disablePhotoSideAction, true); |
| 1069 | } else if (position == unlimitedPinnedDialogsRow) { |
| 1070 | textCell.setTextAndValueAndCheck(LocaleController.getString("UnlimitedPinnedDialogs", R.string.UnlimitedPinnedDialogs), LocaleController.getString("UnlimitedPinnedDialogsAbout", R.string.UnlimitedPinnedDialogsAbout), NekoConfig.unlimitedPinnedDialogs, true, deleteAccountRow != -1); |
| 1071 | } else if (position == openArchiveOnPullRow) { |
| 1072 | textCell.setTextAndCheck(LocaleController.getString("OpenArchiveOnPull", R.string.OpenArchiveOnPull), NekoConfig.openArchiveOnPull, true); |
| 1073 | } else if (position == hideKeyboardOnChatScrollRow) { |
| 1074 | textCell.setTextAndCheck(LocaleController.getString("HideKeyboardOnChatScroll", R.string.HideKeyboardOnChatScroll), NekoConfig.hideKeyboardOnChatScroll, true); |
| 1075 | } else if (position == avatarAsDrawerBackgroundRow) { |
| 1076 | textCell.setTextAndCheck(LocaleController.getString("UseAvatarAsDrawerBackground", R.string.UseAvatarAsDrawerBackground), NekoConfig.avatarAsDrawerBackground, true); |
| 1077 | } else if (position == showTabsOnForwardRow) { |
| 1078 | textCell.setTextAndCheck(LocaleController.getString("ShowTabsOnForward", R.string.ShowTabsOnForward), NekoConfig.showTabsOnForward, true); |
| 1079 | } else if (position == chatMessageAnimationRow) { |
| 1080 | textCell.setTextAndCheck(LocaleController.getString("ChatMessageAnimation", R.string.ChatMessageAnimation), NekoConfig.chatMessageAnimation, true); |
| 1081 | } else if (position == rearVideoMessagesRow) { |
| 1082 | textCell.setTextAndCheck(LocaleController.getString("RearVideoMessages", R.string.RearVideoMessages), NekoConfig.rearVideoMessages, true); |
| 1083 | } else if (position == hideAllTabRow) { |
| 1084 | textCell.setTextAndValueAndCheck(LocaleController.getString("HideAllTab", R.string.HideAllTab), LocaleController.getString("HideAllTabAbout", R.string.HideAllTabAbout), NekoConfig.hideAllTab, true, true); |
| 1085 | } |
| 1086 | break; |
| 1087 | } |
| 1088 | case 4: { |
| 1089 | HeaderCell headerCell = (HeaderCell) holder.itemView; |
| 1090 | if (position == settingsRow) { |
| 1091 | headerCell.setText(LocaleController.getString("General", R.string.General)); |
| 1092 | } else if (position == connectionRow) { |
| 1093 | headerCell.setText(LocaleController.getString("Connection", R.string.Connection)); |
| 1094 | } else if (position == chatRow) { |
| 1095 | headerCell.setText(LocaleController.getString("Chat", R.string.Chat)); |
| 1096 | } else if (position == experimentRow) { |
| 1097 | headerCell.setText(LocaleController.getString("Experiment", R.string.Experiment)); |
| 1098 | } |
| 1099 | break; |
| 1100 | } |
| 1101 | case 7: { |
| 1102 | TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; |
| 1103 | if (position == needRestartRow) { |
| 1104 | cell.setText(LocaleController.getString("SomeItemsNeedRestart", R.string.SomeItemsNeedRestart)); |
| 1105 | } |
| 1106 | break; |
| 1107 | } |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | @Override |
| 1112 | public boolean isEnabled(RecyclerView.ViewHolder holder) { |
| 1113 | int position = holder.getAdapterPosition(); |
| 1114 | return position == hidePhoneRow || position == inappCameraRow || position == ignoreBlockedRow || |
| 1115 | position == useSystemEmojiRow || position == ipv6Row || position == typefaceRow || position == nameOrderRow || |
| 1116 | position == forceTabletRow || position == mapPreviewRow || position == newYearRow || |
| 1117 | position == actionBarDecorationRow || position == eventTypeRow || position == transparentStatusBarRow || |
| 1118 | position == hideProxySponsorChannelRow || position == saveCacheToPrivateDirectoryRow || |
| 1119 | position == disableFilteringRow || position == stickerSizeRow || |
| 1120 | position == unlimitedFavedStickersRow || position == messageMenuRow || position == deleteAccountRow || |
| 1121 | position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow || |
| 1122 | position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow || |
| 1123 | position == experimentRow || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || |
| 1124 | position == showTabsOnForwardRow || position == chatMessageAnimationRow || position == rearVideoMessagesRow || |
| 1125 | position == hideAllTabRow; |
| 1126 | } |
| 1127 | |
| 1128 | @Override |
| 1129 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 1130 | View view = null; |
| 1131 | switch (viewType) { |
| 1132 | case 1: |
| 1133 | view = new ShadowSectionCell(mContext); |
| 1134 | break; |
| 1135 | case 2: |
| 1136 | view = new TextSettingsCell(mContext); |
| 1137 | view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); |
| 1138 | break; |
| 1139 | case 3: |
| 1140 | view = new TextCheckCell(mContext); |
| 1141 | view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); |
| 1142 | break; |
| 1143 | case 4: |
| 1144 | view = new HeaderCell(mContext); |
| 1145 | view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); |
| 1146 | break; |
| 1147 | case 5: |
| 1148 | view = new NotificationsCheckCell(mContext); |
| 1149 | view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); |
| 1150 | break; |
| 1151 | case 6: |
| 1152 | view = new TextDetailSettingsCell(mContext); |
| 1153 | view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); |
| 1154 | break; |
| 1155 | case 7: |
| 1156 | view = new TextInfoPrivacyCell(mContext); |
| 1157 | view.setBackground(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); |
| 1158 | break; |
| 1159 | } |
| 1160 | //noinspection ConstantConditions |
| 1161 | view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT)); |
| 1162 | return new RecyclerListView.Holder(view); |
| 1163 | } |
| 1164 | |
| 1165 | @Override |
| 1166 | public int getItemViewType(int position) { |
| 1167 | if (position == connection2Row || position == chat2Row || position == experiment2Row) { |
| 1168 | return 1; |
| 1169 | } else if (position == nameOrderRow || position == mapPreviewRow || position == stickerSizeRow || position == messageMenuRow || |
| 1170 | position == deleteAccountRow || position == translationProviderRow || position == eventTypeRow || position == actionBarDecorationRow) { |
| 1171 | return 2; |
| 1172 | } else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow || |
| 1173 | position == transparentStatusBarRow || position == hideProxySponsorChannelRow || |
| 1174 | position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow || |
| 1175 | position == forceTabletRow || position == newYearRow || |
| 1176 | position == saveCacheToPrivateDirectoryRow || position == unlimitedFavedStickersRow || |
| 1177 | position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow || |
| 1178 | position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow || |
| 1179 | position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || position == showTabsOnForwardRow || |
| 1180 | position == chatMessageAnimationRow || position == rearVideoMessagesRow || position == hideAllTabRow) { |
| 1181 | return 3; |
| 1182 | } else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) { |
| 1183 | return 4; |
| 1184 | } else if (position == needRestartRow) { |
| 1185 | return 7; |
| 1186 | } |
| 1187 | return 6; |
| 1188 | } |
| 1189 | } |
| 1190 | } |
| 1191 | |