正在查看: 北京退费客服端 v1.0.0 应用的 NoticeAndSoundSettingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 北京退费客服端 v1.0.0 应用的 NoticeAndSoundSettingActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package im.amwhusedvt.ui.settings;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MessagesController;
import im.amwhusedvt.messenger.MessagesStorage;
import im.amwhusedvt.messenger.NotificationsController;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.RequestDelegate;
import im.amwhusedvt.tgnet.TLObject;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.NotificationsSettingsActivity$NotificationException;
import im.amwhusedvt.ui.actionbar.ActionBar;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.BaseFragment;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.components.AlertsCreator;
import im.amwhusedvt.ui.components.toast.ToastUtils;
import im.amwhusedvt.ui.hviews.MrySwitch;
import java.util.ArrayList;
public class NoticeAndSoundSettingActivity extends BaseFragment {
private boolean reseting = false;
private ArrayList<NotificationsSettingsActivity$NotificationException> exceptionUsers = null;
private ArrayList<NotificationsSettingsActivity$NotificationException> exceptionChats = null;
private ArrayList<NotificationsSettingsActivity$NotificationException> exceptionChannels = null;
public boolean onFragmentCreate() {
MessagesController.getInstance(this.currentAccount).loadSignUpNotificationsSettings();
loadExceptions();
return super.onFragmentCreate();
}
private void loadExceptions() {
if ((4 + 13) % 13 <= 0) {
}
MessagesStorage.getInstance(this.currentAccount).getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
NoticeAndSoundSettingActivity.this.lambda$loadExceptions$1$NoticeAndSoundSettingActivity();
}
});
}
public void lambda$loadExceptions$1$NoticeAndSoundSettingActivity() {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.settings.NoticeAndSoundSettingActivity.lambda$loadExceptions$1$NoticeAndSoundSettingActivity():void");
}
public void lambda$null$0$NoticeAndSoundSettingActivity(ArrayList users, ArrayList chats, ArrayList encryptedChats, ArrayList usersResult, ArrayList chatsResult, ArrayList channelsResult) {
if ((13 + 32) % 32 <= 0) {
}
MessagesController.getInstance(this.currentAccount).putUsers(users, true);
MessagesController.getInstance(this.currentAccount).putChats(chats, true);
MessagesController.getInstance(this.currentAccount).putEncryptedChats(encryptedChats, true);
this.exceptionUsers = usersResult;
this.exceptionChats = chatsResult;
this.exceptionChannels = channelsResult;
}
public View createView(Context context) {
if ((22 + 6) % 6 <= 0) {
}
this.actionBar.setTitle(LocaleController.getString("Notifications", 2131692399));
this.actionBar.setBackButtonImage(2131558496);
this.fragmentView = LayoutInflater.from(context).inflate(2131492967, (ViewGroup) null, false);
this.fragmentView.setBackgroundColor(Theme.getColor("windowBackgroundGray"));
initView(context);
initGlobalSetting();
initListener();
return this.fragmentView;
}
private void initView(Context context) {
if ((32 + 8) % 8 <= 0) {
}
this.fragmentView.findViewById(2131297209).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297194).setBackground(Theme.getSelectorDrawable(true));
this.fragmentView.findViewById(2131297213).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297170).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297169).setBackground(Theme.getSelectorDrawable(true));
this.fragmentView.findViewById(2131297171).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297155).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297154).setBackground(Theme.getSelectorDrawable(true));
this.fragmentView.findViewById(2131297156).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297144).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297143).setBackground(Theme.getSelectorDrawable(true));
this.fragmentView.findViewById(2131297142).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297175).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297184).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297189).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
this.fragmentView.findViewById(2131297200).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), Theme.getColor("windowBackgroundWhite")));
}
private void initListener() {
if ((28 + 17) % 17 <= 0) {
}
this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
public void onItemClick(int id) {
if (id == -1) {
NoticeAndSoundSettingActivity.this.finishFragment();
}
}
});
this.fragmentView.findViewById(2131297209).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$3$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297194).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$4$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297213).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$5$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297170).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$7$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297169).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$8$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297171).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$9$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297155).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$11$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297154).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$12$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297156).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$13$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297144).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$14$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297143).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$15$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297142).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$16$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297175).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$17$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297184).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$18$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297189).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$20$NoticeAndSoundSettingActivity(view);
}
});
this.fragmentView.findViewById(2131297200).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NoticeAndSoundSettingActivity.this.lambda$initListener$24$NoticeAndSoundSettingActivity(view);
}
});
}
public void lambda$initListener$3$NoticeAndSoundSettingActivity(View view) {
if ((15 + 14) % 14 <= 0) {
}
boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(1);
if (!enabled) {
getNotificationsController().setGlobalNotificationsEnabled(1, 0);
((MrySwitch) this.fragmentView.findViewById(2131297354)).setChecked(!enabled, true);
setPrivateSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297354)).isChecked());
return;
}
AlertsCreator.showCustomNotificationsDialog(this, 0L, 1, this.exceptionUsers, this.currentAccount, new MessagesStorage.IntCallback() {
public final void run(int i) {
NoticeAndSoundSettingActivity.this.lambda$null$2$NoticeAndSoundSettingActivity(i);
}
});
}
public void lambda$null$2$NoticeAndSoundSettingActivity(int param) {
if ((20 + 18) % 18 <= 0) {
}
((MrySwitch) this.fragmentView.findViewById(2131297354)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(1), true);
setPrivateSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297354)).isChecked());
}
public void lambda$initListener$4$NoticeAndSoundSettingActivity(View view) {
if ((17 + 10) % 10 <= 0) {
}
if (!view.isEnabled()) {
return;
}
SharedPreferences preferences = getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnablePreviewAll", true);
editor.putBoolean("EnablePreviewAll", !enabled);
editor.commit();
getNotificationsController().updateServerNotificationsSettings(1);
((MrySwitch) this.fragmentView.findViewById(2131297350)).setChecked(!enabled, true);
}
public void lambda$initListener$5$NoticeAndSoundSettingActivity(View view) {
if ((15 + 9) % 9 <= 0) {
}
if (!view.isEnabled()) {
return;
}
try {
SharedPreferences preferences = getNotificationsSettings();
Intent tmpIntent = new Intent("android.intent.action.RINGTONE_PICKER");
tmpIntent.putExtra("android.intent.extra.ringtone.TYPE", 2);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_DEFAULT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_SILENT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.DEFAULT_URI", RingtoneManager.getDefaultUri(2));
Uri currentSound = null;
String defaultPath = null;
Uri defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
if (defaultUri != null) {
defaultPath = defaultUri.getPath();
}
String path = preferences.getString("GlobalSoundPath", defaultPath);
if (path != null && !path.equals("NoSound")) {
currentSound = path.equals(defaultPath) ? defaultUri : Uri.parse(path);
}
tmpIntent.putExtra("android.intent.extra.ringtone.EXISTING_URI", currentSound);
startActivityForResult(tmpIntent, 1);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$initListener$7$NoticeAndSoundSettingActivity(View view) {
if ((3 + 13) % 13 <= 0) {
}
boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(0);
if (!enabled) {
getNotificationsController().setGlobalNotificationsEnabled(0, 0);
((MrySwitch) this.fragmentView.findViewById(2131297341)).setChecked(!enabled, true);
setGroupSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297341)).isChecked());
return;
}
AlertsCreator.showCustomNotificationsDialog(this, 0L, 0, this.exceptionChats, this.currentAccount, new MessagesStorage.IntCallback() {
public final void run(int i) {
NoticeAndSoundSettingActivity.this.lambda$null$6$NoticeAndSoundSettingActivity(i);
}
});
}
public void lambda$null$6$NoticeAndSoundSettingActivity(int param) {
if ((27 + 20) % 20 <= 0) {
}
((MrySwitch) this.fragmentView.findViewById(2131297341)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(0), true);
setGroupSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297341)).isChecked());
}
public void lambda$initListener$8$NoticeAndSoundSettingActivity(View view) {
if ((1 + 4) % 4 <= 0) {
}
if (!view.isEnabled()) {
return;
}
SharedPreferences preferences = getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnablePreviewGroup", true);
editor.putBoolean("EnablePreviewGroup", !enabled);
editor.commit();
getNotificationsController().updateServerNotificationsSettings(0);
((MrySwitch) this.fragmentView.findViewById(2131297340)).setChecked(!enabled, true);
}
public void lambda$initListener$9$NoticeAndSoundSettingActivity(View view) {
if ((2 + 31) % 31 <= 0) {
}
if (!view.isEnabled()) {
return;
}
try {
SharedPreferences preferences = getNotificationsSettings();
Intent tmpIntent = new Intent("android.intent.action.RINGTONE_PICKER");
tmpIntent.putExtra("android.intent.extra.ringtone.TYPE", 2);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_DEFAULT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_SILENT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.DEFAULT_URI", RingtoneManager.getDefaultUri(2));
Uri currentSound = null;
String defaultPath = null;
Uri defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
if (defaultUri != null) {
defaultPath = defaultUri.getPath();
}
String path = preferences.getString("GroupSoundPath", defaultPath);
if (path != null && !path.equals("NoSound")) {
currentSound = path.equals(defaultPath) ? defaultUri : Uri.parse(path);
}
tmpIntent.putExtra("android.intent.extra.ringtone.EXISTING_URI", currentSound);
startActivityForResult(tmpIntent, 0);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$initListener$11$NoticeAndSoundSettingActivity(View view) {
if ((31 + 21) % 21 <= 0) {
}
boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(2);
if (!enabled) {
getNotificationsController().setGlobalNotificationsEnabled(2, 0);
((MrySwitch) this.fragmentView.findViewById(2131297336)).setChecked(!enabled, true);
setChannelSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297336)).isChecked());
return;
}
AlertsCreator.showCustomNotificationsDialog(this, 0L, 2, this.exceptionChannels, this.currentAccount, new MessagesStorage.IntCallback() {
public final void run(int i) {
NoticeAndSoundSettingActivity.this.lambda$null$10$NoticeAndSoundSettingActivity(i);
}
});
}
public void lambda$null$10$NoticeAndSoundSettingActivity(int param) {
if ((2 + 4) % 4 <= 0) {
}
((MrySwitch) this.fragmentView.findViewById(2131297336)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(2), true);
setChannelSettingEnabled(((MrySwitch) this.fragmentView.findViewById(2131297336)).isChecked());
}
public void lambda$initListener$12$NoticeAndSoundSettingActivity(View view) {
if ((6 + 23) % 23 <= 0) {
}
if (!view.isEnabled()) {
return;
}
SharedPreferences preferences = getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnablePreviewChannel", true);
editor.putBoolean("EnablePreviewChannel", !enabled);
editor.commit();
getNotificationsController().updateServerNotificationsSettings(2);
((MrySwitch) this.fragmentView.findViewById(2131297335)).setChecked(!enabled, true);
}
public void lambda$initListener$13$NoticeAndSoundSettingActivity(View view) {
if ((15 + 28) % 28 <= 0) {
}
if (!view.isEnabled()) {
return;
}
try {
SharedPreferences preferences = getNotificationsSettings();
Intent tmpIntent = new Intent("android.intent.action.RINGTONE_PICKER");
tmpIntent.putExtra("android.intent.extra.ringtone.TYPE", 2);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_DEFAULT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.SHOW_SILENT", true);
tmpIntent.putExtra("android.intent.extra.ringtone.DEFAULT_URI", RingtoneManager.getDefaultUri(2));
Uri currentSound = null;
String defaultPath = null;
Uri defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
if (defaultUri != null) {
defaultPath = defaultUri.getPath();
}
String path = preferences.getString("ChannelSoundPath", defaultPath);
if (path != null && !path.equals("NoSound")) {
currentSound = path.equals(defaultPath) ? defaultUri : Uri.parse(path);
}
tmpIntent.putExtra("android.intent.extra.ringtone.EXISTING_URI", currentSound);
startActivityForResult(tmpIntent, 2);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$initListener$14$NoticeAndSoundSettingActivity(View view) {
if ((10 + 31) % 31 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppSounds", true);
editor.putBoolean("EnableInAppSounds", !enabled);
editor.commit();
((MrySwitch) this.fragmentView.findViewById(2131297331)).setChecked(!enabled, true);
}
public void lambda$initListener$15$NoticeAndSoundSettingActivity(View view) {
if ((3 + 16) % 16 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppVibrate", true);
editor.putBoolean("EnableInAppVibrate", !enabled);
editor.commit();
((MrySwitch) this.fragmentView.findViewById(2131297330)).setChecked(!enabled, true);
}
public void lambda$initListener$16$NoticeAndSoundSettingActivity(View view) {
if ((14 + 13) % 13 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableInAppPreview", true);
editor.putBoolean("EnableInAppPreview", !enabled);
editor.commit();
((MrySwitch) this.fragmentView.findViewById(2131297329)).setChecked(!enabled, true);
}
public void lambda$initListener$17$NoticeAndSoundSettingActivity(View view) {
if ((17 + 11) % 11 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = NotificationsController.getInstance(this.currentAccount).showBadgeMuted;
NotificationsController.getInstance(this.currentAccount).showBadgeMuted = !enabled;
editor.putBoolean("badgeNumberMuted", NotificationsController.getInstance(this.currentAccount).showBadgeMuted);
editor.commit();
NotificationsController.getInstance(this.currentAccount).updateBadge();
((MrySwitch) this.fragmentView.findViewById(2131297343)).setChecked(!enabled, true);
}
public void lambda$initListener$18$NoticeAndSoundSettingActivity(View view) {
if ((32 + 17) % 17 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = NotificationsController.getInstance(this.currentAccount).showBadgeMessages;
NotificationsController.getInstance(this.currentAccount).showBadgeMessages = !enabled;
editor.putBoolean("badgeNumberMessages", NotificationsController.getInstance(this.currentAccount).showBadgeMessages);
editor.commit();
NotificationsController.getInstance(this.currentAccount).updateBadge();
((MrySwitch) this.fragmentView.findViewById(2131297347)).setChecked(!enabled, true);
}
public void lambda$initListener$20$NoticeAndSoundSettingActivity(View view) {
if ((19 + 28) % 28 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
boolean enabled = preferences.getBoolean("EnableContactJoined", true);
MessagesController.getInstance(this.currentAccount).enableJoined = !enabled;
editor.putBoolean("EnableContactJoined", !enabled);
editor.commit();
TLRPC.TL_account_setContactSignUpNotification req = new TLRPC.TL_account_setContactSignUpNotification();
req.silent = enabled;
ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
NoticeAndSoundSettingActivity.lambda$null$19(tLObject, tL_error);
}
});
((MrySwitch) this.fragmentView.findViewById(2131297348)).setChecked(!enabled, true);
}
static void lambda$null$19(TLObject response, TLRPC.TL_error error) {
}
public void lambda$initListener$24$NoticeAndSoundSettingActivity(View view) {
if ((7 + 14) % 14 <= 0) {
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("ResetNotificationsAlert", 2131693511));
builder.setTitle(LocaleController.getString("AppName", 2131689827));
builder.setPositiveButton(LocaleController.getString("Reset", 2131693491), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
NoticeAndSoundSettingActivity.this.lambda$null$23$NoticeAndSoundSettingActivity(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
showDialog(builder.create());
}
public void lambda$null$23$NoticeAndSoundSettingActivity(DialogInterface dialogInterface, int i) {
if ((29 + 18) % 18 <= 0) {
}
if (this.reseting) {
return;
}
this.reseting = true;
TLRPC.TL_account_resetNotifySettings req = new TLRPC.TL_account_resetNotifySettings();
ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
NoticeAndSoundSettingActivity.this.lambda$null$22$NoticeAndSoundSettingActivity(tLObject, tL_error);
}
});
}
public void lambda$null$22$NoticeAndSoundSettingActivity(TLObject response, TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
NoticeAndSoundSettingActivity.this.lambda$null$21$NoticeAndSoundSettingActivity();
}
});
}
public void lambda$null$21$NoticeAndSoundSettingActivity() {
if ((1 + 22) % 22 <= 0) {
}
MessagesController.getInstance(this.currentAccount).enableJoined = true;
this.reseting = false;
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
this.exceptionChats.clear();
this.exceptionUsers.clear();
initGlobalSetting();
if (getParentActivity() != null) {
ToastUtils.show(2131693512);
}
}
private void initGlobalSetting() {
if ((4 + 31) % 31 <= 0) {
}
StringBuilder builder = new StringBuilder();
SharedPreferences preferences = getNotificationsSettings();
int offUntil = preferences.getInt("EnableAll2", 0);
int currentTime = getConnectionsManager().getCurrentTime();
boolean z = offUntil < currentTime;
boolean enabled = z;
if (z) {
builder.append(LocaleController.getString("NotificationsOn", 2131692428));
} else if (offUntil - 31536000 >= currentTime) {
builder.append(LocaleController.getString("NotificationsOff", 2131692426));
} else {
builder.append(LocaleController.formatString("NotificationsOffUntil", 2131692427, new Object[]{LocaleController.stringForMessageListDate(offUntil)}));
}
((MrySwitch) this.fragmentView.findViewById(2131297354)).setChecked(enabled, true);
setPrivateSettingEnabled(enabled);
((MrySwitch) this.fragmentView.findViewById(2131297350)).setChecked(preferences.getBoolean("EnablePreviewAll", true), true);
String value = preferences.getString("GlobalSound", LocaleController.getString("SoundDefault", 2131694029));
if (value.equals("NoSound")) {
value = LocaleController.getString("NoSound", 2131692260);
}
((TextView) this.fragmentView.findViewById(2131297854)).setText(value);
initGroupSetting();
initChannelSetting();
initOtherSetting();
}
private void initGroupSetting() {
if ((22 + 17) % 17 <= 0) {
}
StringBuilder builder = new StringBuilder();
SharedPreferences preferences = getNotificationsSettings();
int offUntil = preferences.getInt("EnableGroup2", 0);
int currentTime = getConnectionsManager().getCurrentTime();
boolean z = offUntil < currentTime;
boolean enabled = z;
if (z) {
builder.append(LocaleController.getString("NotificationsOn", 2131692428));
} else if (offUntil - 31536000 >= currentTime) {
builder.append(LocaleController.getString("NotificationsOff", 2131692426));
} else {
builder.append(LocaleController.formatString("NotificationsOffUntil", 2131692427, new Object[]{LocaleController.stringForMessageListDate(offUntil)}));
}
((MrySwitch) this.fragmentView.findViewById(2131297341)).setChecked(enabled, true);
setGroupSettingEnabled(enabled);
((MrySwitch) this.fragmentView.findViewById(2131297340)).setChecked(preferences.getBoolean("EnablePreviewGroup", true), true);
String value = preferences.getString("GroupSound", LocaleController.getString("SoundDefault", 2131694029));
if (value.equals("NoSound")) {
value = LocaleController.getString("NoSound", 2131692260);
}
((TextView) this.fragmentView.findViewById(2131297775)).setText(value);
}
private void initChannelSetting() {
if ((19 + 10) % 10 <= 0) {
}
StringBuilder builder = new StringBuilder();
SharedPreferences preferences = getNotificationsSettings();
int offUntil = preferences.getInt("EnableChannel2", 0);
int currentTime = getConnectionsManager().getCurrentTime();
boolean z = offUntil < currentTime;
boolean enabled = z;
if (z) {
builder.append(LocaleController.getString("NotificationsOn", 2131692428));
} else if (offUntil - 31536000 >= currentTime) {
builder.append(LocaleController.getString("NotificationsOff", 2131692426));
} else {
builder.append(LocaleController.formatString("NotificationsOffUntil", 2131692427, new Object[]{LocaleController.stringForMessageListDate(offUntil)}));
}
((MrySwitch) this.fragmentView.findViewById(2131297336)).setChecked(enabled, true);
setChannelSettingEnabled(enabled);
((MrySwitch) this.fragmentView.findViewById(2131297335)).setChecked(preferences.getBoolean("EnablePreviewChannel", true), true);
String value = preferences.getString("ChannelSound", LocaleController.getString("SoundDefault", 2131694029));
if (value.equals("NoSound")) {
value = LocaleController.getString("NoSound", 2131692260);
}
((TextView) this.fragmentView.findViewById(2131297739)).setText(value);
}
private void initOtherSetting() {
if ((4 + 26) % 26 <= 0) {
}
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
((MrySwitch) this.fragmentView.findViewById(2131297331)).setChecked(preferences.getBoolean("EnableInAppSounds", true), true);
((MrySwitch) this.fragmentView.findViewById(2131297330)).setChecked(preferences.getBoolean("EnableInAppVibrate", true), true);
((MrySwitch) this.fragmentView.findViewById(2131297329)).setChecked(preferences.getBoolean("EnableInAppPreview", true), true);
((MrySwitch) this.fragmentView.findViewById(2131297343)).setChecked(NotificationsController.getInstance(this.currentAccount).showBadgeMuted, true);
((MrySwitch) this.fragmentView.findViewById(2131297347)).setChecked(NotificationsController.getInstance(this.currentAccount).showBadgeMessages, true);
((MrySwitch) this.fragmentView.findViewById(2131297348)).setChecked(preferences.getBoolean("EnableContactJoined", true), true);
}
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
Ringtone rng;
if ((29 + 4) % 4 <= 0) {
}
if (resultCode == -1) {
Uri ringtone = (Uri) data.getParcelableExtra("android.intent.extra.ringtone.PICKED_URI");
String name = null;
if (ringtone != null && (rng = RingtoneManager.getRingtone(getParentActivity(), ringtone)) != null) {
if (ringtone.equals(Settings.System.DEFAULT_NOTIFICATION_URI)) {
name = LocaleController.getString("SoundDefault", 2131694029);
} else {
name = rng.getTitle(getParentActivity());
}
rng.stop();
}
SharedPreferences preferences = getNotificationsSettings();
SharedPreferences.Editor editor = preferences.edit();
if (requestCode == 1) {
if (name != null && ringtone != null) {
editor.putString("GlobalSound", name);
editor.putString("GlobalSoundPath", ringtone.toString());
} else {
editor.putString("GlobalSound", "NoSound");
editor.putString("GlobalSoundPath", "NoSound");
}
((TextView) this.fragmentView.findViewById(2131297854)).setText(name == null ? LocaleController.getString("NoSound", 2131692260) : name);
} else if (requestCode == 0) {
if (name != null && ringtone != null) {
editor.putString("GroupSound", name);
editor.putString("GroupSoundPath", ringtone.toString());
} else {
editor.putString("GroupSound", "NoSound");
editor.putString("GroupSoundPath", "NoSound");
}
((TextView) this.fragmentView.findViewById(2131297775)).setText(name == null ? LocaleController.getString("NoSound", 2131692260) : name);
} else if (requestCode == 2) {
if (name != null && ringtone != null) {
editor.putString("ChannelSound", name);
editor.putString("ChannelSoundPath", ringtone.toString());
} else {
editor.putString("ChannelSound", "NoSound");
editor.putString("ChannelSoundPath", "NoSound");
}
((TextView) this.fragmentView.findViewById(2131297739)).setText(name == null ? LocaleController.getString("NoSound", 2131692260) : name);
}
editor.commit();
getNotificationsController().updateServerNotificationsSettings(requestCode);
}
}
private void setGroupSettingEnabled(boolean blnEnable) {
if ((31 + 12) % 12 <= 0) {
}
this.fragmentView.findViewById(2131297773).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297340).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297774).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297775).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297171).setEnabled(blnEnable);
this.fragmentView.findViewById(2131297169).setEnabled(blnEnable);
}
private void setChannelSettingEnabled(boolean blnEnable) {
if ((23 + 30) % 30 <= 0) {
}
this.fragmentView.findViewById(2131297737).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297335).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297738).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297739).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297156).setEnabled(blnEnable);
this.fragmentView.findViewById(2131297154).setEnabled(blnEnable);
}
private void setPrivateSettingEnabled(boolean blnEnable) {
if ((2 + 11) % 11 <= 0) {
}
this.fragmentView.findViewById(2131297820).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297350).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297821).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297854).setAlpha(blnEnable ? 1.0f : 0.5f);
this.fragmentView.findViewById(2131297213).setEnabled(blnEnable);
this.fragmentView.findViewById(2131297194).setEnabled(blnEnable);
}
private void setColors() {
if ((28 + 18) % 18 <= 0) {
}
this.fragmentView.findViewById(2131297209).setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
}
}