Initial commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AboutPresenter extends RxPresenter<AboutView> {
|
||||
|
||||
public interface AboutView extends BaseRxView {
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.SettingitemBean;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.user.setting.view.CommonSettingView;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommonSettingPresenter extends RxPresenter<CommonSettingView> {
|
||||
public List<SettingitemBean> a = new ArrayList();
|
||||
|
||||
public List<SettingitemBean> a() {
|
||||
String[] stringArray = JimuApplication.l().getResources().getStringArray(R.array.setting_item);
|
||||
for (int i = 0; i < stringArray.length; i++) {
|
||||
SettingitemBean settingitemBean = new SettingitemBean();
|
||||
if (i == 0) {
|
||||
settingitemBean.setChoose(true);
|
||||
}
|
||||
if (LocaleUtils.f() || i != 8) {
|
||||
settingitemBean.setName(stringArray[i]);
|
||||
settingitemBean.setIndex(i);
|
||||
this.a.add(settingitemBean);
|
||||
}
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
getView().d(a());
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
for (int i2 = 0; i2 < this.a.size(); i2++) {
|
||||
this.a.get(i2).setChoose(false);
|
||||
}
|
||||
this.a.get(i).setChoose(true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.utils.GlideCacheUtils;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommonUsePresenter extends RxPresenter<CommonUseView> {
|
||||
|
||||
public interface CommonUseView extends BaseRxView {
|
||||
void p();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.setting.presenter.a
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public final void subscribe(ObservableEmitter observableEmitter) {
|
||||
CommonUsePresenter.a(observableEmitter);
|
||||
}
|
||||
}).observeOn(AndroidSchedulers.a()).subscribeOn(Schedulers.b()).subscribe(new Observer<Boolean>() { // from class: com.ubt.jimu.user.setting.presenter.CommonUsePresenter.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Boolean bool) {
|
||||
GlideCacheUtils.a().b(JimuApplication.l());
|
||||
GlideCacheUtils.a().a(JimuApplication.l().getExternalCacheDir() + "image_manager_disk_cache", true);
|
||||
CommonUsePresenter.this.getView().p();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CommonUsePresenter.this.add(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
new SharePreferenceHelper().put(SharePreferenceHelper.SP_KEY_INFO_TO, Boolean.valueOf(z));
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(ObservableEmitter observableEmitter) throws Exception {
|
||||
GlideCacheUtils.a().a(JimuApplication.l());
|
||||
observableEmitter.onNext(true);
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
new SharePreferenceHelper().put(SharePreferenceHelper.SP_KEY_WIFI_VIEW, Boolean.valueOf(z));
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.base.entities.ApiStatus;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.user.repository.UserRepository;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommonWebPresenter extends RxPresenter<CommonWebView> {
|
||||
|
||||
public interface CommonWebView extends BaseRxView {
|
||||
void a(ApiStatus apiStatus);
|
||||
|
||||
void h();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
UserRepository.a().observeOn(AndroidSchedulers.a()).subscribeOn(Schedulers.b()).subscribe(new Observer<ApiStatus>() { // from class: com.ubt.jimu.user.setting.presenter.CommonWebPresenter.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(ApiStatus apiStatus) {
|
||||
if (CommonWebPresenter.this.getView() == null) {
|
||||
return;
|
||||
}
|
||||
if (apiStatus == null || apiStatus.getCode() != 0) {
|
||||
CommonWebPresenter.this.getView().h();
|
||||
} else {
|
||||
CommonWebPresenter.this.getView().a(apiStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
th.printStackTrace();
|
||||
CommonWebPresenter.this.getView().h();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
CommonWebPresenter.this.add(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HardWarePresenter extends RxPresenter<HardWareView> {
|
||||
|
||||
public interface HardWareView extends BaseRxView {
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class LaboratoryPresenter extends RxPresenter<LaboratoryView> {
|
||||
|
||||
public interface LaboratoryView extends BaseRxView {
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.base.entities.ApiStatus;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.user.repository.UserRepository;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MyAccountPresenter extends RxPresenter<MyAccountView> {
|
||||
|
||||
public interface MyAccountView extends BaseRxView {
|
||||
void l();
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
UserRepository.a(str).observeOn(AndroidSchedulers.a()).subscribeOn(Schedulers.b()).subscribe(new Observer<ApiStatus>() { // from class: com.ubt.jimu.user.setting.presenter.MyAccountPresenter.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(ApiStatus apiStatus) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
MyAccountView view = MyAccountPresenter.this.getView();
|
||||
if (view != null) {
|
||||
view.l();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
MyAccountPresenter.this.add(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package com.ubt.jimu.user.setting.presenter;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.user.model.TeachModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TeachPresenter extends RxPresenter<TeachView> {
|
||||
private String b;
|
||||
private String a = "jimu/help";
|
||||
private String c = "https://jimu.ubtrobot.com/%s/%s/%s";
|
||||
|
||||
public interface TeachView extends BaseRxView {
|
||||
void f(List<TeachModel> list);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.b = JimuApplication.l().c();
|
||||
if (!this.b.equals("CN")) {
|
||||
this.b = "EN";
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
TeachModel teachModel = new TeachModel();
|
||||
teachModel.a(JimuApplication.l().getString(R.string.setting_study_component));
|
||||
teachModel.b(String.format(this.c, this.a, this.b, "Component.html"));
|
||||
arrayList.add(teachModel);
|
||||
TeachModel teachModel2 = new TeachModel();
|
||||
teachModel2.a(JimuApplication.l().getString(R.string.setting_study_assemble));
|
||||
teachModel2.b(String.format(this.c, this.a, this.b, "Build.html"));
|
||||
teachModel2.c("https://video.ubtrobot.com/jimu/videos/build.mp4");
|
||||
teachModel2.a(R.drawable.setting_study_play);
|
||||
arrayList.add(teachModel2);
|
||||
TeachModel teachModel3 = new TeachModel();
|
||||
teachModel3.b(String.format(this.c, this.a, this.b, "Connect.html"));
|
||||
teachModel3.a(JimuApplication.l().getString(R.string.setting_study_connect));
|
||||
arrayList.add(teachModel3);
|
||||
TeachModel teachModel4 = new TeachModel();
|
||||
teachModel4.b(String.format(this.c, this.a, this.b, "Actions.html"));
|
||||
teachModel4.c("https://video.ubtrobot.com/jimu/videos/action.mp4");
|
||||
teachModel4.a(R.drawable.setting_study_play);
|
||||
teachModel4.a(JimuApplication.l().getString(R.string.setting_study_actions));
|
||||
arrayList.add(teachModel4);
|
||||
TeachModel teachModel5 = new TeachModel();
|
||||
teachModel5.a(JimuApplication.l().getString(R.string.setting_study_programming));
|
||||
teachModel5.b(Utils.getBlocklyHelpUrl());
|
||||
arrayList.add(teachModel5);
|
||||
TeachModel teachModel6 = new TeachModel();
|
||||
teachModel6.a(JimuApplication.l().getString(R.string.setting_qa));
|
||||
String g = JimuApplication.l().g();
|
||||
if (!"zh-hans".equals(g)) {
|
||||
g = "en";
|
||||
}
|
||||
teachModel6.b(String.format("https://video.ubtrobot.com/jimu/product/h5/QA/index_%s.html", g));
|
||||
arrayList.add(teachModel6);
|
||||
if (getView() != null) {
|
||||
getView().f(arrayList);
|
||||
}
|
||||
}
|
||||
}
|
212
sources/com/ubt/jimu/user/setting/view/AboutFragment.java
Normal file
212
sources/com/ubt/jimu/user/setting/view/AboutFragment.java
Normal file
@@ -0,0 +1,212 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.entities.UpdateApkEntities;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.update.UpdateManager;
|
||||
import com.ubt.jimu.user.setting.presenter.AboutPresenter;
|
||||
import com.ubt.jimu.user.setting.view.AboutFragment;
|
||||
import com.ubt.jimu.utils.PackageHelper;
|
||||
import com.ubt.jimu.widgets.ClickableSpanListener;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AboutFragment extends BaseMvpFragment<AboutPresenter> implements AboutPresenter.AboutView {
|
||||
private TextView a;
|
||||
private TextView b;
|
||||
private TextView c;
|
||||
private LinearLayout d;
|
||||
private TextView e;
|
||||
private TextView f;
|
||||
private LinearLayout g;
|
||||
private TextView h;
|
||||
|
||||
/* renamed from: com.ubt.jimu.user.setting.view.AboutFragment$1, reason: invalid class name */
|
||||
class AnonymousClass1 implements View.OnClickListener {
|
||||
AnonymousClass1() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
String string = AboutFragment.this.getResources().getString(R.string.version_details);
|
||||
if (TextUtils.isEmpty(string)) {
|
||||
return;
|
||||
}
|
||||
JimuSimpleDialog buildSimpleDialog = JimuSimpleDialog.buildSimpleDialog(AboutFragment.this.getActivity(), AboutFragment.this.getString(R.string.ok), null, AboutFragment.this.getString(R.string.version_desc), string, 19, null, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.a
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
AboutFragment.this.b.setEnabled(false);
|
||||
buildSimpleDialog.setOnDismissListener(new JimuSimpleDialog.OnDismissListener() { // from class: com.ubt.jimu.user.setting.view.AboutFragment.1.1
|
||||
@Override // com.ubt.jimu.base.dialog.JimuSimpleDialog.OnDismissListener
|
||||
public void onDismiss(Dialog dialog) {
|
||||
AboutFragment.this.b.setEnabled(true);
|
||||
}
|
||||
});
|
||||
buildSimpleDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void bindClick() {
|
||||
this.g.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.d
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
AboutFragment.this.a(view);
|
||||
}
|
||||
});
|
||||
this.f.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.c
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
AboutFragment.this.b(view);
|
||||
}
|
||||
});
|
||||
this.e.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.e
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
AboutFragment.this.c(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.a = (TextView) view.findViewById(R.id.tv_jimu_version);
|
||||
this.b = (TextView) view.findViewById(R.id.tvVersionDesc);
|
||||
this.c = (TextView) view.findViewById(R.id.tvUpdateNow);
|
||||
this.d = (LinearLayout) view.findViewById(R.id.xl_china);
|
||||
this.e = (TextView) view.findViewById(R.id.tv_phone);
|
||||
this.f = (TextView) view.findViewById(R.id.tv_start_ucare);
|
||||
this.g = (LinearLayout) view.findViewById(R.id.xl_start_jimu);
|
||||
this.h = (TextView) view.findViewById(R.id.tv_start_jimu);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
PackageHelper.a("CHANNEL_ID");
|
||||
this.a.setText(String.format("Jimu %s", "3.9.6.75"));
|
||||
this.d.setVisibility(0);
|
||||
String string = getString(R.string.version_desc);
|
||||
com.ubt.jimu.utils.TextUtils.a(this.b, string, string, new ClickableSpanListener(new AnonymousClass1(), true, getResources().getColor(R.color.txt_287EF1)));
|
||||
String string2 = getString(R.string.update_now);
|
||||
com.ubt.jimu.utils.TextUtils.a(this.c, string2, string2, new ClickableSpanListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.AboutFragment.2
|
||||
|
||||
/* renamed from: com.ubt.jimu.user.setting.view.AboutFragment$2$1, reason: invalid class name */
|
||||
class AnonymousClass1 implements UpdateManager.UpdateCallback {
|
||||
AnonymousClass1() {
|
||||
}
|
||||
|
||||
public /* synthetic */ void a() {
|
||||
AboutFragment.this.c.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.update.UpdateManager.UpdateCallback
|
||||
public void a(UpdateApkEntities updateApkEntities) {
|
||||
AboutFragment.this.c.post(new Runnable() { // from class: com.ubt.jimu.user.setting.view.b
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
AboutFragment.AnonymousClass2.AnonymousClass1.this.a();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
UpdateManager.c().a((Activity) AboutFragment.this.getActivity(), (UpdateManager.UpdateCallback) new AnonymousClass1(), true);
|
||||
AboutFragment.this.c.setEnabled(false);
|
||||
}
|
||||
}, true, getResources().getColor(R.color.txt_287EF1)));
|
||||
if (Cache.getInstance().getSettings().getBoolean(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, false).booleanValue()) {
|
||||
this.c.setVisibility(0);
|
||||
} else {
|
||||
this.c.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void c(View view) {
|
||||
b();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_about;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
UpdateManager.c().a();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
|
||||
super.onRequestPermissionsResult(i, strArr, iArr);
|
||||
if (iArr[0] == 0) {
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
o();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
bindClick();
|
||||
}
|
||||
|
||||
private void c(String str) {
|
||||
Intent intent = new Intent("android.intent.action.SEND");
|
||||
intent.setType("message/rfc822");
|
||||
intent.putExtra("android.intent.extra.EMAIL", new String[]{str});
|
||||
intent.putExtra("android.intent.extra.SUBJECT", "您的建议");
|
||||
intent.putExtra("android.intent.extra.TEXT", "我们很希望能得到您的建议!!!");
|
||||
startActivity(Intent.createChooser(intent, "Select email application."));
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
c(this.h.getText().toString());
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
c(this.f.getText().toString());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public AboutPresenter createPresenter() {
|
||||
return new AboutPresenter();
|
||||
}
|
||||
|
||||
private void b() {
|
||||
Intent intent = new Intent("android.intent.action.DIAL", Uri.parse("tel:" + this.e.getText().toString()));
|
||||
intent.setFlags(268435456);
|
||||
List<ResolveInfo> queryIntentActivities = getActivity().getPackageManager().queryIntentActivities(intent, 65536);
|
||||
if (queryIntentActivities == null || queryIntentActivities.size() == 0) {
|
||||
return;
|
||||
}
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
@@ -0,0 +1,246 @@
|
||||
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<CommonSettingPresenter> implements CommonSettingView {
|
||||
private ImageView a;
|
||||
private RecyclerView b;
|
||||
private BaseQuickAdapter<SettingitemBean, BaseViewHolder> 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<SettingitemBean> list) {
|
||||
if (this.c == null) {
|
||||
this.c = new BaseQuickAdapter<SettingitemBean, BaseViewHolder>(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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import com.ubt.jimu.base.entities.SettingitemBean;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface CommonSettingView extends BaseRxView {
|
||||
void d(List<SettingitemBean> list);
|
||||
}
|
225
sources/com/ubt/jimu/user/setting/view/CommonUseFragment.java
Normal file
225
sources/com/ubt/jimu/user/setting/view/CommonUseFragment.java
Normal file
@@ -0,0 +1,225 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.analytics.BuglyUtil;
|
||||
import com.ubt.jimu.analytics.JimuAnalyticsUtil;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import com.ubt.jimu.user.setting.presenter.CommonUsePresenter;
|
||||
import com.ubt.jimu.utils.GlideCacheUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtech.utils.PermissionHelper;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommonUseFragment extends BaseMvpFragment<CommonUsePresenter> implements CommonUsePresenter.CommonUseView, SingleClickListener {
|
||||
private RelativeLayout a;
|
||||
private TextView b;
|
||||
private RelativeLayout c;
|
||||
private CheckBox d;
|
||||
private RelativeLayout e;
|
||||
private CheckBox f;
|
||||
private SharePreferenceHelper g;
|
||||
private RelativeLayout h;
|
||||
private ImageView i;
|
||||
|
||||
static /* synthetic */ void a(ObservableEmitter observableEmitter) throws Exception {
|
||||
GlideCacheUtils.a().a(JimuApplication.l());
|
||||
observableEmitter.onNext(true);
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.a = (RelativeLayout) view.findViewById(R.id.xr_clear_cache);
|
||||
this.b = (TextView) view.findViewById(R.id.tv_cache_size);
|
||||
this.c = (RelativeLayout) view.findViewById(R.id.xr_wifi);
|
||||
this.d = (CheckBox) view.findViewById(R.id.cb_wifi);
|
||||
this.e = (RelativeLayout) view.findViewById(R.id.xr_info);
|
||||
this.f = (CheckBox) view.findViewById(R.id.cb_info);
|
||||
this.h = (RelativeLayout) view.findViewById(R.id.user_experience_info);
|
||||
this.i = (ImageView) view.findViewById(R.id.cb_user_experience);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
if (SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE)) {
|
||||
this.i.setBackgroundResource(R.drawable.checkbox_on_xxx);
|
||||
} else {
|
||||
this.i.setBackgroundResource(R.drawable.checkbox_off_xxx);
|
||||
}
|
||||
}
|
||||
|
||||
private void q() {
|
||||
this.a.setOnClickListener(this);
|
||||
this.c.setOnClickListener(this);
|
||||
this.e.setOnClickListener(this);
|
||||
this.h.setOnClickListener(this);
|
||||
this.i.setOnClickListener(this);
|
||||
this.d.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.setting.view.CommonUseFragment.1
|
||||
@Override // android.widget.CompoundButton.OnCheckedChangeListener
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
|
||||
((CommonUsePresenter) CommonUseFragment.this.mPresenter).a(z);
|
||||
}
|
||||
});
|
||||
this.f.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.setting.view.CommonUseFragment.2
|
||||
@Override // android.widget.CompoundButton.OnCheckedChangeListener
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
|
||||
((CommonUsePresenter) CommonUseFragment.this.mPresenter).b(z);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void v() {
|
||||
this.b.setText(GlideCacheUtils.a().c(getActivity()));
|
||||
this.g = new SharePreferenceHelper();
|
||||
this.d.setChecked(this.g.getBoolean(SharePreferenceHelper.SP_KEY_WIFI_VIEW, true).booleanValue());
|
||||
this.f.setChecked(this.g.getBoolean(SharePreferenceHelper.SP_KEY_INFO_TO, true).booleanValue());
|
||||
o();
|
||||
}
|
||||
|
||||
private void x() {
|
||||
new JimuSimpleDialog.Builder(getActivity()).title(R.string.ubt_user_experience_title).cancel(R.string.dialog_add_later).ok(R.string.ok).content(R.string.ubt_user_experience_content).gravity(17).cancleBtnBg(R.drawable.sel_common_negative_btn).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.f
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
CommonUseFragment.this.a(dialogInterface, i);
|
||||
}
|
||||
}).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.g
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
CommonUseFragment.this.b(dialogInterface, i);
|
||||
}
|
||||
}).build().show();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (PermissionHelper.a(getActivity(), "android.permission.WRITE_EXTERNAL_STORAGE")) {
|
||||
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.setting.view.h
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public final void subscribe(ObservableEmitter observableEmitter) {
|
||||
CommonUseFragment.a(observableEmitter);
|
||||
}
|
||||
}).observeOn(AndroidSchedulers.a()).subscribeOn(Schedulers.b()).subscribe(new Observer<Boolean>() { // from class: com.ubt.jimu.user.setting.view.CommonUseFragment.3
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Boolean bool) {
|
||||
GlideCacheUtils.a().b(JimuApplication.l());
|
||||
GlideCacheUtils.a().a(JimuApplication.l().getExternalCacheDir() + "image_manager_disk_cache", true);
|
||||
CommonUseFragment.this.p();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
((CommonUsePresenter) this.mPresenter).a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_commonuse;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.xr_clear_cache) {
|
||||
b();
|
||||
return;
|
||||
}
|
||||
if (id == R.id.xr_wifi) {
|
||||
this.d.setChecked(!r2.isChecked());
|
||||
} else if (id == R.id.xr_info) {
|
||||
this.f.setChecked(!r2.isChecked());
|
||||
} else if (id == R.id.user_experience_info || id == R.id.cb_user_experience) {
|
||||
x();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
v();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
q();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.presenter.CommonUsePresenter.CommonUseView
|
||||
public void p() {
|
||||
this.b.setText(GlideCacheUtils.a().c(getActivity()));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public CommonUsePresenter createPresenter() {
|
||||
return new CommonUsePresenter();
|
||||
}
|
||||
|
||||
private void a(boolean z) {
|
||||
if (z) {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
JimuAnalyticsUtil.a(context);
|
||||
JimuAnalytics.b().a(z);
|
||||
} else {
|
||||
ALog.b("关闭体验优化", new Object[0]);
|
||||
if (JimuAnalytics.b().a()) {
|
||||
JimuAnalytics.b().a(z);
|
||||
}
|
||||
}
|
||||
BuglyUtil.a(z);
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE, true);
|
||||
o();
|
||||
a(true);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE, false);
|
||||
o();
|
||||
a(false);
|
||||
}
|
||||
}
|
485
sources/com/ubt/jimu/user/setting/view/CommonWebFragment.java
Normal file
485
sources/com/ubt/jimu/user/setting/view/CommonWebFragment.java
Normal file
@@ -0,0 +1,485 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.MailTo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
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.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import com.ubt.jimu.course.repository.CourseResult;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.user.Constant;
|
||||
import com.ubt.jimu.user.setting.presenter.CommonWebPresenter;
|
||||
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.utils.ShortcutHelper;
|
||||
import com.ubt.jimu.widgets.choosePhotos.AlbumActivity;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubtech.utils.FileHelper;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.widget.UButton;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommonWebFragment extends BaseMvpFragment<CommonWebPresenter> implements CommonWebPresenter.CommonWebView {
|
||||
private ProgressBar a;
|
||||
private WebView b;
|
||||
private RelativeLayout c;
|
||||
private ImageView d;
|
||||
private UButton e;
|
||||
private String f;
|
||||
private String g;
|
||||
private int h;
|
||||
private int i;
|
||||
private byte[] j;
|
||||
private RelativeLayout k;
|
||||
private ValueCallback<Uri[]> m;
|
||||
private boolean l = false;
|
||||
private boolean n = false;
|
||||
|
||||
private void A() {
|
||||
this.l = true;
|
||||
this.g = getArguments().getString("url");
|
||||
this.f = this.g;
|
||||
getArguments().getString("title");
|
||||
this.h = getArguments().getInt("type");
|
||||
String string = getArguments().getString("data");
|
||||
if (string == null) {
|
||||
string = "";
|
||||
}
|
||||
this.j = string.getBytes();
|
||||
this.i = getArguments().getInt("zoom", 100);
|
||||
getArguments().getBoolean("show_title");
|
||||
this.b.getSettings().setTextZoom(this.i);
|
||||
LogUtils.c("initData:" + this.g);
|
||||
c(this.g);
|
||||
if (this.g.contains("https://support.qq.com/product/33918?")) {
|
||||
this.k.setVisibility(0);
|
||||
} else {
|
||||
this.k.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void B() {
|
||||
new JimuSimpleDialog.Builder(getActivity()).cancel(R.string.cancel).ok(R.string.ok).content(R.string.tips_close_account).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.j
|
||||
@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.setting.view.i
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
CommonWebFragment.this.a(dialogInterface, i);
|
||||
}
|
||||
}).cancleBtnBg(R.drawable.shape_cor50_bg92a7b6).build().show();
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.k = (RelativeLayout) view.findViewById(R.id.rl_left_back);
|
||||
this.d = (ImageView) view.findViewById(R.id.iv_web_back);
|
||||
this.e = (UButton) view.findViewById(R.id.btnLogout);
|
||||
this.a = (ProgressBar) view.findViewById(R.id.pb_web);
|
||||
this.b = (WebView) view.findViewById(R.id.web_view);
|
||||
this.c = (RelativeLayout) view.findViewById(R.id.rl_web_error);
|
||||
}
|
||||
|
||||
private void q() {
|
||||
if (this.g.equals("https://support.qq.com/product/33918?")) {
|
||||
this.j = null;
|
||||
this.b.loadUrl(this.g);
|
||||
}
|
||||
}
|
||||
|
||||
private void v() {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
this.b.removeJavascriptInterface("searchBoxJavaBridge_");
|
||||
this.b.removeJavascriptInterface("accessibility");
|
||||
this.b.removeJavascriptInterface("accessibilityTraversal");
|
||||
}
|
||||
WebSettings settings = this.b.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
settings.setAllowFileAccess(true);
|
||||
settings.setSupportZoom(true);
|
||||
settings.setCacheMode(2);
|
||||
settings.setBuiltInZoomControls(false);
|
||||
settings.setLoadsImagesAutomatically(true);
|
||||
settings.setDefaultTextEncodingName("UTF-8");
|
||||
settings.setLoadWithOverviewMode(true);
|
||||
settings.setDomStorageEnabled(true);
|
||||
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
settings.setBlockNetworkLoads(false);
|
||||
settings.setBlockNetworkImage(false);
|
||||
this.b.setWebChromeClient(new WebChromeClient() { // from class: com.ubt.jimu.user.setting.view.CommonWebFragment.4
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public void onProgressChanged(WebView webView, int i) {
|
||||
if (i == 100) {
|
||||
CommonWebFragment.this.a.setVisibility(8);
|
||||
CommonWebFragment.this.b();
|
||||
} else {
|
||||
if (CommonWebFragment.this.a.getVisibility() == 8) {
|
||||
CommonWebFragment.this.a.setVisibility(0);
|
||||
}
|
||||
CommonWebFragment.this.a.setProgress(i);
|
||||
}
|
||||
super.onProgressChanged(webView, i);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public void onReceivedTitle(WebView webView, String str) {
|
||||
super.onReceivedTitle(webView, str);
|
||||
Log.e("webviewtitle", str);
|
||||
if (CommonWebFragment.this.g.equals("https://support.qq.com/product/33918?")) {
|
||||
CommonWebFragment.this.n = true;
|
||||
CommonWebFragment.this.c.setVisibility(8);
|
||||
} else if (str.contains("404") || str.contains("500") || str.contains("Error") || str.contains("找不到网页") || str.contains("网页无法打开")) {
|
||||
CommonWebFragment.this.n = false;
|
||||
CommonWebFragment.this.c.setVisibility(0);
|
||||
} else {
|
||||
CommonWebFragment.this.n = true;
|
||||
CommonWebFragment.this.c.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
|
||||
CommonWebFragment.this.m = valueCallback;
|
||||
Intent intent = new Intent(CommonWebFragment.this.getActivity(), (Class<?>) AlbumActivity.class);
|
||||
intent.putExtra("type", "MULTITERM_IMAGE");
|
||||
intent.putExtra(FileDownloadModel.TOTAL, 6);
|
||||
CommonWebFragment.this.startActivityForResult(intent, 1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
this.b.setWebViewClient(new WebViewClient() { // from class: com.ubt.jimu.user.setting.view.CommonWebFragment.5
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageFinished(WebView webView, String str) {
|
||||
super.onPageFinished(webView, str);
|
||||
CommonWebFragment.this.f = str;
|
||||
CommonWebFragment.this.b();
|
||||
LogUtils.c("onPageFinished:" + str);
|
||||
if (CommonWebFragment.this.c.getVisibility() == 0 && NetWorkUtil.b(JimuApplication.l()) && CommonWebFragment.this.n) {
|
||||
CommonWebFragment.this.c.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
|
||||
super.onPageStarted(webView, str, bitmap);
|
||||
CommonWebFragment.this.f = str;
|
||||
LogUtils.c("onPageStarted:" + str);
|
||||
if (NetWorkUtil.b(JimuApplication.l())) {
|
||||
return;
|
||||
}
|
||||
CommonWebFragment.this.c.setVisibility(0);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onReceivedError(WebView webView, int i, String str, String str2) {
|
||||
super.onReceivedError(webView, i, str, str2);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
|
||||
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
|
||||
if (str.startsWith("tel:")) {
|
||||
CommonWebFragment.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
|
||||
return true;
|
||||
}
|
||||
if (str.startsWith("mailto:")) {
|
||||
MailTo parse = MailTo.parse(str);
|
||||
CommonWebFragment.this.startActivity(CommonWebFragment.this.a(parse.getTo(), parse.getSubject(), parse.getBody(), parse.getCc()));
|
||||
webView.reload();
|
||||
return true;
|
||||
}
|
||||
if (TextUtils.isEmpty(str) || str.startsWith("http")) {
|
||||
webView.loadUrl(str);
|
||||
LogUtils.c("url:" + str);
|
||||
return true;
|
||||
}
|
||||
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
|
||||
if (intent.resolveActivity(CommonWebFragment.this.getActivity().getPackageManager()) != null) {
|
||||
intent.setFlags(270532608);
|
||||
CommonWebFragment.this.getActivity().startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(CommonWebFragment.this.getActivity(), "App not installed", 0).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void x() {
|
||||
this.c.setOnClickListener(new SingleClickListener() { // from class: com.ubt.jimu.user.setting.view.CommonWebFragment.1
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
CommonWebFragment commonWebFragment = CommonWebFragment.this;
|
||||
commonWebFragment.c(commonWebFragment.f);
|
||||
}
|
||||
});
|
||||
this.d.setOnClickListener(new SingleClickListener() { // from class: com.ubt.jimu.user.setting.view.CommonWebFragment.2
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
if (CommonWebFragment.this.b.canGoBack()) {
|
||||
CommonWebFragment.this.b.goBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.e.setOnClickListener(new SingleClickListener() { // from class: com.ubt.jimu.user.setting.view.CommonWebFragment.3
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
CommonWebFragment.this.B();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void y() {
|
||||
User user;
|
||||
if (!this.g.equals("https://support.qq.com/product/33918?") || (user = UserDbHandler.getUser()) == null) {
|
||||
return;
|
||||
}
|
||||
this.j = ("nickname=" + user.getNickName() + "&avatar=" + com.ubt.jimu.utils.TextUtils.e(user.getUserImage()) + "&openid=" + user.getUserId()).getBytes();
|
||||
this.b.postUrl("https://support.qq.com/product/33918?", this.j);
|
||||
}
|
||||
|
||||
public void b() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_commonwebview;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.presenter.CommonWebPresenter.CommonWebView
|
||||
public void h() {
|
||||
hideLoading();
|
||||
toast(getString(R.string.tips_delete_account_failed));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public boolean isRegistEventBus() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void l() {
|
||||
Cache.getInstance().clearCacheUser();
|
||||
UserDbHandler.clearUser();
|
||||
ShortcutHelper.a(getActivity());
|
||||
EventBus.b().b(new MessageEvent(5));
|
||||
}
|
||||
|
||||
public void o() {
|
||||
User user = UserDbHandler.getUser();
|
||||
if (user == null || user.getUserId() <= 0 || !this.f.contains(Constant.a)) {
|
||||
this.e.setVisibility(8);
|
||||
} else {
|
||||
this.e.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
List list;
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (-1 != i2 || intent == null || (list = (List) intent.getSerializableExtra("result_data")) == null) {
|
||||
return;
|
||||
}
|
||||
Uri[] uriArr = new Uri[list.size()];
|
||||
for (int i3 = 0; i3 < list.size(); i3++) {
|
||||
HPMedia hPMedia = (HPMedia) list.get(i3);
|
||||
if (hPMedia != null) {
|
||||
XLog.a("web", "media %s", hPMedia.getPath());
|
||||
uriArr[i3] = Uri.fromFile(new File(hPMedia.getPath()));
|
||||
}
|
||||
}
|
||||
ValueCallback<Uri[]> valueCallback = this.m;
|
||||
if (valueCallback != null) {
|
||||
valueCallback.onReceiveValue(uriArr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return super.onCreateView(layoutInflater, viewGroup, bundle);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
WebView webView = this.b;
|
||||
if (webView != null) {
|
||||
ViewParent parent = webView.getParent();
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(this.b);
|
||||
}
|
||||
this.b.stopLoading();
|
||||
this.b.clearHistory();
|
||||
this.b.removeAllViews();
|
||||
this.b.destroy();
|
||||
this.b.clearCache(true);
|
||||
this.b = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onHiddenChanged(boolean z) {
|
||||
super.onHiddenChanged(z);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
this.b.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public void onReceiveMessage(MessageEvent messageEvent) {
|
||||
super.onReceiveMessage(messageEvent);
|
||||
if (messageEvent.getType() == 1) {
|
||||
o();
|
||||
q();
|
||||
} else if (messageEvent.getType() == 0) {
|
||||
o();
|
||||
y();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
o();
|
||||
this.b.onResume();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (this.l) {
|
||||
return;
|
||||
}
|
||||
A();
|
||||
v();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
x();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void c(String str) {
|
||||
if (this.h == 0) {
|
||||
this.b.loadUrl(str);
|
||||
return;
|
||||
}
|
||||
byte[] bArr = this.j;
|
||||
if (bArr != null) {
|
||||
this.b.postUrl(str, bArr);
|
||||
} else {
|
||||
this.b.loadUrl(str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public CommonWebPresenter createPresenter() {
|
||||
return new CommonWebPresenter();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
if (!NetWorkUtil.b(JimuApplication.l())) {
|
||||
toast(getString(R.string.network_error));
|
||||
return;
|
||||
}
|
||||
((CommonWebPresenter) this.mPresenter).a();
|
||||
dialogInterface.dismiss();
|
||||
showLoading(getString(R.string.logoff) + "...");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.presenter.CommonWebPresenter.CommonWebView
|
||||
public void a(ApiStatus apiStatus) {
|
||||
hideLoading();
|
||||
if (apiStatus.getCode() != 0 && !CourseResult.SUCCESS.equals(apiStatus.getMessage())) {
|
||||
toast(getString(R.string.tips_delete_account_failed));
|
||||
return;
|
||||
}
|
||||
File file = new File(ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + String.format(Constants.USER_HOME, Cache.getInstance().getUserId()));
|
||||
if (file.exists()) {
|
||||
FileHelper.a(file);
|
||||
}
|
||||
l();
|
||||
toast(getString(R.string.tips_delete_account));
|
||||
this.e.setVisibility(8);
|
||||
EventBus.b().b(new MessageEvent(5));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public Intent a(String str, String str2, String str3, String str4) {
|
||||
Intent intent = new Intent("android.intent.action.SEND");
|
||||
intent.putExtra("android.intent.extra.EMAIL", new String[]{str});
|
||||
intent.putExtra("android.intent.extra.TEXT", str3);
|
||||
intent.putExtra("android.intent.extra.SUBJECT", str2);
|
||||
intent.putExtra("android.intent.extra.CC", str4);
|
||||
intent.setType("message/rfc822");
|
||||
return intent;
|
||||
}
|
||||
}
|
579
sources/com/ubt/jimu/user/setting/view/FeedBackFragment.java
Normal file
579
sources/com/ubt/jimu/user/setting/view/FeedBackFragment.java
Normal file
@@ -0,0 +1,579 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.jakewharton.rxbinding2.view.RxView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.entities.FeedbackEntities;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.base.event.SelectPackEvent;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.community.presenter.PublishCommunityPresenter;
|
||||
import com.ubt.jimu.main.utils.CardActionUtils;
|
||||
import com.ubt.jimu.picture.PictureShowActivity;
|
||||
import com.ubt.jimu.upload.DataUploadProxy;
|
||||
import com.ubt.jimu.upload.UploadRequest;
|
||||
import com.ubt.jimu.upload.UploadResponse;
|
||||
import com.ubt.jimu.user.feedback.FeedBackIconAdapter;
|
||||
import com.ubt.jimu.user.feedback.FeedBackIconBean;
|
||||
import com.ubt.jimu.user.feedback.FeedbackPostBean;
|
||||
import com.ubt.jimu.user.feedback.IFBOperateImg;
|
||||
import com.ubt.jimu.user.feedback.PostMediaBean;
|
||||
import com.ubt.jimu.user.setting.view.FeedBackFragment;
|
||||
import com.ubt.jimu.user.setting.view.FeedBackPresenter;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import com.ubt.jimu.widgets.FeedBackTypeLayout;
|
||||
import com.ubt.jimu.widgets.UploadPopupWindow;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubt.jimu.widgets.player.UbtPlayer;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import com.ubtech.view.widget.UButton;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class FeedBackFragment extends BaseMvpFragment<FeedBackPresenter> implements FeedBackPresenter.FeedBackView {
|
||||
private String a = "sales";
|
||||
private FeedBackTypeLayout b;
|
||||
private TextView c;
|
||||
private ImageView d;
|
||||
private TextView e;
|
||||
private EditText f;
|
||||
private RelativeLayout g;
|
||||
private EditText h;
|
||||
private UButton i;
|
||||
private RelativeLayout j;
|
||||
private RelativeLayout k;
|
||||
private TextView l;
|
||||
private RecyclerView m;
|
||||
private FeedBackIconAdapter n;
|
||||
private ArrayList<FeedBackIconBean> o;
|
||||
private UploadPopupWindow p;
|
||||
private long q;
|
||||
|
||||
/* renamed from: com.ubt.jimu.user.setting.view.FeedBackFragment$1, reason: invalid class name */
|
||||
class AnonymousClass1 implements PublishCommunityPresenter.CompressionProgressListener {
|
||||
AnonymousClass1() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void U() {
|
||||
((FragmentActivity) Objects.requireNonNull(FeedBackFragment.this.getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.l
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.AnonymousClass1.this.b();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(int i) {
|
||||
FeedBackFragment.this.p.b(i);
|
||||
}
|
||||
|
||||
public /* synthetic */ void b() {
|
||||
FeedBackFragment.this.p.a(FeedBackFragment.this.getResources().getString(R.string.compressing_video));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void c(boolean z) {
|
||||
ALog.a("FeedBackFragment").d("视频压缩失败:");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void d(final int i) {
|
||||
((FragmentActivity) Objects.requireNonNull(FeedBackFragment.this.getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.n
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.AnonymousClass1.this.a(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void m() {
|
||||
ALog.a("FeedBackFragment").d("视频压缩完成");
|
||||
((FragmentActivity) Objects.requireNonNull(FeedBackFragment.this.getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.o
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.AnonymousClass1.this.a();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void onAllCompressFail() {
|
||||
ALog.a("FeedBackFragment").d("视频压缩全部失败");
|
||||
FeedBackFragment.this.p.a(FeedBackFragment.this.rootView, UploadPopupWindow.UploadState.UPLOAD_FAILURE);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.presenter.PublishCommunityPresenter.CompressionProgressListener
|
||||
public void a(int i, String str) {
|
||||
FeedBackIconBean feedBackIconBean = ((FeedBackPresenter) FeedBackFragment.this.mPresenter).c().getmMediaList().get(i);
|
||||
File file = new File(str);
|
||||
if (file.exists()) {
|
||||
feedBackIconBean.setPath(str);
|
||||
feedBackIconBean.setmName(file.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a() {
|
||||
FeedBackFragment.this.p.a(FeedBackFragment.this.getResources().getString(R.string.uploading));
|
||||
FeedBackFragment.this.p.b(0);
|
||||
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.setting.view.m
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public final void subscribe(ObservableEmitter observableEmitter) {
|
||||
FeedBackFragment.AnonymousClass1.this.a(observableEmitter);
|
||||
}
|
||||
}).subscribeOn(Schedulers.b()).subscribe();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(ObservableEmitter observableEmitter) throws Exception {
|
||||
FeedBackFragment feedBackFragment = FeedBackFragment.this;
|
||||
((FeedBackPresenter) feedBackFragment.mPresenter).c(feedBackFragment.o);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"CheckResult"})
|
||||
private void A() {
|
||||
((FeedBackPresenter) this.mPresenter).a(new AnonymousClass1());
|
||||
RxView.a(this.i).throttleFirst(500L, TimeUnit.MILLISECONDS).subscribe(new Consumer() { // from class: com.ubt.jimu.user.setting.view.t
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
public final void accept(Object obj) {
|
||||
FeedBackFragment.this.a(obj);
|
||||
}
|
||||
});
|
||||
RxView.a(this.l).throttleFirst(500L, TimeUnit.MILLISECONDS).subscribe(new Consumer() { // from class: com.ubt.jimu.user.setting.view.u
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
public final void accept(Object obj) {
|
||||
FeedBackFragment.this.b(obj);
|
||||
}
|
||||
});
|
||||
this.b.setiSelectCallBack(new FeedBackTypeLayout.ISelectCallBack() { // from class: com.ubt.jimu.user.setting.view.FeedBackFragment.2
|
||||
@Override // com.ubt.jimu.widgets.FeedBackTypeLayout.ISelectCallBack
|
||||
public void a() {
|
||||
FeedBackFragment.this.a = "sales";
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.FeedBackTypeLayout.ISelectCallBack
|
||||
public void b() {
|
||||
FeedBackFragment.this.a = "product";
|
||||
}
|
||||
});
|
||||
this.g.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.p
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
FeedBackFragment.this.a(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void B() {
|
||||
this.b.a();
|
||||
x();
|
||||
}
|
||||
|
||||
private void C() {
|
||||
this.p = new UploadPopupWindow(getActivity());
|
||||
this.p.a(new UploadPopupWindow.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.FeedBackFragment.3
|
||||
@Override // com.ubt.jimu.widgets.UploadPopupWindow.OnClickListener
|
||||
public void G() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.UploadPopupWindow.OnClickListener
|
||||
public void O() {
|
||||
FeedBackFragment.this.b();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.UploadPopupWindow.OnClickListener
|
||||
public void R() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.UploadPopupWindow.OnClickListener
|
||||
public void e0() {
|
||||
}
|
||||
});
|
||||
this.p.a(this.rootView, UploadPopupWindow.UploadState.UPLOADING_PROGRESS);
|
||||
}
|
||||
|
||||
private void D() {
|
||||
String trim = this.f.getText().toString().trim();
|
||||
if (LocaleUtils.f()) {
|
||||
if (StringUtils.e(trim) || (!StringUtils.d(trim) && !StringUtils.a((CharSequence) trim))) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.feedback_contact_toast_error), ToastView.Type.ERROR).a();
|
||||
return;
|
||||
}
|
||||
} else if (StringUtils.e(trim) || !StringUtils.d(trim)) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.error_email_format), ToastView.Type.ERROR).a();
|
||||
return;
|
||||
}
|
||||
String trim2 = this.h.getText().toString().trim();
|
||||
if (StringUtils.e(trim2) || trim2.length() < 10) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.feedback_content_toast_error), ToastView.Type.ERROR).a();
|
||||
return;
|
||||
}
|
||||
if (Cache.getInstance().getUser() == null) {
|
||||
new JimuSimpleDialog.Builder(getActivity()).cancel(R.string.i_got_it).ok(R.string.now_login).content(R.string.setting_feedback_loginnow).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.v
|
||||
@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.setting.view.y
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
FeedBackFragment.this.a(dialogInterface, i);
|
||||
}
|
||||
}).build().show();
|
||||
return;
|
||||
}
|
||||
((FeedBackPresenter) this.mPresenter).a(this.f.getText().toString().trim(), this.h.getText().toString().trim(), this.a, this.q);
|
||||
if (this.o.size() > 0) {
|
||||
F();
|
||||
} else {
|
||||
((FeedBackPresenter) this.mPresenter).b(this.o);
|
||||
}
|
||||
}
|
||||
|
||||
private void E() {
|
||||
this.k.setVisibility(8);
|
||||
this.j.setVisibility(0);
|
||||
}
|
||||
|
||||
private void F() {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(getActivity(), new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.x
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
FeedBackFragment.d(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.w
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
FeedBackFragment.this.b(dialogInterface, i);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
private void H() {
|
||||
((FeedBackPresenter) this.mPresenter).b();
|
||||
this.o.clear();
|
||||
this.k.setVisibility(0);
|
||||
this.j.setVisibility(8);
|
||||
}
|
||||
|
||||
static /* synthetic */ void d(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.b = (FeedBackTypeLayout) view.findViewById(R.id.feedback_type);
|
||||
this.f = (EditText) view.findViewById(R.id.et_email);
|
||||
this.h = (EditText) view.findViewById(R.id.et_feedback);
|
||||
this.i = (UButton) view.findViewById(R.id.xl_send);
|
||||
this.g = (RelativeLayout) view.findViewById(R.id.card_external);
|
||||
this.c = (TextView) view.findViewById(R.id.external_name);
|
||||
this.d = (ImageView) view.findViewById(R.id.external_icon);
|
||||
this.e = (TextView) view.findViewById(R.id.contact_desc);
|
||||
this.m = (RecyclerView) view.findViewById(R.id.icon_list);
|
||||
this.j = (RelativeLayout) view.findViewById(R.id.container);
|
||||
this.k = (RelativeLayout) view.findViewById(R.id.success_view);
|
||||
this.l = (TextView) view.findViewById(R.id.feedback_complete_sure);
|
||||
B();
|
||||
A();
|
||||
y();
|
||||
}
|
||||
|
||||
private void x() {
|
||||
String packageImagePath = Cache.getInstance().getPackageImagePath();
|
||||
if (TextUtils.isEmpty(packageImagePath)) {
|
||||
this.c.setText(getResources().getString(R.string.feedback_external_default));
|
||||
this.d.setVisibility(8);
|
||||
this.c.setVisibility(0);
|
||||
} else {
|
||||
this.d.setVisibility(0);
|
||||
this.c.setVisibility(8);
|
||||
this.q = Cache.getInstance().getPackageId();
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(packageImagePath);
|
||||
a.a(new RequestOptions().b(R.drawable.image_load_error).a(R.drawable.image_load_error).b());
|
||||
a.a(this.d);
|
||||
}
|
||||
}
|
||||
|
||||
private void y() {
|
||||
this.o = new ArrayList<>();
|
||||
this.n = new FeedBackIconAdapter(getActivity());
|
||||
((FeedBackPresenter) this.mPresenter).a(new FeedBackPresenter.IChooseImg() { // from class: com.ubt.jimu.user.setting.view.r
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.IChooseImg
|
||||
public final void a(List list) {
|
||||
FeedBackFragment.this.h(list);
|
||||
}
|
||||
});
|
||||
this.m.setLayoutManager(new GridLayoutManager(getActivity(), 3));
|
||||
this.n.a(new IFBOperateImg() { // from class: com.ubt.jimu.user.setting.view.FeedBackFragment.4
|
||||
@Override // com.ubt.jimu.user.feedback.IFBOperateImg
|
||||
public void a() {
|
||||
FeedBackFragment feedBackFragment = FeedBackFragment.this;
|
||||
((FeedBackPresenter) feedBackFragment.mPresenter).a(feedBackFragment.getActivity());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.feedback.IFBOperateImg
|
||||
public void b(FeedBackIconBean feedBackIconBean) {
|
||||
PictureShowActivity.start(FeedBackFragment.this.getActivity(), "", feedBackIconBean.getPath());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.feedback.IFBOperateImg
|
||||
public void a(int i) {
|
||||
FeedBackFragment.this.o.remove(i);
|
||||
((FeedBackPresenter) FeedBackFragment.this.mPresenter).a(i);
|
||||
FeedBackFragment.this.n.a(FeedBackFragment.this.o);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.feedback.IFBOperateImg
|
||||
public void a(FeedBackIconBean feedBackIconBean) {
|
||||
UbtPlayer.a(FeedBackFragment.this.getActivity(), "", feedBackIconBean.getPath());
|
||||
}
|
||||
});
|
||||
this.m.setAdapter(this.n);
|
||||
this.n.a((List<FeedBackIconBean>) null);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void allUploadSucceed() {
|
||||
((FragmentActivity) Objects.requireNonNull(getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.q
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.this.q();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void g() {
|
||||
UploadPopupWindow uploadPopupWindow = this.p;
|
||||
if (uploadPopupWindow != null && uploadPopupWindow.c()) {
|
||||
this.p.a();
|
||||
}
|
||||
ToastView.a(JimuApplication.k, getString(R.string.failed_to_send_feedback), ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_feedback;
|
||||
}
|
||||
|
||||
public /* synthetic */ void h(List list) {
|
||||
this.o.clear();
|
||||
Iterator it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
HPMedia hPMedia = (HPMedia) it.next();
|
||||
this.o.add(new FeedBackIconBean(false, hPMedia.getPath(), hPMedia.getMediaType(), hPMedia.getDisplayName()));
|
||||
}
|
||||
this.n.a(this.o);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void k() {
|
||||
((FragmentActivity) Objects.requireNonNull(getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.k
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.this.v();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void n() {
|
||||
C();
|
||||
}
|
||||
|
||||
protected void o() {
|
||||
User user;
|
||||
EditText editText;
|
||||
if (LocaleUtils.f()) {
|
||||
this.e.setText(getResources().getString(R.string.feedback_contact_way));
|
||||
this.f.setHint(getResources().getString(R.string.feedback_contact_hint));
|
||||
} else {
|
||||
this.e.setText(getResources().getString(R.string.email));
|
||||
this.f.setHint(getResources().getString(R.string.setting_input_email));
|
||||
}
|
||||
String userId = Cache.getInstance().getUserId();
|
||||
if (TextUtils.isEmpty(userId) || userId.equals("local") || (user = Cache.getInstance().getUser()) == null) {
|
||||
return;
|
||||
}
|
||||
String email = user.getEmail();
|
||||
String phone = user.getPhone();
|
||||
if (!TextUtils.isEmpty(phone)) {
|
||||
this.f.setText(phone);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(email) || (editText = this.f) == null) {
|
||||
return;
|
||||
}
|
||||
editText.setText(email);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
((FeedBackPresenter) this.mPresenter).a(i, i2, intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (EventBus.b().a(this)) {
|
||||
EventBus.b().d(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
o();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSelectExternal(SelectPackEvent selectPackEvent) {
|
||||
this.q = selectPackEvent.getPackId();
|
||||
if (TextUtils.isEmpty(selectPackEvent.getPacketImgPath())) {
|
||||
this.d.setVisibility(8);
|
||||
this.c.setVisibility(0);
|
||||
return;
|
||||
}
|
||||
this.d.setVisibility(0);
|
||||
this.c.setVisibility(8);
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(selectPackEvent.getPacketImgPath());
|
||||
a.a(new RequestOptions().b(R.drawable.image_load_error).a(R.drawable.image_load_error).b());
|
||||
a.a(this.d);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
if (!EventBus.b().a(this)) {
|
||||
EventBus.b().c(this);
|
||||
}
|
||||
initView(view);
|
||||
}
|
||||
|
||||
public /* synthetic */ void q() {
|
||||
UploadPopupWindow uploadPopupWindow = this.p;
|
||||
if (uploadPopupWindow == null || !uploadPopupWindow.c()) {
|
||||
return;
|
||||
}
|
||||
this.p.a();
|
||||
}
|
||||
|
||||
public /* synthetic */ void v() {
|
||||
this.p.a(105);
|
||||
this.p.a(getResources().getString(R.string.uploading));
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(Object obj) throws Exception {
|
||||
this.h.setText("");
|
||||
E();
|
||||
this.n.a((List<FeedBackIconBean>) null);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public FeedBackPresenter createPresenter() {
|
||||
return new FeedBackPresenter(getActivity(), this);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(Object obj) throws Exception {
|
||||
D();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
CardActionUtils.a(getActivity(), 9, this.q);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void a(FeedbackEntities feedbackEntities) {
|
||||
if (feedbackEntities.isStatus()) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.feedback_success), ToastView.Type.SUCCESS).a();
|
||||
H();
|
||||
} else {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.failed_to_send_feedback), ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
((FeedBackPresenter) this.mPresenter).b(this.o);
|
||||
}
|
||||
|
||||
public void b() {
|
||||
((FeedBackPresenter) this.mPresenter).a();
|
||||
DataUploadProxy.c().a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void a(int i) {
|
||||
this.p.a(i);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
LoginActivity.start(getActivity());
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(double d) {
|
||||
this.p.b((int) (d * 100.0d));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void a(UploadRequest uploadRequest, final double d) {
|
||||
((FragmentActivity) Objects.requireNonNull(getActivity())).runOnUiThread(new Runnable() { // from class: com.ubt.jimu.user.setting.view.s
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
FeedBackFragment.this.a(d);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.view.FeedBackPresenter.FeedBackView
|
||||
public void a(UploadResponse uploadResponse) {
|
||||
if (uploadResponse == null) {
|
||||
return;
|
||||
}
|
||||
FeedbackPostBean c = ((FeedBackPresenter) this.mPresenter).c();
|
||||
List<PostMediaBean> imageList = c.getImageList();
|
||||
if (imageList == null) {
|
||||
imageList = new ArrayList<>();
|
||||
c.setImageList(imageList);
|
||||
}
|
||||
if (imageList != null) {
|
||||
imageList.add(new PostMediaBean(uploadResponse.a(), uploadResponse.c()));
|
||||
}
|
||||
}
|
||||
}
|
425
sources/com/ubt/jimu/user/setting/view/FeedBackPresenter.java
Normal file
425
sources/com/ubt/jimu/user/setting/view/FeedBackPresenter.java
Normal file
@@ -0,0 +1,425 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.FeedbackEntities;
|
||||
import com.ubt.jimu.base.entities.PublishType;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.base.http.service.UserService;
|
||||
import com.ubt.jimu.base.mvp.BaseRxView;
|
||||
import com.ubt.jimu.base.mvp.RxPresenter;
|
||||
import com.ubt.jimu.community.presenter.PublishCommunityPresenter;
|
||||
import com.ubt.jimu.upload.DataUploadProxy;
|
||||
import com.ubt.jimu.upload.ProgressUploadCallback;
|
||||
import com.ubt.jimu.upload.UploadRequest;
|
||||
import com.ubt.jimu.upload.UploadResponse;
|
||||
import com.ubt.jimu.user.feedback.FeedBackIconBean;
|
||||
import com.ubt.jimu.user.feedback.FeedbackPostBean;
|
||||
import com.ubt.jimu.user.feedback.LogUploadWorker;
|
||||
import com.ubt.jimu.utils.EncryptUtils;
|
||||
import com.ubt.jimu.utils.Md5Utils;
|
||||
import com.ubt.jimu.utils.videoUtil.CompressUtil;
|
||||
import com.ubt.jimu.video.Configuration;
|
||||
import com.ubt.jimu.video.OnCompressListener;
|
||||
import com.ubt.jimu.video.VideoCompressUtils;
|
||||
import com.ubt.jimu.widgets.choosePhotos.AlbumActivity;
|
||||
import com.ubt.jimu.widgets.choosePhotos.media.HPMedia;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtech.permission.PermissionRequestListener;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class FeedBackPresenter extends RxPresenter<FeedBackView> {
|
||||
private Context a;
|
||||
private FeedBackView b;
|
||||
private FeedbackPostBean c;
|
||||
private ArrayList<HPMedia> d;
|
||||
private IChooseImg e;
|
||||
private boolean f;
|
||||
private boolean g;
|
||||
private PublishCommunityPresenter.CompressionProgressListener h;
|
||||
|
||||
public interface FeedBackView extends BaseRxView {
|
||||
void a(int i);
|
||||
|
||||
void a(FeedbackEntities feedbackEntities);
|
||||
|
||||
void a(UploadRequest uploadRequest, double d);
|
||||
|
||||
void a(UploadResponse uploadResponse);
|
||||
|
||||
void allUploadSucceed();
|
||||
|
||||
void g();
|
||||
|
||||
void k();
|
||||
|
||||
void n();
|
||||
}
|
||||
|
||||
public interface IChooseImg {
|
||||
void a(List<HPMedia> list);
|
||||
}
|
||||
|
||||
public FeedBackPresenter(Context context, FeedBackView feedBackView) {
|
||||
this.a = context;
|
||||
this.b = feedBackView;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
VideoCompressUtils.a(JimuApplication.k).a();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void e() {
|
||||
FeedbackPostBean c = c();
|
||||
c.setAppType("2");
|
||||
c.setServiceVersion(ApiConstants.getAppVersion());
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
c.setRequestTime(String.valueOf(currentTimeMillis));
|
||||
c.setRequestKey(EncryptUtils.a(currentTimeMillis + ApiConstants.ENCODE_KEY, 32));
|
||||
c.setSystemLanguage(JimuApplication.l().g());
|
||||
c.setSystemArea(JimuApplication.l().c());
|
||||
c.setAppSource("Jimu");
|
||||
c.setLanguage(JimuApplication.l().g());
|
||||
ALog.a("FeedBackFragment").d("请求参数:" + c.toString());
|
||||
((UserService) ApiClient.getService(UserService.class)).sendFeedback(c).subscribeOn(Schedulers.b()).observeOn(AndroidSchedulers.a()).subscribe(new Observer<FeedbackEntities>() { // from class: com.ubt.jimu.user.setting.view.FeedBackPresenter.5
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(FeedbackEntities feedbackEntities) {
|
||||
ALog.a("FeedBackFragment").d("反馈完成:" + feedbackEntities);
|
||||
FeedBackPresenter.this.b.hideLoadingDialog();
|
||||
FeedBackPresenter.this.b.a(feedbackEntities);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
ALog.a("FeedBackFragment").d("反馈失败:" + th.getMessage());
|
||||
FeedBackPresenter.this.b.hideLoadingDialog();
|
||||
ToastView.a(FeedBackPresenter.this.a, FeedBackPresenter.this.a.getString(R.string.failed_to_send_feedback), ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void b(List<FeedBackIconBean> list) {
|
||||
int i = 0;
|
||||
this.g = false;
|
||||
final ArrayList arrayList = new ArrayList();
|
||||
for (FeedBackIconBean feedBackIconBean : list) {
|
||||
if (!feedBackIconBean.isAddFlag()) {
|
||||
arrayList.add(feedBackIconBean);
|
||||
}
|
||||
}
|
||||
if (arrayList.size() <= 0) {
|
||||
this.b.showLoadingDialog(JimuApplication.l().getString(R.string.feedback_sending));
|
||||
a(false);
|
||||
return;
|
||||
}
|
||||
this.b.n();
|
||||
this.c.setmMediaList(arrayList);
|
||||
Iterator<FeedBackIconBean> it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (1 == it.next().getmType()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
this.b.a((i * 100) + 10);
|
||||
a(arrayList);
|
||||
} else {
|
||||
this.b.k();
|
||||
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.setting.view.a0
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public final void subscribe(ObservableEmitter observableEmitter) {
|
||||
FeedBackPresenter.this.a(arrayList, observableEmitter);
|
||||
}
|
||||
}).subscribeOn(Schedulers.b()).subscribe();
|
||||
}
|
||||
a(true);
|
||||
}
|
||||
|
||||
public FeedbackPostBean c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void a(String str, String str2, String str3, long j) {
|
||||
this.c = new FeedbackPostBean();
|
||||
if (!TextUtils.isEmpty(str) && StringUtils.d(str)) {
|
||||
this.c.setFeedbackEmail(str);
|
||||
} else if (!TextUtils.isEmpty(str) && StringUtils.a((CharSequence) str)) {
|
||||
this.c.setFeedbackPhone(str);
|
||||
}
|
||||
User user = UserDbHandler.getUser();
|
||||
if (user == null || user.getUserId() > 0) {
|
||||
this.c.setFeedbackUser(Long.valueOf(user.getUserId()));
|
||||
}
|
||||
this.c.setFeedbackContent(str2);
|
||||
this.c.setDeviceType(Build.MODEL);
|
||||
this.c.setDeviceVersion("android-" + Build.VERSION.RELEASE);
|
||||
this.c.setFeedbackType(str3);
|
||||
this.c.setPackageId((int) j);
|
||||
this.c.setLanguage(JimuApplication.l().g());
|
||||
this.c.setArea(JimuApplication.l().c());
|
||||
}
|
||||
|
||||
public void c(List<FeedBackIconBean> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
FeedBackIconBean feedBackIconBean = list.get(i);
|
||||
int i2 = feedBackIconBean.getmType();
|
||||
if (i2 == 0 || i2 == 1) {
|
||||
UploadRequest uploadRequest = new UploadRequest();
|
||||
ALog.a("FeedBackFragment").d("\"MD5后数值" + Md5Utils.a(feedBackIconBean.getmName(), 8));
|
||||
uploadRequest.a("jimu/post/" + (Md5Utils.a(feedBackIconBean.getmName(), 8) + (i2 == 1 ? ".mp4" : ".jpg")));
|
||||
uploadRequest.b(feedBackIconBean.getPath());
|
||||
uploadRequest.a(i);
|
||||
if (i2 == 0) {
|
||||
uploadRequest.a(PublishType.IMAGE);
|
||||
}
|
||||
arrayList.add(uploadRequest);
|
||||
if (i2 == 1) {
|
||||
arrayList2.add(uploadRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.f = false;
|
||||
DataUploadProxy.c().a(arrayList, new ProgressUploadCallback() { // from class: com.ubt.jimu.user.setting.view.FeedBackPresenter.3
|
||||
@Override // com.ubt.jimu.upload.ProgressUploadCallback
|
||||
public void a(UploadRequest uploadRequest2, double d) {
|
||||
if (FeedBackPresenter.this.g) {
|
||||
return;
|
||||
}
|
||||
FeedBackPresenter.this.b.a(uploadRequest2, d);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.upload.ProgressUploadCallback, com.ubt.jimu.upload.IUploadCallback
|
||||
public void allComplete() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.upload.ProgressUploadCallback, com.ubt.jimu.upload.IUploadCallback
|
||||
public void allUploadSucceed() {
|
||||
ALog.a("FeedBackFragment").d("所有任务执行完成");
|
||||
if (FeedBackPresenter.this.g) {
|
||||
return;
|
||||
}
|
||||
FeedBackPresenter.this.c().setMediaUploadFinishFlag(true);
|
||||
FeedBackPresenter.this.b.allUploadSucceed();
|
||||
if (FeedBackPresenter.this.c().isLogUploadFinisgFlag()) {
|
||||
FeedBackPresenter.this.e();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.upload.IUploadCallback
|
||||
public void uploadFaulted(UploadRequest uploadRequest2, Exception exc) {
|
||||
ALog.a("FeedBackFragment").d("上传失败");
|
||||
if (FeedBackPresenter.this.f) {
|
||||
return;
|
||||
}
|
||||
FeedBackPresenter.this.f = true;
|
||||
DataUploadProxy.c().a();
|
||||
FeedBackPresenter.this.b.g();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.upload.IUploadCallback
|
||||
public void uploadSucceed(UploadResponse uploadResponse) {
|
||||
if (FeedBackPresenter.this.g) {
|
||||
return;
|
||||
}
|
||||
FeedBackPresenter.this.b.a(uploadResponse);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(final Activity activity) {
|
||||
if (this.d == null) {
|
||||
this.d = new ArrayList<>();
|
||||
}
|
||||
JimuPermissionRequest.c(activity, new PermissionRequestListener() { // from class: com.ubt.jimu.user.setting.view.FeedBackPresenter.1
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onDenied() {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.permission.PermissionRequestListener
|
||||
public void onGranted() {
|
||||
AlbumActivity.a(activity, 999, 6, FeedBackPresenter.this.d, 5, "MULTITERM_VIDEO_IMAGE");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void b() {
|
||||
ArrayList<HPMedia> arrayList = this.d;
|
||||
if (arrayList != null) {
|
||||
arrayList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(List list, ObservableEmitter observableEmitter) throws Exception {
|
||||
c((List<FeedBackIconBean>) list);
|
||||
}
|
||||
|
||||
public void a(List<FeedBackIconBean> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
FeedBackIconBean feedBackIconBean = list.get(i);
|
||||
if (feedBackIconBean.getmType() == 1) {
|
||||
String path = feedBackIconBean.getPath();
|
||||
Configuration configuration = new Configuration();
|
||||
String a = CompressUtil.a(path, i);
|
||||
configuration.a = path;
|
||||
configuration.b = a;
|
||||
configuration.f = i;
|
||||
arrayList.add(configuration);
|
||||
}
|
||||
}
|
||||
VideoCompressUtils.a(JimuApplication.k).a(arrayList, new OnCompressListener() { // from class: com.ubt.jimu.user.setting.view.FeedBackPresenter.2
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void onAllCompressFail() {
|
||||
if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.onAllCompressFail();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void onAllCompressSuccess() {
|
||||
if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.m();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void onFail(boolean z) {
|
||||
if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.c(z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void onProgress(float f) {
|
||||
if (FeedBackPresenter.this.g) {
|
||||
ALog.a("FeedBackFragment").d("压缩视频被取消");
|
||||
} else if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.d((int) f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void onSuccess(Configuration configuration2) {
|
||||
if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.a(configuration2.f, configuration2.b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.video.OnCompressListener
|
||||
public void prepareCompress() {
|
||||
if (FeedBackPresenter.this.h != null) {
|
||||
FeedBackPresenter.this.h.U();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(final boolean z, ObservableEmitter observableEmitter) throws Exception {
|
||||
new LogUploadWorker().c(new LogUploadWorker.LogWorkerCallBack() { // from class: com.ubt.jimu.user.setting.view.FeedBackPresenter.4
|
||||
@Override // com.ubt.jimu.user.feedback.LogUploadWorker.LogWorkerCallBack
|
||||
public void a(String str) {
|
||||
ALog.a("FeedBackFragment").d("日志上传成功");
|
||||
FeedBackPresenter.this.c().setLogFilePath(str);
|
||||
FeedBackPresenter.this.c().setLogUploadFinisgFlag(true);
|
||||
if (z && FeedBackPresenter.this.c().isMediaUploadFinishFlag()) {
|
||||
ALog.a("FeedBackFragment").d("媒体上传完成:发布反馈");
|
||||
FeedBackPresenter.this.e();
|
||||
} else {
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
ALog.a("FeedBackFragment").d("不需要等待媒体上传完成:发布反馈");
|
||||
FeedBackPresenter.this.e();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.feedback.LogUploadWorker.LogWorkerCallBack
|
||||
public void b(String str) {
|
||||
ALog.a("FeedBackFragment").d("日志上传失败");
|
||||
FeedBackPresenter.this.c().setLogFilePath("");
|
||||
FeedBackPresenter.this.c().setLogUploadFinisgFlag(true);
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
ALog.a("FeedBackFragment").d("不需要等待媒体上传完成:发布反馈");
|
||||
FeedBackPresenter.this.e();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(final boolean z) {
|
||||
Observable.create(new ObservableOnSubscribe() { // from class: com.ubt.jimu.user.setting.view.z
|
||||
@Override // io.reactivex.ObservableOnSubscribe
|
||||
public final void subscribe(ObservableEmitter observableEmitter) {
|
||||
FeedBackPresenter.this.a(z, observableEmitter);
|
||||
}
|
||||
}).subscribeOn(Schedulers.b()).subscribe();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.g = true;
|
||||
d();
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
ArrayList<HPMedia> arrayList = this.d;
|
||||
if (arrayList == null || arrayList.size() <= i) {
|
||||
return;
|
||||
}
|
||||
this.d.remove(i);
|
||||
}
|
||||
|
||||
public void a(PublishCommunityPresenter.CompressionProgressListener compressionProgressListener) {
|
||||
this.h = compressionProgressListener;
|
||||
}
|
||||
|
||||
public void a(IChooseImg iChooseImg) {
|
||||
this.e = iChooseImg;
|
||||
}
|
||||
|
||||
public void a(int i, int i2, Intent intent) {
|
||||
if (-1 == i2 && intent != null && i == 999) {
|
||||
List list = (List) intent.getSerializableExtra("result_data");
|
||||
ALog.a("FeedBackFragment").d("选中的列表:" + list.size());
|
||||
this.d.clear();
|
||||
this.d.addAll(list);
|
||||
IChooseImg iChooseImg = this.e;
|
||||
if (iChooseImg != null) {
|
||||
iChooseImg.a(this.d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class GameControllerSupportIntroductionActivity extends BaseActivity {
|
||||
private TextView a;
|
||||
private ImageView b;
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.layout_gamecontroller_introduction);
|
||||
this.a = (TextView) findViewById(R.id.tv_support);
|
||||
this.a.setText(getString(R.string.android_game_controller_support) + "\n" + getString(R.string.ios_game_controller_support));
|
||||
this.b = (ImageView) findViewById(R.id.btn_back);
|
||||
this.b.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.GameControllerSupportIntroductionActivity.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
GameControllerSupportIntroductionActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
144
sources/com/ubt/jimu/user/setting/view/HardwareFragment.java
Normal file
144
sources/com/ubt/jimu/user/setting/view/HardwareFragment.java
Normal file
@@ -0,0 +1,144 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.user.setting.presenter.HardWarePresenter;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HardwareFragment extends BaseMvpFragment<HardWarePresenter> implements HardWarePresenter.HardWareView, SingleClickListener {
|
||||
private boolean a = true;
|
||||
private RelativeLayout b;
|
||||
private CheckBox c;
|
||||
private RelativeLayout d;
|
||||
private ImageView e;
|
||||
private RelativeLayout f;
|
||||
private SharePreferenceHelper g;
|
||||
private Dialog h;
|
||||
|
||||
private void initView(View view) {
|
||||
this.b = (RelativeLayout) view.findViewById(R.id.xr_protect);
|
||||
this.c = (CheckBox) view.findViewById(R.id.cb_protect);
|
||||
this.d = (RelativeLayout) view.findViewById(R.id.xr_auto_connect);
|
||||
this.e = (ImageView) view.findViewById(R.id.cb_auto);
|
||||
this.f = (RelativeLayout) view.findViewById(R.id.xl_modify);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
this.c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.user.setting.view.b0
|
||||
@Override // android.widget.CompoundButton.OnCheckedChangeListener
|
||||
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
|
||||
HardwareFragment.this.a(compoundButton, z);
|
||||
}
|
||||
});
|
||||
this.b.setOnClickListener(this);
|
||||
this.d.setOnClickListener(this);
|
||||
this.f.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void q() {
|
||||
this.a = this.g.getBoolean(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, true).booleanValue();
|
||||
this.e.setBackgroundResource(this.a ? R.drawable.checkbox_on_xxx : R.drawable.checkbox_off_xxx);
|
||||
this.c.setChecked(this.g.getBoolean(SharePreferenceHelper.SP_KEY_ELECTRICITY_PROTECT, true).booleanValue());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_hardware;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
this.g = new SharePreferenceHelper();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.xr_protect) {
|
||||
CheckBox checkBox = this.c;
|
||||
checkBox.setChecked(true ^ checkBox.isChecked());
|
||||
return;
|
||||
}
|
||||
if (id != R.id.xr_auto_connect) {
|
||||
if (id == R.id.xl_modify) {
|
||||
UnityActivity.startUnityActivity(getActivity(), (Robot) null, 1, -1, UnityActivity.BLOCKLY_TYPE_NONE);
|
||||
JimuAnalytics.b().a("click_P15_1");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.a) {
|
||||
b();
|
||||
return;
|
||||
}
|
||||
this.a = true;
|
||||
SharePreferenceHelper sharePreferenceHelper = this.g;
|
||||
if (sharePreferenceHelper != null) {
|
||||
sharePreferenceHelper.put(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, Boolean.valueOf(this.a));
|
||||
}
|
||||
this.e.setBackgroundResource(R.drawable.checkbox_off_xxx);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
q();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
o();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.h = new SimpleDialog.Builder(getActivity()).a(R.string.search_cancel_return).a(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.HardwareFragment.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
HardwareFragment.this.a = true;
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).d(R.string.confirm).b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.HardwareFragment.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
HardwareFragment.this.a = false;
|
||||
if (HardwareFragment.this.g != null) {
|
||||
HardwareFragment.this.g.put(SharePreferenceHelper.SP_KEY_AUTO_CONNECT, Boolean.valueOf(HardwareFragment.this.a));
|
||||
}
|
||||
HardwareFragment.this.e.setBackgroundResource(R.drawable.checkbox_off_xxx);
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).b(R.string.bluetooth_auto_connect_tips).a();
|
||||
this.h.show();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public HardWarePresenter createPresenter() {
|
||||
return new HardWarePresenter();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(CompoundButton compoundButton, boolean z) {
|
||||
this.g.put(SharePreferenceHelper.SP_KEY_ELECTRICITY_PROTECT, Boolean.valueOf(z));
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.user.setting.presenter.LaboratoryPresenter;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class LaboratoryFragment extends BaseMvpFragment<LaboratoryPresenter> implements LaboratoryPresenter.LaboratoryView {
|
||||
private RelativeLayout a;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void b() {
|
||||
if (getContext() == null) {
|
||||
return;
|
||||
}
|
||||
startActivity(new Intent(getContext(), (Class<?>) GameControllerSupportIntroductionActivity.class));
|
||||
}
|
||||
|
||||
private void bindClick() {
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.a = (RelativeLayout) view.findViewById(R.id.rl_game_controller_operate_text);
|
||||
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.LaboratoryFragment.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
LaboratoryFragment.this.b();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_laboratory;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
bindClick();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public LaboratoryPresenter createPresenter() {
|
||||
return new LaboratoryPresenter();
|
||||
}
|
||||
}
|
240
sources/com/ubt/jimu/user/setting/view/MyAccountFragment.java
Normal file
240
sources/com/ubt/jimu/user/setting/view/MyAccountFragment.java
Normal file
@@ -0,0 +1,240 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.base.event.MessageEvent;
|
||||
import com.ubt.jimu.base.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import com.ubt.jimu.base.util.FileUtil;
|
||||
import com.ubt.jimu.user.setting.presenter.MyAccountPresenter;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.user.view.UserDetailInfoActivity;
|
||||
import com.ubt.jimu.user.view.setting.ThePolicyActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.ShortcutHelper;
|
||||
import com.ubt.jimu.widgets.RoundedImageView;
|
||||
import com.ubtech.view.widget.UButton;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MyAccountFragment extends BaseMvpFragment<MyAccountPresenter> implements MyAccountPresenter.MyAccountView, SingleClickListener {
|
||||
private LinearLayout a;
|
||||
private FrameLayout b;
|
||||
private UButton c;
|
||||
private RoundedImageView d;
|
||||
private TextView e;
|
||||
private TextView f;
|
||||
private long g;
|
||||
private long h;
|
||||
private boolean i;
|
||||
private boolean j;
|
||||
private User k;
|
||||
private RelativeLayout l;
|
||||
private RelativeLayout m;
|
||||
private RelativeLayout n;
|
||||
|
||||
private void a(User user) {
|
||||
boolean z = this.i;
|
||||
if (!z || (z && !this.j)) {
|
||||
return;
|
||||
}
|
||||
this.e.setText(user.getNickName());
|
||||
this.f.setText("UID:" + user.getUserId());
|
||||
this.d.setBackgroundResource(R.drawable.user_center_protrait_bg);
|
||||
RequestBuilder<Drawable> a = Glide.a(this).a(user.getUserImage());
|
||||
a.a(RequestOptions.N().b(R.drawable.community_img_official).a(R.drawable.community_img_official));
|
||||
a.a((ImageView) this.d);
|
||||
}
|
||||
|
||||
private void b() {
|
||||
this.c.setOnClickListener(this);
|
||||
this.l.setOnClickListener(this);
|
||||
this.m.setOnClickListener(this);
|
||||
this.n.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.l = (RelativeLayout) view.findViewById(R.id.btn_edit_pmsg);
|
||||
this.m = (RelativeLayout) view.findViewById(R.id.btn_write_off);
|
||||
this.n = (RelativeLayout) view.findViewById(R.id.btn_logout);
|
||||
this.a = (LinearLayout) view.findViewById(R.id.ll_account);
|
||||
this.b = (FrameLayout) view.findViewById(R.id.unLoginLayout);
|
||||
this.c = (UButton) view.findViewById(R.id.btnLogin);
|
||||
this.d = (RoundedImageView) view.findViewById(R.id.iv_setting_portrait);
|
||||
this.e = (TextView) view.findViewById(R.id.tv_setting_name);
|
||||
this.f = (TextView) view.findViewById(R.id.tv_setting_uid);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
this.g = getArguments().getLong("view_user_id", 0L);
|
||||
this.k = UserDbHandler.getUser();
|
||||
User user = this.k;
|
||||
if (user != null) {
|
||||
this.h = user.getUserId();
|
||||
} else {
|
||||
this.h = 0L;
|
||||
}
|
||||
boolean z = true;
|
||||
this.i = this.h > 0;
|
||||
long j = this.h;
|
||||
if ((j <= 0 || j != this.g) && this.g > 0) {
|
||||
z = false;
|
||||
}
|
||||
this.j = z;
|
||||
User user2 = this.k;
|
||||
if (user2 != null) {
|
||||
a(user2);
|
||||
}
|
||||
}
|
||||
|
||||
private void q() {
|
||||
boolean z = this.i || this.g > 0;
|
||||
this.b.setVisibility(z ? 8 : 0);
|
||||
this.a.setVisibility(z ? 0 : 8);
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
LogUtils.c("退出登录:" + str);
|
||||
((MyAccountPresenter) this.mPresenter).a(str);
|
||||
this.b.setVisibility(0);
|
||||
this.a.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_setting_myaccount;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public boolean isRegistEventBus() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.presenter.MyAccountPresenter.MyAccountView
|
||||
public void l() {
|
||||
Cache.getInstance().clearCacheUser();
|
||||
UserDbHandler.clearUser();
|
||||
ShortcutHelper.a(JimuApplication.l());
|
||||
EventBus.b().b(new MessageEvent(1));
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (i == 4096) {
|
||||
if (intent == null) {
|
||||
getActivity().finish();
|
||||
return;
|
||||
}
|
||||
User user = (User) intent.getSerializableExtra("user");
|
||||
if (user != null) {
|
||||
b(user);
|
||||
} else {
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener, android.view.View.OnClickListener
|
||||
public /* synthetic */ void onClick(View view) {
|
||||
com.ubt.jimu.base.mvp.b.$default$onClick(this, view);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public void onReceiveMessage(MessageEvent messageEvent) {
|
||||
super.onReceiveMessage(messageEvent);
|
||||
if (messageEvent.getType() == 5) {
|
||||
this.b.setVisibility(0);
|
||||
this.a.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
if (messageEvent.getType() == 6) {
|
||||
a(UserDbHandler.getUser());
|
||||
return;
|
||||
}
|
||||
if (messageEvent.getType() == 1) {
|
||||
this.b.setVisibility(0);
|
||||
this.a.setVisibility(8);
|
||||
} else if (messageEvent.getType() == 0) {
|
||||
b(UserDbHandler.getUser());
|
||||
} else if (messageEvent.getType() == 7) {
|
||||
b(UserDbHandler.getUser());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.SingleClickListener
|
||||
public void onSingleClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnLogin) {
|
||||
LoginActivity.start(getActivity(), FileUtil.ZIP_BUFFER_SIZE);
|
||||
return;
|
||||
}
|
||||
if (id == R.id.btn_edit_pmsg) {
|
||||
if (this.h > 0) {
|
||||
UserDetailInfoActivity.start(getActivity());
|
||||
return;
|
||||
} else {
|
||||
LoginActivity.start(getActivity(), FileUtil.ZIP_BUFFER_SIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id == R.id.btn_write_off) {
|
||||
ThePolicyActivity.a(getActivity(), 10);
|
||||
} else if (id == R.id.btn_logout) {
|
||||
c(Cache.getInstance().getUserToken());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
o();
|
||||
q();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
initView(view);
|
||||
b();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public MyAccountPresenter createPresenter() {
|
||||
return new MyAccountPresenter();
|
||||
}
|
||||
|
||||
private void b(User user) {
|
||||
if (user != null) {
|
||||
this.h = user.getUserId();
|
||||
o();
|
||||
q();
|
||||
a(user);
|
||||
}
|
||||
}
|
||||
}
|
272
sources/com/ubt/jimu/user/setting/view/PrivacyFragment.java
Normal file
272
sources/com/ubt/jimu/user/setting/view/PrivacyFragment.java
Normal file
@@ -0,0 +1,272 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
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.Constant;
|
||||
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.user.view.setting.ThePolicyActivity;
|
||||
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.utils.ShortcutHelper;
|
||||
import com.ubt.jimu.widgets.JAlertDialog;
|
||||
import com.ubtech.utils.FileHelper;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import java.io.File;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class PrivacyFragment extends BaseFragment implements View.OnClickListener, SettingContract$View {
|
||||
private RelativeLayout a;
|
||||
private RelativeLayout b;
|
||||
private RelativeLayout c;
|
||||
private RelativeLayout d;
|
||||
private RelativeLayout e;
|
||||
private SettingPresenter f;
|
||||
protected JAlertDialog g;
|
||||
|
||||
static /* synthetic */ void d(DialogInterface dialogInterface, int i) {
|
||||
SPUtils.a(Constant.NoviceGuide.AGREE_LEGAL_EXAMINE, false);
|
||||
SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE, false);
|
||||
JimuApplication.l().b();
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.a = (RelativeLayout) view.findViewById(R.id.forward_privacy);
|
||||
this.b = (RelativeLayout) view.findViewById(R.id.child_privacy);
|
||||
this.c = (RelativeLayout) view.findViewById(R.id.suggest_ll);
|
||||
this.d = (RelativeLayout) view.findViewById(R.id.reset_accredit);
|
||||
this.e = (RelativeLayout) view.findViewById(R.id.logout);
|
||||
this.a.setOnClickListener(this);
|
||||
this.c.setOnClickListener(this);
|
||||
this.d.setOnClickListener(this);
|
||||
this.e.setOnClickListener(this);
|
||||
this.d.setVisibility(0);
|
||||
if (LocaleUtils.g()) {
|
||||
this.b.setVisibility(0);
|
||||
} else {
|
||||
this.b.setVisibility(8);
|
||||
}
|
||||
this.b.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
if (UserDbHandler.getUser() != null) {
|
||||
this.e.setVisibility(0);
|
||||
} else {
|
||||
this.e.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void q() {
|
||||
new JimuSimpleDialog.Builder(getActivity()).ok(R.string.dialog_reset).cancel(R.string.dialog_see_see).content(R.string.legal_reset_agree_tip).gravity(17).cancleBtnBg(R.drawable.sel_common_negative_btn).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.g0
|
||||
@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.setting.view.f0
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
PrivacyFragment.d(dialogInterface, i);
|
||||
}
|
||||
}).build().show();
|
||||
}
|
||||
|
||||
private void v() {
|
||||
new JimuSimpleDialog.Builder(getActivity()).title(getString(R.string.setting_suggest)).ok(R.string.ok).content(R.string.ubt_contact_info).gravity(17).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.c0
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).build().show();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
if (!NetWorkUtil.b(getActivity())) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.network_error), ToastView.Type.NORMAL).a();
|
||||
return;
|
||||
}
|
||||
this.f.b();
|
||||
dialogInterface.dismiss();
|
||||
showLoading(getString(R.string.logoff) + "...");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(SettingContract$Presenter settingContract$Presenter) {
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
new JimuSimpleDialog.Builder(getActivity()).cancel(R.string.dialog_see_see).ok(R.string.close_account).content(R.string.ubt_user_logout_remind).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.user.setting.view.e0
|
||||
@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.setting.view.d0
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
PrivacyFragment.this.a(dialogInterface, i);
|
||||
}
|
||||
}).cancleBtnBg(R.drawable.shape_cor50_bg92a7b6).build().show();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public void c(ApiStatus apiStatus) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public void f(String str) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public void h() {
|
||||
hideLoading();
|
||||
ToastView.a(JimuApplication.k, getString(R.string.tips_delete_account_failed), ToastView.Type.NORMAL).a();
|
||||
}
|
||||
|
||||
protected void hideLoading() {
|
||||
JAlertDialog jAlertDialog = this.g;
|
||||
if (jAlertDialog == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
jAlertDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void l() {
|
||||
Cache.getInstance().clearCacheUser();
|
||||
UserDbHandler.clearUser();
|
||||
ShortcutHelper.a(getActivity());
|
||||
EventBus.b().b(new MessageEvent(1));
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (R.id.forward_privacy == id) {
|
||||
ThePolicyActivity.a(getActivity(), 0, 0);
|
||||
return;
|
||||
}
|
||||
if (R.id.child_privacy == id) {
|
||||
ThePolicyActivity.a(getActivity(), 1, 0);
|
||||
return;
|
||||
}
|
||||
if (R.id.suggest_ll == id) {
|
||||
v();
|
||||
} else if (R.id.reset_accredit == id) {
|
||||
q();
|
||||
} else if (R.id.logout == id) {
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
View inflate = layoutInflater.inflate(R.layout.fragment_privacy, viewGroup, false);
|
||||
initView(inflate);
|
||||
this.f = new SettingPresenter(getActivity(), this);
|
||||
if (!EventBus.b().a(this)) {
|
||||
EventBus.b().c(this);
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (EventBus.b().a(this)) {
|
||||
EventBus.b().d(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoginOrLogoutMessageEvent(MessageEvent messageEvent) {
|
||||
RelativeLayout relativeLayout;
|
||||
int type = messageEvent.getType();
|
||||
if (type != 0) {
|
||||
if (type == 1 && (relativeLayout = this.e) != null) {
|
||||
relativeLayout.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
RelativeLayout relativeLayout2 = this.e;
|
||||
if (relativeLayout2 != null) {
|
||||
relativeLayout2.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
o();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public boolean r() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public boolean s() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void showLoading(String str) {
|
||||
JAlertDialog jAlertDialog = this.g;
|
||||
if (jAlertDialog == null) {
|
||||
JAlertDialog.Builder builder = new JAlertDialog.Builder(getActivity());
|
||||
builder.a(R.drawable.ic_loading);
|
||||
builder.a(str);
|
||||
builder.a(true);
|
||||
this.g = builder.a();
|
||||
} else {
|
||||
jAlertDialog.a(str);
|
||||
}
|
||||
this.g.show();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public boolean t() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.user.contract.SettingContract$View
|
||||
public void a(ApiStatus apiStatus) {
|
||||
hideLoading();
|
||||
if (apiStatus.getCode() != 0 && !CourseResult.SUCCESS.equals(apiStatus.getMessage())) {
|
||||
ToastView.a(JimuApplication.k, getString(R.string.tips_delete_account_failed), ToastView.Type.NORMAL).a();
|
||||
return;
|
||||
}
|
||||
File file = new File(ExternalOverFroyoUtils.a(getActivity(), (ModelType) null) + String.format(Constants.USER_HOME, Cache.getInstance().getUserId()));
|
||||
if (file.exists()) {
|
||||
FileHelper.a(file);
|
||||
}
|
||||
ToastView.a(JimuApplication.k, getString(R.string.tips_delete_account), ToastView.Type.NORMAL).a();
|
||||
l();
|
||||
this.e.setVisibility(8);
|
||||
}
|
||||
}
|
65
sources/com/ubt/jimu/user/setting/view/TeachFragment.java
Normal file
65
sources/com/ubt/jimu/user/setting/view/TeachFragment.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.ubt.jimu.user.setting.view;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
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.mvp.BaseMvpFragment;
|
||||
import com.ubt.jimu.community.view.WebViewShopActivity;
|
||||
import com.ubt.jimu.user.model.TeachModel;
|
||||
import com.ubt.jimu.user.setting.presenter.TeachPresenter;
|
||||
import com.ubt.jimu.utils.ResoureUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TeachFragment extends BaseMvpFragment<TeachPresenter> implements TeachPresenter.TeachView {
|
||||
private RecyclerView a;
|
||||
private BaseQuickAdapter<TeachModel, BaseViewHolder> b;
|
||||
|
||||
@Override // com.ubt.jimu.user.setting.presenter.TeachPresenter.TeachView
|
||||
public void f(List<TeachModel> list) {
|
||||
this.a.setLayoutManager(new GridLayoutManager(getActivity(), 3));
|
||||
this.b = new BaseQuickAdapter<TeachModel, BaseViewHolder>(this, R.layout.item_teach, list) { // from class: com.ubt.jimu.user.setting.view.TeachFragment.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, TeachModel teachModel) {
|
||||
baseViewHolder.setText(R.id.tv_teach_text, teachModel.a());
|
||||
baseViewHolder.setBackgroundRes(R.id.img_teach_icon, ResoureUtils.a(this.mContext, String.format("setting_study_%s", Integer.valueOf(baseViewHolder.getAdapterPosition())), "drawable"));
|
||||
}
|
||||
};
|
||||
this.b.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { // from class: com.ubt.jimu.user.setting.view.TeachFragment.2
|
||||
@Override // com.chad.library.adapter.base.BaseQuickAdapter.OnItemClickListener
|
||||
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
|
||||
TeachModel teachModel = (TeachModel) baseQuickAdapter.getItem(i);
|
||||
WebViewShopActivity.a(TeachFragment.this.getActivity(), teachModel.a(), teachModel.c(), teachModel.d(), teachModel.b());
|
||||
}
|
||||
});
|
||||
this.a.setAdapter(this.b);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public int getLayoutID() {
|
||||
return R.layout.fragment_teach;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
((TeachPresenter) this.mPresenter).a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment, androidx.fragment.app.Fragment
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
super.onViewCreated(view, bundle);
|
||||
this.a = (RecyclerView) view.findViewById(R.id.rcv_content);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.mvp.BaseMvpFragment
|
||||
public TeachPresenter createPresenter() {
|
||||
return new TeachPresenter();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user