正在查看: CallApp v2.226 应用的 SettingsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CallApp v2.226 应用的 SettingsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.callapp.contacts.activity.settings;
import a1.d0;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.appcompat.widget.s0;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.p0;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.a0;
import androidx.lifecycle.x;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.p;
import androidx.preference.s;
import androidx.preference.t;
import com.callapp.contacts.CallAppApplication;
import com.callapp.contacts.R;
import com.callapp.contacts.activity.base.BaseNoTitleActivity;
import com.callapp.contacts.activity.interfaces.ThemeChangedListener;
import com.callapp.contacts.activity.settings.SettingsSearchFragment;
import com.callapp.contacts.manager.analytics.AnalyticsManager;
import com.callapp.contacts.manager.phone.PhoneManager;
import com.callapp.contacts.manager.preferences.LocalPrefsStore;
import com.callapp.contacts.manager.preferences.prefs.PrefsAdapter;
import com.callapp.contacts.model.Constants;
import com.callapp.contacts.util.Activities;
import com.callapp.contacts.util.CLog;
import com.callapp.contacts.util.ReflectionUtils;
import com.callapp.contacts.util.ThemeUtils;
import com.callapp.contacts.util.ViewUtils;
import com.callapp.framework.util.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects;
public class SettingsActivity extends BaseNoTitleActivity implements ThemeChangedListener, t, s {
public static final String ACTION_DEACTIVATE = "ACTION_DEACTIVATE";
public static final String EXTRA_ADS_SETTINGS = "ads_settings";
public static final String EXTRA_BACKUP_SETTINGS = "backup_settings";
public static final String EXTRA_CALLER_ID_SETTINGS = "callerid_settings";
public static final String EXTRA_CUSTOMIZE_SETTINGS = "customize_settings";
public static final String EXTRA_DEBUG_INSIGHTS = "insights_screen";
public static final String EXTRA_DEBUG_SETTINGS = "debug_settings";
public static final String EXTRA_GENERAL_SETTINGS = "general_settings";
public static final String EXTRA_HIDE_CALL_RECORDER = "EXTRA_HIDE_CALL_RECORDER";
public static final String EXTRA_MY_ACCOUNT_KEY = "myAccount";
public static final String EXTRA_NOTIFICATIONS_SETTINGS = "notifications_settings";
public static final String EXTRA_OVERLAYS_SETTINGS = "popup_settings";
public static final String EXTRA_RECORDER_SETTINGS = "call_recorder_settings";
public static final String EXTRA_SHOW_CALL_RECORDER_PERMISSION = "show_call_recorder_permission";
public static final String EXTRA_SMS_SETTINGS = "sms_settings";
public static final String EXTRA_SMS_SETTINGS_DIRECT_BACK = "sms_settings_direct_back";
public static final String MANAGE_CLICKED = "ManageClicked";
public static final int REQUEST_CODE_SETTINGS = 15000;
public static final int RESULT_DEACTIVATE = -1111111;
public static final String TAG = "SettingsActivity";
private SettingsFragment settingsFragment;
private SettingsViewModel viewModel;
private void configureFragmentsFromIntent(Intent intent) {
if (getSettingsFragment() != null) {
getSettingsFragment().x(intent);
}
}
public static Intent getSettingsIntent(String str) {
Intent intent = new Intent((Context) CallAppApplication.get(), (Class<?>) SettingsActivity.class);
intent.putExtra(str, true);
return intent;
}
private void initSearchView(Menu menu) {
MenuItem findItem = menu.findItem(R.id.action_filter_search);
final SearchView actionView = findItem.getActionView();
if (actionView != null) {
actionView.setIconifiedByDefault(false);
ImageView imageView = (ImageView) actionView.findViewById(2131364947);
imageView.setImageResource(R.drawable.ic_search_white_24);
imageView.setColorFilter(ThemeUtils.getColor(R.color.icon));
EditText editText = (EditText) actionView.findViewById(2131364950);
editText.setTextColor(ThemeUtils.getColor(R.color.third_background_text));
editText.setTextSize(2, 16.0f);
editText.setHintTextColor(ThemeUtils.getColor(R.color.subtitle));
ImageView imageView2 = (ImageView) actionView.findViewById(2131364944);
imageView2.setColorFilter(ThemeUtils.getColor(R.color.icon));
imageView2.setOnClickListener(new aa.g(7, actionView, editText));
actionView.findViewById(2131364948).setBackgroundColor(0);
actionView.setQueryHint(Activities.getString(R.string.settings_search_hint));
int i = ThemeUtils.isThemeLight() ? R.drawable.search_view_background : R.drawable.search_view_background_dark;
View findViewById = actionView.findViewById(2131364945);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) findViewById.getLayoutParams();
layoutParams.height = -2;
layoutParams.gravity = 16;
findViewById.setLayoutParams(layoutParams);
int dimensionPixelOffset = getResources().getDimensionPixelOffset(2131165616);
findViewById.setPadding(dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset);
findViewById.setBackgroundResource(i);
actionView.setOnQueryTextListener(new s0() {
public final void a(String str) {
if (actionView.isShown()) {
SettingsViewModel settingsViewModel = SettingsActivity.this.viewModel;
if (str == null) {
str = "";
}
settingsViewModel.setSearchQuery(str);
}
}
public final void b(String str) {
}
});
}
findItem.setIcon(R.drawable.ic_search_white_24);
Drawable icon = findItem.getIcon();
if (icon != null) {
icon.setTint(ThemeUtils.getColor(R.color.icon));
}
findItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public final boolean onMenuItemClick(MenuItem menuItem) {
boolean lambda$initSearchView$1;
lambda$initSearchView$1 = SettingsActivity.this.lambda$initSearchView$1(menuItem);
return lambda$initSearchView$1;
}
});
findItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public final boolean onMenuItemActionCollapse(MenuItem menuItem) {
AnalyticsManager.get().o(Constants.SETTINGS, "ClickBackSearchBar");
FragmentManager supportFragmentManager = SettingsActivity.this.getSupportFragmentManager();
SettingsSearchFragment.Companion companion = SettingsSearchFragment.n;
if (supportFragmentManager.G(companion.getTAG()) != null) {
supportFragmentManager.y(new FragmentManager.h(supportFragmentManager, companion.getTAG(), -1, 1), false);
}
return true;
}
@Override
public final boolean onMenuItemActionExpand(MenuItem menuItem) {
return true;
}
});
}
private void initToolbar(Toolbar toolbar) {
toolbar.setBackgroundColor(ThemeUtils.getColor(R.color.background));
toolbar.setTitleTextColor(ThemeUtils.getColor(R.color.title));
toolbar.setTitle(Activities.getString(R.string.settings_title));
Drawable i = ViewUtils.i(R.drawable.ic_arrow_back_grey, Integer.valueOf(ThemeUtils.getColor(R.color.icon)));
toolbar.setNavigationIcon(i);
toolbar.setCollapseIcon(i);
i.setAutoMirrored(true);
setSupportActionBar(toolbar);
}
private void initViewModel(final Toolbar toolbar) {
SettingsViewModel settingsViewModel = (SettingsViewModel) new ViewModelProvider(this).a(SettingsViewModel.class);
this.viewModel = settingsViewModel;
x toolbarTitle = settingsViewModel.getToolbarTitle();
Objects.requireNonNull(toolbar);
final int i = 0;
toolbarTitle.d(this, new a0() {
public final void onChanged(Object obj) {
switch (i) {
case 0:
((Toolbar) toolbar).setTitle((String) obj);
break;
default:
((SettingsActivity) toolbar).lambda$initViewModel$2((Boolean) obj);
break;
}
}
});
final int i2 = 1;
this.viewModel.getShowSearchMenuIcon().d(this, new a0() {
public final void onChanged(Object obj) {
switch (i2) {
case 0:
((Toolbar) this).setTitle((String) obj);
break;
default:
((SettingsActivity) this).lambda$initViewModel$2((Boolean) obj);
break;
}
}
});
}
public static void lambda$initSearchView$0(SearchView searchView, EditText editText, View view) {
searchView.setQuery("", false);
editText.setText("");
AnalyticsManager.get().o(Constants.SETTINGS, "ClickXSearchBar");
}
public boolean lambda$initSearchView$1(MenuItem menuItem) {
AnalyticsManager.get().o(Constants.SETTINGS, "ClickSearchIcon");
FragmentManager supportFragmentManager = getSupportFragmentManager();
supportFragmentManager.getClass();
androidx.fragment.app.a aVar = new androidx.fragment.app.a(supportFragmentManager);
SettingsSearchFragment.Companion companion = SettingsSearchFragment.n;
companion.getClass();
aVar.i(R.id.content_holder, new SettingsSearchFragment(), companion.getTAG());
aVar.c(companion.getTAG());
aVar.d();
return false;
}
public void lambda$initViewModel$2(Boolean bool) {
invalidateOptionsMenu();
}
public static void startSettings(String str) {
Activities.E(CallAppApplication.get(), getSettingsIntent(str));
}
@Override
public int getLayoutResourceId() {
return R.layout.layout_settings_screen;
}
public SettingsFragment getSettingsFragment() {
return getSupportFragmentManager().G("SettingsFragment");
}
public SharedPreferences getSharedPreferences(String str, int i) {
return (getSettingsFragment() == null || getSettingsFragment().getPreferenceManager() == null || !getSettingsFragment().getPreferenceManager().f.equals(str)) ? super/*android.content.Context*/.getSharedPreferences(str, i) : new PrefsAdapter(LocalPrefsStore.get());
}
@Override
public int getThemeResId() {
return ThemeUtils.isThemeLight() ? R.style.settings_light : R.style.settings_dark;
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (getSettingsFragment() != null) {
getSettingsFragment().onActivityResult(i, i2, intent);
}
}
public void onBackPressed() {
getSettingsFragment().onDismiss(null);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Toolbar findViewById = findViewById(R.id.toolbar_settings);
initToolbar(findViewById);
initViewModel(findViewById);
if (!PhoneManager.get().isDefaultPhoneApp()) {
getIntent().putExtra(EXTRA_HIDE_CALL_RECORDER, true);
}
this.settingsFragment = new SettingsFragment();
if (getResources().getBoolean(R.bool.debugMode)) {
try {
Object c = ReflectionUtils.c(Class.forName("com.callapp.contacts.debug.DebugSettingsFragment"));
if (c instanceof SettingsFragment) {
this.settingsFragment = (SettingsFragment) c;
}
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException unused) {
}
}
FragmentManager supportFragmentManager = getSupportFragmentManager();
androidx.fragment.app.a f = d0.f(supportFragmentManager, supportFragmentManager);
f.i(R.id.content_holder, this.settingsFragment, "SettingsFragment");
f.d();
onNewIntent(getIntent());
AnalyticsManager.get().t(Constants.SETTING_SCREEN, null);
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
initSearchView(menu);
return true;
}
public void onNewIntent(Intent intent) {
super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
configureFragmentsFromIntent(intent);
}
public boolean onPreferenceStartFragment(@NonNull p pVar, @NonNull Preference preference) {
FragmentManager supportFragmentManager = getSupportFragmentManager();
androidx.fragment.app.a f = d0.f(supportFragmentManager, supportFragmentManager);
try {
SettingsFragment settingsFragment = (SettingsFragment) ReflectionUtils.c(Class.forName("com.callapp.contacts.debug.DebugSettingsFragment"));
Bundle bundle = new Bundle();
bundle.putString("androidx.preference.PreferenceFragmentCompat.PREFERENCE_ROOT", preference.getKey());
settingsFragment.setArguments(bundle);
f.i(R.id.content_holder, settingsFragment, preference.getKey());
if (!((p0) f).h) {
return true;
}
f.c(preference.getKey());
f.d();
return true;
} catch (ReflectiveOperationException e) {
e.getMessage();
CLog.a();
return true;
}
}
public boolean onPreferenceStartScreen(@NonNull p pVar, @NonNull PreferenceScreen preferenceScreen) {
SettingsFragment settingsFragment;
FragmentManager supportFragmentManager = getSupportFragmentManager();
androidx.fragment.app.a f = d0.f(supportFragmentManager, supportFragmentManager);
if (preferenceScreen.getKey().equals(EXTRA_DEBUG_INSIGHTS)) {
try {
settingsFragment = (SettingsFragment) ReflectionUtils.c(Class.forName("com.callapp.contacts.debug.DebugSettingsFragment"));
} catch (ReflectiveOperationException e) {
e.getMessage();
CLog.a();
settingsFragment = null;
}
} else {
settingsFragment = new SettingsFragment();
}
Bundle bundle = new Bundle();
bundle.putString("androidx.preference.PreferenceFragmentCompat.PREFERENCE_ROOT", preferenceScreen.getKey());
settingsFragment.setArguments(bundle);
f.i(R.id.content_holder, settingsFragment, preferenceScreen.getKey());
if (!((p0) f).h) {
return true;
}
f.c(preferenceScreen.getKey());
f.d();
return true;
}
public boolean onPrepareOptionsMenu(Menu menu) {
if (this.viewModel.getShowSearchMenuIcon().getValue() != null) {
menu.findItem(R.id.action_filter_search).setVisible(((Boolean) this.viewModel.getShowSearchMenuIcon().getValue()).booleanValue());
}
return super/*android.app.Activity*/.onPrepareOptionsMenu(menu);
}
@Override
public void onThemeChanged() {
SettingsFragment settingsFragment = this.settingsFragment;
if (settingsFragment == null || settingsFragment.getCurrentPreferenceScreen() == null || !StringUtils.j(this.settingsFragment.getCurrentPreferenceScreen().getTitle(), Activities.getString(R.string.market_superskin_title))) {
super.onThemeChanged();
}
}
}