导航菜单

页面标题

页面副标题

CallApp v2.226 - SettingsAdvancedBlockActivity.java 源代码

正在查看: CallApp v2.226 应用的 SettingsAdvancedBlockActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.callapp.contacts.activity.settings;

import android.app.Activity;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import androidx.appcompat.app.AppCompatActivity;
import com.callapp.contacts.R;
import com.callapp.contacts.activity.base.BaseTopBarActivity;
import com.callapp.contacts.manager.BlockManager;
import com.callapp.contacts.manager.analytics.AnalyticsManager;
import com.callapp.contacts.manager.popup.DialogPopup;
import com.callapp.contacts.manager.popup.PopupManager;
import com.callapp.contacts.manager.preferences.Prefs;
import com.callapp.contacts.manager.task.Task;
import com.callapp.contacts.model.Constants;
import com.callapp.contacts.popup.contact.DialogSelectSingleChoiceBase;
import com.callapp.contacts.popup.contact.DialogSimpleMessage;
import com.callapp.contacts.util.Activities;
import com.callapp.contacts.util.AndroidUtils;
import com.callapp.contacts.util.ThemeUtils;
import com.callapp.contacts.widget.SettingsRowCompoundBtn;
import com.callapp.contacts.widget.SettingsRowSelectSingleChoice;
import com.callapp.contacts.widget.TopBarFragment;

