APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:国中资本
版本号:1.0.0
包名称:com.byhhd.oxojy

MD5 校验值:1036132062d4d223cd1a714f5bbea98b

反编译源代码说明

NoticeAndSoundSettingActivity.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package im.skmzhmurqt.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.text.TextUtils;
import android.util.LongSparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.exoplayer2.upstream.cache.ContentMetadata;
import im.skmzhmurqt.messenger.AndroidUtilities;
import im.skmzhmurqt.messenger.ChatObject;
import im.skmzhmurqt.messenger.FileLog;
import im.skmzhmurqt.messenger.LocaleController;
import im.skmzhmurqt.messenger.MessagesController;
import im.skmzhmurqt.messenger.MessagesStorage;
import im.skmzhmurqt.messenger.NotificationsController;
import im.skmzhmurqt.messenger.R;
import im.skmzhmurqt.messenger.UserConfig;
import im.skmzhmurqt.messenger.Utilities;
import im.skmzhmurqt.tgnet.ConnectionsManager;
import im.skmzhmurqt.tgnet.RequestDelegate;
import im.skmzhmurqt.tgnet.TLObject;
import im.skmzhmurqt.tgnet.TLRPC;
import im.skmzhmurqt.ui.NotificationsSettingsActivity;
import im.skmzhmurqt.ui.actionbar.ActionBar;
import im.skmzhmurqt.ui.actionbar.AlertDialog;
import im.skmzhmurqt.ui.actionbar.BaseFragment;
import im.skmzhmurqt.ui.actionbar.Theme;
import im.skmzhmurqt.ui.components.AlertsCreator;
import im.skmzhmurqt.ui.components.toast.ToastUtils;
import im.skmzhmurqt.ui.hviews.MrySwitch;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;

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;

    @Override
    public boolean onFragmentCreate() {
        MessagesController.getInstance(this.currentAccount).loadSignUpNotificationsSettings();
        loadExceptions();
        return super.onFragmentCreate();
    }

    private void loadExceptions() {
        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() {
        ArrayList<TLRPC.Chat> chats;
        ArrayList<TLRPC.User> users;
        int a;
        int size;
        int a2;
        int size2;
        int a3;
        int size3;
        int a4;
        int size4;
        ArrayList<Integer> encryptedChatsToLoad;
        Map<String, ?> values;
        SharedPreferences preferences;
        int selfId;
        ArrayList<TLRPC.User> users2;
        ArrayList<NotificationsSettingsActivity.NotificationException> channelsResult;
        ArrayList<NotificationsSettingsActivity.NotificationException> chatsResult;
        final ArrayList<NotificationsSettingsActivity.NotificationException> usersResult = new ArrayList<>();
        ArrayList<NotificationsSettingsActivity.NotificationException> chatsResult2 = new ArrayList<>();
        ArrayList<NotificationsSettingsActivity.NotificationException> chatsResult3 = new ArrayList<>();
        LongSparseArray<NotificationsSettingsActivity.NotificationException> waitingForLoadExceptions = new LongSparseArray<>();
        ArrayList<Integer> usersToLoad = new ArrayList<>();
        ArrayList<Integer> chatsToLoad = new ArrayList<>();
        ArrayList<Integer> encryptedChatsToLoad2 = new ArrayList<>();
        ArrayList<TLRPC.User> users3 = new ArrayList<>();
        ArrayList<TLRPC.Chat> chats2 = new ArrayList<>();
        final ArrayList<TLRPC.EncryptedChat> encryptedChats = new ArrayList<>();
        int selfId2 = UserConfig.getInstance(this.currentAccount).clientUserId;
        SharedPreferences preferences2 = MessagesController.getNotificationsSettings(this.currentAccount);
        Map<String, ?> values2 = preferences2.getAll();
        Iterator<Map.Entry<String, ?>> it = values2.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, ?> entry = it.next();
            Iterator<Map.Entry<String, ?>> it2 = it;
            String key = entry.getKey();
            ArrayList<TLRPC.Chat> chats3 = chats2;
            if (key.startsWith("notify2_")) {
                users2 = users3;
                String key2 = key.replace("notify2_", "");
                long did = Utilities.parseLong(key2).longValue();
                if (did != 0) {
                    ArrayList<NotificationsSettingsActivity.NotificationException> chatsResult4 = chatsResult2;
                    ArrayList<NotificationsSettingsActivity.NotificationException> channelsResult2 = chatsResult3;
                    if (did != selfId2) {
                        NotificationsSettingsActivity.NotificationException exception = new NotificationsSettingsActivity.NotificationException();
                        exception.did = did;
                        StringBuilder sb = new StringBuilder();
                        selfId = selfId2;
                        sb.append(ContentMetadata.KEY_CUSTOM_PREFIX);
                        sb.append(did);
                        exception.hasCustom = preferences2.getBoolean(sb.toString(), false);
                        exception.notify = ((Integer) entry.getValue()).intValue();
                        if (exception.notify != 0) {
                            Integer time = (Integer) values2.get("notifyuntil_" + key2);
                            if (time != null) {
                                exception.muteUntil = time.intValue();
                            }
                        }
                        int lower_id = (int) did;
                        int high_id = (int) (did << 32);
                        if (lower_id == 0) {
                            values = values2;
                            channelsResult = channelsResult2;
                            chatsResult = chatsResult4;
                            if (high_id != 0) {
                                preferences = preferences2;
                                TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(this.currentAccount).getEncryptedChat(Integer.valueOf(high_id));
                                if (encryptedChat == null) {
                                    encryptedChatsToLoad2.add(Integer.valueOf(high_id));
                                    waitingForLoadExceptions.put(did, exception);
                                } else {
                                    TLRPC.User user = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(encryptedChat.user_id));
                                    if (user == null) {
                                        usersToLoad.add(Integer.valueOf(encryptedChat.user_id));
                                        waitingForLoadExceptions.put(encryptedChat.user_id, exception);
                                    } else if (user.deleted) {
                                        chatsResult2 = chatsResult;
                                        chats2 = chats3;
                                        it = it2;
                                        users3 = users2;
                                        preferences2 = preferences;
                                        selfId2 = selfId;
                                        chatsResult3 = channelsResult;
                                        values2 = values;
                                    }
                                }
                                usersResult.add(exception);
                            } else {
                                preferences = preferences2;
                            }
                        } else if (lower_id > 0) {
                            values = values2;
                            TLRPC.User user2 = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(lower_id));
                            if (user2 == null) {
                                usersToLoad.add(Integer.valueOf(lower_id));
                                waitingForLoadExceptions.put(did, exception);
                            } else if (user2.deleted) {
                                chats2 = chats3;
                                it = it2;
                                users3 = users2;
                                chatsResult2 = chatsResult4;
                                chatsResult3 = channelsResult2;
                                selfId2 = selfId;
                                values2 = values;
                            }
                            usersResult.add(exception);
                            chatsResult = chatsResult4;
                            channelsResult = channelsResult2;
                            preferences = preferences2;
                        } else {
                            values = values2;
                            TLRPC.Chat chat = MessagesController.getInstance(this.currentAccount).getChat(Integer.valueOf(-lower_id));
                            if (chat == null) {
                                chatsToLoad.add(Integer.valueOf(-lower_id));
                                waitingForLoadExceptions.put(did, exception);
                                chats2 = chats3;
                                it = it2;
                                users3 = users2;
                                chatsResult2 = chatsResult4;
                                chatsResult3 = channelsResult2;
                                selfId2 = selfId;
                                values2 = values;
                            } else if (chat.left || chat.kicked) {
                                chatsResult2 = chatsResult4;
                                chats2 = chats3;
                                it = it2;
                                users3 = users2;
                                selfId2 = selfId;
                                chatsResult3 = channelsResult2;
                                values2 = values;
                            } else if (chat.migrated_to != null) {
                                chats2 = chats3;
                                it = it2;
                                users3 = users2;
                                chatsResult2 = chatsResult4;
                                chatsResult3 = channelsResult2;
                                selfId2 = selfId;
                                values2 = values;
                            } else {
                                if (!ChatObject.isChannel(chat) || chat.megagroup) {
                                    channelsResult = channelsResult2;
                                    chatsResult = chatsResult4;
                                    chatsResult.add(exception);
                                } else {
                                    channelsResult = channelsResult2;
                                    channelsResult.add(exception);
                                    chatsResult = chatsResult4;
                                }
                                preferences = preferences2;
                            }
                        }
                    } else {
                        values = values2;
                        selfId = selfId2;
                        chatsResult = chatsResult4;
                        channelsResult = channelsResult2;
                        preferences = preferences2;
                    }
                } else {
                    values = values2;
                    preferences = preferences2;
                    selfId = selfId2;
                    channelsResult = chatsResult3;
                    chatsResult = chatsResult2;
                }
            } else {
                values = values2;
                preferences = preferences2;
                selfId = selfId2;
                users2 = users3;
                channelsResult = chatsResult3;
                chatsResult = chatsResult2;
            }
            chatsResult2 = chatsResult;
            chats2 = chats3;
            it = it2;
            users3 = users2;
            preferences2 = preferences;
            selfId2 = selfId;
            chatsResult3 = channelsResult;
            values2 = values;
        }
        ArrayList<TLRPC.Chat> chats4 = chats2;
        ArrayList<TLRPC.User> users4 = users3;
        final ArrayList<NotificationsSettingsActivity.NotificationException> channelsResult3 = chatsResult3;
        final ArrayList<NotificationsSettingsActivity.NotificationException> channelsResult4 = chatsResult2;
        if (waitingForLoadExceptions.size() != 0) {
            try {
                if (!encryptedChatsToLoad2.isEmpty()) {
                    try {
                        MessagesStorage.getInstance(this.currentAccount).getEncryptedChatsInternal(TextUtils.join(",", encryptedChatsToLoad2), encryptedChats, usersToLoad);
                    } catch (Exception e) {
                        e = e;
                        chats = chats4;
                        users = users4;
                        FileLog.e(e);
                        a = 0;
                        size = chats.size();
                        while (a < size) {
                        }
                        size2 = users.size();
                        while (a2 < size2) {
                        }
                        size3 = encryptedChats.size();
                        while (a3 < size3) {
                        }
                        size4 = waitingForLoadExceptions.size();
                        while (a4 < size4) {
                        }
                        final ArrayList<TLRPC.User> arrayList = users;
                        final ArrayList<TLRPC.Chat> arrayList2 = chats;
                        AndroidUtilities.runOnUIThread(new Runnable() {
                            @Override
                            public final void run() {
                                NoticeAndSoundSettingActivity.this.lambda$null$0$NoticeAndSoundSettingActivity(arrayList, arrayList2, encryptedChats, usersResult, channelsResult4, channelsResult3);
                            }
                        });
                    }
                }
                if (usersToLoad.isEmpty()) {
                    users = users4;
                } else {
                    try {
                        users = users4;
                        try {
                            MessagesStorage.getInstance(this.currentAccount).getUsersInternal(TextUtils.join(",", usersToLoad), users);
                        } catch (Exception e2) {
                            e = e2;
                            chats = chats4;
                            FileLog.e(e);
                            a = 0;
                            size = chats.size();
                            while (a < size) {
                            }
                            size2 = users.size();
                            while (a2 < size2) {
                            }
                            size3 = encryptedChats.size();
                            while (a3 < size3) {
                            }
                            size4 = waitingForLoadExceptions.size();
                            while (a4 < size4) {
                            }
                            final ArrayList arrayList3 = users;
                            final ArrayList arrayList22 = chats;
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                @Override
                                public final void run() {
                                    NoticeAndSoundSettingActivity.this.lambda$null$0$NoticeAndSoundSettingActivity(arrayList3, arrayList22, encryptedChats, usersResult, channelsResult4, channelsResult3);
                                }
                            });
                        }
                    } catch (Exception e3) {
                        e = e3;
                        users = users4;
                        chats = chats4;
                    }
                }
                try {
                    if (chatsToLoad.isEmpty()) {
                        chats = chats4;
                    } else {
                        chats = chats4;
                        try {
                            MessagesStorage.getInstance(this.currentAccount).getChatsInternal(TextUtils.join(",", chatsToLoad), chats);
                        } catch (Exception e4) {
                            e = e4;
                            FileLog.e(e);
                            a = 0;
                            size = chats.size();
                            while (a < size) {
                            }
                            size2 = users.size();
                            while (a2 < size2) {
                            }
                            size3 = encryptedChats.size();
                            while (a3 < size3) {
                            }
                            size4 = waitingForLoadExceptions.size();
                            while (a4 < size4) {
                            }
                            final ArrayList arrayList32 = users;
                            final ArrayList arrayList222 = chats;
                            AndroidUtilities.runOnUIThread(new Runnable() {
                                @Override
                                public final void run() {
                                    NoticeAndSoundSettingActivity.this.lambda$null$0$NoticeAndSoundSettingActivity(arrayList32, arrayList222, encryptedChats, usersResult, channelsResult4, channelsResult3);
                                }
                            });
                        }
                    }
                } catch (Exception e5) {
                    e = e5;
                    chats = chats4;
                }
            } catch (Exception e6) {
                e = e6;
                chats = chats4;
                users = users4;
            }
            a = 0;
            size = chats.size();
            while (a < size) {
                TLRPC.Chat chat2 = chats.get(a);
                if (chat2.left || chat2.kicked) {
                    encryptedChatsToLoad = encryptedChatsToLoad2;
                } else if (chat2.migrated_to != null) {
                    encryptedChatsToLoad = encryptedChatsToLoad2;
                } else {
                    encryptedChatsToLoad = encryptedChatsToLoad2;
                    NotificationsSettingsActivity.NotificationException exception2 = waitingForLoadExceptions.get(-chat2.id);
                    waitingForLoadExceptions.remove(-chat2.id);
                    if (exception2 != null) {
                        if (!ChatObject.isChannel(chat2) || chat2.megagroup) {
                            channelsResult4.add(exception2);
                        } else {
                            channelsResult3.add(exception2);
                        }
                    }
                }
                a++;
                encryptedChatsToLoad2 = encryptedChatsToLoad;
            }
            size2 = users.size();
            for (a2 = 0; a2 < size2; a2++) {
                TLRPC.User user3 = users.get(a2);
                if (!user3.deleted) {
                    waitingForLoadExceptions.remove(user3.id);
                }
            }
            size3 = encryptedChats.size();
            for (a3 = 0; a3 < size3; a3++) {
                waitingForLoadExceptions.remove(encryptedChats.get(a3).id << 32);
            }
            size4 = waitingForLoadExceptions.size();
            for (a4 = 0; a4 < size4; a4++) {
                if (((int) waitingForLoadExceptions.keyAt(a4)) < 0) {
                    channelsResult4.remove(waitingForLoadExceptions.valueAt(a4));
                    channelsResult3.remove(waitingForLoadExceptions.valueAt(a4));
                } else {
                    usersResult.remove(waitingForLoadExceptions.valueAt(a4));
                }
            }
        } else {
            chats = chats4;
            users = users4;
        }
        final ArrayList arrayList322 = users;
        final ArrayList arrayList2222 = chats;
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                NoticeAndSoundSettingActivity.this.lambda$null$0$NoticeAndSoundSettingActivity(arrayList322, arrayList2222, encryptedChats, usersResult, channelsResult4, channelsResult3);
            }
        });
    }

    public void lambda$null$0$NoticeAndSoundSettingActivity(ArrayList users, ArrayList chats, ArrayList encryptedChats, ArrayList usersResult, ArrayList chatsResult, ArrayList channelsResult) {
        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;
    }

    @Override
    public View createView(Context context) {
        this.actionBar.setTitle(LocaleController.getString("Notifications", R.string.Notifications));
        this.actionBar.setBackButtonImage(R.mipmap.ic_back);
        this.fragmentView = LayoutInflater.from(context).inflate(R.layout.activity_setting_notice, (ViewGroup) null, false);
        this.fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
        initView(context);
        initGlobalSetting();
        initListener();
        return this.fragmentView;
    }

    private void initView(Context context) {
        this.fragmentView.findViewById(R.id.rl_show_notice).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_preview_message).setBackground(Theme.getSelectorDrawable(true));
        this.fragmentView.findViewById(R.id.rl_sound).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_group_show_notice).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_group_preview_message).setBackground(Theme.getSelectorDrawable(true));
        this.fragmentView.findViewById(R.id.rl_group_sound).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_channel_show_notice).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_channel_preview_message).setBackground(Theme.getSelectorDrawable(true));
        this.fragmentView.findViewById(R.id.rl_channel_sound).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_app_show_notice).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_app_shake_notice).setBackground(Theme.getSelectorDrawable(true));
        this.fragmentView.findViewById(R.id.rl_app_preview_notice).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_include_closed_dialog).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), 0, 0, Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_msg_count_statistics).setBackground(Theme.getRoundRectSelectorDrawable(0, 0, AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_new_contacter_add).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
        this.fragmentView.findViewById(R.id.rl_reset).setBackground(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(5.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
    }

    private void initListener() {
        this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
            @Override
            public void onItemClick(int id) {
                if (id == -1) {
                    NoticeAndSoundSettingActivity.this.finishFragment();
                }
            }
        });
        this.fragmentView.findViewById(R.id.rl_show_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$3$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_preview_message).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$4$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_sound).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$5$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_group_show_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$7$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_group_preview_message).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$8$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_group_sound).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$9$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_channel_show_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$11$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_channel_preview_message).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$12$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_channel_sound).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$13$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_app_show_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$14$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_app_shake_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$15$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_app_preview_notice).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$16$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_include_closed_dialog).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$17$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_msg_count_statistics).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$18$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_new_contacter_add).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NoticeAndSoundSettingActivity.this.lambda$initListener$20$NoticeAndSoundSettingActivity(view);
            }
        });
        this.fragmentView.findViewById(R.id.rl_reset).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) {
        boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(1);
        if (!enabled) {
            getNotificationsController().setGlobalNotificationsEnabled(1, 0);
            ((MrySwitch) this.fragmentView.findViewById(R.id.switch_show)).setChecked(!enabled, true);
            setPrivateSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_show)).isChecked());
            return;
        }
        AlertsCreator.showCustomNotificationsDialog(this, 0L, 1, this.exceptionUsers, this.currentAccount, new MessagesStorage.IntCallback() {
            @Override
            public final void run(int i) {
                NoticeAndSoundSettingActivity.this.lambda$null$2$NoticeAndSoundSettingActivity(i);
            }
        });
    }

    public void lambda$null$2$NoticeAndSoundSettingActivity(int param) {
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_show)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(1), true);
        setPrivateSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_show)).isChecked());
    }

    public void lambda$initListener$4$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_preview_message)).setChecked(!enabled, true);
    }

    public void lambda$initListener$5$NoticeAndSoundSettingActivity(View view) {
        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) {
        boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(0);
        if (!enabled) {
            getNotificationsController().setGlobalNotificationsEnabled(0, 0);
            ((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_show)).setChecked(!enabled, true);
            setGroupSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_show)).isChecked());
            return;
        }
        AlertsCreator.showCustomNotificationsDialog(this, 0L, 0, this.exceptionChats, this.currentAccount, new MessagesStorage.IntCallback() {
            @Override
            public final void run(int i) {
                NoticeAndSoundSettingActivity.this.lambda$null$6$NoticeAndSoundSettingActivity(i);
            }
        });
    }

    public void lambda$null$6$NoticeAndSoundSettingActivity(int param) {
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_show)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(0), true);
        setGroupSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_show)).isChecked());
    }

    public void lambda$initListener$8$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_group_preview_message)).setChecked(!enabled, true);
    }

    public void lambda$initListener$9$NoticeAndSoundSettingActivity(View view) {
        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) {
        boolean enabled = getNotificationsController().isGlobalNotificationsEnabled(2);
        if (!enabled) {
            getNotificationsController().setGlobalNotificationsEnabled(2, 0);
            ((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_show)).setChecked(!enabled, true);
            setChannelSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_show)).isChecked());
            return;
        }
        AlertsCreator.showCustomNotificationsDialog(this, 0L, 2, this.exceptionChannels, this.currentAccount, new MessagesStorage.IntCallback() {
            @Override
            public final void run(int i) {
                NoticeAndSoundSettingActivity.this.lambda$null$10$NoticeAndSoundSettingActivity(i);
            }
        });
    }

    public void lambda$null$10$NoticeAndSoundSettingActivity(int param) {
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_show)).setChecked(getNotificationsController().isGlobalNotificationsEnabled(2), true);
        setChannelSettingEnabled(((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_show)).isChecked());
    }

    public void lambda$initListener$12$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_channel_preview_message)).setChecked(!enabled, true);
    }

    public void lambda$initListener$13$NoticeAndSoundSettingActivity(View view) {
        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) {
        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(R.id.switch_app_show)).setChecked(!enabled, true);
    }

    public void lambda$initListener$15$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_app_shake)).setChecked(!enabled, true);
    }

    public void lambda$initListener$16$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_app_preview_notice)).setChecked(!enabled, true);
    }

    public void lambda$initListener$17$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_include_closed_dialog)).setChecked(!enabled, true);
    }

    public void lambda$initListener$18$NoticeAndSoundSettingActivity(View view) {
        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(R.id.switch_msg_count_statistics)).setChecked(!enabled, true);
    }

    public void lambda$initListener$20$NoticeAndSoundSettingActivity(View view) {
        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() {
            @Override
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                NoticeAndSoundSettingActivity.lambda$null$19(tLObject, tL_error);
            }
        });
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_new_contacter_add)).setChecked(!enabled, true);
    }

    public static void lambda$null$19(TLObject response, TLRPC.TL_error error) {
    }

    public void lambda$initListener$24$NoticeAndSoundSettingActivity(View view) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("ResetNotificationsAlert", R.string.ResetNotificationsAlert));
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        builder.setPositiveButton(LocaleController.getString("Reset", R.string.Reset), 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", R.string.Cancel), null);
        showDialog(builder.create());
    }

    public void lambda$null$23$NoticeAndSoundSettingActivity(DialogInterface dialogInterface, int i) {
        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() {
            @Override
            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() {
        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(R.string.ResetNotificationsText);
        }
    }

    private void initGlobalSetting() {
        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", R.string.NotificationsOn));
        } else if (offUntil - 31536000 >= currentTime) {
            builder.append(LocaleController.getString("NotificationsOff", R.string.NotificationsOff));
        } else {
            builder.append(LocaleController.formatString("NotificationsOffUntil", R.string.NotificationsOffUntil, LocaleController.stringForMessageListDate(offUntil)));
        }
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_show)).setChecked(enabled, true);
        setPrivateSettingEnabled(enabled);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_preview_message)).setChecked(preferences.getBoolean("EnablePreviewAll", true), true);
        String value = preferences.getString("GlobalSound", LocaleController.getString("SoundDefault", R.string.SoundDefault));
        if (value.equals("NoSound")) {
            value = LocaleController.getString("NoSound", R.string.NoSound);
        }
        ((TextView) this.fragmentView.findViewById(R.id.tv_sound_type)).setText(value);
        initGroupSetting();
        initChannelSetting();
        initOtherSetting();
    }

    private void initGroupSetting() {
        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", R.string.NotificationsOn));
        } else if (offUntil - 31536000 >= currentTime) {
            builder.append(LocaleController.getString("NotificationsOff", R.string.NotificationsOff));
        } else {
            builder.append(LocaleController.formatString("NotificationsOffUntil", R.string.NotificationsOffUntil, LocaleController.stringForMessageListDate(offUntil)));
        }
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_show)).setChecked(enabled, true);
        setGroupSettingEnabled(enabled);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_group_preview_message)).setChecked(preferences.getBoolean("EnablePreviewGroup", true), true);
        String value = preferences.getString("GroupSound", LocaleController.getString("SoundDefault", R.string.SoundDefault));
        if (value.equals("NoSound")) {
            value = LocaleController.getString("NoSound", R.string.NoSound);
        }
        ((TextView) this.fragmentView.findViewById(R.id.tv_group_sound_type)).setText(value);
    }

    private void initChannelSetting() {
        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", R.string.NotificationsOn));
        } else if (offUntil - 31536000 >= currentTime) {
            builder.append(LocaleController.getString("NotificationsOff", R.string.NotificationsOff));
        } else {
            builder.append(LocaleController.formatString("NotificationsOffUntil", R.string.NotificationsOffUntil, LocaleController.stringForMessageListDate(offUntil)));
        }
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_show)).setChecked(enabled, true);
        setChannelSettingEnabled(enabled);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_channel_preview_message)).setChecked(preferences.getBoolean("EnablePreviewChannel", true), true);
        String value = preferences.getString("ChannelSound", LocaleController.getString("SoundDefault", R.string.SoundDefault));
        if (value.equals("NoSound")) {
            value = LocaleController.getString("NoSound", R.string.NoSound);
        }
        ((TextView) this.fragmentView.findViewById(R.id.tv_channel_sound_type)).setText(value);
    }

    private void initOtherSetting() {
        SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_app_show)).setChecked(preferences.getBoolean("EnableInAppSounds", true), true);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_app_shake)).setChecked(preferences.getBoolean("EnableInAppVibrate", true), true);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_app_preview_notice)).setChecked(preferences.getBoolean("EnableInAppPreview", true), true);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_include_closed_dialog)).setChecked(NotificationsController.getInstance(this.currentAccount).showBadgeMuted, true);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_msg_count_statistics)).setChecked(NotificationsController.getInstance(this.currentAccount).showBadgeMessages, true);
        ((MrySwitch) this.fragmentView.findViewById(R.id.switch_new_contacter_add)).setChecked(preferences.getBoolean("EnableContactJoined", true), true);
    }

    @Override
    public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
        Ringtone rng;
        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", R.string.SoundDefault);
                } 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(R.id.tv_sound_type)).setText(name == null ? LocaleController.getString("NoSound", R.string.NoSound) : 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(R.id.tv_group_sound_type)).setText(name == null ? LocaleController.getString("NoSound", R.string.NoSound) : 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(R.id.tv_channel_sound_type)).setText(name == null ? LocaleController.getString("NoSound", R.string.NoSound) : name);
            }
            editor.commit();
            getNotificationsController().updateServerNotificationsSettings(requestCode);
        }
    }

    private void setGroupSettingEnabled(boolean blnEnable) {
        this.fragmentView.findViewById(R.id.tv_group_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.switch_group_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_group_sound).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_group_sound_type).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.rl_group_sound).setEnabled(blnEnable);
        this.fragmentView.findViewById(R.id.rl_group_preview_message).setEnabled(blnEnable);
    }

    private void setChannelSettingEnabled(boolean blnEnable) {
        this.fragmentView.findViewById(R.id.tv_channel_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.switch_channel_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_channel_sound).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_channel_sound_type).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.rl_channel_sound).setEnabled(blnEnable);
        this.fragmentView.findViewById(R.id.rl_channel_preview_message).setEnabled(blnEnable);
    }

    private void setPrivateSettingEnabled(boolean blnEnable) {
        this.fragmentView.findViewById(R.id.tv_private_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.switch_preview_message).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_private_sound).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.tv_sound_type).setAlpha(blnEnable ? 1.0f : 0.5f);
        this.fragmentView.findViewById(R.id.rl_sound).setEnabled(blnEnable);
        this.fragmentView.findViewById(R.id.rl_preview_message).setEnabled(blnEnable);
    }

    private void setColors() {
        this.fragmentView.findViewById(R.id.rl_show_notice).setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    }
}