package com.ubt.jimu.user.view.setting; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.ButterKnife; import com.alibaba.android.arouter.facade.Postcard; import com.alibaba.android.arouter.launcher.ARouter; import com.ubt.jimu.BaseActivity; import com.ubt.jimu.R; import com.ubt.jimu.base.cache.Cache; import com.ubt.jimu.base.cache.Constants; import com.ubt.jimu.base.cache.SharePreferenceHelper; import com.ubt.jimu.base.db.user.UserDbHandler; import com.ubt.jimu.base.dialog.JimuSimpleDialog; import com.ubt.jimu.base.entities.ApiStatus; import com.ubt.jimu.base.entities.User; import com.ubt.jimu.base.event.MessageEvent; import com.ubt.jimu.course.repository.CourseResult; import com.ubt.jimu.unity.ModelType; import com.ubt.jimu.user.contract.SettingContract$Presenter; import com.ubt.jimu.user.contract.SettingContract$View; import com.ubt.jimu.user.presenter.SettingPresenter; import com.ubt.jimu.utils.ExternalOverFroyoUtils; import com.ubt.jimu.utils.GlideUtils; import com.ubt.jimu.utils.LocaleUtils; import com.ubt.jimu.utils.NetWorkUtil; import com.ubt.jimu.utils.ShortcutHelper; import com.ubt.jimu.utils.SystemUtils; import com.ubt.jimu.widgets.JAlertDialog; import com.ubtech.utils.FileHelper; import com.ubtech.view.dialog.SimpleDialog; import com.ubtech.view.widget.UButton; import com.ubtrobot.ubtlib.analytics.JimuAnalytics; import java.io.File; import org.greenrobot.eventbus.EventBus; /* loaded from: classes2.dex */ public class SettingActivity extends BaseActivity implements SettingContract$View { private SharePreferenceHelper a; private SettingPresenter b; ImageView cbAuto; CheckBox cbInfo; CheckBox cbProtect; CheckBox cbWifi; private Dialog d; TextView tvAutoConnect; TextView tvCacheSize; TextView tvClearCache; TextView tvInfo; TextView tvNewVersion; TextView tvProtect; TextView tvWifi; RelativeLayout xlAbout; RelativeLayout xlInput; UButton xlLogout; RelativeLayout xlModify; RelativeLayout xlPolicy; RelativeLayout xlQa; ViewGroup xlTc; RelativeLayout xlTech; RelativeLayout xlTo; LinearLayout xlTop; RelativeLayout xrAutoConnect; RelativeLayout xrClearCache; RelativeLayout xrInfo; RelativeLayout xrProtect; RelativeLayout xrWifi; private Handler c = new Handler(); private boolean e = true; private ExitLoginPopupwindow f = null; private void K0() { JAlertDialog jAlertDialog = this.mJAlertDialog; if (jAlertDialog != null) { jAlertDialog.dismiss(); } } private void bindClick() { this.xrClearCache.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.e0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.h(view); } }); this.xrWifi.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.y @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.j(view); } }); this.cbWifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.view.setting.u @Override // android.widget.CompoundButton.OnCheckedChangeListener public final void onCheckedChanged(CompoundButton compoundButton, boolean z) { SettingActivity.this.b(compoundButton, z); } }); this.xrInfo.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.q @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.k(view); } }); this.cbInfo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.view.setting.a0 @Override // android.widget.CompoundButton.OnCheckedChangeListener public final void onCheckedChanged(CompoundButton compoundButton, boolean z) { SettingActivity.this.c(compoundButton, z); } }); this.xrProtect.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.d0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.l(view); } }); this.cbProtect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.view.setting.r @Override // android.widget.CompoundButton.OnCheckedChangeListener public final void onCheckedChanged(CompoundButton compoundButton, boolean z) { SettingActivity.this.a(compoundButton, z); } }); this.xrAutoConnect.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.g0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.a(view); } }); this.xlTo.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.n @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.b(view); } }); this.xlModify.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.c0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.c(view); } }); this.xlTech.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.w @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.d(view); } }); this.xlAbout.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.o @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.e(view); } }); this.xlQa.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.v @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.f(view); } }); this.xlLogout.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.f0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.g(view); } }); this.xlTc.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.i0 @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.m(view); } }); this.xlPolicy.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.z @Override // android.view.View.OnClickListener public final void onClick(View view) { SettingActivity.this.i(view); } }); } private void initData() { this.b = new SettingPresenter(this, this); this.a = new SharePreferenceHelper(); this.cbWifi.setChecked(this.a.getBoolean(SharePreferenceHelper.SP_KEY_WIFI_VIEW, true).booleanValue()); this.cbInfo.setChecked(this.a.getBoolean(SharePreferenceHelper.SP_KEY_INFO_TO, true).booleanValue()); this.cbProtect.setChecked(this.a.getBoolean(SharePreferenceHelper.SP_KEY_ELECTRICITY_PROTECT, true).booleanValue()); this.e = this.a.getBoolean(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, true).booleanValue(); this.cbAuto.setBackgroundResource(this.e ? R.drawable.checkbox_on_xxx : R.drawable.checkbox_off_xxx); this.tvCacheSize.setText(GlideUtils.a(this)); User user = UserDbHandler.getUser(); if (user == null || user.getUserId() <= 0) { this.xlLogout.setVisibility(8); } else { this.xlLogout.setVisibility(0); } if (LocaleUtils.f()) { this.xlTc.setVisibility(0); } else { this.xlTc.setVisibility(8); } if (Cache.getInstance().getSettings().getBoolean(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, false).booleanValue()) { this.tvNewVersion.setVisibility(0); } else { this.tvNewVersion.setVisibility(8); } findViewById(R.id.xl_test).setVisibility(8); } static /* synthetic */ void m(View view) { User user = UserDbHandler.getUser(); if (user == null) { Postcard a = ARouter.b().a("/page/web"); a.a("type", 0); a.a("url", "https://support.qq.com/product/33918"); a.a("zoom", 60); a.t(); return; } String str = "nickname=" + user.getNickName() + "&avatar=" + user.getUserImage() + "&openid=" + user.getUserOnlyId(); Postcard a2 = ARouter.b().a("/page/web"); a2.a("type", 1); a2.a("url", "https://support.qq.com/product/33918"); a2.a("data", str.getBytes()); a2.a("zoom", 60); a2.t(); } public /* synthetic */ void D0() { this.xrProtect.setPressed(false); } public /* synthetic */ void E0() { this.xrWifi.setPressed(false); } public /* synthetic */ void F0() { this.xrInfo.setPressed(false); } public /* synthetic */ void G0() { this.xlLogout.setVisibility(8); } public void H0() { new JimuSimpleDialog.Builder(this).cancel(R.string.cancel).ok(R.string.ok).content(R.string.delete_account).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.x @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.b0 @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { SettingActivity.this.a(dialogInterface, i); } }).build().show(); } public void I0() { this.b.a(Cache.getInstance().getUserToken()); } public void J0() { this.d = new SimpleDialog.Builder(this).a(R.string.search_cancel_return).a(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.SettingActivity.2 @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i) { SettingActivity.this.e = true; dialogInterface.dismiss(); } }).d(R.string.confirm).b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.view.setting.SettingActivity.1 @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i) { SettingActivity.this.e = false; SettingActivity.this.b.a(SettingActivity.this.e); if (SettingActivity.this.a != null) { SettingActivity.this.a.put(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, false); } SettingActivity.this.cbAuto.setBackgroundResource(R.drawable.checkbox_off_xxx); dialogInterface.dismiss(); } }).b(R.string.bluetooth_auto_connect_tips).a(); this.d.show(); } @Override // com.ubt.jimu.user.contract.SettingContract$View public void c(ApiStatus apiStatus) { } public /* synthetic */ void d(View view) { this.b.g(this.xlTech); } public /* synthetic */ void e(View view) { this.b.a(this.xlAbout); } public /* synthetic */ void f(View view) { this.b.e(this.xlQa); } @Override // com.ubt.jimu.user.contract.SettingContract$View public void f(String str) { } public /* synthetic */ void g(View view) { if (this.f == null) { this.f = new ExitLoginPopupwindow(this); } this.f.b(this.xlTop); } public /* synthetic */ void h(View view) { File externalCacheDir = getExternalCacheDir(); if (externalCacheDir == null) { return; } String absolutePath = externalCacheDir.getAbsolutePath(); if (new File(absolutePath).exists()) { SystemUtils.b(absolutePath); this.tvCacheSize.setText(GlideUtils.a(this)); } } public /* synthetic */ void i(View view) { ThePolicyActivity.a(this, 10); } public /* synthetic */ void j(View view) { this.cbWifi.setChecked(!r2.isChecked()); this.b.d(this.xrWifi); } public /* synthetic */ void k(View view) { this.cbInfo.setChecked(!r2.isChecked()); this.b.f(this.xrInfo); } public /* synthetic */ void l(View view) { this.cbProtect.setChecked(!r2.isChecked()); this.b.b(this.xrProtect); } @Override // androidx.fragment.app.FragmentActivity, android.app.Activity protected void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); if (i == 10 && i2 == -1) { this.xlLogout.post(new Runnable() { // from class: com.ubt.jimu.user.view.setting.h0 @Override // java.lang.Runnable public final void run() { SettingActivity.this.G0(); } }); } } @Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_setting); ButterKnife.a(this); initData(); bindClick(); } @Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity protected void onDestroy() { Handler handler = this.c; if (handler != null) { handler.removeCallbacksAndMessages(null); } this.b.a(); super.onDestroy(); } @Override // com.ubt.jimu.user.contract.SettingContract$View public boolean r() { return this.cbProtect.isChecked(); } @Override // com.ubt.jimu.BaseActivity public void relayout() { } @Override // com.ubt.jimu.user.contract.SettingContract$View public boolean s() { return this.cbWifi.isChecked(); } @Override // com.ubt.jimu.user.contract.SettingContract$View public boolean t() { return this.cbInfo.isChecked(); } public /* synthetic */ void b(CompoundButton compoundButton, boolean z) { this.b.d(this.xrWifi); this.c.postDelayed(new Runnable() { // from class: com.ubt.jimu.user.view.setting.s @Override // java.lang.Runnable public final void run() { SettingActivity.this.E0(); } }, 20L); } public /* synthetic */ void c(CompoundButton compoundButton, boolean z) { this.b.f(this.xrInfo); this.c.postDelayed(new Runnable() { // from class: com.ubt.jimu.user.view.setting.t @Override // java.lang.Runnable public final void run() { SettingActivity.this.F0(); } }, 20L); } public /* synthetic */ void a(CompoundButton compoundButton, boolean z) { this.b.b(this.xrProtect); this.c.postDelayed(new Runnable() { // from class: com.ubt.jimu.user.view.setting.p @Override // java.lang.Runnable public final void run() { SettingActivity.this.D0(); } }, 20L); } public void l() { Cache.getInstance().clearCacheUser(); UserDbHandler.clearUser(); this.xlLogout.setVisibility(8); ShortcutHelper.a(this); EventBus.b().b(new MessageEvent(1)); } public /* synthetic */ void b(View view) { this.b.h(this.xlTo); } public /* synthetic */ void c(View view) { this.b.c(this.xlModify); JimuAnalytics.b().a("click_P15_1"); } public /* synthetic */ void a(View view) { if (this.e) { J0(); return; } this.e = true; SharePreferenceHelper sharePreferenceHelper = this.a; if (sharePreferenceHelper != null) { sharePreferenceHelper.put(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, true); } this.b.a(this.e); this.cbAuto.setBackgroundResource(this.e ? R.drawable.checkbox_on_xxx : R.drawable.checkbox_off_xxx); } @Override // com.ubt.jimu.user.contract.SettingContract$View public void h() { K0(); toast(getString(R.string.tips_delete_account_failed)); } @Override // com.ubtech.view.BaseView /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void setPresenter(SettingContract$Presenter settingContract$Presenter) { this.b = (SettingPresenter) settingContract$Presenter; } @Override // com.ubt.jimu.user.contract.SettingContract$View public void a(ApiStatus apiStatus) { K0(); if (apiStatus.getCode() != 0 && !CourseResult.SUCCESS.equals(apiStatus.getMessage())) { toast(getString(R.string.tips_delete_account_failed)); return; } File file = new File(ExternalOverFroyoUtils.a(this, (ModelType) null) + String.format(Constants.USER_HOME, Cache.getInstance().getUserId())); if (file.exists()) { FileHelper.a(file); } l(); toast(getString(R.string.tips_delete_account)); } public /* synthetic */ void a(DialogInterface dialogInterface, int i) { if (!NetWorkUtil.b(this)) { toast(getString(R.string.network_error)); return; } dialogInterface.dismiss(); showLoading(getString(R.string.logoff) + "..."); this.b.b(); } }