public class SettingsAdvancedBlockActivity extends BaseTopBarActivity {
    @Override
    public int getLayoutResourceId() {
        return R.layout.activity_settings_advanced_block;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getSupportActionBar().r(true);
        setTitle(Activities.getString(R.string.settings_title));
        AnalyticsManager.get().t(Constants.ADVANCED_BLOCK_SCREEN, null);
        int color = ThemeUtils.getColor(R.color.background);
        View findViewById = findViewById(R.id.row_common_spammers_container);
        SettingsRowCompoundBtn settingsRowCompoundBtn = (SettingsRowCompoundBtn) findViewById.findViewById(R.id.row_common_spammers);
        findViewById.setBackgroundColor(color);
        settingsRowCompoundBtn.setTitle(Activities.getString(R.string.block_settings_common_spammers_title));
        settingsRowCompoundBtn.setChecked(Prefs.c2.get().booleanValue());
        settingsRowCompoundBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(this) {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                AndroidUtils.e(compoundButton, 1);
                Prefs.c2.set(Boolean.valueOf(z));
                AnalyticsManager.get().o(Constants.BLOCK_AND_SPAM, "Block common spammers toggled. is enabled: " + z);
            }
        });
        View findViewById2 = findViewById(R.id.row_private_numbers_container);
        SettingsRowCompoundBtn settingsRowCompoundBtn2 = (SettingsRowCompoundBtn) findViewById2.findViewById(R.id.row_private_numbers);
        findViewById2.setBackgroundColor(color);
        settingsRowCompoundBtn2.setTitle(Activities.getString(R.string.block_settings_private_numbers_title));
        settingsRowCompoundBtn2.setChecked(Prefs.Y1.get().booleanValue());
        settingsRowCompoundBtn2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(this) {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                AndroidUtils.e(compoundButton, 1);
                Prefs.Y1.set(Boolean.valueOf(z));
                AnalyticsManager.get().o(Constants.BLOCK_AND_SPAM, "Block private numbers toggled. is enabled: " + z);
            }
        });
        View findViewById3 = findViewById(R.id.row_block_international_numbers_container);
        SettingsRowCompoundBtn settingsRowCompoundBtn3 = (SettingsRowCompoundBtn) findViewById3.findViewById(R.id.row_block_international_numbers);
        findViewById3.setBackgroundColor(color);
        settingsRowCompoundBtn3.setTitle(Activities.getString(R.string.international_numbers_row));
        settingsRowCompoundBtn3.setChecked(Prefs.Z1.get().booleanValue());
        settingsRowCompoundBtn3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                AndroidUtils.d(SettingsAdvancedBlockActivity.this);
                Prefs.Z1.set(Boolean.valueOf(z));
                AnalyticsManager.get().p(Constants.ADVANCED_BLOCK_SETTINGS, "Block international numbers toggled. is enabled: " + z, Constants.CLICK);
            }
        });
        View findViewById4 = findViewById(R.id.row_block_not_in_phonebook_numbers_container);
        final SettingsRowCompoundBtn settingsRowCompoundBtn4 = (SettingsRowCompoundBtn) findViewById4.findViewById(R.id.row_block_not_in_phonebook_numbers);
        findViewById4.setBackgroundColor(color);
        settingsRowCompoundBtn4.setTitle(Activities.getString(R.string.not_in_phonebook_row));
        settingsRowCompoundBtn4.setChecked(Prefs.a2.get().booleanValue());
        settingsRowCompoundBtn4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, final boolean z) {
                AppCompatActivity appCompatActivity = SettingsAdvancedBlockActivity.this;
                AndroidUtils.d(appCompatActivity);
                if (z) {
                    PopupManager.get().c(appCompatActivity, new DialogSimpleMessage(null, Activities.getString(R.string.block_settings_advanced_title_non_contact_warning), Activities.getString(R.string.ok), Activities.getString(R.string.cancel), new DialogPopup.IDialogOnClickListener(this) {
                        @Override
                        public final void onClickListener(Activity activity) {
                            new Task() {
                                @Override
                                public final void doTask() {
                                    Prefs.a2.set(Boolean.TRUE);
                                    AnalyticsManager.get().p(Constants.ADVANCED_BLOCK_SETTINGS, "Block non contacts toggled. is enabled: true" + z, Constants.CLICK);
                                }
                            }.execute();
                        }
                    }, new DialogPopup.IDialogOnClickListener() {
                        @Override
                        public final void onClickListener(Activity activity) {
                            settingsRowCompoundBtn4.setChecked(Prefs.a2.get().booleanValue());
                        }
                    }, new DialogPopup.IDialogSimpleListener() {
                        @Override
                        public final void a(DialogPopup dialogPopup) {
                        }

                        @Override
                        public final void b(DialogPopup dialogPopup) {
                            settingsRowCompoundBtn4.setChecked(Prefs.a2.get().booleanValue());
                        }

                        @Override
                        public final void onShow(DialogInterface dialogInterface) {
                        }
                    }), true);
                    return;
                }
                Prefs.a2.set(Boolean.valueOf(z));
                AnalyticsManager.get().p(Constants.ADVANCED_BLOCK_SETTINGS, "Block non contacts toggled. is enabled: " + z, Constants.CLICK);
            }
        });
        View findViewById5 = findViewById(R.id.row_block_method_container);
        SettingsRowSelectSingleChoice settingsRowSelectSingleChoice = (SettingsRowSelectSingleChoice) findViewById5.findViewById(R.id.row_block_method);
        final BlockManager.BlockMethod[] values = BlockManager.BlockMethod.values();
        String[] strArr = new String[values.length];
        for (int i = 0; i < values.length; i++) {
            strArr[i] = values[i].getTitle();
        }
        int ordinal = ((BlockManager.BlockMethod) Prefs.b2.get()).ordinal();
        findViewById5.setBackgroundColor(color);
        settingsRowSelectSingleChoice.setTitle(Activities.getString(R.string.advanced_block_settings_method_row_title));
        settingsRowSelectSingleChoice.setChoices(ordinal, strArr, Activities.getString(R.string.advanced_block_settings_method_row_title));
        settingsRowSelectSingleChoice.setListener(new DialogSelectSingleChoiceBase.SingleChoiceListenerImpel(this) {
            @Override
            public final void b(int i2) {
                BlockManager.BlockMethod blockMethod = values[i2];
                Prefs.b2.set(blockMethod);
                AnalyticsManager.get().p(Constants.ADVANCED_BLOCK_SETTINGS, "Block method option changed to: " + blockMethod.getTitle(), Constants.CLICK);
            }
        });
        settingsRowSelectSingleChoice.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                AndroidUtils.d(SettingsAdvancedBlockActivity.this);
                AnalyticsManager.get().p(Constants.ADVANCED_BLOCK_SETTINGS, "Block method option clicked.", Constants.CLICK);
            }
        });
    }

    public void onStateIconClicked(TopBarFragment.TopBarIconStates topBarIconStates) {
        finish();
    }
}