package com.ubt.jimu.user.setting.view; import android.content.Intent; import android.os.Bundle; import android.os.PersistableBundle; import android.view.View; import android.widget.ImageView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.ubt.jimu.R; import com.ubt.jimu.base.cache.Cache; import com.ubt.jimu.base.cache.SharePreferenceHelper; import com.ubt.jimu.base.db.user.UserDbHandler; import com.ubt.jimu.base.entities.SettingitemBean; import com.ubt.jimu.base.entities.User; import com.ubt.jimu.base.mvp.HbBaseActivity; import com.ubt.jimu.user.setting.presenter.CommonSettingPresenter; import com.ubt.jimu.utils.TextUtils; import java.util.List; /* loaded from: classes2.dex */ public class CommonSettingActivity extends HbBaseActivity implements CommonSettingView { private ImageView a; private RecyclerView b; private BaseQuickAdapter c; private Fragment d; private Fragment e; private Fragment f; private Fragment g; private Fragment h; private Fragment i; private Fragment j; private Fragment k; private Fragment l; private FragmentManager m; private Fragment[] n = new Fragment[9]; private int o = -1; private String p = "chooseIndex"; private FragmentTransaction D0() { FragmentTransaction a = this.m.a(); int i = 0; while (true) { Fragment[] fragmentArr = this.n; if (i >= fragmentArr.length) { return a; } a.c(fragmentArr[i]); i++; } } private void E0() { User user = UserDbHandler.getUser(); Bundle bundle = new Bundle(); if (user != null) { String str = "nickname=" + user.getNickName() + "&avatar=" + TextUtils.e(user.getUserImage()) + "&openid=" + user.getUserId(); bundle.putInt("type", 1); bundle.putInt("zoom", 100); bundle.putString("url", "https://support.qq.com/product/33918?"); bundle.putString("data", str); this.k.setArguments(bundle); } else { bundle.putInt("type", 0); bundle.putInt("zoom", 100); bundle.putString("url", "https://support.qq.com/product/33918?"); } this.k.setArguments(bundle); } private void F0() { this.a.setOnClickListener(this); } private void initView() { this.a = (ImageView) findViewById(R.id.iv_setting_back); this.b = (RecyclerView) findViewById(R.id.rcv_setting_right); } @Override // com.ubt.jimu.user.setting.view.CommonSettingView public void d(List list) { if (this.c == null) { this.c = new BaseQuickAdapter(R.layout.view_textview, list) { // from class: com.ubt.jimu.user.setting.view.CommonSettingActivity.1 /* JADX INFO: Access modifiers changed from: protected */ @Override // com.chad.library.adapter.base.BaseQuickAdapter /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void convert(BaseViewHolder baseViewHolder, SettingitemBean settingitemBean) { baseViewHolder.setText(R.id.tv_setting_item, settingitemBean.getName()); if (settingitemBean.isChoose()) { baseViewHolder.setTextColor(R.id.tv_setting_item, CommonSettingActivity.this.getResources().getColor(R.color.bg_24A8FF)); baseViewHolder.setBackgroundColor(R.id.rl_setting_content, CommonSettingActivity.this.getResources().getColor(R.color.bg_color_halfinvisibel_blue)); } else { baseViewHolder.setTextColor(R.id.tv_setting_item, CommonSettingActivity.this.getResources().getColor(R.color.bg_596F80)); baseViewHolder.setBackgroundColor(R.id.rl_setting_content, CommonSettingActivity.this.getResources().getColor(R.color.translucent)); } if (baseViewHolder.getAdapterPosition() != 6) { baseViewHolder.setVisible(R.id.tv_new_version, false); } else if (Cache.getInstance().getSettings().getBoolean(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, false).booleanValue()) { baseViewHolder.setVisible(R.id.tv_new_version, true); } else { baseViewHolder.setVisible(R.id.tv_new_version, false); } } }; } this.c.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { // from class: com.ubt.jimu.user.setting.view.CommonSettingActivity.2 @Override // com.chad.library.adapter.base.BaseQuickAdapter.OnItemClickListener public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) { ((CommonSettingPresenter) ((HbBaseActivity) CommonSettingActivity.this).mPresenter).a(i); baseQuickAdapter.notifyDataSetChanged(); CommonSettingActivity.this.a((SettingitemBean) baseQuickAdapter.getItem(i)); } }); this.b.setLayoutManager(new LinearLayoutManager(this)); this.b.setAdapter(this.c); } @Override // com.ubt.jimu.base.mvp.HbBaseActivity public int getLayoutResId() { return R.layout.activity_commonsetting; } @Override // androidx.fragment.app.FragmentActivity, android.app.Activity protected void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); Fragment fragment = this.n[this.o]; if (fragment instanceof FeedBackFragment) { fragment.onActivityResult(i, i2, intent); } } @Override // com.ubt.jimu.base.mvp.HbBaseActivity, 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); initView(); a(bundle); F0(); ((CommonSettingPresenter) this.mPresenter).b(); } @Override // android.app.Activity protected void onRestoreInstanceState(Bundle bundle) { super.onRestoreInstanceState(bundle); } @Override // android.app.Activity public void onSaveInstanceState(Bundle bundle, PersistableBundle persistableBundle) { bundle.putInt(this.p, this.o); super.onSaveInstanceState(bundle, persistableBundle); } @Override // com.ubt.jimu.base.mvp.SingleClickListener public void onSingleClick(View view) { if (view.getId() == R.id.iv_setting_back) { finish(); } } @Override // com.ubt.jimu.base.mvp.HbBaseActivity public CommonSettingPresenter createPresenter() { return new CommonSettingPresenter(); } private void a(Bundle bundle) { this.m = getSupportFragmentManager(); FragmentTransaction a = this.m.a(); for (int i = 0; i < this.n.length; i++) { Fragment a2 = this.m.a("frag" + i); if (a2 != null) { a.c(a2); this.n[i] = a2; } else { switch (i) { case 0: this.d = new MyAccountFragment(); Bundle bundle2 = new Bundle(); bundle2.putLong("view_user_id", 0L); this.d.setArguments(bundle2); this.n[0] = this.d; break; case 1: this.e = new CommonUseFragment(); this.n[1] = this.e; break; case 2: this.f = new HardwareFragment(); this.n[2] = this.f; break; case 3: this.g = new TeachFragment(); this.n[3] = this.g; break; case 4: this.h = new LaboratoryFragment(); this.n[4] = this.h; break; case 5: this.l = new PrivacyFragment(); this.n[5] = this.l; break; case 6: this.i = new AboutFragment(); this.n[6] = this.i; break; case 7: this.j = new FeedBackFragment(); this.n[7] = this.j; break; case 8: this.k = new CommonWebFragment(); E0(); this.n[8] = this.k; break; } a.a(R.id.rl_setting_content, this.n[i], "frag" + i); a.c(this.n[i]); } } if (bundle != null && bundle.getInt(this.p, this.o) != -1) { this.o = bundle.getInt(this.p, this.o); } else { this.o = 0; } a.e(this.n[this.o]); a.a(); } @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity protected void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); } /* JADX INFO: Access modifiers changed from: private */ public void a(SettingitemBean settingitemBean) { FragmentTransaction D0 = D0(); int index = settingitemBean.getIndex(); D0.e(this.n[index]); D0.a(); this.o = index; } }