Initial commit
This commit is contained in:
524
sources/com/ubt/jimu/main/activity/MainActivity.java
Normal file
524
sources/com/ubt/jimu/main/activity/MainActivity.java
Normal file
@@ -0,0 +1,524 @@
|
||||
package com.ubt.jimu.main.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.SplashActivity;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.base.db.robot.RobotDbHandler;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Push;
|
||||
import com.ubt.jimu.base.entities.Redirection;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.UpdateApkEntities;
|
||||
import com.ubt.jimu.base.event.MessageEvent;
|
||||
import com.ubt.jimu.base.http.ApiResultException;
|
||||
import com.ubt.jimu.base.http.IApiObserver;
|
||||
import com.ubt.jimu.blockly.BuildConfig;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.community.activity.ActivityAlertActivity;
|
||||
import com.ubt.jimu.community.activity.contract.HomeActivityContract$Presenter;
|
||||
import com.ubt.jimu.community.activity.contract.HomeActivityContract$View;
|
||||
import com.ubt.jimu.community.activity.presenter.HomeActivityPresenter;
|
||||
import com.ubt.jimu.main.activity.MainActivity;
|
||||
import com.ubt.jimu.main.adapter.MainAdapter;
|
||||
import com.ubt.jimu.main.widget.TabBarView;
|
||||
import com.ubt.jimu.main.widget.UserEntryView;
|
||||
import com.ubt.jimu.pack.view.DownloadRobotActivity;
|
||||
import com.ubt.jimu.unity.bluetooth.MyUnityListener;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.update.UpdateManager;
|
||||
import com.ubt.jimu.user.model.EmailCheckMsg;
|
||||
import com.ubt.jimu.user.model.RefHolder;
|
||||
import com.ubt.jimu.user.repository.UserRepository;
|
||||
import com.ubt.jimu.user.setting.view.CommonSettingActivity;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.user.view.RegisterActivity;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import com.ubt.jimu.world.repository.VersionRepository;
|
||||
import com.ubtech.permission.JimuPermissionRequest;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import com.yanzhenjie.permission.Permission$Group;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MainActivity extends BaseActivity implements HomeActivityContract$View {
|
||||
private static int[] l = {1, 2, 4};
|
||||
private UserEntryView a;
|
||||
private TabBarView b;
|
||||
private ImageView c;
|
||||
private ImageView d;
|
||||
private ImageView e;
|
||||
private ImageView f;
|
||||
private ViewPager g;
|
||||
private MainAdapter<BaseFragment> h;
|
||||
private HomeActivityContract$Presenter i;
|
||||
private boolean j = false;
|
||||
private ViewPager.OnPageChangeListener k = new ViewPager.OnPageChangeListener() { // from class: com.ubt.jimu.main.activity.MainActivity.4
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageScrolled(int i, float f, int i2) {
|
||||
MainActivity.this.b.a(i, f);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageSelected(int i) {
|
||||
}
|
||||
};
|
||||
|
||||
private void D0() {
|
||||
UpdateManager.c().a((Activity) this, (UpdateManager.UpdateCallback) new AnonymousClass3(), false);
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
VersionRepository.a(this, null);
|
||||
}
|
||||
|
||||
private void F0() {
|
||||
final String string = Cache.getInstance().getSettings().getString(SharePreferenceHelper.SP_KEY_LAST_PARENT_EMAIL, "");
|
||||
if (TextUtils.isEmpty(string)) {
|
||||
return;
|
||||
}
|
||||
UserRepository.a(string, DeviceUtils.a((Context) this)).compose(RxSchedulers.a()).subscribe(new IApiObserver<EmailCheckMsg>(this) { // from class: com.ubt.jimu.main.activity.MainActivity.1
|
||||
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(EmailCheckMsg emailCheckMsg) {
|
||||
super.onNext(emailCheckMsg);
|
||||
Log.i("getEmailCheckState:", "" + emailCheckMsg);
|
||||
if (emailCheckMsg.isEmailChecked()) {
|
||||
MainActivity.this.a(this, string, emailCheckMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.IApiObserver
|
||||
public void onApiError(ApiResultException apiResultException) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
super.onSubscribe(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean G0() {
|
||||
return JimuPermissionRequest.b(this, Permission$Group.d);
|
||||
}
|
||||
|
||||
private void H0() {
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
this.i = new HomeActivityPresenter(this, this);
|
||||
}
|
||||
|
||||
private void J0() {
|
||||
SharePreferenceHelper sharePreferenceHelper = new SharePreferenceHelper();
|
||||
if (sharePreferenceHelper.getBoolean(SharePreferenceHelper.SP_KEY_START_FROM_SPLASH, false).booleanValue()) {
|
||||
sharePreferenceHelper.put(SharePreferenceHelper.SP_KEY_START_FROM_SPLASH, false);
|
||||
this.i.c();
|
||||
}
|
||||
}
|
||||
|
||||
private void K0() {
|
||||
this.i.refreshToken();
|
||||
this.i.getTTSToken();
|
||||
this.i.j();
|
||||
}
|
||||
|
||||
private void L0() {
|
||||
O0();
|
||||
E0();
|
||||
a(getIntent());
|
||||
}
|
||||
|
||||
private void M0() {
|
||||
if (getIntent().getIntExtra(Constant.Base.ACTIVITY_START_ACTION, 0) == 10001) {
|
||||
Intent intent = new Intent(this, (Class<?>) RegisterActivity.class);
|
||||
SharePreferenceHelper sharePreferenceHelper = new SharePreferenceHelper();
|
||||
int i = sharePreferenceHelper.getInt(SharePreferenceHelper.SP_KEY_FLIPPER_PAGE_INDEX, 0);
|
||||
String string = sharePreferenceHelper.getString(SharePreferenceHelper.SP_KEY_REGISTER_BIRTHDAY, "");
|
||||
String string2 = sharePreferenceHelper.getString(SharePreferenceHelper.SP_KEY_REGISTER_ACCOUNT, "");
|
||||
String string3 = sharePreferenceHelper.getString(SharePreferenceHelper.SP_KEY_REGISTER_COUNTRY, "");
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_FLIPPER_PAGE_INDEX, i);
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_REGISTER_BIRTHDAY, string);
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_REGISTER_ACCOUNT, string2);
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_REGISTER_COUNTRY, string3);
|
||||
intent.setFlags(335544320);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void N0() {
|
||||
if (DeviceUtils.d(this)) {
|
||||
XLog.c("main", "is background, turn foreground, start splashactivity");
|
||||
Intent intent = new Intent(this, (Class<?>) SplashActivity.class);
|
||||
intent.setFlags(335544320);
|
||||
intent.putExtra(Constant.Base.ACTIVITY_START_ACTION, 10001);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void O0() {
|
||||
if (this.j || !G0()) {
|
||||
XLog.b("main", "Can't unZip Blockly or is unziping ");
|
||||
} else {
|
||||
this.j = true;
|
||||
Utils.unZipBlockly(Utils.BLOCKLY_NEW, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.a = (UserEntryView) findViewById(R.id.user);
|
||||
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.activity.d
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
MainActivity.this.a(view);
|
||||
}
|
||||
});
|
||||
this.b = (TabBarView) findViewById(R.id.tab_bar);
|
||||
this.b.setListener(new TabBarView.OnActionListener() { // from class: com.ubt.jimu.main.activity.e
|
||||
@Override // com.ubt.jimu.main.widget.TabBarView.OnActionListener
|
||||
public final void c(int i) {
|
||||
MainActivity.this.l(i);
|
||||
}
|
||||
});
|
||||
this.c = (ImageView) findViewById(R.id.setting);
|
||||
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.activity.c
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
MainActivity.this.b(view);
|
||||
}
|
||||
});
|
||||
this.d = (ImageView) findViewById(R.id.setting_new);
|
||||
this.e = (ImageView) findViewById(R.id.msg);
|
||||
this.e.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.activity.b
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
MainActivity.this.c(view);
|
||||
}
|
||||
});
|
||||
this.f = (ImageView) findViewById(R.id.new_msg);
|
||||
this.g = (ViewPager) findViewById(R.id.pager);
|
||||
this.h = new MainAdapter<>(getSupportFragmentManager(), l);
|
||||
this.g.setAdapter(this.h);
|
||||
this.g.a(this.k);
|
||||
if (Cache.getInstance().getSettings().getBoolean(SharePreferenceHelper.SP_KEY_APP_CHECKED_UPDATE, true).booleanValue()) {
|
||||
this.d.setVisibility(8);
|
||||
} else {
|
||||
this.d.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void o(String str) {
|
||||
JimuAnalytics.b().a(str);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(HomeActivityContract$Presenter homeActivityContract$Presenter) {
|
||||
}
|
||||
|
||||
public /* synthetic */ void c(View view) {
|
||||
o("click_P1_6");
|
||||
ARouter.b().a("/page/message").t();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.activity.contract.HomeActivityContract$View
|
||||
public void c0() {
|
||||
this.i.i();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.activity.contract.HomeActivityContract$View
|
||||
public void e(List<Push> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Bundle bundle = new Bundle();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.addAll(list);
|
||||
bundle.putSerializable("push_list", arrayList);
|
||||
ActivityAlertActivity.a(this, bundle);
|
||||
}
|
||||
|
||||
public /* synthetic */ void l(int i) {
|
||||
this.g.setCurrentItem(i);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onActivityResult(int i, int i2, Intent intent) {
|
||||
super.onActivityResult(i, i2, intent);
|
||||
Fragment item = this.h.getItem(this.g.getCurrentItem());
|
||||
if (item == null || !item.isAdded()) {
|
||||
return;
|
||||
}
|
||||
item.onActivityResult(i, i2, intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.act_main);
|
||||
EventBus.b().c(this);
|
||||
L0();
|
||||
initView();
|
||||
I0();
|
||||
H0();
|
||||
M0();
|
||||
K0();
|
||||
J0();
|
||||
D0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
this.i.unSubscribe();
|
||||
UpdateManager.c().a();
|
||||
EventBus.b().d(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
UnityActivity h;
|
||||
if (i == 4 && (h = JimuApplication.l().h()) != null) {
|
||||
h.finish();
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
XLog.a("main", "onNewIntent");
|
||||
a(intent);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onReceiveMessage(MessageEvent messageEvent) {
|
||||
int type = messageEvent.getType();
|
||||
if (type == 0) {
|
||||
this.i.j();
|
||||
} else {
|
||||
if (type != 6) {
|
||||
return;
|
||||
}
|
||||
this.a.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
O0();
|
||||
this.i.i();
|
||||
F0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.activity.contract.HomeActivityContract$View
|
||||
public void x() {
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void b(Intent intent) {
|
||||
Redirection redirection = (Redirection) intent.getSerializableExtra(Constant.Base.ACTIVITY_START_REDIRECTION);
|
||||
if (redirection == null || TextUtils.isEmpty(redirection.getModule())) {
|
||||
return;
|
||||
}
|
||||
String module = redirection.getModule();
|
||||
char c = 65535;
|
||||
if (module.hashCode() == 94094958 && module.equals("build")) {
|
||||
c = 0;
|
||||
}
|
||||
if (c != 0) {
|
||||
return;
|
||||
}
|
||||
if (G0()) {
|
||||
a(redirection);
|
||||
} else {
|
||||
XLog.b("main", "Has no storage permission!");
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(Context context, String str, EmailCheckMsg emailCheckMsg) {
|
||||
if (RefHolder.d() && emailCheckMsg != null && RefHolder.c().equals(str)) {
|
||||
XLog.c("main", "start register activity & show dialog");
|
||||
Intent intent = new Intent(context, (Class<?>) RegisterActivity.class);
|
||||
SharePreferenceHelper sharePreferenceHelper = new SharePreferenceHelper();
|
||||
int i = sharePreferenceHelper.getInt(SharePreferenceHelper.SP_KEY_FLIPPER_PAGE_INDEX, 0);
|
||||
String string = sharePreferenceHelper.getString(SharePreferenceHelper.SP_KEY_REGISTER_BIRTHDAY, "");
|
||||
sharePreferenceHelper.getString(SharePreferenceHelper.SP_KEY_REGISTER_ACCOUNT, "");
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_FLIPPER_PAGE_INDEX, i);
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_REGISTER_BIRTHDAY, string);
|
||||
intent.putExtra(SharePreferenceHelper.SP_KEY_REGISTER_ACCOUNT, str);
|
||||
if (emailCheckMsg.isThirdRegister()) {
|
||||
if (RefHolder.b() == null) {
|
||||
N0();
|
||||
return;
|
||||
}
|
||||
String str2 = RefHolder.b().get("ubtsocial_user_id");
|
||||
if (!TextUtils.isEmpty(str2) && str2.equals(emailCheckMsg.getOpenId())) {
|
||||
intent.putExtra("loginType", 2);
|
||||
} else {
|
||||
N0();
|
||||
return;
|
||||
}
|
||||
}
|
||||
intent.setFlags(335544320);
|
||||
context.startActivity(intent);
|
||||
Cache.getInstance().getSettings().put(SharePreferenceHelper.SP_KEY_LAST_PARENT_EMAIL, "");
|
||||
return;
|
||||
}
|
||||
XLog.c("main", "hasn't request");
|
||||
N0();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.activity.contract.HomeActivityContract$View
|
||||
public void e(int i) {
|
||||
this.f.setVisibility(i > 0 ? 0 : 8);
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
o("click_P1_7");
|
||||
startActivity(new Intent(this, (Class<?>) CommonSettingActivity.class));
|
||||
if (this.d.getVisibility() == 0) {
|
||||
Cache.getInstance().getSettings().put(SharePreferenceHelper.SP_KEY_APP_CHECKED_UPDATE, true);
|
||||
this.d.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void b(String str, String str2, int i, String str3) {
|
||||
Postcard a = ARouter.b().a("/page/gdpr_web");
|
||||
a.a("url", str3);
|
||||
a.a("title", "");
|
||||
a.a("gdpr_version", str);
|
||||
a.a("gdpr_lan", str2);
|
||||
a.a("type", 0);
|
||||
a.a("gdpr_type", i);
|
||||
a.a("show_title", false);
|
||||
a.t();
|
||||
}
|
||||
|
||||
/* renamed from: com.ubt.jimu.main.activity.MainActivity$3, reason: invalid class name */
|
||||
class AnonymousClass3 implements UpdateManager.UpdateCallback {
|
||||
AnonymousClass3() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.update.UpdateManager.UpdateCallback
|
||||
public void a(UpdateApkEntities updateApkEntities) {
|
||||
if (updateApkEntities == null || updateApkEntities.getModels() == null) {
|
||||
return;
|
||||
}
|
||||
SharePreferenceHelper settings = Cache.getInstance().getSettings();
|
||||
String string = settings.getString(SharePreferenceHelper.SP_KEY_APP_VERSION_NAME, BuildConfig.VERSION_NAME);
|
||||
String versionName = updateApkEntities.getModels().getVersionName();
|
||||
if (string.equals(versionName)) {
|
||||
if (updateApkEntities.getModels().isIsNeed()) {
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_VERSION_NAME, versionName);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, true);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_UPDATE_URL, updateApkEntities.getModels().getPath());
|
||||
} else {
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_VERSION_NAME, versionName);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, false);
|
||||
}
|
||||
} else if (updateApkEntities.getModels().isIsNeed()) {
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_VERSION_NAME, versionName);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, true);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_CHECKED_UPDATE, false);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_UPDATE_URL, updateApkEntities.getModels().getPath());
|
||||
} else {
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_VERSION_NAME, versionName);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_NEED_UPDATE, false);
|
||||
settings.put(SharePreferenceHelper.SP_KEY_APP_CHECKED_UPDATE, true);
|
||||
}
|
||||
final boolean booleanValue = settings.getBoolean(SharePreferenceHelper.SP_KEY_APP_CHECKED_UPDATE, true).booleanValue();
|
||||
MainActivity.this.d.post(new Runnable() { // from class: com.ubt.jimu.main.activity.a
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
MainActivity.AnonymousClass3.this.a(booleanValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(boolean z) {
|
||||
MainActivity.this.d.setVisibility(!z ? 0 : 8);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(final Intent intent) {
|
||||
if (intent.getIntExtra(Constant.Base.ACTIVITY_START_ACTION, 0) == 10002) {
|
||||
UpdateManager.c().a((Activity) this, new UpdateManager.UpdateCallback() { // from class: com.ubt.jimu.main.activity.MainActivity.2
|
||||
@Override // com.ubt.jimu.update.UpdateManager.UpdateCallback
|
||||
public void a(UpdateApkEntities updateApkEntities) {
|
||||
UpdateApkEntities.ModelsBean models;
|
||||
if (updateApkEntities == null || (models = updateApkEntities.getModels()) == null || !models.isIsForce()) {
|
||||
MainActivity.this.b(intent);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Redirection redirection) {
|
||||
Robot robotById = RobotDbHandler.getRobotById(redirection.getRobotId());
|
||||
if (robotById != null) {
|
||||
if (robotById.isAllDownloaded()) {
|
||||
UnityActivity.startUnityActivity(this, robotById, 1, redirection.getSourceValue(), redirection.getCallback());
|
||||
return;
|
||||
} else {
|
||||
DownloadRobotActivity.a(this, robotById, "", redirection.getPackageId(), null, 1, redirection.getSourceValue(), redirection.getCallback());
|
||||
return;
|
||||
}
|
||||
}
|
||||
Postcard a = ARouter.b().a("/robot/download");
|
||||
a.a(Constant.Base.ACTIVITY_START_ROBOT, redirection.getRobotId());
|
||||
a.a(Constant.Base.ACTIVITY_START_PACKAGE, redirection.getPackageId());
|
||||
a.a(Constant.SelectRobot.BUNDLE_KEY_FROM, 1);
|
||||
a.a(MyUnityListener.CALLER, redirection.getSourceValue());
|
||||
a.a(MyUnityListener.CALLBACK, redirection.getCallback());
|
||||
a.t();
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
o("click_P1_1");
|
||||
if (UserDbHandler.isLogin()) {
|
||||
Postcard a = ARouter.b().a("/page/user");
|
||||
a.a("view_user_id", 0L);
|
||||
a.t();
|
||||
return;
|
||||
}
|
||||
LoginActivity.start(this);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.activity.contract.HomeActivityContract$View
|
||||
public void a(String str, String str2, int i, String str3) {
|
||||
b(str, str2, i, str3);
|
||||
}
|
||||
}
|
60
sources/com/ubt/jimu/main/adapter/MainAdapter.java
Normal file
60
sources/com/ubt/jimu/main/adapter/MainAdapter.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.ubt.jimu.main.adapter;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import com.ubt.jimu.main.fragment.CommunityFragment;
|
||||
import com.ubt.jimu.main.fragment.DiyFragment;
|
||||
import com.ubt.jimu.main.fragment.HomeFragment;
|
||||
import com.ubt.jimu.main.fragment.TrainingFragment;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MainAdapter<T extends Fragment> extends FragmentPagerAdapter {
|
||||
private Reference<T>[] a;
|
||||
private int[] b;
|
||||
|
||||
public MainAdapter(FragmentManager fragmentManager, int[] iArr) {
|
||||
super(fragmentManager);
|
||||
this.a = null;
|
||||
this.b = null;
|
||||
this.b = iArr;
|
||||
this.a = new WeakReference[iArr == null ? 0 : iArr.length];
|
||||
}
|
||||
|
||||
private T a(int i) {
|
||||
if (i == 1) {
|
||||
return HomeFragment.b();
|
||||
}
|
||||
if (i == 2) {
|
||||
return TrainingFragment.q();
|
||||
}
|
||||
if (i == 3) {
|
||||
return CommunityFragment.o();
|
||||
}
|
||||
if (i == 4) {
|
||||
return DiyFragment.o();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
int[] iArr = this.b;
|
||||
if (iArr == null) {
|
||||
return 0;
|
||||
}
|
||||
return iArr.length;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentPagerAdapter
|
||||
public Fragment getItem(int i) {
|
||||
int i2 = this.b[i];
|
||||
Reference<T>[] referenceArr = this.a;
|
||||
if (referenceArr[i] == null || referenceArr[i].get() == null) {
|
||||
this.a[i] = new WeakReference(a(i2));
|
||||
}
|
||||
return this.a[i].get();
|
||||
}
|
||||
}
|
213
sources/com/ubt/jimu/main/fragment/CommunityFragment.java
Normal file
213
sources/com/ubt/jimu/main/fragment/CommunityFragment.java
Normal file
@@ -0,0 +1,213 @@
|
||||
package com.ubt.jimu.main.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.CommunityReturnBean;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.DraftsListBean;
|
||||
import com.ubt.jimu.community.activity.JimuActActivity;
|
||||
import com.ubt.jimu.community.contract.CommunityContract$Presenter;
|
||||
import com.ubt.jimu.community.contract.CommunityContract$View;
|
||||
import com.ubt.jimu.community.presenter.CommunityPresenter;
|
||||
import com.ubt.jimu.community.view.CommunityHomeMoreActivity;
|
||||
import com.ubt.jimu.community.view.MyDraftsActivity;
|
||||
import com.ubt.jimu.community.view.PublishCommunityActivity;
|
||||
import com.ubt.jimu.community.view.PublishDetailActivity;
|
||||
import com.ubt.jimu.community.view.adapter.CommunityListAdapter;
|
||||
import com.ubt.jimu.user.view.LoginActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import com.youth.banner.listener.OnBannerListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommunityFragment extends BaseFragment implements CommunityContract$View, View.OnClickListener, OnBannerListener, CommunityListAdapter.HeadOnClickLisenter, CommunityListAdapter.OnClickItemLisenter, CommunityListAdapter.OnClickMoreListener, CommunityListAdapter.BannerItemOnClickListener {
|
||||
private CommunityListAdapter a;
|
||||
private CommunityContract$Presenter b;
|
||||
private Unbinder c;
|
||||
ImageView mIvInspire;
|
||||
RecyclerView mRvCommunity;
|
||||
|
||||
private void a(RecyclerView recyclerView) {
|
||||
this.a.a(LayoutInflater.from(getContext()).inflate(R.layout.comm_foot, (ViewGroup) recyclerView, false));
|
||||
}
|
||||
|
||||
public static CommunityFragment o() {
|
||||
return new CommunityFragment();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.HeadOnClickLisenter
|
||||
public void L() {
|
||||
ARouter.b().a("/community/favorite").t();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.HeadOnClickLisenter
|
||||
public void N() {
|
||||
ARouter.b().a("/community/inspire").t();
|
||||
}
|
||||
|
||||
@Override // com.youth.banner.listener.OnBannerListener
|
||||
public void OnBannerClick(int i) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.HeadOnClickLisenter
|
||||
public void P() {
|
||||
ARouter.b().a("/community/hot").t();
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
this.a.a((CommunityListAdapter.HeadOnClickLisenter) this);
|
||||
this.a.a((CommunityListAdapter.OnClickItemLisenter) this);
|
||||
this.a.a((CommunityListAdapter.OnClickMoreListener) this);
|
||||
this.a.a((CommunityListAdapter.BannerItemOnClickListener) this);
|
||||
this.mIvInspire.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.contract.CommunityContract$View
|
||||
public void c() {
|
||||
}
|
||||
|
||||
protected void initData() {
|
||||
this.a = new CommunityListAdapter(getContext());
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
linearLayoutManager.k(1);
|
||||
this.mRvCommunity.setLayoutManager(linearLayoutManager);
|
||||
new CommunityPresenter(getContext(), this);
|
||||
this.b.e();
|
||||
this.mRvCommunity.setAdapter(this.a);
|
||||
a(this.mRvCommunity);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.contract.CommunityContract$View
|
||||
public void j() {
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityCreated(Bundle bundle) {
|
||||
super.onActivityCreated(bundle);
|
||||
initData();
|
||||
b();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (view.getId() != R.id.im_inspire_publish) {
|
||||
return;
|
||||
}
|
||||
String userId = Cache.getInstance().getUserId();
|
||||
DraftsListBean draftsListBean = (DraftsListBean) SPUtils.b(Constant.Publish.DRAFTS, Constant.Publish.DRAFTS_KEY + Cache.getInstance().getUserId());
|
||||
startActivity((TextUtils.isEmpty(userId) || "local".equals(userId)) ? new Intent(getContext(), (Class<?>) LoginActivity.class) : (draftsListBean == null || draftsListBean.getLinkedHashMap().size() == 0) ? new Intent(getContext(), (Class<?>) PublishCommunityActivity.class) : new Intent(getContext(), (Class<?>) MyDraftsActivity.class));
|
||||
}
|
||||
|
||||
@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.activity_community_home, (ViewGroup) null);
|
||||
this.c = ButterKnife.a(this, inflate);
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
this.c.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPagePause() {
|
||||
super.onPagePause();
|
||||
JimuAnalytics.b().b(getActivity(), "P4");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPageResume() {
|
||||
super.onPageResume();
|
||||
JimuAnalytics.b().a(getActivity(), "P4");
|
||||
CommunityContract$Presenter communityContract$Presenter = this.b;
|
||||
if (communityContract$Presenter != null) {
|
||||
communityContract$Presenter.e();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(CommunityContract$Presenter communityContract$Presenter) {
|
||||
this.b = communityContract$Presenter;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.contract.CommunityContract$View
|
||||
public void a(CommunityReturnBean communityReturnBean) {
|
||||
CommunityListAdapter communityListAdapter;
|
||||
if (communityReturnBean == null || (communityListAdapter = this.a) == null || this.mRvCommunity == null) {
|
||||
return;
|
||||
}
|
||||
communityListAdapter.a(communityReturnBean);
|
||||
this.mRvCommunity.setAdapter(this.a);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.OnClickItemLisenter
|
||||
public void b(int i) {
|
||||
PublishDetailActivity.start(getContext(), i);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.OnClickMoreListener
|
||||
public void a(ArrayList<CommunityReturnBean.SectionsBean.ContentsBean> arrayList, String str) {
|
||||
LogUtils.c("position:" + arrayList.size());
|
||||
CommunityHomeMoreActivity.a(getContext(), arrayList, str);
|
||||
}
|
||||
|
||||
public void b(CommunityReturnBean.ScrollbarBean scrollbarBean) {
|
||||
String sourceType = scrollbarBean.getSourceType();
|
||||
if (sourceType == null) {
|
||||
XLog.b(this.TAG, "Banner type is null!");
|
||||
return;
|
||||
}
|
||||
char c = 65535;
|
||||
int hashCode = sourceType.hashCode();
|
||||
if (hashCode != -1655966961) {
|
||||
if (hashCode != 3321850) {
|
||||
if (hashCode == 3446944 && sourceType.equals("post")) {
|
||||
c = 1;
|
||||
}
|
||||
} else if (sourceType.equals(Constant.Community.SOURCE_LINK_TYPE)) {
|
||||
c = 0;
|
||||
}
|
||||
} else if (sourceType.equals("activity")) {
|
||||
c = 2;
|
||||
}
|
||||
if (c == 0) {
|
||||
Postcard a = ARouter.b().a("/page/web");
|
||||
a.a("title", scrollbarBean.getName());
|
||||
a.a("url", scrollbarBean.getLink());
|
||||
a.t();
|
||||
return;
|
||||
}
|
||||
if (c == 1) {
|
||||
PublishDetailActivity.start(getContext(), scrollbarBean.getSourceId());
|
||||
} else if (c != 2) {
|
||||
XLog.b(this.TAG, "Unknown source type!");
|
||||
} else {
|
||||
JimuActActivity.start(getContext(), scrollbarBean.getSourceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.community.view.adapter.CommunityListAdapter.BannerItemOnClickListener
|
||||
public void a(CommunityReturnBean.ScrollbarBean scrollbarBean) {
|
||||
b(scrollbarBean);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.main.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CommunityFragment_ViewBinding implements Unbinder {
|
||||
private CommunityFragment b;
|
||||
|
||||
public CommunityFragment_ViewBinding(CommunityFragment communityFragment, View view) {
|
||||
this.b = communityFragment;
|
||||
communityFragment.mIvInspire = (ImageView) Utils.b(view, R.id.im_inspire_publish, "field 'mIvInspire'", ImageView.class);
|
||||
communityFragment.mRvCommunity = (RecyclerView) Utils.b(view, R.id.rlv_community_home, "field 'mRvCommunity'", RecyclerView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
CommunityFragment communityFragment = this.b;
|
||||
if (communityFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
communityFragment.mIvInspire = null;
|
||||
communityFragment.mRvCommunity = null;
|
||||
}
|
||||
}
|
189
sources/com/ubt/jimu/main/fragment/DiyFragment.java
Normal file
189
sources/com/ubt/jimu/main/fragment/DiyFragment.java
Normal file
@@ -0,0 +1,189 @@
|
||||
package com.ubt.jimu.main.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.diy.contract.OfficialDiyContract;
|
||||
import com.ubt.jimu.diy.model.DiyModel;
|
||||
import com.ubt.jimu.diy.presenter.OfficialDiyPresenter;
|
||||
import com.ubt.jimu.diy.view.adapter.OfficialDiyAdapter;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.utils.smartScaleTool.ScreenUtils;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubt.jimu.widgets.SpaceGridItemDecoration;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DiyFragment extends BaseFragment implements OfficialDiyContract.View, OfficialDiyAdapter.OnOfficialDiyItemClickListener, URecyclerView.LoadingListener {
|
||||
private ImageView a;
|
||||
private LoadingView b;
|
||||
private URecyclerView c;
|
||||
private OfficialDiyAdapter e;
|
||||
private OfficialDiyContract.Presenter f;
|
||||
private List<DiyModel> d = new ArrayList();
|
||||
private int g = 1;
|
||||
|
||||
private void initData() {
|
||||
this.f.queryOfficialDiy(false, this.g, 20);
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
this.a = (ImageView) view.findViewById(R.id.iv_create);
|
||||
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.fragment.DiyFragment.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 1);
|
||||
DiyFragment.this.q();
|
||||
JimuAnalytics.b().a("click_P5_1");
|
||||
}
|
||||
});
|
||||
this.b = (LoadingView) view.findViewById(R.id.official_diy_loading);
|
||||
this.b.setOnRetryListener(new LoadingView.RetryRequest() { // from class: com.ubt.jimu.main.fragment.DiyFragment.2
|
||||
@Override // com.ubt.jimu.widgets.LoadingView.RetryRequest
|
||||
public void OnRetryListener() {
|
||||
if (DiyFragment.this.f != null) {
|
||||
DiyFragment.this.f.queryOfficialDiy(false, 1, 20);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.c = (URecyclerView) view.findViewById(R.id.official_diy_recycleView);
|
||||
}
|
||||
|
||||
public static DiyFragment o() {
|
||||
return new DiyFragment();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void q() {
|
||||
ARouter.b().a("/diy/usercreatives").t();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.diy.contract.OfficialDiyContract.View
|
||||
public void loadCompleted() {
|
||||
this.c.y();
|
||||
this.c.z();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.diy.contract.OfficialDiyContract.View
|
||||
public void loadError() {
|
||||
this.d.clear();
|
||||
this.e.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityCreated(Bundle bundle) {
|
||||
super.onActivityCreated(bundle);
|
||||
}
|
||||
|
||||
@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.frag_diy_tab, (ViewGroup) null);
|
||||
initView(inflate);
|
||||
this.f = new OfficialDiyPresenter(getContext(), this, this.b);
|
||||
this.c.post(new Runnable() { // from class: com.ubt.jimu.main.fragment.a
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
DiyFragment.this.b();
|
||||
}
|
||||
});
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onLoadingMore() {
|
||||
a(this.g, 20);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.diy.view.adapter.OfficialDiyAdapter.OnOfficialDiyItemClickListener
|
||||
public void onOfficialDiyItemClick(DiyModel diyModel, int i) {
|
||||
XLog.b("DiyFragment", "onOfficialDiyItemClick position: " + i + " robot: " + diyModel);
|
||||
Postcard a = ARouter.b().a("/diy/detail");
|
||||
a.a("modelId", diyModel.getId().longValue());
|
||||
a.a("customModelId", diyModel.getCustomModelId());
|
||||
a.t();
|
||||
String str = "click_P5_2_" + String.valueOf(i + 1);
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("model_id", String.valueOf(diyModel.getId()));
|
||||
ALog.a(this.TAG).d("onOfficialDiyItemClick model_id:" + diyModel.getId());
|
||||
JimuAnalytics.b().a(str, hashMap);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPagePause() {
|
||||
super.onPagePause();
|
||||
JimuAnalytics.b().b(getActivity(), "P5");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPageResume() {
|
||||
super.onPageResume();
|
||||
JimuAnalytics.b().a(getActivity(), "P5");
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.URecyclerView.LoadingListener
|
||||
public void onRefreshing() {
|
||||
a(1, 20);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.diy.contract.OfficialDiyContract.View
|
||||
public void showOfficialDiy(List<DiyModel> list, int i) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.g = i + 1;
|
||||
if (i == 1) {
|
||||
this.d.clear();
|
||||
this.d.addAll(list);
|
||||
} else {
|
||||
this.d.addAll(list);
|
||||
}
|
||||
this.e.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void a(int i, int i2) {
|
||||
OfficialDiyContract.Presenter presenter = this.f;
|
||||
if (presenter != null) {
|
||||
presenter.queryOfficialDiy(true, i, i2);
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void b() {
|
||||
Activity activity = this.mActivity;
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
int[] a = ScreenUtils.a(0.6666667f, this.c, activity.getResources().getDimension(R.dimen.diy_list_left), 3);
|
||||
this.e = new OfficialDiyAdapter(this.mActivity, this.d, a[1], a[0]);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager((Context) this.mActivity, 3, 1, false);
|
||||
this.e.setListener(this);
|
||||
this.c.setLayoutManager(gridLayoutManager);
|
||||
this.c.setAdapter(this.e);
|
||||
Activity activity2 = this.mActivity;
|
||||
this.c.a(new SpaceGridItemDecoration(DisplayUtil.a(activity2, activity2.getResources().getDimension(R.dimen.diy_item_space)), 0, 3, true));
|
||||
this.c.setLoadingListener(this);
|
||||
initData();
|
||||
}
|
||||
}
|
149
sources/com/ubt/jimu/main/fragment/HomeFragment.java
Normal file
149
sources/com/ubt/jimu/main/fragment/HomeFragment.java
Normal file
@@ -0,0 +1,149 @@
|
||||
package com.ubt.jimu.main.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.main.utils.CardActionUtils;
|
||||
import com.ubt.jimu.main.widget.CardLayout;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtrobot.jimu.robotapi.JimuManager;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class HomeFragment extends BaseFragment {
|
||||
private FrameLayout a;
|
||||
private CardLayout b;
|
||||
private CardLayout.OnItemClickListener c = new CardLayout.OnItemClickListener() { // from class: com.ubt.jimu.main.fragment.b
|
||||
@Override // com.ubt.jimu.main.widget.CardLayout.OnItemClickListener
|
||||
public final void onClick(View view) {
|
||||
HomeFragment.this.a(view);
|
||||
}
|
||||
};
|
||||
|
||||
public static HomeFragment b() {
|
||||
return new HomeFragment();
|
||||
}
|
||||
|
||||
private void o() {
|
||||
recordEvent("click_P1_4");
|
||||
CardActionUtils.a(getActivity(), 2);
|
||||
}
|
||||
|
||||
private void q() {
|
||||
recordEvent("click_P1_2");
|
||||
CardActionUtils.a(getActivity(), 1);
|
||||
}
|
||||
|
||||
private void v() {
|
||||
recordEvent("click_P1_5");
|
||||
CardActionUtils.a(getActivity(), 3);
|
||||
}
|
||||
|
||||
private void x() {
|
||||
recordEvent("click_P1_3");
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot == null) {
|
||||
CardActionUtils.b(getActivity(), 8);
|
||||
return;
|
||||
}
|
||||
if (robot.isAllDownloaded()) {
|
||||
Postcard a = ARouter.b().a("/controller/control");
|
||||
a.a("robotLite", robot.getRobotLite());
|
||||
a.t();
|
||||
} else {
|
||||
Postcard a2 = ARouter.b().a("/robot/download");
|
||||
a2.a(Constant.SelectRobot.DOWNLAOD_ROBOT_DATA_KEY, robot);
|
||||
a2.a(Constant.Base.ACTIVITY_START_PACKAGE, Cache.getInstance().getPackageId());
|
||||
a2.a(Constant.SelectRobot.PACKAGE_NAME_KEY, Cache.getInstance().getPackageName());
|
||||
a2.a(getActivity(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
int id = view.getId();
|
||||
JimuManager f = JimuApplication.l().f();
|
||||
if (f.g()) {
|
||||
String e = f.e();
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot != null && robot.getModelName() != null && !robot.getModelName().equals(e)) {
|
||||
XLog.c(this.TAG, "Connected robot is not selected offical model, disconnect");
|
||||
f.c();
|
||||
}
|
||||
}
|
||||
if (id == R.id.card_build) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
q();
|
||||
return;
|
||||
}
|
||||
if (id == R.id.card_control) {
|
||||
x();
|
||||
return;
|
||||
}
|
||||
if (id == R.id.card_action) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
o();
|
||||
} else if (id == R.id.card_code) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
v();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityCreated(Bundle bundle) {
|
||||
super.onActivityCreated(bundle);
|
||||
this.b = (CardLayout) getView().findViewById(R.id.card_layout);
|
||||
this.b.setListener(this.c);
|
||||
this.a = (FrameLayout) getView().findViewById(R.id.robot_switch);
|
||||
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.fragment.c
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
HomeFragment.this.b(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityResult(int i, int i2, Intent intent) {
|
||||
Robot robot;
|
||||
super.onActivityResult(i, i2, intent);
|
||||
if (i2 == 8 && i == 1 && (robot = Cache.getInstance().getRobot()) != null) {
|
||||
Postcard a = ARouter.b().a("/controller/control");
|
||||
a.a("robotLite", robot.getRobotLite());
|
||||
a.t();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return layoutInflater.inflate(R.layout.frag_home_tab, (ViewGroup) null);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPagePause() {
|
||||
super.onPagePause();
|
||||
JimuAnalytics.b().b(getActivity(), "P1");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPageResume() {
|
||||
super.onPageResume();
|
||||
JimuAnalytics.b().a(getActivity(), "P1");
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
recordEvent("click_P1_8");
|
||||
CardActionUtils.b(getActivity(), 5);
|
||||
}
|
||||
}
|
487
sources/com/ubt/jimu/main/fragment/TrainingFragment.java
Normal file
487
sources/com/ubt/jimu/main/fragment/TrainingFragment.java
Normal file
@@ -0,0 +1,487 @@
|
||||
package com.ubt.jimu.main.fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
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.dialog.LoadingDialog;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.course.contract.CourseListContract;
|
||||
import com.ubt.jimu.course.presenter.CourseListPresenter;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.course.view.JimuTaskListActivity;
|
||||
import com.ubt.jimu.discover.view.CourseListActivity;
|
||||
import com.ubt.jimu.main.utils.CardActionUtils;
|
||||
import com.ubt.jimu.main.widget.CardLayout;
|
||||
import com.ubt.jimu.pack.view.DownloadRobotActivity;
|
||||
import com.ubt.jimu.pack.view.PackSelectActivity;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.widgets.LoadingView;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtech.view.dialog.BigDialog$Builder;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import com.ubtrobot.jimu.robotapi.JimuManager;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TrainingFragment extends BaseFragment implements CourseListContract.View, LoadingView.RetryRequest {
|
||||
private FrameLayout a;
|
||||
private CardLayout b;
|
||||
private LoadingView c;
|
||||
private CourseListContract.Presenter d;
|
||||
private Dialog f;
|
||||
private boolean g;
|
||||
private DownloadTask i;
|
||||
private LoadingDialog j;
|
||||
private List<JimuCourse> e = new ArrayList();
|
||||
private CardLayout.OnItemClickListener h = new CardLayout.OnItemClickListener() { // from class: com.ubt.jimu.main.fragment.g
|
||||
@Override // com.ubt.jimu.main.widget.CardLayout.OnItemClickListener
|
||||
public final void onClick(View view) {
|
||||
TrainingFragment.this.b(view);
|
||||
}
|
||||
};
|
||||
|
||||
private boolean A() {
|
||||
return Cache.getInstance().getRobot() != null;
|
||||
}
|
||||
|
||||
private void B() {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(getActivity(), new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.f
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.c(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.e
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.a(dialogInterface, i);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
private void C() {
|
||||
if (v()) {
|
||||
if (!A()) {
|
||||
CardActionUtils.b(getActivity(), 5);
|
||||
return;
|
||||
}
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot != null) {
|
||||
if (!robot.getHasMission()) {
|
||||
D();
|
||||
return;
|
||||
} else if (!robot.isAllDownloaded()) {
|
||||
DownloadRobotActivity.a(getContext(), Cache.getInstance().getRobot(), Cache.getInstance().getPackageName(), Cache.getInstance().getPackageId(), 7);
|
||||
return;
|
||||
}
|
||||
}
|
||||
OnRetryListener();
|
||||
}
|
||||
}
|
||||
|
||||
private void D() {
|
||||
this.g = true;
|
||||
getActivity().getWindow().getDecorView().getRootView();
|
||||
int a = DisplayUtil.a(getContext(), R.dimen.dp120);
|
||||
int a2 = DisplayUtil.a(getContext(), R.dimen.dp120);
|
||||
BigDialog$Builder bigDialog$Builder = new BigDialog$Builder(getActivity());
|
||||
bigDialog$Builder.a(R.string.setting_cancel);
|
||||
bigDialog$Builder.a(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.TrainingFragment.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.b();
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
bigDialog$Builder.d(R.string.switch_robot);
|
||||
bigDialog$Builder.b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.TrainingFragment.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.o();
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
bigDialog$Builder.b(R.string.course_popu_content);
|
||||
bigDialog$Builder.a(Cache.getInstance().getRobot().getFilePath(), a, a2);
|
||||
this.f = bigDialog$Builder.a();
|
||||
this.f.show();
|
||||
}
|
||||
|
||||
static /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
static /* synthetic */ void c(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
|
||||
private void hideLoading() {
|
||||
LoadingDialog loadingDialog = this.j;
|
||||
if (loadingDialog != null) {
|
||||
if (loadingDialog.isShowing()) {
|
||||
this.j.dismiss();
|
||||
}
|
||||
this.j = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.b = (CardLayout) getView().findViewById(R.id.card_layout);
|
||||
this.b.setListener(this.h);
|
||||
this.a = (FrameLayout) getView().findViewById(R.id.robot_switch);
|
||||
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.fragment.h
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
TrainingFragment.this.a(view);
|
||||
}
|
||||
});
|
||||
this.c = (LoadingView) getView().findViewById(R.id.loadingView);
|
||||
this.c.setOnRetryListener(this);
|
||||
}
|
||||
|
||||
public static TrainingFragment q() {
|
||||
return new TrainingFragment();
|
||||
}
|
||||
|
||||
private void showLoading(String str) {
|
||||
LoadingDialog loadingDialog = this.j;
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
this.j = new LoadingDialog(getActivity());
|
||||
this.j.updateProgress(str);
|
||||
this.j.show();
|
||||
}
|
||||
|
||||
private void updateProgress(int i) {
|
||||
LoadingDialog loadingDialog = this.j;
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.updateProgress(i + "%");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean v() {
|
||||
if (y()) {
|
||||
return true;
|
||||
}
|
||||
this.g = false;
|
||||
this.f = new SimpleDialog.Builder(getContext()).a(R.string.i_got_it).a(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.TrainingFragment.4
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.b();
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).d(R.string.now_login).b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.TrainingFragment.3
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.o();
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).b(R.string.course_login_hint).a();
|
||||
this.f.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void x() {
|
||||
this.d = new CourseListPresenter(this, this.c);
|
||||
}
|
||||
|
||||
private boolean y() {
|
||||
String userId = Cache.getInstance().getUserId();
|
||||
return !(TextUtils.isEmpty(userId) || "local".equals(userId)) || SPUtils.a(Constant.Course.ONCLICK_IGETIT_KEY);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.widgets.LoadingView.RetryRequest
|
||||
public void OnRetryListener() {
|
||||
if (A()) {
|
||||
String a = DeviceUtils.a(getContext());
|
||||
long loginUserIntId = Cache.getInstance().getLoginUserIntId();
|
||||
this.d.getCourse("level", 1 > loginUserIntId ? "" : String.valueOf(loginUserIntId), a, Cache.getInstance().getPackageId(), Cache.getInstance().getRobot().getModelId());
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
recordEvent("click_P1_8");
|
||||
CardActionUtils.b(getActivity(), 5);
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
JimuManager f = JimuApplication.l().f();
|
||||
if (f.g()) {
|
||||
String e = f.e();
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot != null && robot.getModelName() != null && !robot.getModelName().equals(e)) {
|
||||
XLog.c("TrainingFragment", "Connected robot is not selected offical model, disconnect");
|
||||
f.c();
|
||||
}
|
||||
}
|
||||
int id = view.getId();
|
||||
if (id == R.id.lessons) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
C();
|
||||
recordEvent("click_P3_1");
|
||||
} else if (id == R.id.adventure) {
|
||||
SPUtils.b(Constant.Black.BLACK_MODEL_TYPE_KEY, 0);
|
||||
long packageId = Cache.getInstance().getPackageId();
|
||||
if (TextUtils.isEmpty(Cache.getInstance().getPackageName())) {
|
||||
PackSelectActivity.a(getActivity(), 10, packageId);
|
||||
} else {
|
||||
this.d.getExpeditionPack();
|
||||
}
|
||||
recordEvent("click_P3_2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void downloadCourseFailed(JimuCourse jimuCourse) {
|
||||
hideLoading();
|
||||
if (getContext() == null) {
|
||||
return;
|
||||
}
|
||||
ToastView.a(getContext(), getString(R.string.tips_download_failed), ToastView.Type.ERROR).a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void downloadCourseProgress(int i, int i2, int i3) {
|
||||
updateProgress(i3);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void downloadCourseStart() {
|
||||
showLoading(getString(R.string.loading_text));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void downloadCourseSuccess(JimuCourse jimuCourse) {
|
||||
hideLoading();
|
||||
if (getContext() != null) {
|
||||
JimuTaskListActivity.start(getContext(), Cache.getInstance().getPackageId(), Cache.getInstance().getRobot().getModelId(), jimuCourse.getId());
|
||||
}
|
||||
Cache.getInstance().setJimuCourse(jimuCourse);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void expeditionListFail() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void expeditionListStart() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void expeditionListSuccess(List<Package> list) {
|
||||
String packageName = Cache.getInstance().getPackageName();
|
||||
long packageId = Cache.getInstance().getPackageId();
|
||||
if (list != null && list.size() > 0) {
|
||||
Iterator<Package> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
String packageName2 = it.next().getPackageName();
|
||||
if (!TextUtils.isEmpty(packageName2) && packageName2.equals(packageName)) {
|
||||
B();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
PackSelectActivity.a(getActivity(), 10, packageId);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void loadArListFail() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void loadArListStart() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void loadArListSuccess(List<Package> list) {
|
||||
String packageName = Cache.getInstance().getPackageName();
|
||||
long packageId = Cache.getInstance().getPackageId();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (Package r3 : list) {
|
||||
String packageName2 = r3.getPackageName();
|
||||
if (!TextUtils.isEmpty(packageName2) && packageName2.equals(packageName)) {
|
||||
Postcard a = ARouter.b().a("/game/list");
|
||||
a.a("PACKAGE", r3);
|
||||
a.t();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
PackSelectActivity.a(getActivity(), 11, packageId);
|
||||
}
|
||||
|
||||
public void o() {
|
||||
SPUtils.a(Constant.Course.ONCLICK_IGETIT_KEY, true);
|
||||
if (this.g) {
|
||||
CardActionUtils.b(getActivity(), 7);
|
||||
} else {
|
||||
ARouter.b().a("/account/login").t();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onActivityCreated(Bundle bundle) {
|
||||
super.onActivityCreated(bundle);
|
||||
initView();
|
||||
x();
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
public boolean onBackPressed() {
|
||||
Dialog dialog = this.f;
|
||||
if (dialog == null || !dialog.isShowing()) {
|
||||
return super.onBackPressed();
|
||||
}
|
||||
this.f.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void onConnectionStatusChange(ConnectionStatus connectionStatus) {
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
return layoutInflater.inflate(R.layout.frag_training_tab, (ViewGroup) null);
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
CourseListContract.Presenter presenter = this.d;
|
||||
if (presenter != null) {
|
||||
presenter.unSubscribe();
|
||||
}
|
||||
Cache.getInstance().setJimuCourse(null);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void onDownloadFail() {
|
||||
hideLoading();
|
||||
this.i = null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void onDownloadStart() {
|
||||
showLoading("");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void onDownloadSuccess(Story story) {
|
||||
hideLoading();
|
||||
this.i = null;
|
||||
if (getContext() == null) {
|
||||
return;
|
||||
}
|
||||
Package r0 = new Package();
|
||||
r0.setPackageName(Cache.getInstance().getPackageName());
|
||||
r0.setPackageImage(Cache.getInstance().getPackageImagePath());
|
||||
r0.setId(Cache.getInstance().getPackageId());
|
||||
CourseListActivity.a(getContext(), "AstroBot", story.getStoryIntroVideo(), r0);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPagePause() {
|
||||
super.onPagePause();
|
||||
JimuAnalytics.b().b(getActivity(), "P3");
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment
|
||||
protected void onPageResume() {
|
||||
super.onPageResume();
|
||||
JimuAnalytics.b().a(getActivity(), "P3");
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onPause() {
|
||||
this.d.cancelDownloadResource();
|
||||
DownloadTask downloadTask = this.i;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void onProgressChange(int i) {
|
||||
updateProgress(i);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void showCourseList(List<JimuCourse> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.e.addAll(list);
|
||||
a(this.e.get(0));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void showCurrentTask(DownloadTask downloadTask) {
|
||||
this.i = downloadTask;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.course.contract.CourseListContract.View
|
||||
public void showException(Throwable th) {
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
this.d.downloadStory();
|
||||
}
|
||||
|
||||
private void a(final JimuCourse jimuCourse) {
|
||||
if (jimuCourse.isDownloaded()) {
|
||||
downloadCourseSuccess(jimuCourse);
|
||||
} else {
|
||||
JimuSimpleDialog.showWifiOnlyDialog(getContext(), new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.d
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.b(dialogInterface, i);
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.main.fragment.i
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
TrainingFragment.this.a(jimuCourse, dialogInterface, i);
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(JimuCourse jimuCourse, DialogInterface dialogInterface, int i) {
|
||||
this.d.downloadJimuCourse(jimuCourse);
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.BaseView
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void setPresenter(CourseListContract.Presenter presenter) {
|
||||
this.d = presenter;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (this.g) {
|
||||
return;
|
||||
}
|
||||
SPUtils.a(Constant.Course.ONCLICK_IGETIT_KEY, true);
|
||||
}
|
||||
}
|
45
sources/com/ubt/jimu/main/utils/CardActionUtils.java
Normal file
45
sources/com/ubt/jimu/main/utils/CardActionUtils.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.ubt.jimu.main.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.blockly.networkSync.BlocklySyncHttpImpl;
|
||||
import com.ubt.jimu.pack.view.DownloadRobotActivity;
|
||||
import com.ubt.jimu.pack.view.PackSelectActivity;
|
||||
import com.ubt.jimu.pack.view.RobotSelectActivity;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CardActionUtils {
|
||||
public static void a(Activity activity, int i) {
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (robot == null) {
|
||||
b(activity, i);
|
||||
return;
|
||||
}
|
||||
BlocklySyncHttpImpl.getInstance().inspectBlockData(robot.getModelId());
|
||||
BlocklySyncHttpImpl.getInstance().checkAudioList();
|
||||
BlocklySyncHttpImpl.getInstance().getServiceMotionList((int) robot.getModelId());
|
||||
if (robot.isAllDownloaded()) {
|
||||
UnityActivity.startUnityActivity(activity, robot, i, 0, (String) null);
|
||||
} else {
|
||||
DownloadRobotActivity.a(activity, Cache.getInstance().getRobot(), Cache.getInstance().getPackageName(), Cache.getInstance().getPackageId(), i);
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(Activity activity, int i) {
|
||||
long packageId = Cache.getInstance().getPackageId();
|
||||
String packageImagePath = Cache.getInstance().getPackageImagePath();
|
||||
String packageName = Cache.getInstance().getPackageName();
|
||||
Robot robot = Cache.getInstance().getRobot();
|
||||
if (i == 7 || (robot != null && packageId > 0)) {
|
||||
RobotSelectActivity.a(activity, packageName, packageId, packageImagePath, i, 0);
|
||||
} else {
|
||||
PackSelectActivity.a(activity, 5, packageId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Activity activity, int i, long j) {
|
||||
PackSelectActivity.a(activity, i, j);
|
||||
}
|
||||
}
|
131
sources/com/ubt/jimu/main/widget/CardLayout.java
Normal file
131
sources/com/ubt/jimu/main/widget/CardLayout.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package com.ubt.jimu.main.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.ubt.jimu.R$styleable;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CardLayout extends ViewGroup {
|
||||
private int a;
|
||||
private int b;
|
||||
private float c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private OnItemClickListener g;
|
||||
private View.OnClickListener h;
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onClick(View view);
|
||||
}
|
||||
|
||||
public CardLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
if (attributeSet != null) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.CardLayout);
|
||||
this.a = obtainStyledAttributes.getDimensionPixelSize(0, 0);
|
||||
this.b = obtainStyledAttributes.getDimensionPixelSize(1, 0);
|
||||
this.c = obtainStyledAttributes.getFloat(2, 0.0f);
|
||||
this.d = obtainStyledAttributes.getInteger(3, 0);
|
||||
}
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
getChildAt(i).setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.a
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
CardLayout.this.a(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(View view) {
|
||||
OnItemClickListener onItemClickListener = this.g;
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onClick(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
int childCount = getChildCount();
|
||||
int i5 = childCount >= this.d ? this.a : (width - ((this.e * childCount) + ((childCount - 1) * this.b))) / 2;
|
||||
int i6 = (height - this.f) / 2;
|
||||
int i7 = 0;
|
||||
while (true) {
|
||||
int i8 = this.d;
|
||||
if (childCount < i8) {
|
||||
i8 = childCount;
|
||||
}
|
||||
if (i7 >= i8) {
|
||||
return;
|
||||
}
|
||||
getChildAt(i7).layout(i5, i6, this.e + i5, this.f + i6);
|
||||
i5 += this.e + this.b;
|
||||
i7++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
View.MeasureSpec.getSize(i2);
|
||||
int i3 = size - (this.a * 2);
|
||||
int i4 = this.b;
|
||||
int i5 = this.d;
|
||||
this.e = (i3 - (i4 * (i5 - 1))) / i5;
|
||||
this.f = (int) (this.e * this.c);
|
||||
for (int i6 = 0; i6 < getChildCount(); i6++) {
|
||||
View childAt = getChildAt(i6);
|
||||
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
|
||||
layoutParams.width = this.e;
|
||||
layoutParams.height = this.f;
|
||||
childAt.setLayoutParams(layoutParams);
|
||||
}
|
||||
measureChildren(i, i2);
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public void setListener(OnItemClickListener onItemClickListener) {
|
||||
this.g = onItemClickListener;
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View childAt = getChildAt(i);
|
||||
if (childAt != null) {
|
||||
childAt.setOnClickListener(this.h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CardLayout(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public CardLayout(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public CardLayout(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
this.h = new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.b
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
CardLayout.this.b(view);
|
||||
}
|
||||
};
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
OnItemClickListener onItemClickListener = this.g;
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onClick(view);
|
||||
}
|
||||
}
|
||||
}
|
66
sources/com/ubt/jimu/main/widget/RobotSwitchView.java
Normal file
66
sources/com/ubt/jimu/main/widget/RobotSwitchView.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.ubt.jimu.main.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class RobotSwitchView extends FrameLayout {
|
||||
private ImageView a;
|
||||
private ImageView b;
|
||||
|
||||
public RobotSwitchView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
LayoutInflater.from(context).inflate(R.layout.lay_robot_switch, this);
|
||||
this.a = (ImageView) findViewById(R.id.robot);
|
||||
this.b = (ImageView) findViewById(R.id.status);
|
||||
a(getResources().getColor(R.color.image_foreground_filter), ConnectionStatus.DIS_CONNECT.getStatus());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
super.onWindowFocusChanged(z);
|
||||
if (z) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
public RobotSwitchView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public RobotSwitchView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
private void a() {
|
||||
int i = new SharePreferenceHelper().getInt(SharePreferenceHelper.SP_KEY_CONNECTION_STATUS, ConnectionStatus.DIS_CONNECT.getStatus());
|
||||
for (ConnectionStatus connectionStatus : ConnectionStatus.values()) {
|
||||
if (connectionStatus.getStatus() == i) {
|
||||
a(getResources().getColor(R.color.image_foreground_filter), i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(int i, int i2) {
|
||||
setBackgroundResource(R.drawable.connection_status_bg);
|
||||
this.b.setImageResource(R.drawable.robot_can_change);
|
||||
RequestBuilder<Drawable> a = Glide.e(getContext()).a(new SharePreferenceHelper(false).getString(SharePreferenceHelper.SP_KEY_ROBOT_IMAGE, ""));
|
||||
a.a(new RequestOptions().b(R.drawable.default_robot_logo).a(R.drawable.default_robot_logo));
|
||||
a.a(this.a);
|
||||
}
|
||||
}
|
136
sources/com/ubt/jimu/main/widget/TabBarView.java
Normal file
136
sources/com/ubt/jimu/main/widget/TabBarView.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.ubt.jimu.main.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.R$styleable;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TabBarView extends FrameLayout {
|
||||
private OnActionListener a;
|
||||
private ViewGroup b;
|
||||
private View c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private int g;
|
||||
private int h;
|
||||
private View.OnClickListener i;
|
||||
|
||||
public interface OnActionListener {
|
||||
void c(int i);
|
||||
}
|
||||
|
||||
public TabBarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet) {
|
||||
LayoutInflater.from(context).inflate(R.layout.lay_tabbar, this);
|
||||
this.c = findViewById(R.id.line);
|
||||
if (attributeSet != null) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.TabBarView);
|
||||
CharSequence[] textArray = obtainStyledAttributes.getTextArray(0);
|
||||
this.f = obtainStyledAttributes.getColor(1, 0);
|
||||
this.g = obtainStyledAttributes.getColor(2, 0);
|
||||
float dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(3, 16);
|
||||
XLog.a("tabbar", "titles %s", Arrays.toString(textArray));
|
||||
XLog.a("tabbar", "textSize %s", Float.valueOf(dimensionPixelSize));
|
||||
this.b = (ViewGroup) findViewById(R.id.tabs);
|
||||
this.e = textArray.length;
|
||||
for (int i = 0; i < textArray.length; i++) {
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText(textArray[i]);
|
||||
if (i > 0) {
|
||||
textView.setTextColor(this.f);
|
||||
} else {
|
||||
textView.setTextColor(this.g);
|
||||
}
|
||||
textView.setGravity(17);
|
||||
textView.setTextSize(0, dimensionPixelSize);
|
||||
textView.setTypeface(Typeface.defaultFromStyle(1));
|
||||
textView.setOnClickListener(this.i);
|
||||
textView.setTag(Integer.valueOf(i));
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
|
||||
layoutParams.weight = 1.0f;
|
||||
this.b.addView(textView, layoutParams);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
private void b(int i, float f) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.c.getLayoutParams();
|
||||
int i2 = this.d;
|
||||
layoutParams.leftMargin = ((int) ((i + f) * i2)) + ((i2 - layoutParams.width) / 2);
|
||||
this.c.setLayoutParams(layoutParams);
|
||||
if (Float.compare(f, 0.5f) >= 0) {
|
||||
i++;
|
||||
}
|
||||
if (this.h != i) {
|
||||
for (int i3 = 0; i3 < this.b.getChildCount(); i3++) {
|
||||
if (i3 == i) {
|
||||
((TextView) this.b.getChildAt(i3)).setTextColor(this.g);
|
||||
} else if (i3 == this.h) {
|
||||
((TextView) this.b.getChildAt(i3)).setTextColor(this.f);
|
||||
}
|
||||
}
|
||||
this.h = i;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
getMeasuredHeight();
|
||||
this.d = measuredWidth / this.e;
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public void setListener(OnActionListener onActionListener) {
|
||||
this.a = onActionListener;
|
||||
}
|
||||
|
||||
public TabBarView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public TabBarView(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public TabBarView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
this.h = 0;
|
||||
this.i = new View.OnClickListener() { // from class: com.ubt.jimu.main.widget.c
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
TabBarView.this.a(view);
|
||||
}
|
||||
};
|
||||
a(context, attributeSet);
|
||||
}
|
||||
|
||||
public void a(int i, float f) {
|
||||
b(i, f);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(View view) {
|
||||
int intValue = ((Integer) view.getTag()).intValue();
|
||||
OnActionListener onActionListener = this.a;
|
||||
if (onActionListener != null) {
|
||||
onActionListener.c(intValue);
|
||||
}
|
||||
}
|
||||
}
|
74
sources/com/ubt/jimu/main/widget/UserEntryView.java
Normal file
74
sources/com/ubt/jimu/main/widget/UserEntryView.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.ubt.jimu.main.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
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.R;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class UserEntryView extends RelativeLayout {
|
||||
private ImageView a;
|
||||
private TextView b;
|
||||
private ProgressBar c;
|
||||
|
||||
public UserEntryView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.lay_user_entry, this);
|
||||
this.a = (ImageView) findViewById(R.id.portrait);
|
||||
this.b = (TextView) findViewById(R.id.name);
|
||||
this.c = (ProgressBar) findViewById(R.id.level);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
super.onWindowFocusChanged(z);
|
||||
if (z) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
public UserEntryView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public UserEntryView(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public UserEntryView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
a(context);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
User user = UserDbHandler.getUser();
|
||||
if (user == null) {
|
||||
this.b.setVisibility(8);
|
||||
this.c.setVisibility(8);
|
||||
RequestBuilder<Drawable> a = Glide.e(getContext()).a(Integer.valueOf(R.drawable.default_photo));
|
||||
a.a(RequestOptions.O().h().b());
|
||||
a.a(this.a);
|
||||
return;
|
||||
}
|
||||
this.b.setVisibility(0);
|
||||
this.c.setVisibility(0);
|
||||
this.c.setProgress((int) ((user.getCurExp() / user.getExpLength()) * 100.0f));
|
||||
this.b.setText(user.getNickName());
|
||||
RequestBuilder<Drawable> a2 = Glide.e(getContext()).a(user.getUserImage());
|
||||
a2.a(RequestOptions.N().b().b(R.drawable.default_photo).a(R.drawable.default_photo));
|
||||
a2.a(this.a);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user