Kate Mobile v109.1版本的 MD5 值为:fcd76ded5f363ecbfac46035a4ed2a23
以下内容为反编译后的 Settings.java 源代码,内容仅作参考
package com.perm.kate;
import android.app.AlertDialog;
import android.app.Application;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
import android.provider.MediaStore;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.flurry.android.FlurryAgent;
import com.perm.kate.Settings;
import com.perm.kate.audio_cache.AudioCache;
import com.perm.kate.color_picker.widget.ColorPickerPreference;
import com.perm.kate.notifications.RunningNotification;
import com.perm.kate.notifications.Utils;
import com.perm.kate.push.Push;
import com.perm.kate.push.PushService;
import com.perm.kate.session.Callback;
import com.perm.kate.session.Session;
import com.perm.kate.theme.ColorTheme;
import com.perm.kate.theme.ThemeColorsHelper;
import com.perm.kate.theme.ThemeSettingsHelper;
import com.perm.kate.video_cache.VideoCache;
import com.perm.utils.FingerprintManager;
import com.perm.utils.LeakDetector;
import com.perm.utils.MusicTimer;
import com.perm.utils.NightThemeHelper;
import com.perm.utils.SettingsBackup;
import com.perm.utils.SilentMode;
import com.perm.utils.SleepModeHelper;
import com.perm.utils.SmileHelper;
import com.perm.utils.SpamHelper;
import com.perm.utils.TaskDescriptionWrapper;
import com.perm.utils.UpdateChecker;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
public class Settings extends PreferenceActivity {
private EditText audio_input;
private CheckBoxPreference card_style_news;
ColorPickerPreference key_theme_general_color1;
ColorPickerPreference key_theme_general_color2;
private RingtonePreference notify_ringtone;
private CheckBoxPreference notify_sound;
private CheckBoxPreference notify_sound_default;
private EditText photo_input;
private Preference silence_mode;
private Preference sleep_mode_end;
private Preference sleep_mode_start;
private EditText video_input;
private final Preference.OnPreferenceChangeListener popupReplyChangedListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) Settings.this.findPreference("headsup_notifications");
if (checkBoxPreference != null) {
checkBoxPreference.setEnabled(!((Boolean) obj).booleanValue());
}
return true;
}
};
private final Preference.OnPreferenceChangeListener oldStyleNewsChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings.this.setEnabledCardStyleNews(((Boolean) obj).booleanValue());
if (obj.equals(Boolean.TRUE)) {
Settings.this.displayDeprecatedDialog();
return true;
}
return true;
}
};
private final Preference.OnPreferenceChangeListener notify_soundChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings.this.notify_ringtone.setEnabled(((Boolean) obj).booleanValue() && !Settings.this.notify_sound_default.isChecked());
return true;
}
};
private final Preference.OnPreferenceChangeListener notify_sound_defaultChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings.this.notify_ringtone.setEnabled(Settings.this.notify_sound.isChecked() && !((Boolean) obj).booleanValue());
return true;
}
};
private final Preference.OnPreferenceChangeListener intervalChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
int parseInt = Integer.parseInt((String) obj);
preference.setSummary(Settings.this.getResources().getTextArray(R.array.notify_interval_values)[parseInt]);
UpdateService.schedule(Settings.this.getApplicationContext(), UpdateService.limitPeriod(Settings.this.getResources().getIntArray(R.array.timer_values)[parseInt]) * 1000);
return true;
}
};
private final Preference.OnPreferenceChangeListener updateChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
UpdateService.scheduleForced(Settings.this);
return true;
}
UpdateService.cancel(Settings.this);
return true;
}
};
private final Preference.OnPreferenceChangeListener imagesChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Boolean bool = (Boolean) obj;
KApplication.getImageLoader().download_images = bool.booleanValue();
if (bool.booleanValue()) {
KApplication.getImageLoader().clearMemoryCache();
}
return true;
}
};
private final Preference.OnPreferenceChangeListener firstTabChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
preference.setSummary(Settings.this.getResources().getTextArray(R.array.first_tab_values)[Integer.parseInt((String) obj)]);
return true;
}
};
private final Preference.OnPreferenceChangeListener long_pullChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings settings = Settings.this;
settings.handler.removeCallbacks(settings.longPollRunnavle);
Settings settings2 = Settings.this;
settings2.handler.postDelayed(settings2.longPollRunnavle, 5000L);
return true;
}
};
final Handler handler = new Handler();
final Runnable longPollRunnavle = new Runnable() {
@Override
public void run() {
KApplication.longPoll.checkSettings();
}
};
private final Preference.OnPreferenceChangeListener newsFilterChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
NewsFragment.redisplay_data = true;
return true;
}
};
private final Preference.OnPreferenceChangeListener onlineChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
String str = (String) obj;
int parseInt = Integer.parseInt(str);
preference.setSummary(Settings.this.getResources().getTextArray(R.array.online_values)[parseInt]);
if (str.equals("0")) {
KApplication.online.startUnchecked();
} else {
KApplication.online.stop(true);
}
if (parseInt == 1) {
new AlertDialog.Builder(Settings.this).setMessage(Html.fromHtml(Settings.this.getString(R.string.offline_info))).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).create().show();
}
return true;
}
};
private final Preference.OnPreferenceChangeListener key_hd_quality_videoChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
preference.setSummary(Settings.this.getResources().getTextArray(R.array.quality_video_values)[Integer.parseInt((String) obj)]);
return true;
}
};
final SharedPreferences.OnSharedPreferenceChangeListener changeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String str) {
if (System.nanoTime() % 1000 >= 1 || str.equals("news_from") || str.startsWith("news_offset_") || str.startsWith("news_pos_") || str.startsWith("has_news_") || str.startsWith("last_friends_") || str.equals("last_cache_check_1") || str.startsWith("invite_shown_") || str.equals("accounts") || str.equals("push_token") || str.equals("new_messages") || str.startsWith("last_birthdays_1") || str.equals("video_cache_fixed") || str.equals("last_update_check") || str.equals("audio_id")) {
return;
}
Helper.reportStats(str, "settingsChange", null);
}
};
final Preference.OnPreferenceClickListener syncClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.startActivity(new Intent(Settings.this, SyncActivity.class));
return true;
}
};
final Preference.OnPreferenceClickListener micClick = new AnonymousClass23();
final Preference.OnPreferenceClickListener proxyClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.startActivity(new Intent(Settings.this, ProxyActivity.class));
return true;
}
};
final Preference.OnPreferenceChangeListener themeChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
String checkSystemTheme = ThemeSettingsHelper.checkSystemTheme(Settings.this, (String) obj);
int parseInt = Integer.parseInt(checkSystemTheme);
ListPreference listPreference = (ListPreference) preference;
listPreference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue(checkSystemTheme)]);
if (!NightThemeHelper.isNight(Settings.this)) {
BaseActivity.theme_id = checkSystemTheme;
BaseActivity.Theme = BaseActivity.GetThemeByValue(parseInt);
ColorTheme.getColorTheme().updateTheme(BaseActivity.Theme, checkSystemTheme);
BaseActivity.IsCustomTheme = ThemeSettingsHelper.getIsCustomTheme(checkSystemTheme, Settings.this);
Settings.this.displayRestartDialog();
}
Settings.this.updateEnabledThemeGeneralColor2();
if (Build.VERSION.SDK_INT >= 21) {
TaskDescriptionWrapper.resetTaskDescription();
return true;
}
return true;
}
};
private final Preference.OnPreferenceChangeListener birthdaysChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (!((Boolean) obj).booleanValue()) {
BirthdayService.cancel(Settings.this);
return true;
}
BirthdayService.scheduleForced(Settings.this);
BirthdayService.startService(Settings.this);
return true;
}
};
final Preference.OnPreferenceChangeListener restartListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings.this.displayRestartDialog();
return true;
}
};
final Preference.OnPreferenceChangeListener pushChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
try {
if (((Boolean) obj).booleanValue()) {
Settings.this.turnPushOn();
return true;
}
Settings.this.turnPushOff();
return true;
} catch (Throwable th) {
Helper.reportError(th);
th.printStackTrace();
return false;
}
}
};
final Preference.OnPreferenceClickListener clearFileCacheClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new Thread() {
@Override
public void run() {
KApplication.getImageLoader().clearFileCache();
Log.i("Kate.Settings", "clearFileCache complete");
}
}.start();
new AlertDialog.Builder(Settings.this).setMessage(R.string.clear_file_cache_message).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).create().show();
return true;
}
};
final Preference.OnPreferenceClickListener aboutClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
Settings.this.aboutClick();
return true;
} catch (Throwable th) {
th.printStackTrace();
Helper.reportError(th);
return true;
}
}
};
private int count = 0;
private final Preference.OnPreferenceClickListener blockPasswordClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(Settings.this, BlockActivity.class);
intent.putExtra("change_block_password", true);
Settings.this.startActivity(intent);
return true;
}
};
final Preference.OnPreferenceClickListener clearDataCacheClick = new AnonymousClass35();
final Preference.OnPreferenceClickListener bannedNewsClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.startActivity(new Intent(Settings.this, BannedActivity.class));
return true;
}
};
private int secret2_count = 0;
final Preference.OnPreferenceClickListener onSendEnterClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.clickEasterEgg2();
return false;
}
};
private final Preference.OnPreferenceClickListener sleep_mode_startClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int[] startTime = SleepModeHelper.getStartTime(Settings.this);
TimePickerDialog timePickerDialog = new TimePickerDialog(Settings.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i2) {
SleepModeHelper.saveStartTime(Settings.this, i, i2);
Settings.this.sleep_mode_start.setSummary(SleepModeHelper.getStringTime(SleepModeHelper.getStartTime(Settings.this)));
}
}, startTime[0], startTime[1], true);
timePickerDialog.setTitle(R.string.label_sleep_mode_start);
timePickerDialog.show();
return true;
}
};
private final Preference.OnPreferenceClickListener sleep_mode_endClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int[] endTime = SleepModeHelper.getEndTime(Settings.this);
TimePickerDialog timePickerDialog = new TimePickerDialog(Settings.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i2) {
SleepModeHelper.saveEndTime(Settings.this, i, i2);
Settings.this.sleep_mode_end.setSummary(SleepModeHelper.getStringTime(SleepModeHelper.getEndTime(Settings.this)));
}
}, endTime[0], endTime[1], true);
timePickerDialog.setTitle(R.string.label_sleep_mode_end);
timePickerDialog.show();
return true;
}
};
final Preference.OnPreferenceClickListener groupClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(Settings.this, GroupTopicsActivity.class);
intent.putExtra("com.perm.kate.gid", "26062647");
Settings.this.startActivity(intent);
return true;
}
};
final Preference.OnPreferenceClickListener faqClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Helper.showWebActivity("https://vk.com/pages?oid=-26062647&p=faq", null, Settings.this);
return true;
}
};
final Preference.OnPreferenceClickListener reformalClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Helper.openUrlInBrowser("http://kate-mobile.reformal.ru", Settings.this);
return true;
}
};
final Preference.OnPreferenceClickListener logClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setClass(Settings.this, SendLogActivity.class);
Settings.this.startActivity(intent);
return true;
}
};
final Preference.OnPreferenceClickListener ledColorClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setClass(Settings.this, ColorPickerActivity.class);
intent.putExtra("com.perm.kate.default_color", Settings.getLedColor(Settings.this));
intent.putExtra("com.perm.kate.is_led", true);
Settings.this.startActivityForResult(intent, 2003);
return true;
}
};
final Preference.OnPreferenceClickListener photoSaveDirClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!PhotoSaver.isScopedStorage() && ContextCompat.checkSelfPermission(Settings.this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(Settings.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 3);
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
View inflate = LayoutInflater.from(Settings.this).inflate(R.layout.photo_save_dir_dialog, (ViewGroup) null);
Settings.this.photo_input = (EditText) inflate.findViewById(R.id.editText);
Settings.this.photo_input.setText(PhotoSaver.getSaveDir().getAbsolutePath());
Button button = (Button) inflate.findViewById(R.id.btnSelect);
button.setVisibility(0);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Settings.this, FileManager.class);
intent.putExtra("select_folder", true);
intent.putExtra("default_dir_name", "KatePhotos");
Settings.this.startActivityForResult(intent, 2012);
}
});
builder.setView(inflate);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
String obj = Settings.this.photo_input.getText().toString();
if (!TextUtils.isEmpty(obj)) {
File file = new File(obj);
file.mkdirs();
if (!file.exists()) {
Toast.makeText(KApplication.current, (int) R.string.incorrect_path, 1).show();
return;
}
}
PreferenceManager.getDefaultSharedPreferences(KApplication.current).edit().putString("photo_save_dir", obj).apply();
}
});
builder.setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return true;
}
};
final Preference.OnPreferenceClickListener audioCacheDirClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
View inflate = LayoutInflater.from(Settings.this).inflate(R.layout.audio_cache_dir_dialog, (ViewGroup) null);
Settings.this.audio_input = (EditText) inflate.findViewById(R.id.editText);
Settings.this.audio_input.setText(AudioCache.getCacheDir().getAbsolutePath());
Button button = (Button) inflate.findViewById(R.id.btnSelect);
button.setVisibility(0);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Settings.this, FileManager.class);
intent.putExtra("select_folder", true);
intent.putExtra("default_dir_name", "audio_cache");
Settings.this.startActivityForResult(intent, 2011);
}
});
builder.setView(inflate);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
String obj = Settings.this.audio_input.getText().toString();
if (!TextUtils.isEmpty(obj)) {
File file = new File(obj);
file.mkdirs();
if (!file.exists()) {
Toast.makeText(KApplication.current, (int) R.string.incorrect_path, 1).show();
return;
}
}
PreferenceManager.getDefaultSharedPreferences(KApplication.current).edit().putString("audio_cache_dir", obj).apply();
}
});
builder.setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return true;
}
};
final Preference.OnPreferenceClickListener videoCacheDirClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!PhotoSaver.isScopedStorage() && ContextCompat.checkSelfPermission(Settings.this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(Settings.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 2);
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
View inflate = LayoutInflater.from(Settings.this).inflate(R.layout.audio_cache_dir_dialog, (ViewGroup) null);
Settings.this.video_input = (EditText) inflate.findViewById(R.id.editText);
Settings.this.video_input.setText(VideoCache.getCacheDir().getAbsolutePath());
Button button = (Button) inflate.findViewById(R.id.btnSelect);
button.setVisibility(0);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Settings.this, FileManager.class);
intent.putExtra("select_folder", true);
intent.putExtra("default_dir_name", "video_cache");
Settings.this.startActivityForResult(intent, 2013);
}
});
builder.setView(inflate);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
String obj = Settings.this.video_input.getText().toString();
if (!TextUtils.isEmpty(obj)) {
File file = new File(obj);
file.mkdirs();
if (!file.exists()) {
Toast.makeText(KApplication.current, (int) R.string.incorrect_path, 1).show();
return;
}
}
PreferenceManager.getDefaultSharedPreferences(KApplication.current).edit().putString("video_cache_dir", obj).apply();
VideoCache.fixCacheIfRequired(true);
}
});
builder.setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return true;
}
};
final Preference.OnPreferenceChangeListener runningNotificationChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
RunningNotification.display();
return true;
}
RunningNotification.cancel();
return true;
}
};
final Preference.OnPreferenceClickListener custom_theme_onPreferenceClickListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.setGeneralColorValues();
return false;
}
};
final ColorPickerPreference.OnColorChangedListener general_colors_ChangedListener = new ColorPickerPreference.OnColorChangedListener() {
@Override
public void colorChanged(int i) {
Settings.this.getGeneralColorValues();
BaseActivity.IsCustomTheme = ThemeSettingsHelper.getIsCustomTheme(Settings.this);
if (Build.VERSION.SDK_INT >= 21) {
TaskDescriptionWrapper.resetTaskDescription();
}
Settings.this.displayRestartDialog();
}
};
private final Preference.OnPreferenceClickListener colors_reset_onPreferenceClickListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
ThemeSettingsHelper.resetCustomTheme(Settings.this);
ColorTheme.getColorTheme().resetColor();
BaseActivity.IsCustomTheme = ThemeSettingsHelper.getIsCustomTheme(Settings.this);
Settings.this.setGeneralColorValues();
Settings.this.displayRestartDialog();
return true;
}
};
private final Preference.OnPreferenceClickListener chatBackgroundListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
Intent intent = new Intent("android.intent.action.PICK", MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
Settings.this.startActivityForResult(intent, 2004);
return true;
} catch (Throwable th) {
th.printStackTrace();
Helper.reportError(th);
return true;
}
}
};
private final Preference.OnPreferenceClickListener backgroundListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
try {
Intent intent = new Intent("android.intent.action.PICK", MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
Settings.this.startActivityForResult(intent, 2006);
return true;
} catch (Throwable th) {
th.printStackTrace();
Helper.reportError(th);
return true;
}
}
};
private final Preference.OnPreferenceClickListener changePasswordClickListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setClass(Settings.this, ChangePasswordActivity.class);
Settings.this.startActivity(intent);
return true;
}
};
private final Preference.OnPreferenceClickListener blackListClickListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setClass(Settings.this, BlackListActivity.class);
Settings.this.startActivity(intent);
return true;
}
};
private final Preference.OnPreferenceClickListener silentModeClickListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (SilentMode.isEnabled()) {
Settings.this.resetSilentMode();
return true;
}
Settings.this.showSilenceDialog();
return true;
}
};
private final Preference.OnPreferenceClickListener privacySettingsClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent();
intent.setClass(Settings.this, PrivacyActivity.class);
Settings.this.startActivity(intent);
return true;
}
};
private final Preference.OnPreferenceChangeListener roundAvaChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
KApplication.getImageLoader().clearMemoryCache();
return true;
}
};
private final Preference.OnPreferenceChangeListener wideAvaChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
KApplication.getImageLoader().clearMemoryCache();
return true;
}
};
final Preference.OnPreferenceClickListener updateClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
UpdateChecker.checkOnThread(Settings.this, true, true);
return true;
}
};
private final Preference.OnPreferenceChangeListener deprecatedListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (obj.equals(Boolean.FALSE)) {
Settings.this.displayDeprecatedDialog();
return true;
}
return true;
}
};
private final Preference.OnPreferenceChangeListener deprecatedListener1 = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (obj.equals("0")) {
Settings.this.displayDeprecatedDialog();
return true;
}
return true;
}
};
private final Preference.OnPreferenceChangeListener deprecatedListener2 = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (obj.equals("1")) {
Settings.this.displayDeprecatedDialog();
return true;
}
return true;
}
};
final Preference.OnPreferenceChangeListener imageCacheSizeChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
ListPreference listPreference = (ListPreference) preference;
listPreference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue((String) obj)]);
PreferenceManager.getDefaultSharedPreferences(Settings.this).edit().putLong("last_cache_check_1", System.currentTimeMillis() - 86400000).apply();
Helper.cleanup(Settings.this);
return true;
}
};
final Preference.OnPreferenceClickListener dashLinksClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.startActivity(new Intent(Settings.this, DashConfigActivity.class));
return true;
}
};
private final Preference.OnPreferenceChangeListener spamNewsListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
SpamHelper.setHideSpamEnabled(((Boolean) obj).booleanValue());
return true;
}
};
private final Preference.OnPreferenceChangeListener spamNewsWordsListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
SpamHelper.resetWordsCache();
return true;
}
};
final Preference.OnPreferenceChangeListener nightThemeChangeListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
ListPreference listPreference = (ListPreference) preference;
listPreference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue((String) obj)]);
return true;
}
};
private final Preference.OnPreferenceClickListener night_startClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
int[] startTime = NightThemeHelper.getStartTime(Settings.this);
TimePickerDialog timePickerDialog = new TimePickerDialog(Settings.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i2) {
NightThemeHelper.saveStartTime(Settings.this, i, i2);
preference.setSummary(SleepModeHelper.getStringTime(NightThemeHelper.getStartTime(Settings.this)));
}
}, startTime[0], startTime[1], true);
timePickerDialog.setTitle(R.string.label_sleep_mode_start);
timePickerDialog.show();
return true;
}
};
private final Preference.OnPreferenceClickListener night_endClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
int[] endTime = NightThemeHelper.getEndTime(Settings.this);
TimePickerDialog timePickerDialog = new TimePickerDialog(Settings.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i2) {
NightThemeHelper.saveEndTime(Settings.this, i, i2);
preference.setSummary(SleepModeHelper.getStringTime(NightThemeHelper.getEndTime(Settings.this)));
}
}, endTime[0], endTime[1], true);
timePickerDialog.setTitle(R.string.label_sleep_mode_end);
timePickerDialog.show();
return true;
}
};
private final Preference.OnPreferenceChangeListener musicTimerListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if ("".equals(obj)) {
return false;
}
int parseInt = Integer.parseInt((String) obj);
MusicTimer.startTimer(parseInt);
preference.setSummary(Settings.this.getString(R.string.audio_timer_summary, Integer.valueOf(parseInt)));
return true;
}
};
private final Preference.OnPreferenceClickListener changeHiddenMessagesPasswordListener = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
View inflate = LayoutInflater.from(Settings.this).inflate(R.layout.hidden_chat_change_pin_dialog, (ViewGroup) null);
final EditText editText = (EditText) inflate.findViewById(R.id.editText1);
final EditText editText2 = (EditText) inflate.findViewById(R.id.editText2);
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
builder.setView(inflate);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
String obj = editText.getText().toString();
String obj2 = editText2.getText().toString();
if (!obj.equals(HiddenChats.getPin())) {
Toast.makeText(Settings.this, (int) R.string.incorrect_pin, 1).show();
} else if (TextUtils.isEmpty(obj2)) {
Toast.makeText(Settings.this, (int) R.string.incorrect_pin, 1).show();
} else {
HiddenChats.setPin(obj2);
Toast.makeText(Settings.this, (int) R.string.done, 1).show();
}
}
});
builder.setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return true;
}
};
private final Preference.OnPreferenceChangeListener smilesVkListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
SmileHelper.replaceVkSmiles(((Boolean) obj).booleanValue());
return true;
}
};
private final Preference.OnPreferenceChangeListener blurListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
KApplication.getImageLoader().memoryCache.remove("[app_background]");
return true;
}
};
final Preference.OnPreferenceClickListener exportClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!PhotoSaver.isScopedStorage() && ContextCompat.checkSelfPermission(Settings.this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(Settings.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 4);
return true;
}
if (SettingsBackup.backup()) {
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
builder.setMessage(Settings.this.getString(R.string.settings_saved) + " " + SettingsBackup.getSettingsDir().getAbsolutePath()).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).show();
} else {
Application application = KApplication.current;
Toast.makeText(application, ((Object) Settings.this.getText(R.string.error)) + ". Убедитесть что в папке " + SettingsBackup.getSettingsDir() + " пусто прежде чем сохранять настройки.", 1).show();
}
return true;
}
};
final Preference.OnPreferenceClickListener importClick = new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!PhotoSaver.isScopedStorage() && ContextCompat.checkSelfPermission(Settings.this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(Settings.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 5);
return true;
}
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
builder.setMessage(Settings.this.getString(R.string.settings_will_be_restored) + " " + SettingsBackup.getRestoreDir().getAbsolutePath());
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (SettingsBackup.restore()) {
Settings.this.displayRestartDialog();
} else {
Toast.makeText(KApplication.current, (int) R.string.error, 1).show();
}
}
});
builder.setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return true;
}
};
private final Preference.OnPreferenceChangeListener cameraSaveChange = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (!((Boolean) obj).booleanValue() || PhotoSaver.isScopedStorage() || ContextCompat.checkSelfPermission(Settings.this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
return true;
}
ActivityCompat.requestPermissions(Settings.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1);
return false;
}
};
class AnonymousClass23 implements Preference.OnPreferenceClickListener {
AnonymousClass23() {
}
public static void lambda$onPreferenceClick$0(ArrayList arrayList, DialogInterface dialogInterface, int i) {
Settings.setPrefferedMic(((Integer) arrayList.get(i)).intValue());
dialogInterface.dismiss();
}
@Override
public boolean onPreferenceClick(Preference preference) {
AudioDeviceInfo[] devices;
int type;
String address;
int id;
ArrayList arrayList = new ArrayList();
final ArrayList arrayList2 = new ArrayList();
arrayList.add("default");
arrayList2.add(-1);
devices = ((AudioManager) Settings.this.getSystemService("audio")).getDevices(1);
for (AudioDeviceInfo audioDeviceInfo : devices) {
type = audioDeviceInfo.getType();
if (type == 15) {
address = audioDeviceInfo.getAddress();
arrayList.add(address);
id = audioDeviceInfo.getId();
arrayList2.add(Integer.valueOf(id));
}
}
new AlertDialog.Builder(Settings.this).setSingleChoiceItems((CharSequence[]) arrayList.toArray(new CharSequence[0]), arrayList2.indexOf(Integer.valueOf(Settings.getPrefferedMic())), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Settings.AnonymousClass23.lambda$onPreferenceClick$0(arrayList2, dialogInterface, i);
}
}).setNegativeButton(R.string.label_cancel, (DialogInterface.OnClickListener) null).create().show();
return true;
}
}
class AnonymousClass35 implements Preference.OnPreferenceClickListener {
AnonymousClass35() {
}
@Override
public boolean onPreferenceClick(Preference preference) {
Settings settings = Settings.this;
final ProgressDialog show = ProgressDialog.show(settings, "", settings.getText(R.string.please_wait));
new Thread() {
@Override
public void run() {
Log.i("Kate.Settings", "clearDataCache start");
KApplication.db.clearCache();
Log.i("Kate.Settings", "clearDataCache complete");
FriendsFragment.setLastRefreshedDate(0L);
Settings.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (Settings.this.isFinishing()) {
return;
}
show.dismiss();
Settings.this.displayRestartDialog();
}
});
}
}.start();
return true;
}
}
public class AnonymousClass80 implements Preference.OnPreferenceClickListener {
AnonymousClass80() {
}
@Override
public boolean onPreferenceClick(Preference preference) {
new AlertDialog.Builder(Settings.this).setTitle(R.string.please_confirm).setMessage(R.string.reset_notifications).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
Utils.resetChannels();
}
}).setNegativeButton(R.string.no, (DialogInterface.OnClickListener) null).create().show();
return true;
}
}
public void aboutClick() {
View inflate = LayoutInflater.from(this).inflate(R.layout.about, (ViewGroup) null);
TextView textView = (TextView) inflate.findViewById(R.id.version_text);
textView.setText(getString(R.string.text_about, Helper.getVersion()));
TextView textView2 = (TextView) inflate.findViewById(R.id.privacy);
textView2.setText(Html.fromHtml("<a href=\"http://katemobile.ru/privacy.html\">" + getString(R.string.privacy) + "</a>"));
textView2.setMovementMethod(LinkMovementMethod.getInstance());
TextView textView3 = (TextView) inflate.findViewById(R.id.terms);
textView3.setText(Html.fromHtml("<a href=\"https://vk.com/terms\">VK Terms of Service</a>"));
textView3.setMovementMethod(LinkMovementMethod.getInstance());
new AlertDialog.Builder(this).setView(inflate).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).create().show();
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Settings.this.clickEasterEgg();
}
});
Log.i("Kate.Settings", "s: " + Helper.getSigHash());
}
private void checkPreferencesForOreo() {
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("key_customize_notifications");
PreferenceScreen preferenceScreen2 = (PreferenceScreen) findPreference("key_notification_channels");
if (Build.VERSION.SDK_INT < 26) {
preferenceScreen.removePreference(preferenceScreen2);
preferenceScreen.removePreference(findPreference("key_notifications_reset"));
return;
}
preferenceScreen.removePreference(findPreference("key_notify_vibration"));
preferenceScreen.removePreference(findPreference("key_notify_led"));
preferenceScreen.removePreference(findPreference(getText(R.string.key_notify_sound_default)));
preferenceScreen.removePreference(findPreference(getText(R.string.key_notify_sound)));
preferenceScreen.removePreference(findPreference(getText(R.string.key_notify_ringtone)));
preferenceScreen.removePreference(findPreference("headsup_notifications"));
preferenceScreen2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Settings.this.openAllChannels();
return true;
}
});
findPreference("key_notifications_reset").setOnPreferenceClickListener(new AnonymousClass80());
}
public void clickEasterEgg() {
showLeaks();
int i = this.count + 1;
this.count = i;
if (i == 7) {
Toast.makeText(this, (int) R.string.toast_congratulation_easter_egg1, 1).show();
ProfileFragment.showNewMessage(KApplication.session.getMid(), this);
this.count = 0;
}
}
public void clickEasterEgg2() {
int i = this.secret2_count + 1;
this.secret2_count = i;
if (i == 7) {
boolean z = !Helper.footerAddButtonEnabled(this);
Toast.makeText(this, z ? R.string.toast_easter_egg2_1 : R.string.toast_easter_egg2_2, 1).show();
Helper.setFooterAddButtonEnabled(this, z);
this.secret2_count = 0;
}
}
public void displayDeprecatedDialog() {
new AlertDialog.Builder(this).setMessage(R.string.option_deprecated).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).show();
}
public void displayRestartDialog() {
Toast.makeText(KApplication.current, (int) R.string.theme_restart, 1).show();
}
public void getGeneralColorValues() {
int editableColorCount = ThemeColorsHelper.getEditableColorCount(BaseActivity.Theme);
int[] iArr = new int[editableColorCount];
iArr[0] = this.key_theme_general_color1.getValue();
if (editableColorCount > 1) {
iArr[1] = this.key_theme_general_color2.getValue();
}
ColorTheme.getColorTheme().setColors(iArr);
}
public static int getLedColor(Context context) {
try {
return PreferenceManager.getDefaultSharedPreferences(context).getInt(context.getString(R.string.key_notify_led_color), -16096092);
} catch (Throwable unused) {
return -16096092;
}
}
public static int getPrefferedMic() {
return PreferenceManager.getDefaultSharedPreferences(KApplication.current).getInt("mic", -1);
}
public void openAllChannels() {
Intent intent = new Intent("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName());
startActivity(intent);
}
public void resetNotificationsAlert() {
if (Build.VERSION.SDK_INT < 26) {
return;
}
new AlertDialog.Builder(this).setMessage(R.string.reset_to_apply).setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null).show();
}
public void resetSilentMode() {
SilentMode.saveSilentValue(0L);
this.silence_mode.setSummary(SilentMode.getSilentSummary());
}
public void setEnabledCardStyleNews(boolean z) {
this.card_style_news.setEnabled(!z);
}
public void setGeneralColorValues() {
int[] Colors = ColorTheme.getColorTheme().Colors();
this.key_theme_general_color1.forceSetValue(Colors[0]);
if (Colors.length > 1) {
this.key_theme_general_color2.forceSetValue(Colors[1]);
} else {
this.key_theme_general_color2.forceSetValue(-16777216);
}
}
private void setLedColor(int i) {
PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(getString(R.string.key_notify_led_color), i).apply();
}
public static void setPrefferedMic(int i) {
PreferenceManager.getDefaultSharedPreferences(KApplication.current).edit().putInt("mic", i).apply();
}
private void showLeaks() {
}
public void showSilenceDialog() {
new AlertDialog.Builder(this).setItems(new CharSequence[]{getText(R.string.str_silent_mode0), getText(R.string.str_silent_mode1), getText(R.string.str_silent_mode2), getText(R.string.str_silent_mode4), getText(R.string.str_silent_mode8)}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == 0) {
Settings.this.startSilentMode(1800);
} else if (i == 1) {
Settings.this.startSilentMode(3600);
} else if (i == 2) {
Settings.this.startSilentMode(7200);
} else if (i == 3) {
Settings.this.startSilentMode(14400);
} else if (i == 4) {
Settings.this.startSilentMode(28800);
}
}
}).show();
}
public void startSilentMode(int i) {
SilentMode.saveSilentValue(System.currentTimeMillis() + (i * 1000));
this.silence_mode.setSummary(SilentMode.getSilentSummary());
}
public void turnPushOff() {
new Thread() {
@Override
public void run() {
Iterator it = KApplication.sessions.iterator();
while (it.hasNext()) {
final Session session = (Session) it.next();
session.unregisterDevice(Helper.installation_id(), new Callback(Settings.this) {
@Override
public void ready(Object obj) {
session.getAccount().push_registered = false;
KApplication.accountManager.saveAccounts();
}
}, Settings.this);
}
}
}.start();
Push.gotNewToken(null);
Push.resetRetryInterval();
PushService.cancelRetry(this);
}
public void turnPushOn() {
PushService.startService(this);
}
public void updateEnabledThemeGeneralColor2() {
ColorPickerPreference colorPickerPreference = this.key_theme_general_color2;
if (colorPickerPreference != null) {
colorPickerPreference.setEnabled(ThemeColorsHelper.isMaterial(BaseActivity.Theme));
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
EditText editText;
EditText editText2;
EditText editText3;
super.onActivityResult(i, i2, intent);
if (i == 2005 && i2 == -1) {
try {
int intExtra = intent.getIntExtra("com.perm.kate.color_selected", ColorTheme.getColorTheme().Colors()[0]);
String stringExtra = intent.getStringExtra("com.perm.kate.key_preference");
if (stringExtra != null) {
((ColorPickerPreference) findPreference(stringExtra)).onSettingsActivityResult(intExtra);
}
} catch (Throwable th) {
th.printStackTrace();
Helper.reportError(th);
return;
}
}
if (i == 2003 && i2 == -1) {
setLedColor(intent.getIntExtra("com.perm.kate.color_selected", -16096092));
resetNotificationsAlert();
}
if (i == 2004 && i2 == -1) {
PreferenceManager.getDefaultSharedPreferences(this).edit().putString("key_chat_background", MessageThreadBackground.makeLocalCopy(intent.getData(), null).toString()).apply();
KApplication.getImageLoader().memoryCache.remove("[message_thread_background]");
}
if (i == 2006 && i2 == -1) {
PreferenceManager.getDefaultSharedPreferences(this).edit().putString("key_background", AppBackground.makeLocalCopy(intent.getData()).toString()).apply();
KApplication.getImageLoader().memoryCache.remove("[app_background]");
}
if (i == 2011 && i2 == -1 && (editText3 = this.audio_input) != null) {
editText3.setText(intent.getStringExtra("path"));
}
if (i == 2012 && i2 == -1 && (editText2 = this.photo_input) != null) {
editText2.setText(intent.getStringExtra("path"));
}
if (i == 2013 && i2 == -1 && (editText = this.video_input) != null) {
editText.setText(intent.getStringExtra("path"));
}
}
@Override
protected void onCreate(Bundle bundle) {
PreferenceGroup parent;
PreferenceGroup parent2;
int i = Build.VERSION.SDK_INT;
if (i >= 21) {
setTheme(ThemeColorsHelper.isLightTheme() ? 16974391 : 16974372);
} else {
setTheme(16973931);
}
super.onCreate(bundle);
LeakDetector.getInstance().monitorObject(this);
BaseActivity.reportActivityCreate(getClass().getName());
addPreferencesFromResource(R.xml.preferences);
ListPreference listPreference = (ListPreference) findPreference("key_notify_interval");
listPreference.setSummary(listPreference.getEntry());
listPreference.setOnPreferenceChangeListener(this.intervalChange);
findPreference(getText(R.string.key_autoupdate)).setOnPreferenceChangeListener(this.updateChange);
findPreference("camera_save_1").setOnPreferenceChangeListener(this.cameraSaveChange);
findPreference(getText(R.string.key_images)).setOnPreferenceChangeListener(this.imagesChange);
ListPreference listPreference2 = (ListPreference) findPreference(getText(R.string.key_first_tab));
listPreference2.setSummary(listPreference2.getEntry());
listPreference2.setOnPreferenceChangeListener(this.firstTabChange);
((CheckBoxPreference) findPreference(getText(R.string.key_news_post))).setOnPreferenceChangeListener(this.newsFilterChange);
((CheckBoxPreference) findPreference(getText(R.string.key_news_photo))).setOnPreferenceChangeListener(this.newsFilterChange);
((CheckBoxPreference) findPreference(getText(R.string.key_news_photo_tag))).setOnPreferenceChangeListener(this.newsFilterChange);
((CheckBoxPreference) findPreference(getText(R.string.key_news_friend))).setOnPreferenceChangeListener(this.newsFilterChange);
((ListPreference) findPreference(getText(R.string.key_long_pull))).setOnPreferenceChangeListener(this.long_pullChange);
ListPreference listPreference3 = (ListPreference) findPreference(getText(R.string.key_online));
listPreference3.setSummary(listPreference3.getEntry());
listPreference3.setOnPreferenceChangeListener(this.onlineChange);
ListPreference listPreference4 = (ListPreference) findPreference(getText(R.string.key_hd_quality_video));
listPreference4.setSummary(listPreference4.getEntry());
listPreference4.setOnPreferenceChangeListener(this.key_hd_quality_videoChange);
findPreference("sync_contacts").setOnPreferenceClickListener(this.syncClick);
findPreference("proxy").setOnPreferenceClickListener(this.proxyClick);
Preference findPreference = findPreference("mic_pref");
if (i < 28) {
((PreferenceGroup) findPreference("advanced")).removePreference(findPreference);
} else {
findPreference.setOnPreferenceClickListener(this.micClick);
}
findPreference("clear_file_cache").setOnPreferenceClickListener(this.clearFileCacheClick);
findPreference("export").setOnPreferenceClickListener(this.exportClick);
findPreference("import").setOnPreferenceClickListener(this.importClick);
ListPreference listPreference5 = (ListPreference) findPreference("key_theme");
listPreference5.setOnPreferenceChangeListener(this.themeChangeListener);
listPreference5.setSummary(listPreference5.getEntry());
findPreference(getText(R.string.key_notify_birthdays)).setOnPreferenceChangeListener(this.birthdaysChange);
findPreference(getText(R.string.key_font_size)).setOnPreferenceChangeListener(this.restartListener);
findPreference(getText(R.string.key_push_notifications)).setOnPreferenceChangeListener(this.pushChange);
findPreference("about").setOnPreferenceClickListener(this.aboutClick);
Preference findPreference2 = findPreference("key_profile_tab");
findPreference2.setOnPreferenceChangeListener(this.deprecatedListener2);
if (KApplication.isTabletUi) {
findPreference2.setEnabled(false);
}
findPreference("change_block_password").setOnPreferenceClickListener(this.blockPasswordClick);
findPreference("clear_data_cache").setOnPreferenceClickListener(this.clearDataCacheClick);
findPreference("key_banned_news").setOnPreferenceClickListener(this.bannedNewsClick);
findPreference("key_send_on_enter").setOnPreferenceClickListener(this.onSendEnterClick);
CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference(getText(R.string.key_notify_sound));
this.notify_sound = checkBoxPreference;
checkBoxPreference.setOnPreferenceChangeListener(this.notify_soundChangeListener);
CheckBoxPreference checkBoxPreference2 = (CheckBoxPreference) findPreference(getText(R.string.key_notify_sound_default));
this.notify_sound_default = checkBoxPreference2;
checkBoxPreference2.setOnPreferenceChangeListener(this.notify_sound_defaultChangeListener);
RingtonePreference ringtonePreference = (RingtonePreference) findPreference(getText(R.string.key_notify_ringtone));
this.notify_ringtone = ringtonePreference;
ringtonePreference.setEnabled(this.notify_sound.isChecked() && !this.notify_sound_default.isChecked());
Preference findPreference3 = getPreferenceScreen().findPreference(getString(R.string.key_sleep_mode_start));
this.sleep_mode_start = findPreference3;
findPreference3.setOnPreferenceClickListener(this.sleep_mode_startClick);
this.sleep_mode_start.setSummary(SleepModeHelper.getStringTime(SleepModeHelper.getStartTime(this)));
Preference findPreference4 = getPreferenceScreen().findPreference(getString(R.string.key_sleep_mode_end));
this.sleep_mode_end = findPreference4;
findPreference4.setOnPreferenceClickListener(this.sleep_mode_endClick);
this.sleep_mode_end.setSummary(SleepModeHelper.getStringTime(SleepModeHelper.getEndTime(this)));
if (KApplication.isTabletUi) {
findPreference("key_main_tabs").setEnabled(false);
}
findPreference("key_news_tab").setOnPreferenceChangeListener(this.restartListener);
findPreference(getText(R.string.key_friends_button)).setOnPreferenceChangeListener(this.restartListener);
findPreference("key_show_tabs").setOnPreferenceChangeListener(this.restartListener);
findPreference("feedback_group").setOnPreferenceClickListener(this.groupClick);
findPreference("feedback_faq").setOnPreferenceClickListener(this.faqClick);
findPreference("feedback_reformal").setOnPreferenceClickListener(this.reformalClick);
findPreference("feedback_log").setOnPreferenceClickListener(this.logClick);
findPreference(getText(R.string.key_notify_led_color)).setOnPreferenceClickListener(this.ledColorClick);
findPreference("photo_save_dir_virtual").setOnPreferenceClickListener(this.photoSaveDirClick);
findPreference("audio_cache_dir_virtual").setOnPreferenceClickListener(this.audioCacheDirClick);
findPreference("video_cache_dir_virtual").setOnPreferenceClickListener(this.videoCacheDirClick);
Preference findPreference5 = findPreference("key_force_phone_ui");
findPreference5.setOnPreferenceChangeListener(this.restartListener);
if (!KApplication.isTablet) {
((PreferenceGroup) findPreference("key_ui")).removePreference(findPreference5);
}
findPreference("running_notification").setOnPreferenceChangeListener(this.runningNotificationChange);
CheckBoxPreference checkBoxPreference3 = (CheckBoxPreference) findPreference(getText(R.string.key_old_style_news));
checkBoxPreference3.setOnPreferenceChangeListener(this.oldStyleNewsChange);
CheckBoxPreference checkBoxPreference4 = (CheckBoxPreference) findPreference(getText(R.string.key_card_style_news));
this.card_style_news = checkBoxPreference4;
checkBoxPreference4.setOnPreferenceChangeListener(this.restartListener);
setEnabledCardStyleNews(checkBoxPreference3.isChecked());
((PreferenceScreen) findPreference("key_custom_theme_colors")).setOnPreferenceClickListener(this.custom_theme_onPreferenceClickListener);
((PreferenceScreen) findPreference("key_custom_theme_colors_reset")).setOnPreferenceClickListener(this.colors_reset_onPreferenceClickListener);
findPreference("key_language").setOnPreferenceChangeListener(this.restartListener);
findPreference("key_chat_background").setOnPreferenceClickListener(this.chatBackgroundListener);
ColorPickerPreference colorPickerPreference = (ColorPickerPreference) findPreference("key_theme_general_color1");
this.key_theme_general_color1 = colorPickerPreference;
colorPickerPreference.setOnColorChangedListener(this.general_colors_ChangedListener);
if (i < 21) {
((PreferenceGroup) findPreference("key_customize_notifications")).removePreference(findPreference("headsup_notifications"));
} else if (i >= 29) {
parent = findPreference("key_popup_reply").getParent();
parent2 = parent.getParent();
parent2.removePreference(parent);
} else {
((CheckBoxPreference) findPreference("key_popup_reply")).setOnPreferenceChangeListener(this.popupReplyChangedListener);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("key_popup_reply", false)) {
findPreference("headsup_notifications").setEnabled(false);
}
}
if (i != 19) {
((PreferenceGroup) findPreference("key_ui")).removePreference(findPreference("translucent_status"));
}
ColorPickerPreference colorPickerPreference2 = (ColorPickerPreference) findPreference("key_theme_general_color2");
this.key_theme_general_color2 = colorPickerPreference2;
colorPickerPreference2.setOnColorChangedListener(this.general_colors_ChangedListener);
updateEnabledThemeGeneralColor2();
findPreference("change_password").setOnPreferenceClickListener(this.changePasswordClickListener);
findPreference("black_list").setOnPreferenceClickListener(this.blackListClickListener);
findPreference("key_banned_news2").setOnPreferenceClickListener(this.bannedNewsClick);
Preference findPreference6 = findPreference("key_silent_mode");
this.silence_mode = findPreference6;
findPreference6.setOnPreferenceClickListener(this.silentModeClickListener);
this.silence_mode.setSummary(SilentMode.getSilentSummary());
findPreference("key_privacy_settings").setOnPreferenceClickListener(this.privacySettingsClick);
findPreference("key_round_ava").setOnPreferenceChangeListener(this.roundAvaChange);
findPreference("key_wide_ava").setOnPreferenceChangeListener(this.wideAvaChange);
findPreference("key_update").setOnPreferenceClickListener(this.updateClick);
findPreference("key_reverse_message_2").setOnPreferenceChangeListener(this.deprecatedListener);
findPreference("key_messages_reverse_2").setOnPreferenceChangeListener(this.deprecatedListener1);
findPreference("news_click_key_4").setOnPreferenceChangeListener(this.deprecatedListener2);
findPreference("key_messages_in_bubbles_2").setOnPreferenceChangeListener(this.deprecatedListener);
ListPreference listPreference6 = (ListPreference) findPreference("image_cache_size_2");
listPreference6.setOnPreferenceChangeListener(this.imageCacheSizeChangeListener);
listPreference6.setSummary(listPreference6.getEntry());
if (KApplication.isTabletUi) {
findPreference("dash_links").setEnabled(false);
} else {
findPreference("dash_links").setOnPreferenceClickListener(this.dashLinksClick);
}
findPreference("key_hide_news_spam").setOnPreferenceChangeListener(this.spamNewsListener);
findPreference("new_spam_words").setOnPreferenceChangeListener(this.spamNewsWordsListener);
ListPreference listPreference7 = (ListPreference) findPreference("key_night_theme");
listPreference7.setOnPreferenceChangeListener(this.nightThemeChangeListener);
listPreference7.setSummary(listPreference7.getEntry());
Preference findPreference7 = getPreferenceScreen().findPreference("key_night_start");
findPreference7.setOnPreferenceClickListener(this.night_startClick);
findPreference7.setSummary(SleepModeHelper.getStringTime(NightThemeHelper.getStartTime(this)));
Preference findPreference8 = getPreferenceScreen().findPreference("key_night_end");
findPreference8.setOnPreferenceClickListener(this.night_endClick);
findPreference8.setSummary(SleepModeHelper.getStringTime(NightThemeHelper.getEndTime(this)));
Preference findPreference9 = findPreference("key_header_scroll");
if (i < 21) {
((PreferenceGroup) findPreference("key_news")).removePreference(findPreference9);
} else {
findPreference9.setOnPreferenceChangeListener(this.restartListener);
}
Preference findPreference10 = findPreference("key_audio_timer");
findPreference10.setOnPreferenceChangeListener(this.musicTimerListener);
if (MusicTimer.isTimerActive()) {
findPreference10.setSummary(getString(R.string.audio_timer_summary, Integer.valueOf(MusicTimer.getStopMinutes())));
}
findPreference("key_background").setOnPreferenceClickListener(this.backgroundListener);
findPreference("hidden_mess_change_pass").setOnPreferenceClickListener(this.changeHiddenMessagesPasswordListener);
CheckBoxPreference checkBoxPreference5 = (CheckBoxPreference) findPreference("key_unblock_by_fingerprint");
if (i < 23) {
((PreferenceGroup) findPreference("block_screen_pref")).removePreference(checkBoxPreference5);
} else if (FingerprintManager.isHardwareDetected(this)) {
checkBoxPreference5.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean booleanValue = ((Boolean) obj).booleanValue();
if (!booleanValue || FingerprintManager.hasEnrolledFingerprints(Settings.this)) {
if (!booleanValue || BlockActivity.hasBlockPassword(KApplication.current)) {
return true;
}
Toast.makeText(KApplication.current, (int) R.string.no_block_code_alert, 1).show();
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(Settings.this);
builder.setTitle(R.string.label_unblock_by_fingerprint);
builder.setMessage(R.string.register_one_fingerprint);
builder.setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null);
AlertDialog create = builder.create();
create.setCanceledOnTouchOutside(true);
create.show();
return false;
}
});
} else {
((PreferenceGroup) findPreference("block_screen_pref")).removePreference(checkBoxPreference5);
}
findPreference("smiles_vk").setOnPreferenceChangeListener(this.smilesVkListener);
findPreference("background_blur").setOnPreferenceChangeListener(this.blurListener);
findPreference(getString(R.string.key_vibration_length)).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
Settings.this.resetNotificationsAlert();
return true;
}
});
checkPreferencesForOreo();
findPreference("instant_read").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
PreferenceManager.getDefaultSharedPreferences(Settings.this).edit().putBoolean("key_close_unread", false).apply();
return true;
}
return true;
}
});
findPreference("key_close_unread").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) {
PreferenceManager.getDefaultSharedPreferences(Settings.this).edit().putBoolean("instant_read", false).apply();
return true;
}
return true;
}
});
if (!PlaybackService.useExo()) {
((PreferenceGroup) findPreference("advanced")).removePreference(findPreference("exo"));
}
findPreference("regular_info").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Helper.showWebActivity("http://vk.com/pages?oid=-26062647&p=regular", null, Settings.this);
return false;
}
});
findPreference("push_info").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Helper.showWebActivity("http://vk.com/pages?oid=-26062647&p=push", null, Settings.this);
return false;
}
});
findPreference("unread_info").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new AlertDialog.Builder(Settings.this).setMessage("Есть два варианта:\n\nВариант 1: Можно включить опцию \"Закрывать непрочитанными\". Тогда сообщения будут оставаться непрочитанными пока вы вручную не нажмёте Прочитано или не ответите в этот диалог.\n\nВариант 2: Можно не включать эту опцию. Тогда сообщения будут прочитыватся автоматически. Постоянно нажимать Прочитано не потребуется. Но если какой-то конкретный диалог вы захотите оставить непрочитанным, то вы его откроете и, пока сообщение ещё не помечено прочитанным, нажмёте Меню - Закрыть непрочитанным.").setPositiveButton(R.string.close, (DialogInterface.OnClickListener) null).create().show();
return false;
}
});
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
if (i == 1) {
if (iArr.length <= 0 || iArr[0] != 0) {
return;
}
((CheckBoxPreference) findPreference("camera_save_1")).setChecked(true);
} else if (i == 2) {
if (iArr.length <= 0 || iArr[0] != 0) {
return;
}
this.videoCacheDirClick.onPreferenceClick(null);
} else if (i == 3) {
if (iArr.length <= 0 || iArr[0] != 0) {
return;
}
this.photoSaveDirClick.onPreferenceClick(null);
} else if (i == 4) {
if (iArr.length <= 0 || iArr[0] != 0) {
return;
}
this.exportClick.onPreferenceClick(null);
} else if (i == 5 && iArr.length > 0 && iArr[0] == 0) {
this.importClick.onPreferenceClick(null);
}
}
@Override
public void onStart() {
super.onStart();
ActivityCounter.increment();
FlurryAgent.onStartSession(this, "LRLYCGYV2C3J627J66YD");
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this.changeListener);
}
@Override
public void onStop() {
super.onStop();
ActivityCounter.decrement();
FlurryAgent.onEndSession(this);
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this.changeListener);
}
}