Initial commit
This commit is contained in:
234
sources/com/ubt/jimu/BaseActivity.java
Normal file
234
sources/com/ubt/jimu/BaseActivity.java
Normal file
@@ -0,0 +1,234 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import com.recyclelib.URecyclerView;
|
||||
import com.ubt.jimu.base.http.ApiObserver;
|
||||
import com.ubt.jimu.base.http.manager.Manager;
|
||||
import com.ubt.jimu.base.networkstate.NetworkStateObserver;
|
||||
import com.ubt.jimu.base.networkstate.NetworkType;
|
||||
import com.ubt.jimu.utils.InputMethod;
|
||||
import com.ubt.jimu.widgets.JAlertDialog;
|
||||
import com.ubtech.utils.DensityUtils;
|
||||
import com.ubtech.view.widget.ToastView;
|
||||
import com.ubtrobot.log.ALog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class BaseActivity extends ScreenRotationManageActivity implements DeviceStateListener, NetworkStateObserver {
|
||||
private String mActivityJumpTag;
|
||||
private long mClickTime;
|
||||
protected JAlertDialog mJAlertDialog;
|
||||
public NavigationBarStatusListener navigationBarStatusListener;
|
||||
protected final String TAG = getClass().getSimpleName();
|
||||
private int orientation = -1;
|
||||
private int navigationBarHeight = 0;
|
||||
|
||||
public interface NavigationBarStatusListener {
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(URecyclerView uRecyclerView, Throwable th) {
|
||||
uRecyclerView.y();
|
||||
uRecyclerView.A();
|
||||
}
|
||||
|
||||
protected boolean checkDoubleClick(Intent intent) {
|
||||
String action;
|
||||
boolean z = true;
|
||||
if (intent.getComponent() == null) {
|
||||
if (intent.getAction() != null) {
|
||||
action = intent.getAction();
|
||||
}
|
||||
return z;
|
||||
}
|
||||
action = intent.getComponent().getClassName();
|
||||
if (action.equals(this.mActivityJumpTag) && this.mClickTime >= SystemClock.uptimeMillis() - 250) {
|
||||
z = false;
|
||||
Log.e(this.TAG, "double fast call startActivity to a same activity, ignore this call.");
|
||||
}
|
||||
this.mActivityJumpTag = action;
|
||||
this.mClickTime = SystemClock.uptimeMillis();
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == 0 && InputMethod.a(getCurrentFocus(), motionEvent)) {
|
||||
InputMethod.a(this);
|
||||
}
|
||||
return super.dispatchTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public float[] getRatios() {
|
||||
int[] a = DensityUtils.a(this);
|
||||
return new float[]{Math.max(a[0], a[1]) / 1536.0f, Math.min(a[0], a[1]) / 2048.0f};
|
||||
}
|
||||
|
||||
public int getScreenHeight() {
|
||||
int[] a = DensityUtils.a(this);
|
||||
return Math.min(a[0], a[1]);
|
||||
}
|
||||
|
||||
public int getScreenWidth() {
|
||||
int[] a = DensityUtils.a(this);
|
||||
return Math.max(a[0], a[1]) + this.navigationBarHeight;
|
||||
}
|
||||
|
||||
protected void hideLoading() {
|
||||
JAlertDialog jAlertDialog = this.mJAlertDialog;
|
||||
if (jAlertDialog == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
jAlertDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHorizontal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void loadComplete(final URecyclerView uRecyclerView, ApiObserver apiObserver) {
|
||||
if (uRecyclerView == null || apiObserver == null) {
|
||||
return;
|
||||
}
|
||||
apiObserver.setNetErrorListener(new ApiObserver.NetErrorListener() { // from class: com.ubt.jimu.b
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver.NetErrorListener
|
||||
public final void onError(Throwable th) {
|
||||
BaseActivity.a(URecyclerView.this, th);
|
||||
}
|
||||
});
|
||||
apiObserver.setRequestComplete(new ApiObserver.RequestComplete() { // from class: com.ubt.jimu.a
|
||||
@Override // com.ubt.jimu.base.http.ApiObserver.RequestComplete
|
||||
public final void onComplete() {
|
||||
BaseActivity.a(URecyclerView.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onCharging() {
|
||||
ALog.a(this.TAG).d("Jimu Robot:onCharging");
|
||||
}
|
||||
|
||||
public void onConnected() {
|
||||
ALog.a(this.TAG).d("Jimu Robot:onConnected");
|
||||
}
|
||||
|
||||
@Override // 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);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
Manager.mList.clear();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void onDisConnected() {
|
||||
ALog.a(this.TAG).d("Jimu Robot:onFail");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i == 111) {
|
||||
onBackPressed();
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
public void onLowpower() {
|
||||
ALog.a(this.TAG).d("Jimu Robot:onLowpower");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.networkstate.NetworkStateObserver
|
||||
public void onNetworkConnected(NetworkType networkType) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.networkstate.NetworkStateObserver
|
||||
public void onNetworkDisconnected() {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
JimuApplication.l().a();
|
||||
}
|
||||
|
||||
protected void relayout() {
|
||||
}
|
||||
|
||||
public void setNavigationBarStatusListener(NavigationBarStatusListener navigationBarStatusListener) {
|
||||
this.navigationBarStatusListener = navigationBarStatusListener;
|
||||
}
|
||||
|
||||
protected void showLoading(String str) {
|
||||
JAlertDialog jAlertDialog = this.mJAlertDialog;
|
||||
if (jAlertDialog == null) {
|
||||
JAlertDialog.Builder builder = new JAlertDialog.Builder(this);
|
||||
builder.a(R.drawable.ic_loading);
|
||||
builder.a(str);
|
||||
builder.a(true);
|
||||
this.mJAlertDialog = builder.a();
|
||||
} else {
|
||||
jAlertDialog.a(str);
|
||||
}
|
||||
this.mJAlertDialog.show();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
@SuppressLint({"RestrictedApi"})
|
||||
public void startActivityForResult(Intent intent, int i, Bundle bundle) {
|
||||
if (checkDoubleClick(intent)) {
|
||||
super.startActivityForResult(intent, i, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
public void startActivityForResultWithAnim(Intent intent, int i) {
|
||||
startActivityForResult(intent, i);
|
||||
overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_from_left);
|
||||
}
|
||||
|
||||
public void startActivityWithAnim(Class<?> cls) {
|
||||
startActivityWithAnim(new Intent(this, cls));
|
||||
}
|
||||
|
||||
public void toast(String str) {
|
||||
ToastView.a(JimuApplication.k, str, ToastView.Type.NORMAL).a();
|
||||
}
|
||||
|
||||
public void toastError(String str) {
|
||||
ToastView.a(JimuApplication.k, str, ToastView.Type.ERROR).a();
|
||||
}
|
||||
|
||||
public void toastSuccess(String str) {
|
||||
ToastView.a(JimuApplication.k, str, ToastView.Type.SUCCESS).a();
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(URecyclerView uRecyclerView) {
|
||||
uRecyclerView.y();
|
||||
uRecyclerView.A();
|
||||
}
|
||||
|
||||
public void startActivityWithAnim(Intent intent) {
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.slide_in_from_right, R.anim.slide_out_from_left);
|
||||
}
|
||||
}
|
27
sources/com/ubt/jimu/Channel.java
Normal file
27
sources/com/ubt/jimu/Channel.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum Channel {
|
||||
GOOGLE_PLAY(1, "google_play"),
|
||||
OFFICIAL_WEBSITE(2, "official_website"),
|
||||
FIR_CUSTOMERS(3, "fir_customers"),
|
||||
FIR_TEST(4, "fir_test"),
|
||||
DEV(5, "dev"),
|
||||
JIMU_EDU(6, "jimu_edu");
|
||||
|
||||
private int channelId;
|
||||
private String channelName;
|
||||
|
||||
Channel(int i, String str) {
|
||||
this.channelId = i;
|
||||
this.channelName = str;
|
||||
}
|
||||
|
||||
public int getChannelId() {
|
||||
return this.channelId;
|
||||
}
|
||||
|
||||
public String getChannelName() {
|
||||
return this.channelName;
|
||||
}
|
||||
}
|
5
sources/com/ubt/jimu/DeviceStateListener.java
Normal file
5
sources/com/ubt/jimu/DeviceStateListener.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DeviceStateListener {
|
||||
}
|
349
sources/com/ubt/jimu/JimuApplication.java
Normal file
349
sources/com/ubt/jimu/JimuApplication.java
Normal file
@@ -0,0 +1,349 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ijm.dataencryption.de.StatusInfo;
|
||||
import com.liulishuo.filedownloader.FileDownloader;
|
||||
import com.ubt.jimu.analytics.AppDelayInit;
|
||||
import com.ubt.jimu.base.db.JimuOpenHelper;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.networkstate.NetWorkUtil;
|
||||
import com.ubt.jimu.base.networkstate.NetworkStateObserver;
|
||||
import com.ubt.jimu.base.networkstate.NetworkStateReceiver;
|
||||
import com.ubt.jimu.base.networkstate.NetworkType;
|
||||
import com.ubt.jimu.connect.JimuStatusMonitor;
|
||||
import com.ubt.jimu.course.view.JimuTaskListActivity;
|
||||
import com.ubt.jimu.discover.view.CourseListActivity;
|
||||
import com.ubt.jimu.diy.activity.UserDiyActivity;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.pack.view.PackSelectActivity;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.user.view.UserCenterActivity;
|
||||
import com.ubt.jimu.user.view.setting.SettingActivity;
|
||||
import com.ubt.jimu.utils.CrashExceptionHandler;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import com.ubt.jimu.utils.PackageHelper;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.jimu.bluetooth.ConnectionState;
|
||||
import com.ubtrobot.jimu.bluetooth.ConnectionStateListener;
|
||||
import com.ubtrobot.jimu.robotapi.IPowerStateListener;
|
||||
import com.ubtrobot.jimu.robotapi.JimuManager;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import com.ubtrobot.ubtlib.analytics.UbtPageIdUtil;
|
||||
import com.ubtrobot.ubtlib.social.SocialTool;
|
||||
import com.ubtrobot.ubtlib.stat.UbtStats;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.lang.Thread;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuApplication extends Application implements NetworkStateObserver {
|
||||
public static long i = 0;
|
||||
private static JimuApplication j = null;
|
||||
public static Context k = null;
|
||||
public static boolean l = false;
|
||||
private Thread.UncaughtExceptionHandler a;
|
||||
private String b = "86";
|
||||
private boolean c = false;
|
||||
private UnityActivity d;
|
||||
private Activity e;
|
||||
private DaoSession f;
|
||||
private ConnectionStateListener g;
|
||||
private IPowerStateListener h;
|
||||
|
||||
private static class JimuManagerHolder {
|
||||
private static JimuManager a = new JimuManager(JimuApplication.k);
|
||||
}
|
||||
|
||||
public JimuApplication() {
|
||||
NetworkType networkType = NetworkType.NONE_NET;
|
||||
this.g = new ConnectionStateListener() { // from class: com.ubt.jimu.JimuApplication.1
|
||||
@Override // com.ubtrobot.jimu.bluetooth.ConnectionStateListener
|
||||
public void onConnectionStateChange(String str, ConnectionState connectionState) {
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
if (connectionState == ConnectionState.STATE_CONNECTED) {
|
||||
JimuApplication.this.f().o();
|
||||
JimuApplication.this.f().a(JimuApplication.this.h);
|
||||
} else if (connectionState == ConnectionState.STATE_DISCONNECTED) {
|
||||
JimuApplication.this.f().p();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.h = new JimuStatusMonitor();
|
||||
}
|
||||
|
||||
private void j() {
|
||||
t();
|
||||
u();
|
||||
}
|
||||
|
||||
private String k() {
|
||||
int myPid = Process.myPid();
|
||||
ActivityManager activityManager = (ActivityManager) getApplicationContext().getSystemService("activity");
|
||||
if (activityManager == null || activityManager.getRunningAppProcesses() == null) {
|
||||
return "";
|
||||
}
|
||||
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : activityManager.getRunningAppProcesses()) {
|
||||
if (myPid == runningAppProcessInfo.pid) {
|
||||
return runningAppProcessInfo.processName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static JimuApplication l() {
|
||||
return j;
|
||||
}
|
||||
|
||||
private Thread.UncaughtExceptionHandler m() {
|
||||
if (this.a == null) {
|
||||
this.a = CrashExceptionHandler.b(this);
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
|
||||
private void n() {
|
||||
UbtPageIdUtil.a(PackSelectActivity.class.getSimpleName(), "P2");
|
||||
UbtPageIdUtil.a(JimuTaskListActivity.class.getSimpleName(), "P11");
|
||||
UbtPageIdUtil.a(UserDiyActivity.class.getSimpleName(), "P12");
|
||||
UbtPageIdUtil.a(CourseListActivity.class.getSimpleName(), "P13");
|
||||
UbtPageIdUtil.a(UserCenterActivity.class.getSimpleName(), "P14");
|
||||
UbtPageIdUtil.a(SettingActivity.class.getSimpleName(), "P15");
|
||||
}
|
||||
|
||||
private void o() {
|
||||
this.f = new DaoMaster(new JimuOpenHelper(l(), "local").getWritableDb()).newSession();
|
||||
}
|
||||
|
||||
private void p() {
|
||||
FileDownloader.a(this);
|
||||
UbtStats.a(this, false);
|
||||
XLog.a(false);
|
||||
}
|
||||
|
||||
private void q() {
|
||||
}
|
||||
|
||||
private boolean r() {
|
||||
return getApplicationContext().getPackageName().equals(k());
|
||||
}
|
||||
|
||||
private void s() {
|
||||
try {
|
||||
NetWorkUtil.isNetworkAvailable(this);
|
||||
NetWorkUtil.getAPNType(this);
|
||||
NetworkStateReceiver.getInstance().registerNetworkStateReceiver(this);
|
||||
NetworkStateReceiver.getInstance().registerObserver(this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void t() {
|
||||
if ("OPPO".equalsIgnoreCase(Build.MANUFACTURER)) {
|
||||
try {
|
||||
Field declaredField = Class.forName("java.lang.Daemons").getDeclaredField("MAX_FINALIZE_NANOS");
|
||||
declaredField.setAccessible(true);
|
||||
declaredField.set(null, Long.MAX_VALUE);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e2) {
|
||||
e2.printStackTrace();
|
||||
} catch (NoSuchFieldException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void u() {
|
||||
if ("OPPO".equalsIgnoreCase(Build.MANUFACTURER)) {
|
||||
try {
|
||||
Class<?> cls = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon");
|
||||
Method declaredMethod = cls.getSuperclass().getDeclaredMethod("stop", new Class[0]);
|
||||
declaredMethod.setAccessible(true);
|
||||
Field declaredField = cls.getDeclaredField("INSTANCE");
|
||||
declaredField.setAccessible(true);
|
||||
declaredMethod.invoke(declaredField.get(null), new Object[0]);
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void v() {
|
||||
try {
|
||||
((NotificationManager) getSystemService("notification")).cancelAll();
|
||||
NetworkStateReceiver.getInstance().unRegisterNetworkStateReceiver(this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper
|
||||
protected void attachBaseContext(Context context) {
|
||||
a(context);
|
||||
super.attachBaseContext(context);
|
||||
j();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
List<ActivityManager.AppTask> appTasks = ((ActivityManager) getApplicationContext().getSystemService("activity")).getAppTasks();
|
||||
if (appTasks != null && !appTasks.isEmpty()) {
|
||||
Iterator<ActivityManager.AppTask> it = appTasks.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().finishAndRemoveTask();
|
||||
}
|
||||
}
|
||||
UnityActivity unityActivity = this.d;
|
||||
if (unityActivity != null) {
|
||||
unityActivity.finish();
|
||||
}
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return LocaleUtils.d();
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public DaoSession e() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public JimuManager f() {
|
||||
return JimuManagerHolder.a;
|
||||
}
|
||||
|
||||
public String g() {
|
||||
return LocaleUtils.b();
|
||||
}
|
||||
|
||||
public UnityActivity h() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public boolean i() {
|
||||
return getResources().getBoolean(R.bool.isTablet);
|
||||
}
|
||||
|
||||
@Override // android.app.Application
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
j = this;
|
||||
k = getApplicationContext();
|
||||
p();
|
||||
PackageHelper.c();
|
||||
Thread.setDefaultUncaughtExceptionHandler(m());
|
||||
SocialTool.a(this);
|
||||
if (r()) {
|
||||
o();
|
||||
n();
|
||||
f().a(this.g);
|
||||
}
|
||||
ALog.a(this, "Jimu");
|
||||
ARouter.a((Application) this);
|
||||
registerActivityLifecycleCallbacks(new LifecycleCallback());
|
||||
RxJavaPlugins.a(new Consumer() { // from class: com.ubt.jimu.c
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
public final void accept(Object obj) {
|
||||
XLog.a("rx-error", "error happen", (Throwable) obj);
|
||||
}
|
||||
});
|
||||
a(g());
|
||||
s();
|
||||
q();
|
||||
if (SPUtils.a(Constant.NoviceGuide.AGREE_LEGAL_EXAMINE)) {
|
||||
AppDelayInit.a(getApplicationContext());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.networkstate.NetworkStateObserver
|
||||
public void onNetworkConnected(NetworkType networkType) {
|
||||
ComponentCallbacks2 componentCallbacks2 = this.e;
|
||||
if (componentCallbacks2 == null || !(componentCallbacks2 instanceof NetworkStateObserver)) {
|
||||
return;
|
||||
}
|
||||
((NetworkStateObserver) componentCallbacks2).onNetworkConnected(networkType);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.networkstate.NetworkStateObserver
|
||||
public void onNetworkDisconnected() {
|
||||
NetworkType networkType = NetworkType.NONE_NET;
|
||||
ComponentCallbacks2 componentCallbacks2 = this.e;
|
||||
if (componentCallbacks2 == null || !(componentCallbacks2 instanceof NetworkStateObserver)) {
|
||||
return;
|
||||
}
|
||||
((NetworkStateObserver) componentCallbacks2).onNetworkDisconnected();
|
||||
}
|
||||
|
||||
@Override // android.app.Application
|
||||
public void onTerminate() {
|
||||
v();
|
||||
super.onTerminate();
|
||||
}
|
||||
|
||||
public void a(Activity activity) {
|
||||
this.e = activity;
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
StatusInfo licenseKey = DataDecryptTool.setLicenseKey(context, "85EB780E18D0EC8FE94AD2AAB2915B71AC38CEEB2093B643272CCE48C4A10342F7E29DF996F7BC92C01D10EC22B2718757AA734222258657C69C021B9A25C14AD16DE950BFF1CF5D61528C027FE323D1B796E4C366031DC2526C7C3AC843307CE6D4");
|
||||
if (licenseKey.getStatusCode() == 1) {
|
||||
XLog.c("JimuApp", "授权成功");
|
||||
} else {
|
||||
XLog.b("JimuApp", "授权失败,reason:" + licenseKey.getStatusDescribe());
|
||||
}
|
||||
DataDecryptTool.doworkForDecrypt(context, DataDecryptTool.DECRYPT_SP_FILE);
|
||||
}
|
||||
|
||||
public void a(UnityActivity unityActivity) {
|
||||
this.d = unityActivity;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
"google_play".equals(Channel.FIR_TEST.getChannelName());
|
||||
String b = SPUtils.b(Constant.Course.LAST_ALTER_LANGUAGE_KEY);
|
||||
String b2 = LocaleUtils.b();
|
||||
if (TextUtils.isEmpty(b)) {
|
||||
SPUtils.a(Constant.Course.LAST_ALTER_LANGUAGE_KEY, b2);
|
||||
return false;
|
||||
}
|
||||
if (!b.equals(b2)) {
|
||||
SPUtils.a(Constant.Course.LAST_ALTER_LANGUAGE_KEY, b2);
|
||||
Intent intent = new Intent(this, (Class<?>) SplashActivity.class);
|
||||
intent.setFlags(268468224);
|
||||
startActivity(intent);
|
||||
UnityActivity unityActivity = this.d;
|
||||
if (unityActivity != null) {
|
||||
unityActivity.finish();
|
||||
} else {
|
||||
Process.killProcess(Process.myPid());
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
return this.c;
|
||||
}
|
||||
}
|
42
sources/com/ubt/jimu/JimuJobScheduler.java
Normal file
42
sources/com/ubt/jimu/JimuJobScheduler.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.app.job.JobParameters;
|
||||
import android.app.job.JobService;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuJobScheduler extends JobService {
|
||||
private static final String a = JimuJobScheduler.class.getSimpleName();
|
||||
|
||||
@Override // android.app.Service
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.i(a, "Service created");
|
||||
}
|
||||
|
||||
@Override // android.app.Service
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.i(a, "Service destroyed");
|
||||
}
|
||||
|
||||
@Override // android.app.Service
|
||||
public int onStartCommand(Intent intent, int i, int i2) {
|
||||
Log.i(a, "onStartCommand");
|
||||
return super.onStartCommand(intent, i, i2);
|
||||
}
|
||||
|
||||
@Override // android.app.job.JobService
|
||||
public boolean onStartJob(JobParameters jobParameters) {
|
||||
Log.i(a, "onStartJob");
|
||||
return jobParameters.getExtras() != null && jobParameters.getExtras().getInt("extra_job_type", 4097) == 4097;
|
||||
}
|
||||
|
||||
@Override // android.app.job.JobService
|
||||
public boolean onStopJob(JobParameters jobParameters) {
|
||||
Log.i(a, "onStopJob");
|
||||
return false;
|
||||
}
|
||||
}
|
66
sources/com/ubt/jimu/LifecycleCallback.java
Normal file
66
sources/com/ubt/jimu/LifecycleCallback.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
import com.ubt.jimu.base.UbtActivityStack;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import com.ubtrobot.ubtlib.analytics.UbtPageIdUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LifecycleCallback implements Application.ActivityLifecycleCallbacks {
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
XLog.a("act_life", "onActivityCreated act %s", activity.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
XLog.a("act_life", "act %s ", activity.getClass().getSimpleName());
|
||||
UbtActivityStack.getInstance().removeActivity(activity);
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityPaused(Activity activity) {
|
||||
XLog.a("act_life", "act %s", activity.getClass().getSimpleName());
|
||||
UbtActivityStack.getInstance().decrement();
|
||||
String a = UbtPageIdUtil.a(activity.getClass().getSimpleName());
|
||||
if (a != null) {
|
||||
JimuAnalytics.b().b(a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityResumed(Activity activity) {
|
||||
JimuApplication.l().a(activity);
|
||||
XLog.a("act_life", "act %s isHomeExit %s resumeCount: %d", activity.getClass().getSimpleName(), Boolean.valueOf(JimuApplication.l), Integer.valueOf(UbtActivityStack.getInstance().getResumedCount()));
|
||||
UnityActivity h = JimuApplication.l().h();
|
||||
if (h != null && !h.isBack() && !h.resumeUnityActivity) {
|
||||
UnityActivity.startRunningUnityActivity(activity);
|
||||
JimuApplication.l = false;
|
||||
}
|
||||
UbtActivityStack.getInstance().increment();
|
||||
UbtActivityStack.getInstance().addActivity(activity);
|
||||
String a = UbtPageIdUtil.a(activity.getClass().getSimpleName());
|
||||
if (a != null) {
|
||||
JimuAnalytics.b().c(a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||
XLog.a("act_life", "onActivitySaveInstanceState act %s", activity.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityStarted(Activity activity) {
|
||||
XLog.a("act_life", "onActivityStarted act %s", activity.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||||
public void onActivityStopped(Activity activity) {
|
||||
XLog.a("act_life", "onActivityStopped act %s", activity.getClass().getSimpleName());
|
||||
}
|
||||
}
|
136
sources/com/ubt/jimu/NoviceGuideActivity.java
Normal file
136
sources/com/ubt/jimu/NoviceGuideActivity.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.adapter.GuideViewPagerAdapter;
|
||||
import com.ubt.jimu.base.SuperActivity;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Redirection;
|
||||
import com.ubt.jimu.utils.JsonHelper;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoviceGuideActivity extends SuperActivity implements View.OnClickListener {
|
||||
int a;
|
||||
ImageView im_shape_left;
|
||||
ImageView im_shape_right;
|
||||
TextView tv_guide_page;
|
||||
TextView tv_skip;
|
||||
ViewPager viewPager;
|
||||
|
||||
private void D0() {
|
||||
SPUtils.a(Constant.NoviceGuide.SHOW_GUIDE, true);
|
||||
E0();
|
||||
finish();
|
||||
}
|
||||
|
||||
private void E0() {
|
||||
Intent intent = getIntent();
|
||||
Uri data = intent.getData();
|
||||
Redirection redirection = null;
|
||||
if (data != null) {
|
||||
try {
|
||||
String decode = URLDecoder.decode(data.getQueryParameter("json"), "UTF-8");
|
||||
redirection = !TextUtils.isEmpty(decode) ? (Redirection) JsonHelper.b(decode, Redirection.class) : null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.a = 10002;
|
||||
} else {
|
||||
this.a = intent.getIntExtra(Constant.Base.ACTIVITY_START_ACTION, 0);
|
||||
}
|
||||
Postcard a = ARouter.b().a("/page/main");
|
||||
a.a(Constant.Base.ACTIVITY_START_ACTION, this.a);
|
||||
a.a("ACTIVITY_START_REDIRECTION", redirection);
|
||||
a.t();
|
||||
finish();
|
||||
}
|
||||
|
||||
public static void b(Context context) {
|
||||
context.startActivity(new Intent(context, (Class<?>) NoviceGuideActivity.class));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initData() {
|
||||
View inflate = View.inflate(this, R.layout.layout_guide_page_1, null);
|
||||
View inflate2 = View.inflate(this, R.layout.layout_guide_page_2, null);
|
||||
View inflate3 = View.inflate(this, R.layout.layout_guide_page_3, null);
|
||||
View inflate4 = View.inflate(this, R.layout.layout_guide_page_4, null);
|
||||
View inflate5 = View.inflate(this, R.layout.layout_guide_page_5, null);
|
||||
View inflate6 = View.inflate(this, R.layout.layout_guide_page_6, null);
|
||||
View inflate7 = View.inflate(this, R.layout.layout_guide_page_7, null);
|
||||
View inflate8 = View.inflate(this, R.layout.layout_guide_page_8, null);
|
||||
View inflate9 = View.inflate(this, R.layout.layout_guide_page_9, null);
|
||||
inflate9.findViewById(R.id.im_start).setOnClickListener(this);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
arrayList.add(inflate);
|
||||
arrayList.add(inflate2);
|
||||
arrayList.add(inflate3);
|
||||
arrayList.add(inflate4);
|
||||
arrayList.add(inflate5);
|
||||
arrayList.add(inflate6);
|
||||
arrayList.add(inflate7);
|
||||
arrayList.add(inflate8);
|
||||
arrayList.add(inflate9);
|
||||
this.viewPager.setAdapter(new GuideViewPagerAdapter(arrayList));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
protected void initEvent() {
|
||||
this.tv_skip.setOnClickListener(this);
|
||||
this.im_shape_right.setOnClickListener(this);
|
||||
this.im_shape_left.setOnClickListener(this);
|
||||
this.viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { // from class: com.ubt.jimu.NoviceGuideActivity.1
|
||||
@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) {
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
public void onPageSelected(int i) {
|
||||
NoviceGuideActivity.this.im_shape_left.setVisibility(i == 0 ? 8 : 0);
|
||||
NoviceGuideActivity.this.im_shape_right.setVisibility(i == 8 ? 8 : 0);
|
||||
NoviceGuideActivity.this.tv_skip.setVisibility(i == 8 ? 8 : 0);
|
||||
NoviceGuideActivity.this.tv_guide_page.setText((i + 1) + "/9");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.SuperActivity
|
||||
public View initView() {
|
||||
return View.inflate(this, R.layout.activity_novice_guide, null);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.im_shape_left /* 2131296801 */:
|
||||
this.viewPager.setCurrentItem(this.viewPager.getCurrentItem() - 1);
|
||||
return;
|
||||
case R.id.im_shape_right /* 2131296802 */:
|
||||
this.viewPager.setCurrentItem(this.viewPager.getCurrentItem() + 1);
|
||||
return;
|
||||
case R.id.im_start /* 2131296807 */:
|
||||
D0();
|
||||
break;
|
||||
case R.id.tv_skip /* 2131297799 */:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
D0();
|
||||
}
|
||||
}
|
36
sources/com/ubt/jimu/NoviceGuideActivity_ViewBinding.java
Normal file
36
sources/com/ubt/jimu/NoviceGuideActivity_ViewBinding.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoviceGuideActivity_ViewBinding implements Unbinder {
|
||||
private NoviceGuideActivity b;
|
||||
|
||||
public NoviceGuideActivity_ViewBinding(NoviceGuideActivity noviceGuideActivity, View view) {
|
||||
this.b = noviceGuideActivity;
|
||||
noviceGuideActivity.viewPager = (ViewPager) Utils.b(view, R.id.viewPager, "field 'viewPager'", ViewPager.class);
|
||||
noviceGuideActivity.tv_skip = (TextView) Utils.b(view, R.id.tv_skip, "field 'tv_skip'", TextView.class);
|
||||
noviceGuideActivity.tv_guide_page = (TextView) Utils.b(view, R.id.tv_guide_page, "field 'tv_guide_page'", TextView.class);
|
||||
noviceGuideActivity.im_shape_right = (ImageView) Utils.b(view, R.id.im_shape_right, "field 'im_shape_right'", ImageView.class);
|
||||
noviceGuideActivity.im_shape_left = (ImageView) Utils.b(view, R.id.im_shape_left, "field 'im_shape_left'", ImageView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
NoviceGuideActivity noviceGuideActivity = this.b;
|
||||
if (noviceGuideActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
noviceGuideActivity.viewPager = null;
|
||||
noviceGuideActivity.tv_skip = null;
|
||||
noviceGuideActivity.tv_guide_page = null;
|
||||
noviceGuideActivity.im_shape_right = null;
|
||||
noviceGuideActivity.im_shape_left = null;
|
||||
}
|
||||
}
|
25
sources/com/ubt/jimu/PrivacyVersion.java
Normal file
25
sources/com/ubt/jimu/PrivacyVersion.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PrivacyVersion implements Serializable {
|
||||
private String jimuChildrenPrivacyPolicy;
|
||||
private String jimuPrivacyPolicy;
|
||||
|
||||
public String getJimuChildrenPrivacyPolicyVersion() {
|
||||
return this.jimuChildrenPrivacyPolicy;
|
||||
}
|
||||
|
||||
public String getJimuPrivacyPolicyVersion() {
|
||||
return this.jimuPrivacyPolicy;
|
||||
}
|
||||
|
||||
public void setJimuChildrenPrivacyPolicyVersion(String str) {
|
||||
this.jimuChildrenPrivacyPolicy = str;
|
||||
}
|
||||
|
||||
public void setJimuPrivacyPolicyVersion(String str) {
|
||||
this.jimuPrivacyPolicy = str;
|
||||
}
|
||||
}
|
1088
sources/com/ubt/jimu/R$styleable.java
Normal file
1088
sources/com/ubt/jimu/R$styleable.java
Normal file
File diff suppressed because it is too large
Load Diff
14383
sources/com/ubt/jimu/R.java
Normal file
14383
sources/com/ubt/jimu/R.java
Normal file
File diff suppressed because it is too large
Load Diff
106
sources/com/ubt/jimu/SchemeFilterActivity.java
Normal file
106
sources/com/ubt/jimu/SchemeFilterActivity.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.base.UbtActivityStack;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Redirection;
|
||||
import com.ubt.jimu.dialog.RedirectDialog;
|
||||
import com.ubt.jimu.main.activity.MainActivity;
|
||||
import com.ubt.jimu.utils.JsonHelper;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SchemeFilterActivity extends ScreenRotationManageActivity {
|
||||
private Redirection D0() {
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
return a(intent.getData());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean E0() {
|
||||
return UbtActivityStack.getInstance().getActivityTask(JimuApplication.l()).size() > 0;
|
||||
}
|
||||
|
||||
private boolean F0() {
|
||||
return UbtActivityStack.getInstance().isTopStack(MainActivity.class);
|
||||
}
|
||||
|
||||
private void G0() {
|
||||
Uri data;
|
||||
Intent intent = getIntent();
|
||||
if (intent == null || (data = intent.getData()) == null) {
|
||||
return;
|
||||
}
|
||||
ARouter.b().a(data).t();
|
||||
}
|
||||
|
||||
private void a(Redirection redirection) {
|
||||
Intent intent = new Intent(this, (Class<?>) MainActivity.class);
|
||||
intent.putExtra(Constant.Base.ACTIVITY_START_ACTION, 10002);
|
||||
intent.putExtra(Constant.Base.ACTIVITY_START_REDIRECTION, redirection);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
Redirection D0 = D0();
|
||||
boolean E0 = E0();
|
||||
boolean F0 = F0();
|
||||
Activity topActivity = UbtActivityStack.getInstance().getTopActivity();
|
||||
super.onCreate(bundle);
|
||||
if (D0 == null) {
|
||||
G0();
|
||||
} else if (!E0 || F0) {
|
||||
a(D0);
|
||||
} else {
|
||||
a(topActivity);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private void a(Activity activity) {
|
||||
ALog.a("woo").d("showMiniCarDialog topActivity : " + activity);
|
||||
if (activity == null) {
|
||||
activity = this;
|
||||
}
|
||||
RedirectDialog.Builder builder = new RedirectDialog.Builder(activity);
|
||||
builder.a(getString(R.string.mini_car_tips));
|
||||
builder.a(R.drawable.mini_car);
|
||||
builder.a(new DialogInterface.OnClickListener(this) { // from class: com.ubt.jimu.SchemeFilterActivity.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
builder.a().show();
|
||||
}
|
||||
|
||||
private Redirection a(Uri uri) {
|
||||
if (uri == null) {
|
||||
return null;
|
||||
}
|
||||
String queryParameter = uri.getQueryParameter("json");
|
||||
if (TextUtils.isEmpty(queryParameter)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
String decode = URLDecoder.decode(queryParameter, "UTF-8");
|
||||
if (TextUtils.isEmpty(decode)) {
|
||||
return null;
|
||||
}
|
||||
return (Redirection) JsonHelper.b(decode, Redirection.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
106
sources/com/ubt/jimu/ScreenRotationManageActivity.java
Normal file
106
sources/com/ubt/jimu/ScreenRotationManageActivity.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.UiUtils;
|
||||
import com.ubtrobot.log.ALog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScreenRotationManageActivity extends AppCompatActivity {
|
||||
private static final String TAG = "BaseActivity";
|
||||
private String mCurrentName;
|
||||
private RotationObserver mRotationObserver;
|
||||
|
||||
private class RotationObserver extends ContentObserver {
|
||||
ContentResolver a;
|
||||
|
||||
public RotationObserver(Handler handler) {
|
||||
super(handler);
|
||||
this.a = ScreenRotationManageActivity.this.getContentResolver();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
try {
|
||||
if (Settings.System.getInt(ScreenRotationManageActivity.this.getContentResolver(), "accelerometer_rotation") == 1) {
|
||||
ScreenRotationManageActivity.this.setRequestedOrientation(6);
|
||||
} else {
|
||||
ScreenRotationManageActivity.this.setRequestedOrientation(0);
|
||||
}
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.a.registerContentObserver(Settings.System.getUriFor("accelerometer_rotation"), false, this);
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.a.unregisterContentObserver(this);
|
||||
}
|
||||
|
||||
@Override // android.database.ContentObserver
|
||||
public void onChange(boolean z) {
|
||||
super.onChange(z);
|
||||
LogUtils.c("selfChange:" + z);
|
||||
try {
|
||||
int i = Settings.System.getInt(this.a, "accelerometer_rotation");
|
||||
LogUtils.c("screenchange:" + i);
|
||||
if (i == 1) {
|
||||
ScreenRotationManageActivity.this.setRequestedOrientation(6);
|
||||
} else {
|
||||
ScreenRotationManageActivity.this.setRequestedOrientation(0);
|
||||
}
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
if (Build.VERSION.SDK_INT >= 26 && UiUtils.b(this)) {
|
||||
UiUtils.a(this);
|
||||
}
|
||||
super.onCreate(bundle);
|
||||
this.mRotationObserver = new RotationObserver(new Handler());
|
||||
this.mCurrentName = toString();
|
||||
ALog.a(TAG).d(this.mCurrentName + "OnCreate");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
this.mRotationObserver.b();
|
||||
ALog.a(TAG).d(this.mCurrentName + "OnDestroy");
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
ALog.a(TAG).d(this.mCurrentName + "OnPause");
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.mRotationObserver.a();
|
||||
ALog.a(TAG).d(this.mCurrentName + "OnResume");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
ALog.a(TAG).d(this.mCurrentName + "OnStop");
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void setRequestedOrientation(int i) {
|
||||
if (Build.VERSION.SDK_INT < 26 || !UiUtils.b(this)) {
|
||||
super.setRequestedOrientation(i);
|
||||
}
|
||||
}
|
||||
}
|
369
sources/com/ubt/jimu/SplashActivity.java
Normal file
369
sources/com/ubt/jimu/SplashActivity.java
Normal file
@@ -0,0 +1,369 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.VideoView;
|
||||
import butterknife.ButterKnife;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.ubt.jimu.analytics.AppDelayInit;
|
||||
import com.ubt.jimu.analytics.BuglyUtil;
|
||||
import com.ubt.jimu.analytics.JimuAnalyticsUtil;
|
||||
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.dialog.JimuSimpleDialog;
|
||||
import com.ubt.jimu.base.dialog.LegalExamineDialog;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.response.Timestamp;
|
||||
import com.ubt.jimu.base.http.service.UserService;
|
||||
import com.ubt.jimu.blockly.dao.JimuSoundDbHandler;
|
||||
import com.ubt.jimu.sync.OfflineDataUploadTool;
|
||||
import com.ubt.jimu.transport3.upgrade.Version2DbUpgrade;
|
||||
import com.ubt.jimu.transport3.upgrade.VersionUpgrade;
|
||||
import com.ubt.jimu.unity.bluetooth.ConnectionStatus;
|
||||
import com.ubt.jimu.utils.GsonUtil;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.utils.ThreadManagerUtils;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SplashActivity extends BaseActivity {
|
||||
private int a;
|
||||
private LegalExamineDialog b;
|
||||
private JimuSimpleDialog c;
|
||||
private PrivacyVersion d;
|
||||
VideoView videoView;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void F0() {
|
||||
AppDelayInit.a(getApplicationContext());
|
||||
H0();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void G0() {
|
||||
if (SPUtils.a(Constant.NoviceGuide.SHOW_GUIDE)) {
|
||||
K0();
|
||||
} else {
|
||||
NoviceGuideActivity.b(this);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void H0() {
|
||||
LogUtils.c("对时开始");
|
||||
((UserService) ApiClient.getService(UserService.class)).getServerTimestamp().observeOn(Schedulers.b()).subscribeOn(Schedulers.b()).subscribe(new Observer<Timestamp>(this) { // from class: com.ubt.jimu.SplashActivity.4
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Timestamp timestamp) {
|
||||
LogUtils.c("对时接口请求成功:" + timestamp);
|
||||
if (timestamp == null || timestamp.getTimestamp() == 0) {
|
||||
a();
|
||||
return;
|
||||
}
|
||||
long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||
long timestamp2 = (timestamp.getTimestamp() * 1000) - elapsedRealtime;
|
||||
LogUtils.c("开机时间:" + elapsedRealtime + " 服务器时间:" + timestamp.getTimestamp() + " 差异:" + timestamp2);
|
||||
Cache.getInstance().differ = timestamp2;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
LogUtils.c("对时失败");
|
||||
a();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
}
|
||||
|
||||
private void a() {
|
||||
Cache.getInstance().differ = System.currentTimeMillis() - SystemClock.elapsedRealtime();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void I0() {
|
||||
getIntent().getIntExtra(Constant.Base.ACTIVITY_START_ACTION, 0);
|
||||
}
|
||||
|
||||
private boolean J0() {
|
||||
String b = SPUtils.b(Constant.Privacy.SP_KEY_PRIVACY_POLICY_VERSION);
|
||||
String b2 = SPUtils.b(Constant.Privacy.SP_KEY_CHILD_PRIVACY_POLICY_VERSION);
|
||||
PrivacyVersion M0 = M0();
|
||||
if (TextUtils.isEmpty(b) && TextUtils.isEmpty(b2) && M0 == null) {
|
||||
return false;
|
||||
}
|
||||
if (M0 == null) {
|
||||
ALog.a("Not internal privacy version!", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(b) || TextUtils.isEmpty(b2)) {
|
||||
ALog.c("Not agreed privacy version!", new Object[0]);
|
||||
return true;
|
||||
}
|
||||
ALog.b("privacyVersion:" + M0.getJimuPrivacyPolicyVersion() + " childrenPrivacyPolicyVersion:" + M0.getJimuChildrenPrivacyPolicyVersion(), new Object[0]);
|
||||
if (b.equals(M0.getJimuPrivacyPolicyVersion()) && b2.equals(M0.getJimuChildrenPrivacyPolicyVersion())) {
|
||||
return false;
|
||||
}
|
||||
ALog.b("internal privacy policy version has update!", new Object[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void K0() {
|
||||
runOnUiThread(new Runnable() { // from class: com.ubt.jimu.f
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
SplashActivity.this.D0();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void L0() {
|
||||
this.videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.splash_screen));
|
||||
this.videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { // from class: com.ubt.jimu.g
|
||||
@Override // android.media.MediaPlayer.OnCompletionListener
|
||||
public final void onCompletion(MediaPlayer mediaPlayer) {
|
||||
SplashActivity.this.a(mediaPlayer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public PrivacyVersion M0() {
|
||||
PrivacyVersion privacyVersion = this.d;
|
||||
if (privacyVersion != null) {
|
||||
return privacyVersion;
|
||||
}
|
||||
try {
|
||||
InputStream open = getAssets().open("privacy/version.json");
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, "utf-8"));
|
||||
String str = "";
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null) {
|
||||
bufferedReader.close();
|
||||
open.close();
|
||||
PrivacyVersion privacyVersion2 = (PrivacyVersion) GsonUtil.a(str, PrivacyVersion.class);
|
||||
ALog.b("privacyVersion:" + privacyVersion2.getJimuPrivacyPolicyVersion() + " childrenPrivacyPolicyVersion:" + privacyVersion2.getJimuChildrenPrivacyPolicyVersion(), new Object[0]);
|
||||
this.d = privacyVersion2;
|
||||
return privacyVersion2;
|
||||
}
|
||||
str = str + readLine;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ALog.a(e, "get privacy policy version fail!", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void N0() {
|
||||
if (this.c == null) {
|
||||
this.c = new JimuSimpleDialog.Builder(this).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).canceledOnTouchOutside(false).cancleBtnBg(R.drawable.sel_common_negative_btn).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.e
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
SplashActivity.this.a(dialogInterface, i);
|
||||
}
|
||||
}).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.h
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public final void onClick(DialogInterface dialogInterface, int i) {
|
||||
SplashActivity.this.b(dialogInterface, i);
|
||||
}
|
||||
}).build();
|
||||
this.c.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ubt.jimu.d
|
||||
@Override // android.content.DialogInterface.OnKeyListener
|
||||
public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
return SplashActivity.a(dialogInterface, i, keyEvent);
|
||||
}
|
||||
});
|
||||
this.c.show();
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void e(boolean z) {
|
||||
G0();
|
||||
f(z);
|
||||
}
|
||||
|
||||
private void f(boolean z) {
|
||||
if (z) {
|
||||
JimuAnalyticsUtil.a(this);
|
||||
JimuAnalytics.b().a(z);
|
||||
} else {
|
||||
ALog.b("未打开体验优化", new Object[0]);
|
||||
}
|
||||
BuglyUtil.a(z);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
SPUtils.a(Constant.NoviceGuide.APP_HAS_PAUSE, true);
|
||||
final int versionCode = Cache.getInstance().getVersionCode();
|
||||
if (versionCode <= 0) {
|
||||
Cache.getInstance().clearCacheUser();
|
||||
UserDbHandler.clearUser();
|
||||
}
|
||||
Cache.getInstance().putInt(Constant.Cache.APP_VERSION_CODE, 3960075);
|
||||
Cache.getInstance().putInt(SharePreferenceHelper.SP_KEY_CONNECTION_STATUS, ConnectionStatus.DIS_CONNECT.getStatus());
|
||||
ThreadManagerUtils.a().a(new Runnable() { // from class: com.ubt.jimu.SplashActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (versionCode <= 0) {
|
||||
ALog.a("upgrade").d("新安装或者从2.x更新过来:versionCode=" + versionCode);
|
||||
new Version2DbUpgrade().migrate(JimuApplication.l());
|
||||
JimuSoundDbHandler.update2Version3();
|
||||
}
|
||||
VersionUpgrade.doUpgrade();
|
||||
SplashActivity.this.E0();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public /* synthetic */ void D0() {
|
||||
ARouter.b().a("/page/main").t();
|
||||
finish();
|
||||
}
|
||||
|
||||
public void E0() {
|
||||
OfflineDataUploadTool.h().d();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper
|
||||
protected void attachBaseContext(Context context) {
|
||||
super.attachBaseContext(new ContextWrapper(this, context) { // from class: com.ubt.jimu.SplashActivity.3
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Object getSystemService(String str) {
|
||||
return "audio".equals(str) ? getApplicationContext().getSystemService(str) : super.getSystemService(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.activity_splash);
|
||||
ButterKnife.a(this);
|
||||
I0();
|
||||
if (getIntent() == null || (getIntent().getFlags() & 4194304) == 0) {
|
||||
L0();
|
||||
} else {
|
||||
XLog.a("splash", "brought to front, finish, do nothing");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
ThreadManagerUtils.a().a();
|
||||
super.onDestroy();
|
||||
((AudioManager) getSystemService("audio")).abandonAudioFocus(null);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
VideoView videoView = this.videoView;
|
||||
if (videoView != null) {
|
||||
this.a = videoView.getCurrentPosition();
|
||||
this.videoView.pause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
VideoView videoView = this.videoView;
|
||||
if (videoView != null) {
|
||||
videoView.seekTo(this.a);
|
||||
this.videoView.start();
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void b(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
e(true);
|
||||
SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE, true);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(MediaPlayer mediaPlayer) {
|
||||
LegalExamineDialog legalExamineDialog = this.b;
|
||||
if (legalExamineDialog == null || !legalExamineDialog.isShowing()) {
|
||||
JimuSimpleDialog jimuSimpleDialog = this.c;
|
||||
if (jimuSimpleDialog == null || !jimuSimpleDialog.isShowing()) {
|
||||
new SharePreferenceHelper().put(SharePreferenceHelper.SP_KEY_START_FROM_SPLASH, true);
|
||||
if (((!SPUtils.a(Constant.NoviceGuide.AGREE_LEGAL_EXAMINE)) || J0()) && LocaleUtils.g()) {
|
||||
if (this.b == null) {
|
||||
this.b = new LegalExamineDialog.Builder(this).onLegalResult(new LegalExamineDialog.LegalResult() { // from class: com.ubt.jimu.SplashActivity.2
|
||||
@Override // com.ubt.jimu.base.dialog.LegalExamineDialog.LegalResult
|
||||
public void pass() {
|
||||
SplashActivity.this.b.dismiss();
|
||||
SplashActivity.this.F0();
|
||||
if (SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE)) {
|
||||
SplashActivity.this.e(true);
|
||||
} else {
|
||||
SplashActivity.this.N0();
|
||||
}
|
||||
PrivacyVersion M0 = SplashActivity.this.M0();
|
||||
if (M0 != null) {
|
||||
SPUtils.a(Constant.Privacy.SP_KEY_PRIVACY_POLICY_VERSION, M0.getJimuPrivacyPolicyVersion());
|
||||
SPUtils.a(Constant.Privacy.SP_KEY_CHILD_PRIVACY_POLICY_VERSION, M0.getJimuChildrenPrivacyPolicyVersion());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.dialog.LegalExamineDialog.LegalResult
|
||||
public void reject() {
|
||||
SplashActivity.this.b.dismiss();
|
||||
SplashActivity.this.finish();
|
||||
}
|
||||
}).build();
|
||||
this.b.show();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!LocaleUtils.g() && !SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE) && !SPUtils.a(Constant.NoviceGuide.APP_HAS_PAUSE)) {
|
||||
N0();
|
||||
F0();
|
||||
} else {
|
||||
e(true);
|
||||
F0();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
e(false);
|
||||
SPUtils.a(Constant.NoviceGuide.JOIN_USER_EXPERIENCE, false);
|
||||
}
|
||||
}
|
26
sources/com/ubt/jimu/SplashActivity_ViewBinding.java
Normal file
26
sources/com/ubt/jimu/SplashActivity_ViewBinding.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.VideoView;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SplashActivity_ViewBinding implements Unbinder {
|
||||
private SplashActivity b;
|
||||
|
||||
public SplashActivity_ViewBinding(SplashActivity splashActivity, View view) {
|
||||
this.b = splashActivity;
|
||||
splashActivity.videoView = (VideoView) Utils.b(view, R.id.video_view, "field 'videoView'", VideoView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
SplashActivity splashActivity = this.b;
|
||||
if (splashActivity == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.b = null;
|
||||
splashActivity.videoView = null;
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/ViewImpl.java
Normal file
8
sources/com/ubt/jimu/ViewImpl.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ViewImpl {
|
||||
View getRootView();
|
||||
}
|
12
sources/com/ubt/jimu/activity/PresenterActivity.java
Normal file
12
sources/com/ubt/jimu/activity/PresenterActivity.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.ubt.jimu.activity;
|
||||
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class PresenterActivity<P> extends BaseActivity {
|
||||
protected P a;
|
||||
|
||||
public void setPresenter(P p) {
|
||||
this.a = p;
|
||||
}
|
||||
}
|
92
sources/com/ubt/jimu/adapter/CreativityListAdapter.java
Normal file
92
sources/com/ubt/jimu/adapter/CreativityListAdapter.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package com.ubt.jimu.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.CreativeListResultBean;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CreativityListAdapter extends RecyclerView.Adapter<ViewContentHolder> {
|
||||
private Context a;
|
||||
List<CreativeListResultBean.RecordsBean> b;
|
||||
private ItemOnClickListener c;
|
||||
|
||||
public interface ItemOnClickListener {
|
||||
void a(int i, int i2);
|
||||
}
|
||||
|
||||
public class ViewContentHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView a;
|
||||
public ImageView b;
|
||||
public RelativeLayout c;
|
||||
public TextView d;
|
||||
public TextView e;
|
||||
public TextView f;
|
||||
public TextView g;
|
||||
|
||||
public ViewContentHolder(CreativityListAdapter creativityListAdapter, View view) {
|
||||
super(view);
|
||||
this.a = (ImageView) view.findViewById(R.id.im_inspire_photo);
|
||||
this.c = (RelativeLayout) view.findViewById(R.id.rl_item_layout);
|
||||
this.b = (ImageView) view.findViewById(R.id.im_inspire_video);
|
||||
this.e = (TextView) view.findViewById(R.id.tv_inspire_title);
|
||||
this.d = (TextView) view.findViewById(R.id.tv_inspire_nick);
|
||||
this.f = (TextView) view.findViewById(R.id.tv_inspire_content);
|
||||
this.g = (TextView) view.findViewById(R.id.tv_no_more);
|
||||
}
|
||||
}
|
||||
|
||||
public CreativityListAdapter(Context context) {
|
||||
this.a = context;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
List<CreativeListResultBean.RecordsBean> list = this.b;
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void a(List<CreativeListResultBean.RecordsBean> list) {
|
||||
this.b = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public ViewContentHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
return new ViewContentHolder(this, View.inflate(this.a, R.layout.item_inspire_layout, null));
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onBindViewHolder(ViewContentHolder viewContentHolder, final int i) {
|
||||
final CreativeListResultBean.RecordsBean recordsBean = this.b.get(i);
|
||||
viewContentHolder.g.setVisibility(i == this.b.size() + (-1) ? 0 : 8);
|
||||
viewContentHolder.b.setVisibility(recordsBean.getPostIcon() != 3 ? 8 : 0);
|
||||
viewContentHolder.d.setText(this.a.getResources().getString(R.string.from) + recordsBean.getNickName());
|
||||
viewContentHolder.e.setText(recordsBean.getTitle() + "");
|
||||
viewContentHolder.f.setText(recordsBean.getContent() + "");
|
||||
Glide.e(this.a.getApplicationContext()).a(recordsBean.getCoverUrl()).a(viewContentHolder.a);
|
||||
viewContentHolder.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.adapter.CreativityListAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (CreativityListAdapter.this.c != null) {
|
||||
CreativityListAdapter.this.c.a(i, recordsBean.getPostId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(ItemOnClickListener itemOnClickListener) {
|
||||
this.c = itemOnClickListener;
|
||||
}
|
||||
}
|
41
sources/com/ubt/jimu/adapter/GuideViewPagerAdapter.java
Normal file
41
sources/com/ubt/jimu/adapter/GuideViewPagerAdapter.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GuideViewPagerAdapter extends PagerAdapter {
|
||||
List<View> a;
|
||||
|
||||
public GuideViewPagerAdapter(List<View> list) {
|
||||
this.a = list;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
viewGroup.removeView((View) obj);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
List<View> list = this.a;
|
||||
if (list == null || list.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.a.size();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public Object instantiateItem(ViewGroup viewGroup, int i) {
|
||||
View view = this.a.get(i);
|
||||
viewGroup.addView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public boolean isViewFromObject(View view, Object obj) {
|
||||
return view == obj;
|
||||
}
|
||||
}
|
150
sources/com/ubt/jimu/adapter/PreviewListAdapter.java
Normal file
150
sources/com/ubt/jimu/adapter/PreviewListAdapter.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package com.ubt.jimu.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
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.entities.PublishItemBean;
|
||||
import com.ubt.jimu.base.entities.PublishType;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PreviewListAdapter extends RecyclerView.Adapter {
|
||||
private PublishItemBean a;
|
||||
private Context b;
|
||||
private List<PublishItemBean.ItemBean> c;
|
||||
private PreviewItemLisener d;
|
||||
|
||||
class PreviewImageViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView a;
|
||||
private ImageView b;
|
||||
private TextView c;
|
||||
private View d;
|
||||
|
||||
public PreviewImageViewHolder(PreviewListAdapter previewListAdapter, View view) {
|
||||
super(view);
|
||||
this.d = view;
|
||||
this.a = (ImageView) view.findViewById(R.id.im_preview_image);
|
||||
this.b = (ImageView) view.findViewById(R.id.im_preview_play);
|
||||
this.c = (TextView) view.findViewById(R.id.et_image_des);
|
||||
}
|
||||
}
|
||||
|
||||
public interface PreviewItemLisener {
|
||||
void i(int i);
|
||||
|
||||
void k(int i);
|
||||
}
|
||||
|
||||
class PreviewTextViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView a;
|
||||
TextView b;
|
||||
View c;
|
||||
|
||||
public PreviewTextViewHolder(PreviewListAdapter previewListAdapter, View view) {
|
||||
super(view);
|
||||
this.a = (TextView) view.findViewById(R.id.tv_preview_des);
|
||||
this.b = (TextView) view.findViewById(R.id.tv_preview_title);
|
||||
this.c = view.findViewById(R.id.view_head);
|
||||
}
|
||||
}
|
||||
|
||||
public PreviewListAdapter(Context context) {
|
||||
this.b = context;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
List<PublishItemBean.ItemBean> list;
|
||||
if (this.a == null || (list = this.c) == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
if (i == 0) {
|
||||
return 2;
|
||||
}
|
||||
return (this.c.get(i).getItemType() == PublishType.IMAGE || this.c.get(i).getItemType() == PublishType.VIDEO) ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int i) {
|
||||
final PublishItemBean.ItemBean itemBean = this.c.get(i);
|
||||
if (i == 0 && (viewHolder instanceof PreviewTextViewHolder)) {
|
||||
((PreviewTextViewHolder) viewHolder).c.setVisibility(0);
|
||||
} else if (i != 0 && (viewHolder instanceof PreviewTextViewHolder)) {
|
||||
((PreviewTextViewHolder) viewHolder).c.setVisibility(8);
|
||||
}
|
||||
if (i == 0 && (viewHolder instanceof PreviewTextViewHolder)) {
|
||||
PreviewTextViewHolder previewTextViewHolder = (PreviewTextViewHolder) viewHolder;
|
||||
previewTextViewHolder.b.setVisibility(0);
|
||||
previewTextViewHolder.b.setText(TextUtils.isEmpty(this.a.getTitle()) ? " " : this.a.getTitle());
|
||||
previewTextViewHolder.a.setText(TextUtils.isEmpty(itemBean.getProcedureDes()) ? " " : itemBean.getProcedureDes());
|
||||
return;
|
||||
}
|
||||
if (!(viewHolder instanceof PreviewImageViewHolder)) {
|
||||
PreviewTextViewHolder previewTextViewHolder2 = (PreviewTextViewHolder) viewHolder;
|
||||
previewTextViewHolder2.b.setVisibility(i == 0 ? 0 : 8);
|
||||
previewTextViewHolder2.a.setText(TextUtils.isEmpty(itemBean.getProcedureDes()) ? " " : itemBean.getProcedureDes());
|
||||
return;
|
||||
}
|
||||
String loadPath = itemBean.getLoadPath();
|
||||
String trim = itemBean.getProcedureDes().trim();
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(new File(loadPath));
|
||||
a.a(new RequestOptions().b());
|
||||
PreviewImageViewHolder previewImageViewHolder = (PreviewImageViewHolder) viewHolder;
|
||||
a.a(previewImageViewHolder.a);
|
||||
if (TextUtils.isEmpty(trim)) {
|
||||
previewImageViewHolder.c.setVisibility(8);
|
||||
} else {
|
||||
previewImageViewHolder.c.setVisibility(0);
|
||||
previewImageViewHolder.c.setText(trim);
|
||||
}
|
||||
previewImageViewHolder.b.setVisibility(itemBean.getItemType() != PublishType.IMAGE ? 0 : 8);
|
||||
previewImageViewHolder.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.adapter.PreviewListAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (itemBean.getItemType() == PublishType.IMAGE && PreviewListAdapter.this.d != null) {
|
||||
PreviewListAdapter.this.d.k(i);
|
||||
}
|
||||
if (itemBean.getItemType() != PublishType.VIDEO || PreviewListAdapter.this.d == null) {
|
||||
return;
|
||||
}
|
||||
PreviewListAdapter.this.d.i(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
if (i == 1) {
|
||||
return new PreviewImageViewHolder(this, View.inflate(this.b, R.layout.item_preview_image_layout, null));
|
||||
}
|
||||
if (i != 2) {
|
||||
return null;
|
||||
}
|
||||
return new PreviewTextViewHolder(this, View.inflate(this.b, R.layout.item_preview_text_layout, null));
|
||||
}
|
||||
|
||||
public void a(PublishItemBean publishItemBean) {
|
||||
this.a = publishItemBean;
|
||||
this.c = publishItemBean.getItemBeanArray();
|
||||
}
|
||||
|
||||
public void a(PreviewItemLisener previewItemLisener) {
|
||||
this.d = previewItemLisener;
|
||||
}
|
||||
}
|
23
sources/com/ubt/jimu/analytics/AppDelayInit.java
Normal file
23
sources/com/ubt/jimu/analytics/AppDelayInit.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.ubt.jimu.analytics;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.http.ApiClient;
|
||||
import com.ubt.jimu.base.http.ApiConfiguration;
|
||||
import com.ubt.jimu.base.http.ApiConstants;
|
||||
import com.ubt.jimu.upload.AliYunUploadHttp;
|
||||
import com.ubt.jimu.upload.DataUploadProxy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppDelayInit {
|
||||
private static boolean a = false;
|
||||
|
||||
public static final void a(Context context) {
|
||||
if (a) {
|
||||
return;
|
||||
}
|
||||
ApiClient.initApiClient(new ApiConfiguration.Builder().baseUrl(ApiConstants.getHostUrl()).debug(false).headers(ApiConstants.getHeaderParams()).verifiedHostNames(ApiConstants.getVerifiedHostNames()).build());
|
||||
DataUploadProxy.c().a(new AliYunUploadHttp());
|
||||
BuglyUtil.a(context.getApplicationContext());
|
||||
a = true;
|
||||
}
|
||||
}
|
19
sources/com/ubt/jimu/analytics/BuglyUtil.java
Normal file
19
sources/com/ubt/jimu/analytics/BuglyUtil.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.ubt.jimu.analytics;
|
||||
|
||||
import android.content.Context;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.ubt.jimu.utils.PackageHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BuglyUtil {
|
||||
public static void a(Context context) {
|
||||
CrashReport.UserStrategy userStrategy = new CrashReport.UserStrategy(context.getApplicationContext());
|
||||
userStrategy.setAppChannel(PackageHelper.a("CHANNEL_ID"));
|
||||
CrashReport.initCrashReport(context.getApplicationContext(), "05931603ef", false, userStrategy);
|
||||
CrashReport.enableBugly(false);
|
||||
}
|
||||
|
||||
public static void a(boolean z) {
|
||||
CrashReport.enableBugly(z);
|
||||
}
|
||||
}
|
18
sources/com/ubt/jimu/analytics/JimuAnalyticsUtil.java
Normal file
18
sources/com/ubt/jimu/analytics/JimuAnalyticsUtil.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.ubt.jimu.analytics;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.db.user.UserDbHandler;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.utils.PackageHelper;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuAnalyticsUtil {
|
||||
public static void a(Context context) {
|
||||
JimuAnalytics.b().a(context.getApplicationContext());
|
||||
JimuAnalytics.b().b(false);
|
||||
String a = PackageHelper.a("CHANNEL_ID");
|
||||
User user = UserDbHandler.getUser();
|
||||
JimuAnalytics.b().a(user != null ? String.valueOf(user.getUserId()) : "0", a);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.ar.contract;
|
||||
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubtech.presenter.BasePresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface GameListContract$Presenter extends BasePresenter {
|
||||
void a(Package r1, Robot robot);
|
||||
|
||||
void a(String str);
|
||||
|
||||
boolean h();
|
||||
}
|
23
sources/com/ubt/jimu/ar/contract/GameListContract$View.java
Normal file
23
sources/com/ubt/jimu/ar/contract/GameListContract$View.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.ubt.jimu.ar.contract;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubtech.view.BaseView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface GameListContract$View extends BaseView<GameListContract$Presenter> {
|
||||
void a(DownloadTask downloadTask);
|
||||
|
||||
void a(Robot robot);
|
||||
|
||||
Context b();
|
||||
|
||||
void b(Robot robot);
|
||||
|
||||
void onDownloadFail();
|
||||
|
||||
void onProgress(int i, int i2, int i3);
|
||||
|
||||
void onStartDownload();
|
||||
}
|
25
sources/com/ubt/jimu/ar/model/ArGameSupportModel.java
Normal file
25
sources/com/ubt/jimu/ar/model/ArGameSupportModel.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.ubt.jimu.ar.model;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.utils.DeviceUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ArGameSupportModel {
|
||||
private Context a = JimuApplication.l().getApplicationContext();
|
||||
|
||||
public boolean a() {
|
||||
if (Build.VERSION.SDK_INT < 23 || DeviceUtils.a() < 4) {
|
||||
return false;
|
||||
}
|
||||
ActivityManager.MemoryInfo c = DeviceUtils.c(this.a);
|
||||
if (c != null) {
|
||||
return ((c.totalMem >> 10) >> 10) >= 1000;
|
||||
}
|
||||
Log.e("ArGameSupportModel", "Get memory info fail!");
|
||||
return false;
|
||||
}
|
||||
}
|
118
sources/com/ubt/jimu/ar/presenter/GameListPresenterImp.java
Normal file
118
sources/com/ubt/jimu/ar/presenter/GameListPresenterImp.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package com.ubt.jimu.ar.presenter;
|
||||
|
||||
import android.util.Log;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$Presenter;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$View;
|
||||
import com.ubt.jimu.ar.model.ArGameSupportModel;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.robot.RobotDbHandler;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.download.Downloader;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.discover.CourseRepository;
|
||||
import com.ubt.jimu.utils.RxSchedulers;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GameListPresenterImp implements GameListContract$Presenter {
|
||||
private ArGameSupportModel a;
|
||||
private GameListContract$View b;
|
||||
private CompositeDisposable c;
|
||||
|
||||
public GameListPresenterImp(GameListContract$View gameListContract$View) {
|
||||
Executors.newSingleThreadExecutor();
|
||||
this.c = new CompositeDisposable();
|
||||
this.b = gameListContract$View;
|
||||
this.a = new ArGameSupportModel();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$Presenter
|
||||
public boolean h() {
|
||||
return this.a.a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$Presenter
|
||||
public void a(Package r3, Robot robot) {
|
||||
if (r3 != null && robot != null) {
|
||||
Cache.getInstance().setPackageName(r3.getPackageName());
|
||||
Cache.getInstance().setRobot(robot);
|
||||
Cache.getInstance().setPackageId(r3.getId());
|
||||
Cache.getInstance().setPackageImagePath(r3.getPackageImage());
|
||||
return;
|
||||
}
|
||||
Log.e("GameListPresenterImp", "Package or robot is null. package:" + r3 + " robot:" + robot);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$Presenter
|
||||
public void a(String str) {
|
||||
Robot robotByModelName = RobotDbHandler.getRobotByModelName(str);
|
||||
if (robotByModelName != null) {
|
||||
if (!robotByModelName.isAllDownloaded()) {
|
||||
a(robotByModelName);
|
||||
return;
|
||||
} else {
|
||||
this.b.b(robotByModelName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
CourseRepository.a(this.b.b(), "dujiaoshou").compose(RxSchedulers.a()).subscribe(new Observer<Robot>() { // from class: com.ubt.jimu.ar.presenter.GameListPresenterImp.1
|
||||
@Override // io.reactivex.Observer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onNext(Robot robot) {
|
||||
if (robot == null || robot.getState() == -100) {
|
||||
GameListPresenterImp.this.b.onDownloadFail();
|
||||
} else if (robot.isAllDownloaded()) {
|
||||
GameListPresenterImp.this.b.b(robot);
|
||||
} else {
|
||||
GameListPresenterImp.this.a(robot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
Log.e("GameListPresenterImp", "Get model info by model name fail!", th);
|
||||
GameListPresenterImp.this.b.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
Log.i("GameListPresenterImp", "onSubscribe");
|
||||
GameListPresenterImp.this.c.b(disposable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public DownloadTask a(final Robot robot) {
|
||||
DownloadTask downloadJimuRobot = Downloader.downloadJimuRobot(robot, new Downloader.IDownloadJimuRobotListener() { // from class: com.ubt.jimu.ar.presenter.GameListPresenterImp.2
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onFailed() {
|
||||
GameListPresenterImp.this.b.onDownloadFail();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onPrepareStart() {
|
||||
GameListPresenterImp.this.b.onStartDownload();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
GameListPresenterImp.this.b.onProgress(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.download.Downloader.IDownloadJimuRobotListener
|
||||
public void onSuccess() {
|
||||
GameListPresenterImp.this.b.a(robot);
|
||||
}
|
||||
});
|
||||
this.b.a(downloadJimuRobot);
|
||||
return downloadJimuRobot;
|
||||
}
|
||||
}
|
278
sources/com/ubt/jimu/ar/view/GameListActivity.java
Normal file
278
sources/com/ubt/jimu/ar/view/GameListActivity.java
Normal file
@@ -0,0 +1,278 @@
|
||||
package com.ubt.jimu.ar.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$Presenter;
|
||||
import com.ubt.jimu.ar.contract.GameListContract$View;
|
||||
import com.ubt.jimu.ar.presenter.GameListPresenterImp;
|
||||
import com.ubt.jimu.base.download.DownloadTask;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GameListActivity extends BaseActivity implements GameListContract$View, View.OnClickListener {
|
||||
private NavigationBarView a;
|
||||
private ImageView b;
|
||||
private ImageView c;
|
||||
private ImageView d;
|
||||
private ImageView e;
|
||||
private View f;
|
||||
private ImageView g;
|
||||
private TextView h;
|
||||
private RelativeLayout i;
|
||||
private GameListContract$Presenter j;
|
||||
private AnimationDrawable k;
|
||||
private Handler l;
|
||||
public Package m;
|
||||
private volatile int o;
|
||||
private DownloadTask q;
|
||||
private Runnable n = new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameListActivity.this.F0();
|
||||
}
|
||||
};
|
||||
private boolean p = false;
|
||||
|
||||
private void E0() {
|
||||
this.j.a("dujiaoshou");
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void F0() {
|
||||
AnimationSet animationSet = new AnimationSet(true);
|
||||
AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
|
||||
alphaAnimation.setDuration(5000L);
|
||||
animationSet.addAnimation(alphaAnimation);
|
||||
animationSet.setFillAfter(true);
|
||||
this.i.startAnimation(animationSet);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setContentView(R.layout.activity_ar_game_list);
|
||||
this.a = (NavigationBarView) findViewById(R.id.nbv_bar);
|
||||
this.a.setTitleColor(-1);
|
||||
this.b = (ImageView) findViewById(R.id.iv_butterfly1);
|
||||
this.c = (ImageView) findViewById(R.id.iv_butterfly2);
|
||||
this.d = (ImageView) findViewById(R.id.iv_butterfly3);
|
||||
this.e = (ImageView) findViewById(R.id.iv_butterfly4);
|
||||
findViewById(R.id.img_rainbow_world).setOnClickListener(this);
|
||||
findViewById(R.id.img_flower_world).setOnClickListener(this);
|
||||
this.f = findViewById(R.id.fl_download);
|
||||
this.f.setVisibility(8);
|
||||
this.g = (ImageView) findViewById(R.id.iv_loading);
|
||||
this.h = (TextView) findViewById(R.id.tv_progress);
|
||||
this.i = (RelativeLayout) findViewById(R.id.rl_warning);
|
||||
}
|
||||
|
||||
public void D0() {
|
||||
new SimpleDialog.Builder(this).d(R.string.ok).b(new DialogInterface.OnClickListener(this) { // from class: com.ubt.jimu.ar.view.GameListActivity.5
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).a((CharSequence) getString(R.string.device_not_support_ar)).a().show();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.img_flower_world) {
|
||||
this.o = 2;
|
||||
if (this.j.h()) {
|
||||
E0();
|
||||
return;
|
||||
} else {
|
||||
D0();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id != R.id.img_rainbow_world) {
|
||||
Log.e(this.TAG, "");
|
||||
return;
|
||||
}
|
||||
this.o = 1;
|
||||
if (this.j.h()) {
|
||||
E0();
|
||||
} else {
|
||||
D0();
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
initView();
|
||||
this.j = new GameListPresenterImp(this);
|
||||
this.l = new Handler(getMainLooper());
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
this.m = (Package) intent.getSerializableExtra("PACKAGE");
|
||||
}
|
||||
if (this.m == null) {
|
||||
this.i.setVisibility(8);
|
||||
} else {
|
||||
this.i.setVisibility(0);
|
||||
this.l.postDelayed(this.n, 5000L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onDestroy() {
|
||||
DownloadTask downloadTask = this.q;
|
||||
if (downloadTask != null) {
|
||||
downloadTask.pause();
|
||||
this.q = null;
|
||||
}
|
||||
this.b.clearAnimation();
|
||||
this.c.clearAnimation();
|
||||
this.d.clearAnimation();
|
||||
this.e.clearAnimation();
|
||||
this.i.clearAnimation();
|
||||
this.l.removeCallbacks(this.n);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onDownloadFail() {
|
||||
this.p = false;
|
||||
toastError(getString(R.string.tips_download_failed));
|
||||
View view = this.f;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
}
|
||||
this.g.clearAnimation();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i == 4 && this.p) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onProgress(int i, int i2, int i3) {
|
||||
if (i == 1) {
|
||||
this.h.setText(i3 + "%");
|
||||
return;
|
||||
}
|
||||
int i4 = 100 / i;
|
||||
int i5 = (i2 * i4) - (((100 - i3) * i4) / 100);
|
||||
this.h.setText(i5 + "%");
|
||||
Log.i(this.TAG, "percent:" + i5);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void onStartDownload() {
|
||||
this.p = true;
|
||||
this.f.setVisibility(0);
|
||||
RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
|
||||
rotateAnimation.setRepeatCount(-1);
|
||||
rotateAnimation.setDuration(800L);
|
||||
rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
rotateAnimation.setRepeatMode(1);
|
||||
this.g.startAnimation(rotateAnimation);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity, android.view.Window.Callback
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
super.onWindowFocusChanged(z);
|
||||
if (z) {
|
||||
this.k = (AnimationDrawable) this.b.getDrawable();
|
||||
this.k.start();
|
||||
this.k = (AnimationDrawable) this.e.getDrawable();
|
||||
this.k.start();
|
||||
this.l.postDelayed(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameListActivity gameListActivity = GameListActivity.this;
|
||||
gameListActivity.k = (AnimationDrawable) gameListActivity.c.getDrawable();
|
||||
GameListActivity.this.k.start();
|
||||
GameListActivity gameListActivity2 = GameListActivity.this;
|
||||
gameListActivity2.k = (AnimationDrawable) gameListActivity2.d.getDrawable();
|
||||
GameListActivity.this.k.start();
|
||||
}
|
||||
}, 300L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void b(Robot robot) {
|
||||
Package r0;
|
||||
if (robot != null && (r0 = this.m) != null) {
|
||||
this.j.a(r0, robot);
|
||||
}
|
||||
int i = this.o;
|
||||
if (i == 1) {
|
||||
d(robot);
|
||||
} else if (i != 2) {
|
||||
Log.e(this.TAG, "Invalid gameId, do nothing");
|
||||
} else {
|
||||
c(robot);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(final Robot robot) {
|
||||
runOnUiThread(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.4
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
UnityActivity.gotoFlowerWorldGamePage(GameListActivity.this, robot);
|
||||
GameListActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void d(final Robot robot) {
|
||||
runOnUiThread(new Runnable() { // from class: com.ubt.jimu.ar.view.GameListActivity.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
UnityActivity.gotoRainbowWorldGamePage(GameListActivity.this, robot);
|
||||
GameListActivity.this.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void a(DownloadTask downloadTask) {
|
||||
this.q = downloadTask;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public void a(Robot robot) {
|
||||
if (this.q != null) {
|
||||
this.q = null;
|
||||
}
|
||||
View view = this.f;
|
||||
if (view != null) {
|
||||
view.setVisibility(8);
|
||||
this.g.clearAnimation();
|
||||
}
|
||||
b(robot);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ar.contract.GameListContract$View
|
||||
public Context b() {
|
||||
return getApplicationContext();
|
||||
}
|
||||
}
|
71
sources/com/ubt/jimu/base/BaseEventModel.java
Normal file
71
sources/com/ubt/jimu/base/BaseEventModel.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BaseEventModel {
|
||||
private ErrorEntity mEntity;
|
||||
private String url;
|
||||
|
||||
public static class ErrorEntity {
|
||||
private String error;
|
||||
private String message;
|
||||
private String path;
|
||||
private int status;
|
||||
private long timestamp;
|
||||
|
||||
public String getError() {
|
||||
return this.error;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
public void setError(String str) {
|
||||
this.error = str;
|
||||
}
|
||||
|
||||
public void setMessage(String str) {
|
||||
this.message = str;
|
||||
}
|
||||
|
||||
public void setPath(String str) {
|
||||
this.path = str;
|
||||
}
|
||||
|
||||
public void setStatus(int i) {
|
||||
this.status = i;
|
||||
}
|
||||
|
||||
public void setTimestamp(long j) {
|
||||
this.timestamp = j;
|
||||
}
|
||||
}
|
||||
|
||||
public ErrorEntity getEntity() {
|
||||
return this.mEntity;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setEntity(ErrorEntity errorEntity) {
|
||||
this.mEntity = errorEntity;
|
||||
}
|
||||
|
||||
public void setUrl(String str) {
|
||||
this.url = str;
|
||||
}
|
||||
}
|
28
sources/com/ubt/jimu/base/BasePresenter.java
Normal file
28
sources/com/ubt/jimu/base/BasePresenter.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class BasePresenter<V> {
|
||||
private WeakReference<V> mViewRef;
|
||||
|
||||
public void attachView(V v) {
|
||||
this.mViewRef = new WeakReference<>(v);
|
||||
}
|
||||
|
||||
public void detachView() {
|
||||
WeakReference<V> weakReference = this.mViewRef;
|
||||
if (weakReference != null) {
|
||||
weakReference.clear();
|
||||
this.mViewRef = null;
|
||||
}
|
||||
}
|
||||
|
||||
public V getView() {
|
||||
WeakReference<V> weakReference = this.mViewRef;
|
||||
if (weakReference != null) {
|
||||
return weakReference.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
200
sources/com/ubt/jimu/base/EngineManager.java
Normal file
200
sources/com/ubt/jimu/base/EngineManager.java
Normal file
@@ -0,0 +1,200 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.data.Engine;
|
||||
import com.ubt.jimu.base.data.Motor;
|
||||
import com.ubt.jimu.base.data.Servo;
|
||||
import com.ubt.jimu.base.data.ServoMode;
|
||||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||||
import com.ubt.jimu.base.db.diy.DiyHelper;
|
||||
import com.ubt.jimu.base.entities.RobotLite;
|
||||
import com.ubt.jimu.base.util.PathHelper;
|
||||
import com.ubt.jimu.connect.model.ModelMatchXmlFileManager;
|
||||
import com.ubt.jimu.connect.model.PeripheralConnections;
|
||||
import com.ubt.jimu.transport3.UnityFileOperator;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class EngineManager {
|
||||
private Context mContext;
|
||||
private PeripheralConnections mPeripheralConn;
|
||||
private RobotLite mRobotLite;
|
||||
private String mUserId;
|
||||
|
||||
public EngineManager(Context context, RobotLite robotLite) {
|
||||
this.mContext = context.getApplicationContext();
|
||||
this.mRobotLite = robotLite;
|
||||
}
|
||||
|
||||
private ModelMatchXmlFileManager createMatchFileManager() {
|
||||
ModelMatchXmlFileManager modelMatchXmlFileManager = new ModelMatchXmlFileManager();
|
||||
modelMatchXmlFileManager.a(PathHelper.getDataRootDir(this.mContext, this.mRobotLite, false) + File.separator + this.mRobotLite.getModelId() + ".xml");
|
||||
return modelMatchXmlFileManager;
|
||||
}
|
||||
|
||||
private List<Engine> getEnginesFromMatchFile() {
|
||||
ModelMatchXmlFileManager createMatchFileManager = createMatchFileManager();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
List<Motor> motorsFromMatchFile = getMotorsFromMatchFile(createMatchFileManager);
|
||||
if (motorsFromMatchFile != null && motorsFromMatchFile.size() > 0) {
|
||||
arrayList.addAll(motorsFromMatchFile);
|
||||
}
|
||||
List<Servo> servosFromMatchFile = getServosFromMatchFile(createMatchFileManager);
|
||||
if (servosFromMatchFile != null && servosFromMatchFile.size() > 0) {
|
||||
arrayList.addAll(servosFromMatchFile);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private List<Engine> getEnginesFromPeripheralFile() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
List<Motor> motorsFromPeripheralFile = getMotorsFromPeripheralFile();
|
||||
if (motorsFromPeripheralFile != null && motorsFromPeripheralFile.size() > 0) {
|
||||
arrayList.addAll(motorsFromPeripheralFile);
|
||||
}
|
||||
List<Servo> servosFromPeripheralFile = getServosFromPeripheralFile();
|
||||
if (servosFromPeripheralFile != null && servosFromPeripheralFile.size() > 0) {
|
||||
arrayList.addAll(servosFromPeripheralFile);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private List<Motor> getMotorsFromMatchFile(ModelMatchXmlFileManager modelMatchXmlFileManager) {
|
||||
List<Integer> a = modelMatchXmlFileManager.a();
|
||||
if (a == null || a.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(a.size());
|
||||
Iterator<Integer> it = a.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(new Motor(it.next().intValue()));
|
||||
}
|
||||
Collections.sort(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private List<Motor> getMotorsFromPeripheralFile() {
|
||||
List<Integer> a = this.mPeripheralConn.a(10);
|
||||
if (a == null || a.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(a.size());
|
||||
Iterator<Integer> it = a.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(new Motor(it.next().intValue()));
|
||||
}
|
||||
Collections.sort(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private List<Servo> getServosFromMatchFile(ModelMatchXmlFileManager modelMatchXmlFileManager) {
|
||||
List<Integer> b = modelMatchXmlFileManager.b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(b.size());
|
||||
Iterator<Integer> it = b.iterator();
|
||||
while (it.hasNext()) {
|
||||
arrayList.add(new Servo(it.next().intValue(), ServoMode.SERVO_MODE_ANGLE));
|
||||
}
|
||||
Collections.sort(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private List<Servo> getServosFromPeripheralFile() {
|
||||
HashMap<Integer, ServoMode> c = this.mPeripheralConn.c();
|
||||
if (c == null || c.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(c.size());
|
||||
Iterator<Integer> it = c.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
int intValue = it.next().intValue();
|
||||
arrayList.add(new Servo(intValue, c.get(Integer.valueOf(intValue))));
|
||||
}
|
||||
Collections.sort(arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void createPeripheralConn(String str) {
|
||||
if (this.mPeripheralConn == null) {
|
||||
this.mPeripheralConn = PeripheralConnections.a(this.mRobotLite.getModelId(), str, !this.mRobotLite.isOfficial());
|
||||
} else if (!str.equals(this.mUserId)) {
|
||||
this.mPeripheralConn = PeripheralConnections.a(this.mRobotLite.getModelId(), str, !this.mRobotLite.isOfficial());
|
||||
}
|
||||
this.mUserId = str;
|
||||
}
|
||||
|
||||
public List<Engine> getEngineList(String str) {
|
||||
if (this.mRobotLite == null || TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
createPeripheralConn(str);
|
||||
if (this.mPeripheralConn != null) {
|
||||
return getEnginesFromPeripheralFile();
|
||||
}
|
||||
XLog.b("woo", "Robot %s has no servos.txt", this.mRobotLite.getModelId());
|
||||
return getEnginesFromMatchFile();
|
||||
}
|
||||
|
||||
public List<Motor> getMotorList(String str) {
|
||||
if (this.mRobotLite == null || TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
createPeripheralConn(str);
|
||||
if (this.mPeripheralConn != null) {
|
||||
return getMotorsFromPeripheralFile();
|
||||
}
|
||||
XLog.b("woo", "Robot %s has no servos.txt", this.mRobotLite.getModelId());
|
||||
return getMotorsFromMatchFile(createMatchFileManager());
|
||||
}
|
||||
|
||||
public List<Servo> getServoList(String str) {
|
||||
if (this.mRobotLite == null || TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
createPeripheralConn(str);
|
||||
if (this.mPeripheralConn != null) {
|
||||
return getServosFromPeripheralFile();
|
||||
}
|
||||
XLog.b("woo", "Robot %s has no servos.txt", this.mRobotLite.getModelId());
|
||||
return getServosFromMatchFile(createMatchFileManager());
|
||||
}
|
||||
|
||||
public ServoMode getServoMode(int i) {
|
||||
PeripheralConnections peripheralConnections = this.mPeripheralConn;
|
||||
return (peripheralConnections == null || i <= 0) ? ServoMode.SERVO_MODE_ANGLE : peripheralConnections.a(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public void reloadPeripheralConn() {
|
||||
this.mPeripheralConn = PeripheralConnections.a(this.mRobotLite.getModelId(), this.mUserId, !this.mRobotLite.isOfficial());
|
||||
}
|
||||
|
||||
public void save() {
|
||||
DiyDBModel queryForUUid;
|
||||
if (this.mPeripheralConn != null) {
|
||||
String dataRootDir = PathHelper.getDataRootDir(this.mContext, this.mRobotLite, false);
|
||||
this.mPeripheralConn.b(dataRootDir);
|
||||
String d = PeripheralConnections.d(dataRootDir);
|
||||
if (this.mRobotLite.isOfficial() || (queryForUUid = DiyHelper.getInstance().queryForUUid(this.mRobotLite.getModelId())) == null) {
|
||||
return;
|
||||
}
|
||||
new UnityFileOperator(queryForUUid.getModelId().intValue(), queryForUUid.getCustomModelId(), 1, d, 2).operateFile();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateServoMode(Servo servo) {
|
||||
PeripheralConnections peripheralConnections = this.mPeripheralConn;
|
||||
if (peripheralConnections == null || servo == null) {
|
||||
return;
|
||||
}
|
||||
peripheralConnections.a(Integer.valueOf(servo.getId()), servo.getModeType());
|
||||
}
|
||||
}
|
136
sources/com/ubt/jimu/base/HelpActivity.java
Normal file
136
sources/com/ubt/jimu/base/HelpActivity.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import butterknife.ButterKnife;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.HelpFragment;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HelpActivity extends BaseActivity implements HelpFragment.OnHelpFragmentInteractionListener {
|
||||
private static final String ACTIONBAR_BG_COLOR = "actionbarBackgroundColorResId";
|
||||
private static final String FROM_MAIN = "fromMain";
|
||||
private static final String TITLE = "title";
|
||||
private static final String URL = "url";
|
||||
private int actionbarBackgroundColorResId;
|
||||
private boolean fromMain;
|
||||
private HelpFragment helpFragment;
|
||||
private String title;
|
||||
private String url;
|
||||
|
||||
public static void start(Activity activity, String str) {
|
||||
start(activity, str, "", R.color.color_community_title);
|
||||
}
|
||||
|
||||
public static void startForResultFromFragment(int i, Fragment fragment, Context context, String str, String str2, int i2, boolean z) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, (Class<?>) HelpActivity.class);
|
||||
intent.putExtra("url", str);
|
||||
intent.putExtra("title", str2);
|
||||
intent.putExtra(ACTIONBAR_BG_COLOR, i2);
|
||||
intent.putExtra(FROM_MAIN, z);
|
||||
fragment.startActivityForResult(intent, i);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.activity_help);
|
||||
ButterKnife.a(this);
|
||||
if (bundle != null) {
|
||||
this.url = bundle.getString("url");
|
||||
this.title = bundle.getString("title");
|
||||
this.actionbarBackgroundColorResId = bundle.getInt(ACTIONBAR_BG_COLOR);
|
||||
this.fromMain = bundle.getBoolean(FROM_MAIN, false);
|
||||
} else {
|
||||
this.url = getIntent().getStringExtra("url");
|
||||
this.title = getIntent().getStringExtra("title");
|
||||
this.actionbarBackgroundColorResId = getIntent().getIntExtra(ACTIONBAR_BG_COLOR, R.color.color_community_title);
|
||||
this.fromMain = getIntent().getBooleanExtra(FROM_MAIN, false);
|
||||
}
|
||||
this.helpFragment = HelpFragment.newInstance(this.url, this.title, this.actionbarBackgroundColorResId);
|
||||
this.helpFragment.setListener(this);
|
||||
FragmentTransaction a = getSupportFragmentManager().a();
|
||||
a.b(R.id.frameLayout, this.helpFragment);
|
||||
a.a();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
LogUtils.c("onDestroy onDestroy");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.HelpFragment.OnHelpFragmentInteractionListener
|
||||
public void onHelpPageBack() {
|
||||
LogUtils.c("onHelpPageBackonHelpPageBackonHelpPageBack");
|
||||
if (this.fromMain) {
|
||||
UnityActivity.startUnityActivity(this, Cache.getInstance().getRobot(), 8, 8, UnityActivity.BLOCKLY_TYPE_NONE);
|
||||
}
|
||||
setResult(-1);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (i != 4) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
if (this.helpFragment.goBack()) {
|
||||
return true;
|
||||
}
|
||||
onHelpPageBack();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
protected void onSaveInstanceState(Bundle bundle) {
|
||||
super.onSaveInstanceState(bundle);
|
||||
bundle.putString("url", this.url);
|
||||
bundle.putString("title", this.title);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
LogUtils.c("onStoponStoponStop");
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
|
||||
public static void start(Activity activity, String str, String str2, int i, boolean z) {
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(activity, (Class<?>) HelpActivity.class);
|
||||
intent.putExtra("url", str);
|
||||
intent.putExtra("title", str2);
|
||||
intent.putExtra(ACTIONBAR_BG_COLOR, i);
|
||||
intent.putExtra(FROM_MAIN, z);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void start(Activity activity, String str, String str2, int i) {
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(activity, (Class<?>) HelpActivity.class);
|
||||
intent.putExtra("url", str);
|
||||
intent.putExtra("title", str2);
|
||||
intent.putExtra(ACTIONBAR_BG_COLOR, i);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
274
sources/com/ubt/jimu/base/HelpFragment.java
Normal file
274
sources/com/ubt/jimu/base/HelpFragment.java
Normal file
@@ -0,0 +1,274 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
import com.ubtech.utils.AndroidVersionCheckUtils;
|
||||
import com.ubtech.view.fragment.BaseFragment;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HelpFragment extends BaseFragment {
|
||||
private static final String ACTIONBAR_BG_COLOR = "actionbarBackgroundColorResId";
|
||||
private static final String TITLE = "title";
|
||||
private static final String URL = "url";
|
||||
private int actionbarBackgroundColorResId;
|
||||
private Unbinder mBind;
|
||||
private OnHelpFragmentInteractionListener mListener;
|
||||
protected NavigationBarView nbv_bar;
|
||||
protected ProgressBar pgLoading;
|
||||
private String title;
|
||||
private String url;
|
||||
protected WebView webView;
|
||||
|
||||
public static class MyWebChromeClient extends WebChromeClient {
|
||||
private WeakReference<HelpFragment> mFragmentReference;
|
||||
|
||||
public MyWebChromeClient(HelpFragment helpFragment) {
|
||||
this.mFragmentReference = new WeakReference<>(helpFragment);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public void onProgressChanged(WebView webView, int i) {
|
||||
HelpFragment helpFragment = this.mFragmentReference.get();
|
||||
if (helpFragment == null || helpFragment.isDetached() || helpFragment.isRemoving()) {
|
||||
return;
|
||||
}
|
||||
helpFragment.updateProgress(i);
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebChromeClient
|
||||
public void onReceivedTitle(WebView webView, String str) {
|
||||
super.onReceivedTitle(webView, str);
|
||||
HelpFragment helpFragment = this.mFragmentReference.get();
|
||||
if (helpFragment == null || helpFragment.isDetached() || helpFragment.isRemoving()) {
|
||||
return;
|
||||
}
|
||||
helpFragment.setTitle(str);
|
||||
}
|
||||
}
|
||||
|
||||
public class MyWebViewClient extends WebViewClient {
|
||||
public MyWebViewClient() {
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageFinished(WebView webView, String str) {
|
||||
super.onPageFinished(webView, str);
|
||||
ProgressBar progressBar = HelpFragment.this.pgLoading;
|
||||
if (progressBar != null) {
|
||||
progressBar.setProgress(100);
|
||||
HelpFragment.this.pgLoading.setVisibility(8);
|
||||
}
|
||||
HelpFragment helpFragment = HelpFragment.this;
|
||||
NavigationBarView navigationBarView = helpFragment.nbv_bar;
|
||||
if (navigationBarView != null) {
|
||||
navigationBarView.setTitle(TextUtils.isEmpty(helpFragment.title) ? webView.getTitle() : HelpFragment.this.title);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
|
||||
super.onPageStarted(webView, str, bitmap);
|
||||
ProgressBar progressBar = HelpFragment.this.pgLoading;
|
||||
if (progressBar != null) {
|
||||
progressBar.setVisibility(0);
|
||||
HelpFragment.this.pgLoading.setProgress(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.webkit.WebViewClient
|
||||
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
webView.loadUrl(webResourceRequest.getUrl().toString());
|
||||
return true;
|
||||
}
|
||||
webView.loadUrl(webResourceRequest.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnHelpFragmentInteractionListener {
|
||||
void onHelpPageBack();
|
||||
}
|
||||
|
||||
private void initWebView() {
|
||||
int i = this.actionbarBackgroundColorResId;
|
||||
if (i != 0) {
|
||||
this.nbv_bar.setBackgroundResource(i);
|
||||
}
|
||||
this.webView.getSettings().setDisplayZoomControls(false);
|
||||
this.webView.getSettings().setSupportZoom(false);
|
||||
this.webView.getSettings().setUseWideViewPort(true);
|
||||
this.webView.getSettings().setJavaScriptEnabled(true);
|
||||
this.webView.getSettings().setLoadWithOverviewMode(true);
|
||||
this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
this.webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
this.webView.getSettings().setBlockNetworkLoads(false);
|
||||
this.webView.getSettings().setDomStorageEnabled(true);
|
||||
this.webView.getSettings().setBlockNetworkImage(false);
|
||||
if (AndroidVersionCheckUtils.c()) {
|
||||
this.webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
|
||||
}
|
||||
if (AndroidVersionCheckUtils.d()) {
|
||||
this.webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
|
||||
}
|
||||
this.webView.getSettings().setAllowContentAccess(true);
|
||||
this.webView.getSettings().setAllowFileAccess(true);
|
||||
this.webView.getSettings().setDatabaseEnabled(true);
|
||||
this.webView.getSettings().setDomStorageEnabled(true);
|
||||
this.webView.getSettings().setAppCacheEnabled(false);
|
||||
if (NetWorkUtil.b(getContext())) {
|
||||
this.webView.getSettings().setCacheMode(2);
|
||||
} else {
|
||||
this.webView.getSettings().setCacheMode(-1);
|
||||
}
|
||||
this.webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
this.webView.setScrollContainer(false);
|
||||
this.webView.setWebViewClient(new MyWebViewClient());
|
||||
this.webView.setWebChromeClient(new MyWebChromeClient(this));
|
||||
LogUtils.c("隐私策略:" + this.url);
|
||||
this.webView.loadUrl(this.url);
|
||||
}
|
||||
|
||||
public static HelpFragment newInstance(String str, String str2, int i) {
|
||||
HelpFragment helpFragment = new HelpFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", str);
|
||||
bundle.putString("title", str2);
|
||||
bundle.putInt(ACTIONBAR_BG_COLOR, i);
|
||||
helpFragment.setArguments(bundle);
|
||||
return helpFragment;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void onImgBack() {
|
||||
if (this.webView.canGoBack()) {
|
||||
this.webView.goBack();
|
||||
return;
|
||||
}
|
||||
OnHelpFragmentInteractionListener onHelpFragmentInteractionListener = this.mListener;
|
||||
if (onHelpFragmentInteractionListener != null) {
|
||||
onHelpFragmentInteractionListener.onHelpPageBack();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean goBack() {
|
||||
if (!this.webView.canGoBack()) {
|
||||
return false;
|
||||
}
|
||||
this.webView.goBack();
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof OnHelpFragmentInteractionListener) {
|
||||
this.mListener = (OnHelpFragmentInteractionListener) context;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubtech.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
if (getArguments() != null) {
|
||||
this.url = getArguments().getString("url");
|
||||
this.title = getArguments().getString("title");
|
||||
this.actionbarBackgroundColorResId = getArguments().getInt(ACTIONBAR_BG_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
@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_help, viewGroup, false);
|
||||
this.mBind = ButterKnife.a(this, inflate);
|
||||
initWebView();
|
||||
if (!TextUtils.isEmpty(this.title)) {
|
||||
this.nbv_bar.setTitle(this.title);
|
||||
}
|
||||
this.nbv_bar.setListener(new NavigationBarView.OnActionClickListener.Stub() { // from class: com.ubt.jimu.base.HelpFragment.1
|
||||
@Override // com.ubt.jimu.widgets.NavigationBarView.OnActionClickListener.Stub
|
||||
public void onLeftClick(View view) {
|
||||
HelpFragment.this.onImgBack();
|
||||
}
|
||||
});
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroy() {
|
||||
WebView webView = this.webView;
|
||||
if (webView != null) {
|
||||
ViewParent parent = webView.getParent();
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(this.webView);
|
||||
}
|
||||
this.webView.removeAllViews();
|
||||
this.webView.destroy();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDestroyView() {
|
||||
WebView webView = this.webView;
|
||||
if (webView != null) {
|
||||
ViewParent parent = webView.getParent();
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(this.webView);
|
||||
}
|
||||
this.webView.stopLoading();
|
||||
this.webView.clearHistory();
|
||||
this.webView.removeAllViews();
|
||||
this.webView.destroy();
|
||||
this.webView = null;
|
||||
}
|
||||
this.mBind.unbind();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.Fragment
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
this.mListener = null;
|
||||
}
|
||||
|
||||
public void setListener(OnHelpFragmentInteractionListener onHelpFragmentInteractionListener) {
|
||||
this.mListener = onHelpFragmentInteractionListener;
|
||||
}
|
||||
|
||||
protected void setTitle(String str) {
|
||||
NavigationBarView navigationBarView;
|
||||
if (!TextUtils.isEmpty(str) || (navigationBarView = this.nbv_bar) == null) {
|
||||
return;
|
||||
}
|
||||
navigationBarView.setTitle(str);
|
||||
}
|
||||
|
||||
protected void updateProgress(int i) {
|
||||
ProgressBar progressBar = this.pgLoading;
|
||||
if (progressBar != null) {
|
||||
progressBar.setProgress(i);
|
||||
}
|
||||
}
|
||||
}
|
33
sources/com/ubt/jimu/base/HelpFragment_ViewBinding.java
Normal file
33
sources/com/ubt/jimu/base/HelpFragment_ViewBinding.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.view.View;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ProgressBar;
|
||||
import butterknife.Unbinder;
|
||||
import butterknife.internal.Utils;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.widgets.NavigationBarView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HelpFragment_ViewBinding implements Unbinder {
|
||||
private HelpFragment target;
|
||||
|
||||
public HelpFragment_ViewBinding(HelpFragment helpFragment, View view) {
|
||||
this.target = helpFragment;
|
||||
helpFragment.nbv_bar = (NavigationBarView) Utils.b(view, R.id.nbv_bar, "field 'nbv_bar'", NavigationBarView.class);
|
||||
helpFragment.pgLoading = (ProgressBar) Utils.b(view, R.id.pgLoading, "field 'pgLoading'", ProgressBar.class);
|
||||
helpFragment.webView = (WebView) Utils.b(view, R.id.webView, "field 'webView'", WebView.class);
|
||||
}
|
||||
|
||||
@Override // butterknife.Unbinder
|
||||
public void unbind() {
|
||||
HelpFragment helpFragment = this.target;
|
||||
if (helpFragment == null) {
|
||||
throw new IllegalStateException("Bindings already cleared.");
|
||||
}
|
||||
this.target = null;
|
||||
helpFragment.nbv_bar = null;
|
||||
helpFragment.pgLoading = null;
|
||||
helpFragment.webView = null;
|
||||
}
|
||||
}
|
25
sources/com/ubt/jimu/base/JsonServiceImpl.java
Normal file
25
sources/com/ubt/jimu/base/JsonServiceImpl.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.service.SerializationService;
|
||||
import com.ubt.jimu.utils.GsonUtil;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JsonServiceImpl implements SerializationService {
|
||||
@Override // com.alibaba.android.arouter.facade.template.IProvider
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
public <T> T json2Object(String str, Class<T> cls) {
|
||||
return (T) GsonUtil.a(str, cls);
|
||||
}
|
||||
|
||||
public String object2Json(Object obj) {
|
||||
return GsonUtil.a(obj);
|
||||
}
|
||||
|
||||
public <T> T parseObject(String str, Type type) {
|
||||
return (T) GsonUtil.a(str, type.getClass());
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/SuperActivity.java
Normal file
37
sources/com/ubt/jimu/base/SuperActivity.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import butterknife.ButterKnife;
|
||||
import com.ubt.jimu.BaseActivity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SuperActivity extends BaseActivity {
|
||||
public View mRootView;
|
||||
|
||||
protected abstract void initData();
|
||||
|
||||
protected abstract void initEvent();
|
||||
|
||||
public abstract View initView();
|
||||
|
||||
@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);
|
||||
this.mRootView = initView();
|
||||
setContentView(this.mRootView);
|
||||
ButterKnife.a(this, this.mRootView);
|
||||
initData();
|
||||
initEvent();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity, android.app.Activity
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
this.mRootView.requestLayout();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.BaseActivity
|
||||
public void relayout() {
|
||||
}
|
||||
}
|
192
sources/com/ubt/jimu/base/UbtActivityStack.java
Normal file
192
sources/com/ubt/jimu/base/UbtActivityStack.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package com.ubt.jimu.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UbtActivityStack {
|
||||
private int mResumedCount;
|
||||
private Stack<Activity> mStack;
|
||||
|
||||
private static class NotesActivityStackHelper {
|
||||
private static final UbtActivityStack INSTANCE = new UbtActivityStack();
|
||||
|
||||
private NotesActivityStackHelper() {
|
||||
}
|
||||
}
|
||||
|
||||
public static UbtActivityStack getInstance() {
|
||||
return NotesActivityStackHelper.INSTANCE;
|
||||
}
|
||||
|
||||
public void addActivity(Activity activity) {
|
||||
Iterator<Activity> it = this.mStack.iterator();
|
||||
while (it.hasNext()) {
|
||||
Activity next = it.next();
|
||||
if (activity.getClass().equals(UnityActivity.class) || activity.getClass().equals(next.getClass())) {
|
||||
this.mStack.remove(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.mStack.add(activity);
|
||||
}
|
||||
|
||||
public void closeActivity(Class cls) {
|
||||
for (int i = 0; i < this.mStack.size(); i++) {
|
||||
if (this.mStack.get(i) != null && !this.mStack.get(i).isFinishing() && this.mStack.get(i).getClass().equals(cls.getClass())) {
|
||||
this.mStack.get(i).finish();
|
||||
this.mStack.remove(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void decrement() {
|
||||
this.mResumedCount--;
|
||||
}
|
||||
|
||||
public void finishAllActivity() {
|
||||
for (int i = 0; i < this.mStack.size(); i++) {
|
||||
if (this.mStack.get(i) != null && !this.mStack.get(i).isFinishing()) {
|
||||
this.mStack.get(i).finish();
|
||||
}
|
||||
}
|
||||
this.mStack.clear();
|
||||
killProgress();
|
||||
}
|
||||
|
||||
public Activity getActivity(int i) {
|
||||
Stack<Activity> stack = this.mStack;
|
||||
if (stack == null || stack.size() <= 0 || this.mStack.size() <= i + 1) {
|
||||
return null;
|
||||
}
|
||||
return this.mStack.get((r0.size() - 1) - i);
|
||||
}
|
||||
|
||||
public Activity getActivityByClassName(String str) {
|
||||
for (Activity activity : getActivityTask(JimuApplication.l())) {
|
||||
if (activity.getClass().getSimpleName().equals(str)) {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Activity> getActivityTask(Application application) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
Field declaredField = Application.class.getDeclaredField("mLoadedApk");
|
||||
declaredField.setAccessible(true);
|
||||
Object obj = declaredField.get(application);
|
||||
Field declaredField2 = obj.getClass().getDeclaredField("mActivityThread");
|
||||
declaredField2.setAccessible(true);
|
||||
Object obj2 = declaredField2.get(obj);
|
||||
Field declaredField3 = obj2.getClass().getDeclaredField("mActivities");
|
||||
declaredField3.setAccessible(true);
|
||||
Object obj3 = declaredField3.get(obj2);
|
||||
if (obj3 instanceof Map) {
|
||||
Iterator it = ((Map) obj3).entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Object value = ((Map.Entry) it.next()).getValue();
|
||||
Field declaredField4 = value.getClass().getDeclaredField("activity");
|
||||
declaredField4.setAccessible(true);
|
||||
arrayList.add((Activity) declaredField4.get(value));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public int getResumedCount() {
|
||||
return this.mResumedCount;
|
||||
}
|
||||
|
||||
public Activity getTopActivity() {
|
||||
if (this.mStack.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return this.mStack.get(r0.size() - 1);
|
||||
}
|
||||
|
||||
public void increment() {
|
||||
this.mResumedCount++;
|
||||
}
|
||||
|
||||
public boolean isActivityStack(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
|
||||
List<ActivityManager.RunningTaskInfo> runningTasks = activityManager.getRunningTasks(3);
|
||||
activityManager.getRunningAppProcesses();
|
||||
activityManager.getAppTasks();
|
||||
return runningTasks.size() <= 2;
|
||||
}
|
||||
|
||||
public boolean isAppForeground() {
|
||||
return this.mResumedCount > 0;
|
||||
}
|
||||
|
||||
public boolean isExistUnityActivity() {
|
||||
Iterator<Activity> it = getActivityTask(JimuApplication.l()).iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().getClass().getSimpleName().equals(UnityActivity.class.getSimpleName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTargetClass(Class cls, int i) {
|
||||
Activity activity = getActivity(i);
|
||||
return activity != null && activity.getClass().equals(cls);
|
||||
}
|
||||
|
||||
public boolean isTopStack(Class cls) {
|
||||
XLog.a("act_life", "size is %s", Integer.valueOf(this.mStack.size()));
|
||||
if (this.mStack.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
Stack<Activity> stack = this.mStack;
|
||||
if (!stack.get(stack.size() - 1).getClass().equals(cls)) {
|
||||
return false;
|
||||
}
|
||||
Object[] objArr = new Object[1];
|
||||
objArr[0] = cls != null ? cls.getSimpleName() : "null";
|
||||
XLog.a("act_life", "top stack clz %s", objArr);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void killProgress() {
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void removeActivity(Activity activity) {
|
||||
this.mStack.remove(activity);
|
||||
}
|
||||
|
||||
public void returnPreActivity(Context context) {
|
||||
((Activity) context).finish();
|
||||
}
|
||||
|
||||
public Stack<Activity> stack() {
|
||||
return this.mStack;
|
||||
}
|
||||
|
||||
private UbtActivityStack() {
|
||||
this.mStack = new Stack<>();
|
||||
this.mResumedCount = 0;
|
||||
}
|
||||
}
|
255
sources/com/ubt/jimu/base/cache/Cache.java
vendored
Normal file
255
sources/com/ubt/jimu/base/cache/Cache.java
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
package com.ubt.jimu.base.cache;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
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.Robot;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubtech.utils.XLog;
|
||||
import com.ubtrobot.jimu.robotapi.BoardInfo;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Cache {
|
||||
private static final String TAG = "Cache";
|
||||
private static Cache instance;
|
||||
private boolean connected;
|
||||
private JimuCourseMission courseMission;
|
||||
private List<JimuCourseTask> courseTaskList;
|
||||
private JimuCourse jimuCourse;
|
||||
private JimuCourseTask jimuCourseTask;
|
||||
private String mBlocklyTestUrl;
|
||||
private BoardInfo mBoardInfo;
|
||||
private BluetoothDevice mLastConnectedDevice;
|
||||
private long packageId;
|
||||
private String packageImagePath;
|
||||
private String packageName;
|
||||
private Robot robot;
|
||||
private User user;
|
||||
private boolean showMobileDataTips = false;
|
||||
public long differ = 0;
|
||||
private SharePreferenceHelper settings = new SharePreferenceHelper();
|
||||
|
||||
private Cache() {
|
||||
}
|
||||
|
||||
public static synchronized Cache getInstance() {
|
||||
Cache cache;
|
||||
synchronized (Cache.class) {
|
||||
if (instance == null) {
|
||||
instance = new Cache();
|
||||
}
|
||||
cache = instance;
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
public void clearCacheUser() {
|
||||
setUser(null);
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_USER_ID, "local");
|
||||
this.settings.put(SharePreferenceHelper.AUTHOR_TOKEN, "");
|
||||
}
|
||||
|
||||
public String getBlocklyTest() {
|
||||
return this.mBlocklyTestUrl;
|
||||
}
|
||||
|
||||
public BoardInfo getBoardInfo() {
|
||||
return this.mBoardInfo;
|
||||
}
|
||||
|
||||
public JimuCourseMission getCourseMission() {
|
||||
return this.courseMission;
|
||||
}
|
||||
|
||||
public List<JimuCourseTask> getCourseTaskList() {
|
||||
return this.courseTaskList;
|
||||
}
|
||||
|
||||
public JimuCourse getJimuCourse() {
|
||||
return this.jimuCourse;
|
||||
}
|
||||
|
||||
public JimuCourseTask getJimuCourseTask() {
|
||||
return this.jimuCourseTask;
|
||||
}
|
||||
|
||||
public BluetoothDevice getLastConnectedDevice() {
|
||||
return this.mLastConnectedDevice;
|
||||
}
|
||||
|
||||
public long getLoginUserIntId() {
|
||||
String string = this.settings.getString(SharePreferenceHelper.SP_KEY_USER_ID, "");
|
||||
if (TextUtils.isEmpty(string) || string.equals("local") || Integer.parseInt(string) <= 0) {
|
||||
return 0L;
|
||||
}
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
|
||||
public long getPackageId() {
|
||||
this.packageId = this.settings.getLong(SharePreferenceHelper.SP_KEY_PACKAGE_ID, 0L).longValue();
|
||||
return this.packageId;
|
||||
}
|
||||
|
||||
public String getPackageImagePath() {
|
||||
return this.settings.getString(SharePreferenceHelper.CURRENT_PACKAGE_IMAGE_PATH, null);
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
this.packageName = this.settings.getString(SharePreferenceHelper.SP_KEY_PACKAGE_NAME, "");
|
||||
return this.packageName;
|
||||
}
|
||||
|
||||
public Robot getRobot() {
|
||||
if (this.robot == null) {
|
||||
long longValue = this.settings.getLong(SharePreferenceHelper.SP_KEY_ROBOT_ID, -1L).longValue();
|
||||
long longValue2 = this.settings.getLong(SharePreferenceHelper.SP_KEY_PACKAGE_ID, -1L).longValue();
|
||||
if (longValue < 0 || longValue2 < 0) {
|
||||
return null;
|
||||
}
|
||||
Robot robotById = RobotDbHandler.getRobotById(longValue);
|
||||
if (robotById != null) {
|
||||
setRobot(robotById);
|
||||
}
|
||||
}
|
||||
return this.robot;
|
||||
}
|
||||
|
||||
public SharePreferenceHelper getSettings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
public String getTTSToken() {
|
||||
return this.settings.getString(Constant.Cache.SP_KEY_TTS_TOKEN, "");
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
if (this.user == null) {
|
||||
this.user = UserDbHandler.getUser();
|
||||
}
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.settings.getString(SharePreferenceHelper.SP_KEY_USER_ID, "local");
|
||||
}
|
||||
|
||||
public String getUserToken() {
|
||||
return this.settings.getString(SharePreferenceHelper.AUTHOR_TOKEN, "");
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
String string = this.settings.getString(SharePreferenceHelper.SP_KEY_UUID, "");
|
||||
if (!TextUtils.isEmpty(string)) {
|
||||
return string;
|
||||
}
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
XLog.d("woo", "UUID.rancomUUID: " + replace, new Object[0]);
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_UUID, replace);
|
||||
return replace;
|
||||
}
|
||||
|
||||
public int getVersionCode() {
|
||||
return this.settings.getInt(Constant.Cache.APP_VERSION_CODE, 0);
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return this.connected;
|
||||
}
|
||||
|
||||
public boolean isShowMobileDataTips() {
|
||||
return this.showMobileDataTips;
|
||||
}
|
||||
|
||||
public boolean isWifiOnly() {
|
||||
return this.settings.getBoolean(SharePreferenceHelper.SP_KEY_WIFI_VIEW, true).booleanValue();
|
||||
}
|
||||
|
||||
public void putBoolean(String str, boolean z) {
|
||||
this.settings.put(str, Boolean.valueOf(z));
|
||||
}
|
||||
|
||||
public void putInt(String str, int i) {
|
||||
this.settings.put(str, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public void putString(String str, String str2) {
|
||||
this.settings.put(str, str2);
|
||||
}
|
||||
|
||||
public void setBlocklyTestUrl(String str) {
|
||||
this.mBlocklyTestUrl = str;
|
||||
}
|
||||
|
||||
public void setBoardInfo(BoardInfo boardInfo) {
|
||||
this.mBoardInfo = boardInfo;
|
||||
}
|
||||
|
||||
public void setConnected(boolean z) {
|
||||
this.connected = z;
|
||||
}
|
||||
|
||||
public void setCourseMission(JimuCourseMission jimuCourseMission) {
|
||||
this.courseMission = jimuCourseMission;
|
||||
}
|
||||
|
||||
public void setCourseTaskList(List<JimuCourseTask> list) {
|
||||
this.courseTaskList = list;
|
||||
}
|
||||
|
||||
public void setJimuCourse(JimuCourse jimuCourse) {
|
||||
this.jimuCourse = jimuCourse;
|
||||
}
|
||||
|
||||
public void setJimuCourseTask(JimuCourseTask jimuCourseTask) {
|
||||
this.jimuCourseTask = jimuCourseTask;
|
||||
}
|
||||
|
||||
public void setLastConnectedDevice(BluetoothDevice bluetoothDevice) {
|
||||
this.mLastConnectedDevice = bluetoothDevice;
|
||||
}
|
||||
|
||||
public void setPackageId(long j) {
|
||||
this.packageId = j;
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_PACKAGE_ID, Long.valueOf(j));
|
||||
}
|
||||
|
||||
public void setPackageImagePath(String str) {
|
||||
this.packageImagePath = str;
|
||||
this.settings.put(SharePreferenceHelper.CURRENT_PACKAGE_IMAGE_PATH, str);
|
||||
}
|
||||
|
||||
public void setPackageName(String str) {
|
||||
this.packageName = str;
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_PACKAGE_NAME, str);
|
||||
}
|
||||
|
||||
public void setRobot(Robot robot) {
|
||||
Robot robot2;
|
||||
if (robot == null) {
|
||||
return;
|
||||
}
|
||||
if (robot.getModelName() != null && (robot2 = this.robot) != null && robot2.getModelName() != null && !robot.getModelName().equals(this.robot.getModelName())) {
|
||||
JimuApplication.l().f().c();
|
||||
}
|
||||
this.robot = robot;
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_ROBOT_NAME, robot.getModelNameLanguage());
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_ROBOT_IMAGE, robot.getFilePath());
|
||||
this.settings.put(SharePreferenceHelper.SP_KEY_ROBOT_ID, Long.valueOf(robot.getModelId()));
|
||||
}
|
||||
|
||||
public void setShowMobileDataTips(boolean z) {
|
||||
this.showMobileDataTips = z;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
93
sources/com/ubt/jimu/base/cache/Constants.java
vendored
Normal file
93
sources/com/ubt/jimu/base/cache/Constants.java
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.ubt.jimu.base.cache;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.transport3.dao.TransportFileDbHandler2;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Constants {
|
||||
public static final String ADV_BEGIN_TIME = "adv_begin";
|
||||
public static final String ADV_END_TIME = "adv_end";
|
||||
public static final String ADV_FLAG = "adv_flag";
|
||||
public static final String ADV_IMG_PATH = "adv_img_path";
|
||||
public static final String ADV_LINK = "adv_link";
|
||||
public static final String ADV_TYPE = "adv_type";
|
||||
public static final String ADV_VERSION = "adv_version";
|
||||
public static final String APP_VERSION = "app_version";
|
||||
public static final String BLOCKLY_GUIDE = "blockly_guide";
|
||||
public static final String BLOCKLY_TYPE = "blockly_type";
|
||||
public static final String BLOCKLY_VERSION = "blockly_version";
|
||||
public static final String BLUETOOTH_AUTO_CONNECT = "bluetooth_auto_connect";
|
||||
public static final String COPY_LOCAL_CACHE_MODEL = "copy_cache_model";
|
||||
public static final String COPY_LOCAL_CACHE_MODEL_IMG = "copy_model_img";
|
||||
public static final String COURSE_RESOURCE_PATH = ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + "data" + File.separator + "blockly" + File.separator + "course_resources" + File.separator;
|
||||
public static final String COURSE_VERSION = "course_version";
|
||||
public static final String CURRENT_LANGUAGE = "current_language";
|
||||
public static final String CUSTOM_MODEL;
|
||||
public static final String CUSTOM_SOUNDS;
|
||||
public static final String DEFAULT_MODEL;
|
||||
public static final String DISABLE_WHILE_CHARGING = "disable_while_charging";
|
||||
public static final String FOO_FILE = "foo";
|
||||
public static final String HOME_BG_FILE_NAME = "home_image.png";
|
||||
public static final String IMAGE_PATH = "images";
|
||||
public static final String INSTRUCTION_CONFIG_FILE = "instruction";
|
||||
public static final String IS_PUSH_REGISTER = "is_push_register";
|
||||
public static final String IS_SHOW_GUIDE = "is_show_guide";
|
||||
public static final String KEY_COURSE_ALERT_LOGIN = "k_c_alert_login";
|
||||
public static final String KEY_COURSE_HAVE_PLAY_VIDEO = "k_c_played_video";
|
||||
public static final String KEY_DOWNLOAD_SERVOS = "key_download_servos";
|
||||
public static final String KEY_IS_ACTIVITY_FIRST_IN = "is_first_in_activity";
|
||||
public static final String KEY_IS_HOME_GUIDE_SHOWN = "is_home_guide_shown";
|
||||
public static final String KEY_MSG_DAILY_TASK = "k_task_daily";
|
||||
public static final String KEY_MSG_MAIN_TASK = "k_task_main";
|
||||
public static final String KEY_PROGRAM_LANGUAGE = "key_program_language";
|
||||
public static final String KEY_SHOULD_SHOW_LOW_END_DIALOG = "should_show_low_end_dialog";
|
||||
public static final String LANGUAGE = "language";
|
||||
public static final String LANGUAGE_SET = "language_set";
|
||||
public static final String LAST_LANGUAGE = "last_language";
|
||||
public static final String LOCAL_CACHE_MODEL_IMG = "local/";
|
||||
public static final String LOGIN = "login";
|
||||
public static final String LOGIN_TIME = "login_time";
|
||||
public static final String MAIN_BOARD_VERSION_CODE = "main_board_version_code";
|
||||
public static final String MAIN_BOARD_VERSION_FILE = "main_board_version_file";
|
||||
public static final long MEMORY_LIMIT = 1800000000;
|
||||
public static final String MERGE_FLAG = "merge_local_flag";
|
||||
public static final String MODEL_CLASS = "model_class";
|
||||
public static final String MODEL_CLASS_LOGO = "model_class_logo";
|
||||
public static final String PARTS = "parts/android/";
|
||||
public static final String PUSH_MSG = "push_msg";
|
||||
public static final String QINIU_TOKEN = "qiniu_token";
|
||||
public static final String REGISTER_DEVICEID = "register_deviceid";
|
||||
public static final String REGISTER_ONLY_EMAIL = "register_only_email";
|
||||
public static final String SENSOR_FILE_PATH = "FilePath";
|
||||
public static final String SENSOR_VERSION = "Version";
|
||||
public static final String STEERING_VERSION_CODE = "Steering_version_code";
|
||||
public static final String STEERING_VERSION_FILE = "Steering_version_file";
|
||||
public static final String UNITY_LANGUAGE_FILE = "LanguageCode";
|
||||
public static final String USER_HOME;
|
||||
public static final String USER_ID = "user_id";
|
||||
public static final String VIDEO_ADV_BEGIN_TIME = "adv_begin";
|
||||
public static final String VIDEO_ADV_END_TIME = "adv_end";
|
||||
public static final String VIDEO_ADV_FLAG = "adv_flag";
|
||||
public static final String VIDEO_ADV_IMG_PATH = "adv_img_path";
|
||||
public static final String VIDEO_ADV_LINK = "adv_link";
|
||||
public static final String VIDEO_ADV_VERSION = "adv_version";
|
||||
public static final String WECHAT_APP_ID = "wx2abcb6ca6e95847d";
|
||||
public static final String WECHAT_APP_SECRET = "d4624c36b6795d1d99dcf0547af5443d";
|
||||
public static final String WIFI_ONLY = "wifi_only";
|
||||
public static final String app_update_notify = "app_update";
|
||||
|
||||
static {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("users");
|
||||
sb.append(File.separator);
|
||||
sb.append("%s");
|
||||
sb.append(File.separator);
|
||||
USER_HOME = sb.toString();
|
||||
DEFAULT_MODEL = USER_HOME + "default" + File.separator;
|
||||
CUSTOM_MODEL = USER_HOME + "playerdata" + File.separator;
|
||||
CUSTOM_SOUNDS = USER_HOME + TransportFileDbHandler2.DIR_SOUNDS + File.separator;
|
||||
}
|
||||
}
|
302
sources/com/ubt/jimu/base/cache/SharePreferenceHelper.java
vendored
Normal file
302
sources/com/ubt/jimu/base/cache/SharePreferenceHelper.java
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
package com.ubt.jimu.base.cache;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubtech.utils.XLog;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.StreamCorruptedException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SharePreferenceHelper<T> {
|
||||
public static final String AUTHOR_TOKEN = "author_token";
|
||||
public static final String CURRENT_PACKAGE_IMAGE_PATH = "current_package_image_path";
|
||||
public static final String KEY_SCAN_TIPS_READ = "scan_tips_read";
|
||||
private static final String SP_FILE_NAME_EXTRA = "file_extra";
|
||||
public static final String SP_FILE_NAME_SETTING = "setting";
|
||||
public static final String SP_FILE_NAME_USER = "file_user";
|
||||
public static final String SP_KEY_APP_CHECKED_UPDATE = "sp_key_app_checked_update";
|
||||
public static final String SP_KEY_APP_NEED_UPDATE = "sp_key_app_need_upadte";
|
||||
public static final String SP_KEY_APP_UPDATE_URL = "sp_key_app_update_url";
|
||||
public static final String SP_KEY_APP_VERSION_NAME = "sp_key_app_version_name";
|
||||
public static final String SP_KEY_AUTO_CONNECT = "auto_connect";
|
||||
public static final String SP_KEY_CONNECTION_STATUS = "jimu_robot_connection_status";
|
||||
public static final String SP_KEY_ELECTRICITY_PROTECT = "electricity_protect";
|
||||
public static final String SP_KEY_FLIPPER_PAGE_INDEX = "sp_key_flipper_page_index";
|
||||
public static final String SP_KEY_INFO_TO = "info_to";
|
||||
public static final String SP_KEY_LAST_PARENT_EMAIL = "sp_key_last_parent_email";
|
||||
public static final String SP_KEY_PACKAGE_ID = "sp_key_package_id";
|
||||
public static final String SP_KEY_PACKAGE_NAME = "sp_key_package_name";
|
||||
public static final String SP_KEY_REGISTER_ACCOUNT = "sp_key_register_account";
|
||||
public static final String SP_KEY_REGISTER_BIRTHDAY = "sp_key_register_birthday";
|
||||
public static final String SP_KEY_REGISTER_COUNTRY = "sp_key_register_country";
|
||||
public static final String SP_KEY_ROBOT_ID = "sp_key_robot_id";
|
||||
public static final String SP_KEY_ROBOT_IMAGE = "robot_image_url";
|
||||
public static final String SP_KEY_ROBOT_NAME = "robot_name";
|
||||
public static final String SP_KEY_SEARCH_HISTORY = "search_history";
|
||||
public static final String SP_KEY_START_FINISH_HOME_GUIDE = "sp_key_finish_home_guide";
|
||||
public static final String SP_KEY_START_FROM_SPLASH = "sp_key_start_from_splash";
|
||||
public static final String SP_KEY_USER_ID = "key_user_id";
|
||||
public static final String SP_KEY_UUID = "sp_key_uuid";
|
||||
public static final String SP_KEY_WIFI_VIEW = "wifi_view";
|
||||
private String setting;
|
||||
|
||||
public SharePreferenceHelper() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public Boolean getBoolean(String str, Boolean bool) {
|
||||
return Boolean.valueOf(JimuApplication.l().getSharedPreferences(this.setting, 0).getBoolean(str, bool.booleanValue()));
|
||||
}
|
||||
|
||||
public float getFloat(String str, float f) {
|
||||
return JimuApplication.l().getSharedPreferences(this.setting, 0).getFloat(str, f);
|
||||
}
|
||||
|
||||
public int getInt(String str, int i) {
|
||||
return JimuApplication.l().getSharedPreferences(this.setting, 0).getInt(str, i);
|
||||
}
|
||||
|
||||
public Long getLong(String str, Long l) {
|
||||
return Long.valueOf(JimuApplication.l().getSharedPreferences(this.setting, 0).getLong(str, l.longValue()));
|
||||
}
|
||||
|
||||
public String getString(String str, String str2) {
|
||||
return JimuApplication.l().getSharedPreferences(this.setting, 0).getString(str, str2);
|
||||
}
|
||||
|
||||
public void put(String str, Object obj) {
|
||||
SharedPreferences.Editor edit = JimuApplication.l().getSharedPreferences(this.setting, 4).edit();
|
||||
if (obj instanceof Boolean) {
|
||||
edit.putBoolean(str, ((Boolean) obj).booleanValue());
|
||||
} else if (obj instanceof Float) {
|
||||
edit.putFloat(str, ((Float) obj).floatValue());
|
||||
} else if (obj instanceof Integer) {
|
||||
edit.putInt(str, ((Integer) obj).intValue());
|
||||
} else if (obj instanceof Long) {
|
||||
edit.putLong(str, ((Long) obj).longValue());
|
||||
} else if (obj instanceof String) {
|
||||
edit.putString(str, (String) obj);
|
||||
}
|
||||
if (edit.commit()) {
|
||||
return;
|
||||
}
|
||||
XLog.b("SharePreferenceHelper", "commit SP failed!");
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r0v13, types: [T, java.lang.Object] */
|
||||
/* JADX WARN: Type inference failed for: r0v2 */
|
||||
/* JADX WARN: Type inference failed for: r0v3 */
|
||||
/* JADX WARN: Type inference failed for: r0v4, types: [T] */
|
||||
/* JADX WARN: Type inference failed for: r0v6 */
|
||||
/* JADX WARN: Type inference failed for: r0v7, types: [java.io.ObjectInputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v1, types: [boolean] */
|
||||
/* JADX WARN: Type inference failed for: r5v10, types: [java.io.ByteArrayInputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v12, types: [java.io.ByteArrayInputStream, java.io.InputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v2 */
|
||||
/* JADX WARN: Type inference failed for: r5v3 */
|
||||
/* JADX WARN: Type inference failed for: r5v4 */
|
||||
/* JADX WARN: Type inference failed for: r5v5, types: [java.io.ByteArrayInputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v8, types: [java.io.ByteArrayInputStream] */
|
||||
public T readObject(String str, String str2) {
|
||||
ObjectInputStream objectInputStream;
|
||||
String string = JimuApplication.l().getSharedPreferences(str, 0).getString(str2, "");
|
||||
?? isEmpty = TextUtils.isEmpty(string);
|
||||
?? r0 = (T) null;
|
||||
if (isEmpty != 0) {
|
||||
return null;
|
||||
}
|
||||
byte[] decode = Base64.decode(string.getBytes(), 0);
|
||||
try {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return (T) r0;
|
||||
}
|
||||
try {
|
||||
try {
|
||||
isEmpty = new ByteArrayInputStream(decode);
|
||||
} catch (StreamCorruptedException e2) {
|
||||
e = e2;
|
||||
objectInputStream = null;
|
||||
isEmpty = 0;
|
||||
} catch (IOException e3) {
|
||||
e = e3;
|
||||
objectInputStream = null;
|
||||
isEmpty = 0;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
isEmpty = 0;
|
||||
}
|
||||
try {
|
||||
objectInputStream = new ObjectInputStream(isEmpty);
|
||||
} catch (StreamCorruptedException e4) {
|
||||
e = e4;
|
||||
objectInputStream = null;
|
||||
} catch (IOException e5) {
|
||||
e = e5;
|
||||
objectInputStream = null;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
if (isEmpty != 0) {
|
||||
try {
|
||||
isEmpty.close();
|
||||
} catch (Exception e6) {
|
||||
e6.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (r0 == 0) {
|
||||
throw th;
|
||||
}
|
||||
try {
|
||||
r0.close();
|
||||
throw th;
|
||||
} catch (IOException e7) {
|
||||
e7.printStackTrace();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
try {
|
||||
try {
|
||||
r0 = (T) objectInputStream.readObject();
|
||||
try {
|
||||
isEmpty.close();
|
||||
} catch (Exception e8) {
|
||||
e8.printStackTrace();
|
||||
}
|
||||
try {
|
||||
objectInputStream.close();
|
||||
} catch (IOException e9) {
|
||||
e9.printStackTrace();
|
||||
}
|
||||
return r0;
|
||||
} catch (StreamCorruptedException e10) {
|
||||
e = e10;
|
||||
e.printStackTrace();
|
||||
if (isEmpty != 0) {
|
||||
try {
|
||||
isEmpty.close();
|
||||
} catch (Exception e11) {
|
||||
e11.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (objectInputStream != null) {
|
||||
objectInputStream.close();
|
||||
}
|
||||
return (T) r0;
|
||||
} catch (IOException e12) {
|
||||
e = e12;
|
||||
e.printStackTrace();
|
||||
if (isEmpty != 0) {
|
||||
try {
|
||||
isEmpty.close();
|
||||
} catch (Exception e13) {
|
||||
e13.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (objectInputStream != null) {
|
||||
objectInputStream.close();
|
||||
}
|
||||
return (T) r0;
|
||||
}
|
||||
} catch (ClassNotFoundException e14) {
|
||||
e14.printStackTrace();
|
||||
try {
|
||||
isEmpty.close();
|
||||
} catch (Exception e15) {
|
||||
e15.printStackTrace();
|
||||
}
|
||||
objectInputStream.close();
|
||||
return (T) r0;
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
r0 = (T) decode;
|
||||
th = th3;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveObject(String str, String str2, Object obj) {
|
||||
ObjectOutputStream objectOutputStream;
|
||||
SharedPreferences sharedPreferences = JimuApplication.l().getSharedPreferences(str, 0);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream objectOutputStream2 = null;
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
objectOutputStream.writeObject(obj);
|
||||
String encodeToString = Base64.encodeToString(byteArrayOutputStream.toByteArray(), 0);
|
||||
SharedPreferences.Editor edit = sharedPreferences.edit();
|
||||
edit.putString(str2, encodeToString);
|
||||
if (!edit.commit()) {
|
||||
XLog.b("SharePreferenceHelper", "commit SP failed!");
|
||||
}
|
||||
try {
|
||||
objectOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
byteArrayOutputStream.close();
|
||||
} catch (IOException e2) {
|
||||
e = e2;
|
||||
objectOutputStream2 = objectOutputStream;
|
||||
e.printStackTrace();
|
||||
if (objectOutputStream2 != null) {
|
||||
try {
|
||||
objectOutputStream2.close();
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
}
|
||||
byteArrayOutputStream.close();
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
if (objectOutputStream != null) {
|
||||
try {
|
||||
objectOutputStream.close();
|
||||
} catch (IOException e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
byteArrayOutputStream.close();
|
||||
throw th;
|
||||
} catch (IOException e5) {
|
||||
e5.printStackTrace();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
objectOutputStream = objectOutputStream2;
|
||||
}
|
||||
} catch (IOException e6) {
|
||||
e = e6;
|
||||
}
|
||||
} catch (IOException e7) {
|
||||
e7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public SharePreferenceHelper(boolean z) {
|
||||
this.setting = z ? SP_FILE_NAME_USER : SP_FILE_NAME_SETTING;
|
||||
}
|
||||
|
||||
private SharePreferenceHelper(String str) {
|
||||
this.setting = str;
|
||||
}
|
||||
|
||||
public void saveObject(String str, Object obj) {
|
||||
saveObject(this.setting, str, obj);
|
||||
}
|
||||
|
||||
public T readObject(String str) {
|
||||
return readObject(this.setting, str);
|
||||
}
|
||||
}
|
7
sources/com/ubt/jimu/base/data/CtrlMotionType.java
Normal file
7
sources/com/ubt/jimu/base/data/CtrlMotionType.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.ubt.jimu.base.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum CtrlMotionType {
|
||||
servo,
|
||||
motor
|
||||
}
|
40
sources/com/ubt/jimu/base/data/Engine.java
Normal file
40
sources/com/ubt/jimu/base/data/Engine.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.ubt.jimu.base.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class Engine implements Comparable {
|
||||
public static final int DIRECTION_CLOCK = 1;
|
||||
public static final int DIRECTION_DISCLOCK = -1;
|
||||
private int id;
|
||||
private int direction = 1;
|
||||
private boolean isConfigged = false;
|
||||
|
||||
public Engine(int i) {
|
||||
this.id = i;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public abstract CtrlMotionType getMotionType();
|
||||
|
||||
public boolean isConfigged() {
|
||||
return this.isConfigged;
|
||||
}
|
||||
|
||||
public void setConfigged(boolean z) {
|
||||
this.isConfigged = z;
|
||||
}
|
||||
|
||||
public void setDirection(int i) {
|
||||
this.direction = i;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Engine{id=" + this.id + " type=" + getMotionType() + '}';
|
||||
}
|
||||
}
|
31
sources/com/ubt/jimu/base/data/Motor.java
Normal file
31
sources/com/ubt/jimu/base/data/Motor.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ubt.jimu.base.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Motor extends Engine {
|
||||
public Motor(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(Object obj) {
|
||||
if (obj != null && (obj instanceof Motor)) {
|
||||
return getId() - ((Motor) obj).getId();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.data.Engine
|
||||
public CtrlMotionType getMotionType() {
|
||||
return CtrlMotionType.motor;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.data.Engine
|
||||
public String toString() {
|
||||
return "Motor{direction=" + getDirection() + "} " + super.toString();
|
||||
}
|
||||
|
||||
public Motor(int i, int i2) {
|
||||
this(i);
|
||||
super.setDirection(i2);
|
||||
}
|
||||
}
|
46
sources/com/ubt/jimu/base/data/Servo.java
Normal file
46
sources/com/ubt/jimu/base/data/Servo.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.ubt.jimu.base.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Servo extends Engine {
|
||||
public boolean isChoose;
|
||||
private ServoMode type;
|
||||
|
||||
public Servo(int i, ServoMode servoMode) {
|
||||
super(i);
|
||||
this.type = servoMode;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(Object obj) {
|
||||
if (obj != null && (obj instanceof Servo)) {
|
||||
return getId() - ((Servo) obj).getId();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public ServoMode getModeType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.data.Engine
|
||||
public CtrlMotionType getMotionType() {
|
||||
return CtrlMotionType.servo;
|
||||
}
|
||||
|
||||
public boolean isChoose() {
|
||||
return this.isChoose;
|
||||
}
|
||||
|
||||
public void setChoose(boolean z) {
|
||||
this.isChoose = z;
|
||||
}
|
||||
|
||||
public void setModeType(ServoMode servoMode) {
|
||||
this.type = servoMode;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.data.Engine
|
||||
public String toString() {
|
||||
return "Servo{type=" + this.type + "} " + super.toString();
|
||||
}
|
||||
}
|
7
sources/com/ubt/jimu/base/data/ServoMode.java
Normal file
7
sources/com/ubt/jimu/base/data/ServoMode.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.ubt.jimu.base.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum ServoMode {
|
||||
SERVO_MODE_ANGLE,
|
||||
SERVO_MODE_TURN
|
||||
}
|
114
sources/com/ubt/jimu/base/db/AbstractDaoHandler.java
Normal file
114
sources/com/ubt/jimu/base/db/AbstractDaoHandler.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractDaoHandler<T> implements IDaoHandler<T> {
|
||||
protected AbstractDao<T, Long> dao;
|
||||
|
||||
public AbstractDaoHandler(AbstractDao<T, Long> abstractDao) {
|
||||
this.dao = abstractDao;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void delete(T t) {
|
||||
this.dao.b((AbstractDao<T, Long>) t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteAll() {
|
||||
this.dao.b();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteById(long j) {
|
||||
this.dao.c((AbstractDao<T, Long>) Long.valueOf(j));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.a((Iterable) list);
|
||||
}
|
||||
|
||||
public QueryBuilder<T> getQueryBuilder() {
|
||||
return this.dao.k();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public long insert(T t) {
|
||||
return this.dao.f(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void insertInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.b((Iterable) list);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public long insertOrUpdate(T t) {
|
||||
return this.dao.g(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void insertOrUpdateInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.c(list);
|
||||
}
|
||||
|
||||
public List<T> query(QueryBuilder<T> queryBuilder) {
|
||||
List<T> list;
|
||||
try {
|
||||
list = queryBuilder.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
list = null;
|
||||
}
|
||||
return list == null ? new ArrayList() : list;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public List<T> selectAll() {
|
||||
return this.dao.j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public T selectById(Long l) {
|
||||
return this.dao.a(l.longValue());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public abstract T selectUnique(T t);
|
||||
|
||||
public T unique(QueryBuilder<T> queryBuilder) {
|
||||
try {
|
||||
return queryBuilder.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void update(T t) {
|
||||
this.dao.j(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void updateInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.d((Iterable) list);
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/base/db/DatabaseUtils.java
Normal file
44
sources/com/ubt/jimu/base/db/DatabaseUtils.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DatabaseUtils {
|
||||
public static final String LOCAL_DB = "local";
|
||||
|
||||
private static DaoSession getDaoSession(Database database) {
|
||||
return new DaoMaster(database).newSession();
|
||||
}
|
||||
|
||||
private static Database getReadableDb(Context context, String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
str = "local";
|
||||
}
|
||||
return new DaoMaster.DevOpenHelper(context, str).getReadableDb();
|
||||
}
|
||||
|
||||
private static Database getWritableDb(Context context, String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
str = "local";
|
||||
}
|
||||
return new DaoMaster.DevOpenHelper(context, str).getWritableDb();
|
||||
}
|
||||
|
||||
public static DaoSession getDaoSession(boolean z) {
|
||||
return JimuApplication.l().e();
|
||||
}
|
||||
|
||||
private static Database getReadableDb() {
|
||||
return getReadableDb(JimuApplication.l(), Cache.getInstance().getUserId());
|
||||
}
|
||||
|
||||
private static Database getWritableDb() {
|
||||
return getWritableDb(JimuApplication.l(), Cache.getInstance().getUserId());
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import com.ubt.jimu.base.entities.FileDownloadRecord;
|
||||
import com.ubt.jimu.gen.FileDownloadRecordDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FileDownloadRecordDbHandler {
|
||||
public static boolean getFileDownloadRecord(int i, int i2) {
|
||||
try {
|
||||
QueryBuilder<FileDownloadRecord> k = DatabaseUtils.getDaoSession(false).j().k();
|
||||
k.a(FileDownloadRecordDao.Properties.TypeId.a(Integer.valueOf(i)), FileDownloadRecordDao.Properties.Type.a(Integer.valueOf(i2)));
|
||||
return k.c() != null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<FileDownloadRecord> getFileDownloadRecordByUrl(String str, int i) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
QueryBuilder<FileDownloadRecord> k = DatabaseUtils.getDaoSession(false).j().k();
|
||||
k.a(FileDownloadRecordDao.Properties.FileUrl.a((Object) str), FileDownloadRecordDao.Properties.Type.a(Integer.valueOf(i)));
|
||||
List<FileDownloadRecord> b = k.b();
|
||||
if (b != null && b.size() > 0) {
|
||||
arrayList.addAll(b);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static void writeRecord(long j, String str, String str2, int i, long j2) {
|
||||
try {
|
||||
FileDownloadRecordDao j3 = DatabaseUtils.getDaoSession(false).j();
|
||||
QueryBuilder<FileDownloadRecord> k = j3.k();
|
||||
k.a(FileDownloadRecordDao.Properties.FileUrl.a((Object) str), new WhereCondition[0]);
|
||||
FileDownloadRecord c = k.c();
|
||||
if (c != null) {
|
||||
c.setUpdateTime(j2);
|
||||
j3.j(c);
|
||||
} else {
|
||||
FileDownloadRecord fileDownloadRecord = new FileDownloadRecord();
|
||||
fileDownloadRecord.setFileUrl(str);
|
||||
fileDownloadRecord.setId(j);
|
||||
fileDownloadRecord.setSavePath(str2);
|
||||
fileDownloadRecord.setType(i);
|
||||
fileDownloadRecord.setTypeId(j);
|
||||
fileDownloadRecord.setUpdateTime(j2);
|
||||
j3.g(fileDownloadRecord);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/IDaoHandler.java
Normal file
32
sources/com/ubt/jimu/base/db/IDaoHandler.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface IDaoHandler<T> {
|
||||
void delete(T t);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void deleteById(long j);
|
||||
|
||||
void deleteInTx(List<T> list);
|
||||
|
||||
long insert(T t);
|
||||
|
||||
void insertInTx(List<T> list);
|
||||
|
||||
long insertOrUpdate(T t);
|
||||
|
||||
void insertOrUpdateInTx(List<T> list);
|
||||
|
||||
List<T> selectAll();
|
||||
|
||||
T selectById(Long l);
|
||||
|
||||
T selectUnique(T t);
|
||||
|
||||
void update(T t);
|
||||
|
||||
void updateInTx(List<T> list);
|
||||
}
|
34
sources/com/ubt/jimu/base/db/JimuDaoMaster.java
Normal file
34
sources/com/ubt/jimu/base/db/JimuDaoMaster.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.AbstractDaoMaster;
|
||||
import org.greenrobot.greendao.AbstractDaoSession;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuDaoMaster extends AbstractDaoMaster {
|
||||
public static final int SCHEMA_VERSION = 1;
|
||||
|
||||
public JimuDaoMaster(Database database, List<Class<? extends AbstractDao<?, ?>>> list) {
|
||||
super(database, 1);
|
||||
Iterator<Class<? extends AbstractDao<?, ?>>> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
registerDaoClass(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.AbstractDaoMaster
|
||||
public AbstractDaoSession newSession() {
|
||||
return new DaoSession(this.db, IdentityScopeType.Session, this.daoConfigMap);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.AbstractDaoMaster
|
||||
public AbstractDaoSession newSession(IdentityScopeType identityScopeType) {
|
||||
return new DaoSession(this.db, identityScopeType, this.daoConfigMap);
|
||||
}
|
||||
}
|
137
sources/com/ubt/jimu/base/db/JimuOpenHelper.java
Normal file
137
sources/com/ubt/jimu/base/db/JimuOpenHelper.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
import com.ubt.jimu.gen.BlocklyProjectDao;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DiyDBModelDao;
|
||||
import com.ubt.jimu.gen.DiyModelActionDao;
|
||||
import com.ubt.jimu.gen.DiyProgramFileDao;
|
||||
import com.ubt.jimu.gen.FirmwareVersionDao;
|
||||
import com.ubt.jimu.gen.JimuMotionDao;
|
||||
import com.ubt.jimu.gen.JimuSoundDao;
|
||||
import com.ubt.jimu.gen.PackageDao;
|
||||
import com.ubt.jimu.gen.TransportFileDao;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuOpenHelper extends DaoMaster.OpenHelper {
|
||||
public JimuOpenHelper(Context context, String str) {
|
||||
super(context, str);
|
||||
}
|
||||
|
||||
private void addColumn(SQLiteDatabase sQLiteDatabase, String str, String str2, String str3, boolean z, int i) {
|
||||
sQLiteDatabase.execSQL(createAddColumnSql(str, str2, str3, z, i));
|
||||
}
|
||||
|
||||
private String createAddColumnSql(String str, String str2, String str3, boolean z, int i) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ALTER TABLE ");
|
||||
sb.append(str);
|
||||
sb.append(" ADD COLUMN ");
|
||||
sb.append(str2);
|
||||
sb.append(" ");
|
||||
sb.append(str3);
|
||||
if (z) {
|
||||
sb.append(";");
|
||||
} else {
|
||||
sb.append(" NOT NULL DEFAULT(");
|
||||
sb.append(i);
|
||||
sb.append(");");
|
||||
}
|
||||
String sb2 = sb.toString();
|
||||
ALog.a("JimuOpenHelper").d(sb2);
|
||||
return sb2;
|
||||
}
|
||||
|
||||
private void upgrade310(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyDBModelDao.TABLENAME, DiyDBModelDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, TransportFileDao.TABLENAME, TransportFileDao.Properties.FileType.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, TransportFileDao.TABLENAME, TransportFileDao.Properties.Uploaded.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.ModelId.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsUploadQiNiu.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsUploadService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsModify.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsUploadQiNiu.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsSyncUbtService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.AudioId.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.IsUploadService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.ModelId.e, "INTEGER", false, 0);
|
||||
DiyModelActionDao.a(wrap(sQLiteDatabase), true);
|
||||
}
|
||||
|
||||
private void upgrade320(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.VideoThumbnail.e, "STRING", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.VideoUrl.e, "STRING", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.Played.e, "INTEGER", true, 0);
|
||||
}
|
||||
|
||||
private void upgrade7(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyDBModelDao.TABLENAME, DiyDBModelDao.Properties.CompleteState.e, "INTEGER", false, 0);
|
||||
}
|
||||
|
||||
private void upgradeFrom122(SQLiteDatabase sQLiteDatabase) {
|
||||
sQLiteDatabase.execSQL("ALTER TABLE ROBOT ADD COLUMN HAS_MISSION INTEGER;");
|
||||
sQLiteDatabase.execSQL("ALTER TABLE JIMU_COURSE_MISSION ADD COLUMN MODULES_STR TEXT;");
|
||||
}
|
||||
|
||||
private void upgradeFrom223(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyProgramFileDao.TABLENAME, DiyProgramFileDao.Properties.Group.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, DiyProgramFileDao.TABLENAME, DiyProgramFileDao.Properties.Language.e, "TEXT", true, 0);
|
||||
}
|
||||
|
||||
private void upgradeTo5(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.EAN.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.UPC.e, "TEXT", true, 0);
|
||||
}
|
||||
|
||||
private void upgradeTo8(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, FirmwareVersionDao.TABLENAME, FirmwareVersionDao.Properties.IsForced.e, "INTEGER", false, 0);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.gen.DaoMaster.OpenHelper, org.greenrobot.greendao.database.DatabaseOpenHelper
|
||||
public void onCreate(Database database) {
|
||||
super.onCreate(database);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper, android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
super.onUpgrade(sQLiteDatabase, i, i2);
|
||||
if (i2 != i) {
|
||||
Log.i("JimuOpenHelper", "onUpgrade version " + i + " to " + i2);
|
||||
if (i <= 1) {
|
||||
upgradeFrom122(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 2) {
|
||||
upgradeFrom223(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 3) {
|
||||
upgrade310(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 4) {
|
||||
upgradeTo5(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 5) {
|
||||
upgrade320(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 6) {
|
||||
upgrade7(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 7) {
|
||||
upgradeTo8(sQLiteDatabase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JimuOpenHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory) {
|
||||
super(context, str, cursorFactory);
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.ubt.jimu.base.db.converter;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import com.ubt.jimu.utils.JsonHelper;
|
||||
import java.util.ArrayList;
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyBuildStepConvert implements PropertyConverter<ArrayList<DiyDetailsModel.DiyBuildStep>, String> {
|
||||
public String convertToDatabaseValue(ArrayList<DiyDetailsModel.DiyBuildStep> arrayList) {
|
||||
return JsonHelper.a(arrayList);
|
||||
}
|
||||
|
||||
public ArrayList<DiyDetailsModel.DiyBuildStep> convertToEntityProperty(String str) {
|
||||
return (ArrayList) JsonHelper.a(str, new TypeToken<ArrayList<DiyDetailsModel.DiyBuildStep>>() { // from class: com.ubt.jimu.base.db.converter.DiyBuildStepConvert.1
|
||||
}.getType());
|
||||
}
|
||||
}
|
102
sources/com/ubt/jimu/base/db/course/JimuCourseDbHandler.java
Normal file
102
sources/com/ubt/jimu/base/db/course/JimuCourseDbHandler.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.gen.JimuCourseDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseDbHandler extends AbstractDaoHandler<JimuCourse> {
|
||||
public JimuCourseDbHandler(AbstractDao<JimuCourse, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static JimuCourse getDownloadedCourse(JimuCourse jimuCourse) {
|
||||
QueryBuilder k = new JimuCourseDbHandler(DatabaseUtils.getDaoSession(false).l()).dao.k();
|
||||
k.a(JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())), new WhereCondition[0]);
|
||||
List<JimuCourse> b = k.b();
|
||||
if (b == null || b.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
for (JimuCourse jimuCourse2 : b) {
|
||||
if (jimuCourse2.getDownload()) {
|
||||
return jimuCourse2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<JimuCourse> getJimuCourseList(String str, long j) {
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = DatabaseUtils.getDaoSession(false).l().k();
|
||||
k.a(JimuCourseDao.Properties.UserId.a((Object) str), new WhereCondition[0]);
|
||||
k.a(JimuCourseDao.Properties.Id);
|
||||
return k.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<JimuCourse> list) {
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
JimuCourseDao l = DatabaseUtils.getDaoSession(false).l();
|
||||
for (JimuCourse jimuCourse : list) {
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = l.k();
|
||||
k.a(JimuCourseDao.Properties.UserId.a((Object) jimuCourse.getUserId()), JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())));
|
||||
JimuCourse c = k.c();
|
||||
if (c == null) {
|
||||
l.f(jimuCourse);
|
||||
} else {
|
||||
c.setDescription(jimuCourse.getDescription());
|
||||
c.setFolderName(jimuCourse.getFolderName());
|
||||
c.setImagePath(jimuCourse.getImagePath());
|
||||
c.setResourceZip(jimuCourse.getResourceZip());
|
||||
c.setImagePathLock(jimuCourse.getImagePathLock());
|
||||
c.setIsAvailable(jimuCourse.getIsAvailable());
|
||||
c.setName(jimuCourse.getName());
|
||||
c.setPassCount(jimuCourse.getPassCount());
|
||||
c.setMissionCount(jimuCourse.getMissionCount());
|
||||
c.setStarMax(jimuCourse.getStarMax());
|
||||
if (jimuCourse.getUpdatedTime() != c.getUpdatedTime()) {
|
||||
c.setDownload(false);
|
||||
}
|
||||
l.j(c);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateAllUserCourseDownloaded(JimuCourse jimuCourse, boolean z) {
|
||||
JimuCourseDao l = DatabaseUtils.getDaoSession(true).l();
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = l.k();
|
||||
k.a(JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())), new WhereCondition[0]);
|
||||
List<JimuCourse> b = k.b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
for (JimuCourse jimuCourse2 : b) {
|
||||
jimuCourse2.setDownload(z);
|
||||
jimuCourse2.setUpdatedTime(jimuCourse.getUpdatedTime());
|
||||
l.j(jimuCourse2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourse selectUnique(JimuCourse jimuCourse) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,110 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.gen.JimuCourseMissionDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseMissionDbHandler extends AbstractDaoHandler<JimuCourseMission> {
|
||||
public JimuCourseMissionDbHandler(AbstractDao<JimuCourseMission, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static JimuCourseMission getJimuCourseMission(JimuCourseMission jimuCourseMission) {
|
||||
try {
|
||||
QueryBuilder<JimuCourseMission> k = DatabaseUtils.getDaoSession(false).m().k();
|
||||
k.a(JimuCourseMissionDao.Properties.UserId.a((Object) jimuCourseMission.getUserId()), JimuCourseMissionDao.Properties.CourseId.a(Long.valueOf(jimuCourseMission.getCourseId())), JimuCourseMissionDao.Properties.TaskId.a(Long.valueOf(jimuCourseMission.getTaskId())), JimuCourseMissionDao.Properties.Id.a(Long.valueOf(jimuCourseMission.getId())));
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<JimuCourseMission> getJimuCourseMissions(String str, long j, long j2, long j3) {
|
||||
try {
|
||||
QueryBuilder<JimuCourseMission> k = DatabaseUtils.getDaoSession(false).m().k();
|
||||
k.a(JimuCourseMissionDao.Properties.UserId.a((Object) str), JimuCourseMissionDao.Properties.PackageId.a(Long.valueOf(j)), JimuCourseMissionDao.Properties.CourseId.a(Long.valueOf(j2)), JimuCourseMissionDao.Properties.TaskId.a(Long.valueOf(j3)));
|
||||
k.a(JimuCourseMissionDao.Properties.Name);
|
||||
return k.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean update(List<JimuCourseMission> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
DaoSession daoSession = DatabaseUtils.getDaoSession(true);
|
||||
for (JimuCourseMission jimuCourseMission : list) {
|
||||
JimuCourseMission jimuCourseMission2 = getJimuCourseMission(jimuCourseMission);
|
||||
if (jimuCourseMission2 != null) {
|
||||
jimuCourseMission.setLocalId(jimuCourseMission2.getLocalId());
|
||||
}
|
||||
}
|
||||
daoSession.m().c((Iterable) list);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean updateMissions(List<JimuCourseMission> list) {
|
||||
JimuCourseMission next;
|
||||
JimuCourseMission jimuCourseMission;
|
||||
if (list == null || list.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
DaoSession daoSession = DatabaseUtils.getDaoSession(true);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<JimuCourseMission> it = list.iterator();
|
||||
while (it.hasNext() && (jimuCourseMission = getJimuCourseMission((next = it.next()))) != null) {
|
||||
jimuCourseMission.setIsLock(next.getIsLock());
|
||||
jimuCourseMission.setIsSkip(next.getIsSkip());
|
||||
jimuCourseMission.setStar(next.getStar());
|
||||
arrayList.add(jimuCourseMission);
|
||||
}
|
||||
if (arrayList.size() != list.size()) {
|
||||
return false;
|
||||
}
|
||||
daoSession.m().d((Iterable) arrayList);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateNextMission(JimuCourseMission jimuCourseMission) {
|
||||
if (jimuCourseMission == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JimuCourseMissionDao m = DatabaseUtils.getDaoSession(true).m();
|
||||
JimuCourseMission jimuCourseMission2 = getJimuCourseMission(jimuCourseMission);
|
||||
if (jimuCourseMission2 != null) {
|
||||
jimuCourseMission.setLocalId(jimuCourseMission2.getLocalId());
|
||||
m.b((Object[]) new JimuCourseMission[]{jimuCourseMission});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourseMission selectUnique(JimuCourseMission jimuCourseMission) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.gen.JimuCourseTaskDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseTaskDbHaldler extends AbstractDaoHandler<JimuCourseTask> {
|
||||
public JimuCourseTaskDbHaldler(AbstractDao<JimuCourseTask, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static List<JimuCourseTask> getJimuCourseTasks(String str, long j, long j2) {
|
||||
QueryBuilder<JimuCourseTask> k = DatabaseUtils.getDaoSession(false).n().k();
|
||||
k.a(JimuCourseTaskDao.Properties.UserId.a((Object) str), JimuCourseTaskDao.Properties.PackageId.a(Long.valueOf(j)), JimuCourseTaskDao.Properties.CourseId.a(Long.valueOf(j2)));
|
||||
return k.b();
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<JimuCourseTask> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
DatabaseUtils.getDaoSession(true).n().c((Iterable) list);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourseTask selectUnique(JimuCourseTask jimuCourseTask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(JimuCourseTask jimuCourseTask) {
|
||||
if (jimuCourseTask == null) {
|
||||
return;
|
||||
}
|
||||
DatabaseUtils.getDaoSession(true).n().a((Object[]) new JimuCourseTask[]{jimuCourseTask});
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/base/db/diy/Diy2Type.java
Normal file
8
sources/com/ubt/jimu/base/db/diy/Diy2Type.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum Diy2Type {
|
||||
TEXT,
|
||||
LIST,
|
||||
PICTURE
|
||||
}
|
369
sources/com/ubt/jimu/base/db/diy/DiyDBModel.java
Normal file
369
sources/com/ubt/jimu/base/db/diy/DiyDBModel.java
Normal file
@@ -0,0 +1,369 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.entities.RobotLite;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModel implements Serializable, Comparable<DiyDBModel> {
|
||||
private static final int CONTROLLER_COMPLETE = 1;
|
||||
private static final long serialVersionUID = 12840;
|
||||
private String actionPath;
|
||||
private int completeState;
|
||||
private String compressImagePath;
|
||||
private int customModelCategory;
|
||||
private long customModelCreatetime;
|
||||
private String customModelId;
|
||||
private String description;
|
||||
private String filePath;
|
||||
private Long id;
|
||||
private boolean isDelete;
|
||||
private Boolean isModify;
|
||||
private long lastUploadTime;
|
||||
private String modelCreatedId;
|
||||
private Integer modelId;
|
||||
private String modelName;
|
||||
private long modifyTime;
|
||||
private Integer mystep;
|
||||
private String step1Desc;
|
||||
private Integer step1state;
|
||||
private Integer step2state;
|
||||
private Integer step3state;
|
||||
private Integer step4state;
|
||||
private String step5PathDesc;
|
||||
private String step5desc;
|
||||
private Integer step5state;
|
||||
private Integer uploadState;
|
||||
private boolean useable;
|
||||
private String version;
|
||||
|
||||
public DiyDBModel(Long l, String str, String str2, int i, long j, long j2, Boolean bool, Integer num, boolean z, String str3, boolean z2, String str4, String str5, String str6, long j3, String str7, Integer num2, Integer num3, String str8, Integer num4, Integer num5, Integer num6, Integer num7, String str9, String str10, Integer num8, String str11, int i2) {
|
||||
this.isModify = false;
|
||||
this.modelId = 0;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
this.id = l;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.customModelCategory = i;
|
||||
this.customModelCreatetime = j;
|
||||
this.modifyTime = j2;
|
||||
this.isModify = bool;
|
||||
this.modelId = num;
|
||||
this.useable = z;
|
||||
this.version = str3;
|
||||
this.isDelete = z2;
|
||||
this.description = str4;
|
||||
this.modelCreatedId = str5;
|
||||
this.compressImagePath = str6;
|
||||
this.lastUploadTime = j3;
|
||||
this.filePath = str7;
|
||||
this.uploadState = num2;
|
||||
this.step1state = num3;
|
||||
this.step1Desc = str8;
|
||||
this.step2state = num4;
|
||||
this.step3state = num5;
|
||||
this.step4state = num6;
|
||||
this.step5state = num7;
|
||||
this.step5desc = str9;
|
||||
this.step5PathDesc = str10;
|
||||
this.mystep = num8;
|
||||
this.actionPath = str11;
|
||||
this.completeState = i2;
|
||||
}
|
||||
|
||||
public String getActionPath() {
|
||||
return this.actionPath;
|
||||
}
|
||||
|
||||
public int getCompleteState() {
|
||||
return this.completeState;
|
||||
}
|
||||
|
||||
public String getCompressImagePath() {
|
||||
return this.compressImagePath;
|
||||
}
|
||||
|
||||
public int getCustomModelCategory() {
|
||||
return this.customModelCategory;
|
||||
}
|
||||
|
||||
public long getCustomModelCreatetime() {
|
||||
return this.customModelCreatetime;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean getIsDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public Boolean getIsModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getLastUploadTime() {
|
||||
return this.lastUploadTime;
|
||||
}
|
||||
|
||||
public String getModelCreatedId() {
|
||||
return this.modelCreatedId;
|
||||
}
|
||||
|
||||
public Integer getModelId() {
|
||||
return this.modelId;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public Boolean getModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getModifyTime() {
|
||||
return this.modifyTime;
|
||||
}
|
||||
|
||||
public Integer getMyStep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public Integer getMystep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public RobotLite getRobotLite() {
|
||||
return new RobotLite(this.modelId.intValue(), this.customModelId, this.modelName, this.filePath, true, true);
|
||||
}
|
||||
|
||||
public String getStep1Desc() {
|
||||
return this.step1Desc;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStep5PathDesc() {
|
||||
return this.step5PathDesc;
|
||||
}
|
||||
|
||||
public String getStep5desc() {
|
||||
return this.step5desc;
|
||||
}
|
||||
|
||||
public Integer getStep5state() {
|
||||
return this.step5state;
|
||||
}
|
||||
|
||||
public Integer getUploadState() {
|
||||
return this.uploadState;
|
||||
}
|
||||
|
||||
public boolean getUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean isControllerComplete() {
|
||||
return (this.completeState & 1) > 0;
|
||||
}
|
||||
|
||||
public boolean isDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public boolean isUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public void setActionPath(String str) {
|
||||
this.actionPath = str;
|
||||
}
|
||||
|
||||
public void setCompleteState(int i) {
|
||||
this.completeState = i;
|
||||
}
|
||||
|
||||
public void setCompressImagePath(String str) {
|
||||
this.compressImagePath = str;
|
||||
}
|
||||
|
||||
public void setControllerComplete() {
|
||||
this.completeState |= 1;
|
||||
}
|
||||
|
||||
public void setCustomModelCategory(int i) {
|
||||
this.customModelCategory = i;
|
||||
}
|
||||
|
||||
public void setCustomModelCreatetime(long j) {
|
||||
this.customModelCreatetime = j;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.filePath = str;
|
||||
}
|
||||
|
||||
public void setId(Long l) {
|
||||
this.id = l;
|
||||
}
|
||||
|
||||
public void setIsDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setIsModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setLastUploadTime(long j) {
|
||||
this.lastUploadTime = j;
|
||||
}
|
||||
|
||||
public void setModelCreatedId(String str) {
|
||||
this.modelCreatedId = str;
|
||||
}
|
||||
|
||||
public void setModelId(Integer num) {
|
||||
this.modelId = num;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModifyTime(long j) {
|
||||
this.modifyTime = j;
|
||||
}
|
||||
|
||||
public void setMyStep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setMystep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setStep1Desc(String str) {
|
||||
this.step1Desc = str;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStep5PathDesc(String str) {
|
||||
this.step5PathDesc = str;
|
||||
}
|
||||
|
||||
public void setStep5desc(String str) {
|
||||
this.step5desc = str;
|
||||
}
|
||||
|
||||
public void setStep5state(Integer num) {
|
||||
this.step5state = num;
|
||||
}
|
||||
|
||||
public void setUploadState(Integer num) {
|
||||
this.uploadState = num;
|
||||
}
|
||||
|
||||
public void setUseable(boolean z) {
|
||||
this.useable = z;
|
||||
}
|
||||
|
||||
public void setVersion(String str) {
|
||||
this.version = str;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(DiyDBModel diyDBModel) {
|
||||
if (TextUtils.isEmpty(diyDBModel.getCustomModelId()) || TextUtils.isEmpty(this.customModelId)) {
|
||||
return 1;
|
||||
}
|
||||
return Long.parseLong(this.customModelId) > Long.parseLong(diyDBModel.getCustomModelId()) ? -1 : 0;
|
||||
}
|
||||
|
||||
public DiyDBModel() {
|
||||
this.isModify = false;
|
||||
this.modelId = 0;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
}
|
||||
}
|
321
sources/com/ubt/jimu/base/db/diy/DiyDBModelCopy.java
Normal file
321
sources/com/ubt/jimu/base/db/diy/DiyDBModelCopy.java
Normal file
@@ -0,0 +1,321 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModelCopy {
|
||||
private String actionPath;
|
||||
private String compressImagePath;
|
||||
private int customModelCategory;
|
||||
private long customModelCreatetime;
|
||||
private String customModelId;
|
||||
private String description;
|
||||
private String filePath;
|
||||
private Long id;
|
||||
private boolean isDelete;
|
||||
private Boolean isModify;
|
||||
private String modelCreatedId;
|
||||
private Integer modelId;
|
||||
private String modelName;
|
||||
private long modifyTime;
|
||||
private Integer mystep;
|
||||
private String step1Desc;
|
||||
private Integer step1state;
|
||||
private Integer step2state;
|
||||
private Integer step3state;
|
||||
private Integer step4state;
|
||||
private String step5PathDesc;
|
||||
private String step5desc;
|
||||
private Integer step5state;
|
||||
private Integer uploadState;
|
||||
private boolean useable;
|
||||
private String version;
|
||||
|
||||
public DiyDBModelCopy() {
|
||||
this.isModify = false;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
}
|
||||
|
||||
public String getActionPath() {
|
||||
return this.actionPath;
|
||||
}
|
||||
|
||||
public String getCompressImagePath() {
|
||||
return this.compressImagePath;
|
||||
}
|
||||
|
||||
public int getCustomModelCategory() {
|
||||
return this.customModelCategory;
|
||||
}
|
||||
|
||||
public long getCustomModelCreatetime() {
|
||||
return this.customModelCreatetime;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean getIsDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public Boolean getIsModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public String getModelCreatedId() {
|
||||
return this.modelCreatedId;
|
||||
}
|
||||
|
||||
public Integer getModelId() {
|
||||
return this.modelId;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public Boolean getModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getModifyTime() {
|
||||
return this.modifyTime;
|
||||
}
|
||||
|
||||
public Integer getMyStep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public Integer getMystep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public String getStep1Desc() {
|
||||
return this.step1Desc;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStep5PathDesc() {
|
||||
return this.step5PathDesc;
|
||||
}
|
||||
|
||||
public String getStep5desc() {
|
||||
return this.step5desc;
|
||||
}
|
||||
|
||||
public Integer getStep5state() {
|
||||
return this.step5state;
|
||||
}
|
||||
|
||||
public Integer getUploadState() {
|
||||
return this.uploadState;
|
||||
}
|
||||
|
||||
public boolean getUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean isDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public boolean isUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public void setActionPath(String str) {
|
||||
this.actionPath = str;
|
||||
}
|
||||
|
||||
public void setCompressImagePath(String str) {
|
||||
this.compressImagePath = str;
|
||||
}
|
||||
|
||||
public void setCustomModelCategory(int i) {
|
||||
this.customModelCategory = i;
|
||||
}
|
||||
|
||||
public void setCustomModelCreatetime(long j) {
|
||||
this.customModelCreatetime = j;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.filePath = str;
|
||||
}
|
||||
|
||||
public void setId(Long l) {
|
||||
this.id = l;
|
||||
}
|
||||
|
||||
public void setIsDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setIsModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModelCreatedId(String str) {
|
||||
this.modelCreatedId = str;
|
||||
}
|
||||
|
||||
public void setModelId(Integer num) {
|
||||
this.modelId = num;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModifyTime(long j) {
|
||||
this.modifyTime = j;
|
||||
}
|
||||
|
||||
public void setMyStep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setMystep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setStep1Desc(String str) {
|
||||
this.step1Desc = str;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStep5PathDesc(String str) {
|
||||
this.step5PathDesc = str;
|
||||
}
|
||||
|
||||
public void setStep5desc(String str) {
|
||||
this.step5desc = str;
|
||||
}
|
||||
|
||||
public void setStep5state(Integer num) {
|
||||
this.step5state = num;
|
||||
}
|
||||
|
||||
public void setUploadState(Integer num) {
|
||||
this.uploadState = num;
|
||||
}
|
||||
|
||||
public void setUseable(boolean z) {
|
||||
this.useable = z;
|
||||
}
|
||||
|
||||
public void setVersion(String str) {
|
||||
this.version = str;
|
||||
}
|
||||
|
||||
public DiyDBModelCopy(Long l, String str, String str2, int i, long j, long j2, Boolean bool, Integer num, boolean z, String str3, boolean z2, String str4, String str5, String str6, String str7, Integer num2, Integer num3, String str8, Integer num4, Integer num5, Integer num6, Integer num7, String str9, String str10, Integer num8, String str11) {
|
||||
this.isModify = false;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
this.id = l;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.customModelCategory = i;
|
||||
this.customModelCreatetime = j;
|
||||
this.modifyTime = j2;
|
||||
this.isModify = bool;
|
||||
this.modelId = num;
|
||||
this.useable = z;
|
||||
this.version = str3;
|
||||
this.isDelete = z2;
|
||||
this.description = str4;
|
||||
this.modelCreatedId = str5;
|
||||
this.compressImagePath = str6;
|
||||
this.filePath = str7;
|
||||
this.uploadState = num2;
|
||||
this.step1state = num3;
|
||||
this.step1Desc = str8;
|
||||
this.step2state = num4;
|
||||
this.step3state = num5;
|
||||
this.step4state = num6;
|
||||
this.step5state = num7;
|
||||
this.step5desc = str9;
|
||||
this.step5PathDesc = str10;
|
||||
this.mystep = num8;
|
||||
this.actionPath = str11;
|
||||
}
|
||||
}
|
22
sources/com/ubt/jimu/base/db/diy/DiyDetailsDbHandler.java
Normal file
22
sources/com/ubt/jimu/base/db/diy/DiyDetailsDbHandler.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDetailsDbHandler extends AbstractDaoHandler<DiyDetailsModel> {
|
||||
public DiyDetailsDbHandler(AbstractDao<DiyDetailsModel, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public boolean checkDownload(DiyDetailsModel diyDetailsModel) {
|
||||
DiyDetailsModel selectById = selectById(diyDetailsModel.getId());
|
||||
return selectById != null && selectById.getDownload();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyDetailsModel selectUnique(DiyDetailsModel diyDetailsModel) {
|
||||
return null;
|
||||
}
|
||||
}
|
89
sources/com/ubt/jimu/base/db/diy/DiyHelper.java
Normal file
89
sources/com/ubt/jimu/base/db/diy/DiyHelper.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.gen.DiyDBModelDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyHelper {
|
||||
public static final boolean ENCRYPTED = true;
|
||||
private static final DiyHelper ourInstance = new DiyHelper();
|
||||
private DaoSession daoSession;
|
||||
|
||||
private DiyHelper() {
|
||||
}
|
||||
|
||||
public static DiyHelper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void deleteItem(DiyDBModel diyDBModel) {
|
||||
DatabaseUtils.getDaoSession(true).a((DaoSession) diyDBModel);
|
||||
}
|
||||
|
||||
public DaoSession getDaoSession() {
|
||||
return this.daoSession;
|
||||
}
|
||||
|
||||
public List<DiyDBModel> getDiyList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.ModelCreatedId.a((Object) Cache.getInstance().getUserId()), new WhereCondition[0]);
|
||||
List<DiyDBModel> b = k.b();
|
||||
for (int size = b.size(); size > 0; size--) {
|
||||
arrayList.add(b.get(size - 1));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void insertData(DiyDBModel diyDBModel) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).b((DaoSession) diyDBModel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean nameRepeat(String str) {
|
||||
QueryBuilder b = DatabaseUtils.getDaoSession(false).b(DiyDBModel.class);
|
||||
b.a(DiyDBModelDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return ((DiyDBModel) b.c()) != null;
|
||||
}
|
||||
|
||||
public boolean queryForName(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return k.c() != null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public DiyDBModel queryForUUid(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new DiyDBModel();
|
||||
}
|
||||
}
|
||||
|
||||
public void rigisterDb(Context context) {
|
||||
this.daoSession = new DaoMaster(new DaoMaster.DevOpenHelper(context, "diy-db-encrypted").getEncryptedWritableDb("super-secret")).newSession();
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import com.ubt.jimu.diy.DiyRobotDbHandler;
|
||||
import com.ubt.jimu.diy.model.DiyProgramFile;
|
||||
import com.ubt.jimu.gen.DiyProgramFileDao;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyProgramFileDbHandler extends AbstractDaoHandler<DiyProgramFile> {
|
||||
public DiyProgramFileDbHandler(AbstractDao<DiyProgramFile, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static List<BlocklyProject> getDiyBlocklyProject(String str) {
|
||||
DiyProgramFileDbHandler diyProgramFileDbHandler = new DiyProgramFileDbHandler(DatabaseUtils.getDaoSession(true).g());
|
||||
ArrayList arrayList = new ArrayList();
|
||||
List<DiyProgramFile> diyProgramFile = diyProgramFileDbHandler.getDiyProgramFile(str);
|
||||
if (diyProgramFile.size() == 0) {
|
||||
return arrayList;
|
||||
}
|
||||
for (DiyProgramFile diyProgramFile2 : diyProgramFile) {
|
||||
File file = new File(DiyRobotDbHandler.getModelPath(str, ModelType.PLAYER_DATA) + str + Utils.BLOCKLY_ADD_PATH + File.separator + diyProgramFile2.getBlocklyProjectXmlName());
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
BlocklyProject blocklyProject = new BlocklyProject();
|
||||
blocklyProject.setBlocklyType(diyProgramFile2.getType());
|
||||
blocklyProject.setBlocklyVersion(diyProgramFile2.getBlocklyVersion());
|
||||
blocklyProject.setCustomModelId(diyProgramFile2.getCustomModelId());
|
||||
blocklyProject.setXmlId(diyProgramFile2.getBlocklyProjectXmlId());
|
||||
blocklyProject.setXmlName(diyProgramFile2.getName());
|
||||
blocklyProject.setIsDeleted("0");
|
||||
blocklyProject.setModelType(String.valueOf(ModelType.PLAYER_DATA.getType()));
|
||||
arrayList.add(blocklyProject);
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public List<DiyProgramFile> getDiyProgramFile(String str) {
|
||||
QueryBuilder k = this.dao.k();
|
||||
k.a(DiyProgramFileDao.Properties.CustomModelId.a((Object) str), DiyProgramFileDao.Properties.Language.a((Object) LocaleUtils.b()));
|
||||
List<DiyProgramFile> b = k.b();
|
||||
return b == null ? new ArrayList() : b;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyProgramFile selectUnique(DiyProgramFile diyProgramFile) {
|
||||
return null;
|
||||
}
|
||||
}
|
59
sources/com/ubt/jimu/base/db/diy/DiyRobotFileDbDandler.java
Normal file
59
sources/com/ubt/jimu/base/db/diy/DiyRobotFileDbDandler.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import com.ubt.jimu.gen.DiyRobotFileDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyRobotFileDbDandler extends AbstractDaoHandler<DiyRobotFile> {
|
||||
public DiyRobotFileDbDandler(AbstractDao<DiyRobotFile, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static DiyRobotFile query(DiyRobotFile diyRobotFile) {
|
||||
if (diyRobotFile == null) {
|
||||
return null;
|
||||
}
|
||||
QueryBuilder<DiyRobotFile> k = DatabaseUtils.getDaoSession(false).h().k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a(TextUtils.isEmpty(diyRobotFile.getCustomModelId()) ? Integer.valueOf(diyRobotFile.getServerModelId()) : diyRobotFile.getCustomModelId()), DiyRobotFileDao.Properties.FileType.a(Integer.valueOf(diyRobotFile.getFileType())), DiyRobotFileDao.Properties.FileName.a((Object) diyRobotFile.getFileName()), DiyRobotFileDao.Properties.ServerModelId.a(Integer.valueOf(diyRobotFile.getServerModelId())));
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static List<DiyRobotFile> queryDiyRobotFile(String str) {
|
||||
QueryBuilder<DiyRobotFile> k = DatabaseUtils.getDaoSession(false).h().k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.b();
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(DiyRobotFile diyRobotFile) {
|
||||
if (diyRobotFile == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
DiyRobotFileDao h = DatabaseUtils.getDaoSession(false).h();
|
||||
QueryBuilder<DiyRobotFile> k = h.k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a(TextUtils.isEmpty(diyRobotFile.getCustomModelId()) ? Integer.valueOf(diyRobotFile.getServerModelId()) : diyRobotFile.getCustomModelId()), DiyRobotFileDao.Properties.FileType.a(Integer.valueOf(diyRobotFile.getFileType())), DiyRobotFileDao.Properties.FileName.a((Object) diyRobotFile.getFileName()), DiyRobotFileDao.Properties.ServerModelId.a(Integer.valueOf(diyRobotFile.getServerModelId())));
|
||||
DiyRobotFile c = k.c();
|
||||
if (c == null) {
|
||||
h.f(diyRobotFile);
|
||||
} else {
|
||||
diyRobotFile.setId(c.getId());
|
||||
h.g(diyRobotFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyRobotFile selectUnique(DiyRobotFile diyRobotFile) {
|
||||
return null;
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/diy/DiyStep2Helper.java
Normal file
37
sources/com/ubt/jimu/base/db/diy/DiyStep2Helper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.gen.DiyStep2ModelDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2Helper {
|
||||
private static final DiyStep2Helper ourInstance = new DiyStep2Helper();
|
||||
|
||||
private DiyStep2Helper() {
|
||||
}
|
||||
|
||||
public static DiyStep2Helper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void insertData(DiyStep2Model diyStep2Model) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).i().g(diyStep2Model);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public DiyStep2Model queryForUUid(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyStep2Model> k = DatabaseUtils.getDaoSession(true).i().k();
|
||||
k.a(DiyStep2ModelDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new DiyStep2Model();
|
||||
}
|
||||
}
|
||||
}
|
169
sources/com/ubt/jimu/base/db/diy/DiyStep2Model.java
Normal file
169
sources/com/ubt/jimu/base/db/diy/DiyStep2Model.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2Model {
|
||||
private String customModelId;
|
||||
private Integer direction;
|
||||
private String directionPath;
|
||||
private String modelName;
|
||||
private String picJson;
|
||||
private Integer step1lock;
|
||||
private Integer step1state;
|
||||
private Integer step2lock;
|
||||
private Integer step2state;
|
||||
private Integer step3lock;
|
||||
private Integer step3state;
|
||||
private Integer step4lock;
|
||||
private Integer step4state;
|
||||
private String stepDesc;
|
||||
|
||||
public DiyStep2Model(String str, String str2, Integer num, Integer num2, String str3, String str4, Integer num3, Integer num4, Integer num5, String str5, Integer num6, Integer num7, Integer num8, Integer num9) {
|
||||
this.step1state = 0;
|
||||
this.step1lock = 0;
|
||||
this.step2state = 0;
|
||||
this.step2lock = 0;
|
||||
this.direction = 1;
|
||||
this.step3state = 0;
|
||||
this.step3lock = 0;
|
||||
this.step4state = 0;
|
||||
this.step4lock = 0;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.step1state = num;
|
||||
this.step1lock = num2;
|
||||
this.stepDesc = str3;
|
||||
this.picJson = str4;
|
||||
this.step2state = num3;
|
||||
this.step2lock = num4;
|
||||
this.direction = num5;
|
||||
this.directionPath = str5;
|
||||
this.step3state = num6;
|
||||
this.step3lock = num7;
|
||||
this.step4state = num8;
|
||||
this.step4lock = num9;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
public String getDirectionPath() {
|
||||
return this.directionPath;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public String getPicJson() {
|
||||
return this.picJson;
|
||||
}
|
||||
|
||||
public Integer getStep1lock() {
|
||||
return this.step1lock;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2lock() {
|
||||
return this.step2lock;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3lock() {
|
||||
return this.step3lock;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4lock() {
|
||||
return this.step4lock;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStepDesc() {
|
||||
return this.stepDesc;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDirection(Integer num) {
|
||||
this.direction = num;
|
||||
}
|
||||
|
||||
public void setDirectionPath(String str) {
|
||||
this.directionPath = str;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setPicJson(String str) {
|
||||
this.picJson = str;
|
||||
}
|
||||
|
||||
public void setStep1lock(Integer num) {
|
||||
this.step1lock = num;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2lock(Integer num) {
|
||||
this.step2lock = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3lock(Integer num) {
|
||||
this.step3lock = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4lock(Integer num) {
|
||||
this.step4lock = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStepDesc(String str) {
|
||||
this.stepDesc = str;
|
||||
}
|
||||
|
||||
public DiyStep2Model() {
|
||||
this.step1state = 0;
|
||||
this.step1lock = 0;
|
||||
this.step2state = 0;
|
||||
this.step2lock = 0;
|
||||
this.direction = 1;
|
||||
this.step3state = 0;
|
||||
this.step3lock = 0;
|
||||
this.step4state = 0;
|
||||
this.step4lock = 0;
|
||||
}
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/DiyStep2TypeConverter.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/DiyStep2TypeConverter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2TypeConverter implements PropertyConverter<Diy2Type, String> {
|
||||
public String convertToDatabaseValue(Diy2Type diy2Type) {
|
||||
return diy2Type.name();
|
||||
}
|
||||
|
||||
public Diy2Type convertToEntityProperty(String str) {
|
||||
return Diy2Type.valueOf(str);
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/base/db/diy/DiyType.java
Normal file
8
sources/com/ubt/jimu/base/db/diy/DiyType.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum DiyType {
|
||||
TEXT,
|
||||
LIST,
|
||||
PICTURE
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/DiyTypeConverter.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/DiyTypeConverter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyTypeConverter implements PropertyConverter<DiyType, String> {
|
||||
public String convertToDatabaseValue(DiyType diyType) {
|
||||
return diyType.name();
|
||||
}
|
||||
|
||||
public DiyType convertToEntityProperty(String str) {
|
||||
return DiyType.valueOf(str);
|
||||
}
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/SyncDbModel.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/SyncDbModel.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SyncDbModel extends DiyDBModel {
|
||||
private String modelDescription;
|
||||
|
||||
public String getModelDescription() {
|
||||
return this.modelDescription;
|
||||
}
|
||||
|
||||
public void setModelDescription(String str) {
|
||||
this.modelDescription = str;
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/proxy/BlocklyProjectImpl.java
Normal file
32
sources/com/ubt/jimu/base/db/proxy/BlocklyProjectImpl.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BlocklyProjectImpl implements ISqlProxy<BlocklyProject> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(BlocklyProject blocklyProject) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public BlocklyProject iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<BlocklyProject> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).a().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(BlocklyProject blocklyProject) {
|
||||
DatabaseUtils.getDaoSession(true).a().g(blocklyProject);
|
||||
}
|
||||
}
|
36
sources/com/ubt/jimu/base/db/proxy/ConfigItemImpl.java
Normal file
36
sources/com/ubt/jimu/base/db/proxy/ConfigItemImpl.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.transport.model.ConfigItem;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ConfigItemImpl implements ISqlProxy<ConfigItem> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(ConfigItem configItem) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public ConfigItem iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<ConfigItem> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).b().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(ConfigItem configItem) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).b().f(configItem);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/proxy/DiyDBModelImpl.java
Normal file
32
sources/com/ubt/jimu/base/db/proxy/DiyDBModelImpl.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModelImpl implements ISqlProxy<DiyDBModel> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(DiyDBModel diyDBModel) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public DiyDBModel iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<DiyDBModel> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).d().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(DiyDBModel diyDBModel) {
|
||||
DatabaseUtils.getDaoSession(true).d().g(diyDBModel);
|
||||
}
|
||||
}
|
30
sources/com/ubt/jimu/base/db/proxy/GreenDaoImpl.java
Normal file
30
sources/com/ubt/jimu/base/db/proxy/GreenDaoImpl.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.proxy.data.TestBean;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GreenDaoImpl implements ISqlProxy<TestBean> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(TestBean testBean) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public TestBean iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(TestBean testBean) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<TestBean> selectAll() {
|
||||
return null;
|
||||
}
|
||||
}
|
16
sources/com/ubt/jimu/base/db/proxy/ISqlProxy.java
Normal file
16
sources/com/ubt/jimu/base/db/proxy/ISqlProxy.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ISqlProxy<T> {
|
||||
void deleteByData(T t);
|
||||
|
||||
void deleteById();
|
||||
|
||||
T iSelect();
|
||||
|
||||
void insert(T t);
|
||||
|
||||
List<T> selectAll();
|
||||
}
|
36
sources/com/ubt/jimu/base/db/proxy/JimuMotionImpl.java
Normal file
36
sources/com/ubt/jimu/base/db/proxy/JimuMotionImpl.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.bean.JimuMotion;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuMotionImpl implements ISqlProxy<JimuMotion> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(JimuMotion jimuMotion) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public JimuMotion iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<JimuMotion> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).o().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(JimuMotion jimuMotion) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).o().g(jimuMotion);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/proxy/SqliteHelper.java
Normal file
37
sources/com/ubt/jimu/base/db/proxy/SqliteHelper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SqliteHelper<T> {
|
||||
private static final SqliteHelper ourInstance = new SqliteHelper();
|
||||
private ISqlProxy mSqlProxy;
|
||||
|
||||
private SqliteHelper() {
|
||||
}
|
||||
|
||||
public static SqliteHelper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void delete(T t) {
|
||||
this.mSqlProxy.deleteByData(t);
|
||||
}
|
||||
|
||||
public SqliteHelper init(ISqlProxy iSqlProxy) {
|
||||
this.mSqlProxy = iSqlProxy;
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void insert(T t) {
|
||||
this.mSqlProxy.insert(t);
|
||||
}
|
||||
|
||||
public List<T> loadAll() {
|
||||
return this.mSqlProxy.selectAll();
|
||||
}
|
||||
|
||||
public T select() {
|
||||
return (T) this.mSqlProxy.iSelect();
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/proxy/TransportFileImpl.java
Normal file
37
sources/com/ubt/jimu/base/db/proxy/TransportFileImpl.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TransportFileImpl implements ISqlProxy<TransportFile> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(TransportFile transportFile) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public TransportFile iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<TransportFile> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).v().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(TransportFile transportFile) {
|
||||
try {
|
||||
LogUtils.c("l=======" + DatabaseUtils.getDaoSession(true).v().g(transportFile));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
27
sources/com/ubt/jimu/base/db/proxy/data/DataBaseHelper.java
Normal file
27
sources/com/ubt/jimu/base/db/proxy/data/DataBaseHelper.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DataBaseHelper extends SQLiteOpenHelper {
|
||||
private static final String DB_NAME = "JIMU_DB";
|
||||
private static final int version = 1007;
|
||||
|
||||
public DataBaseHelper(Context context) {
|
||||
this(context, DB_NAME, null, 1007);
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
}
|
||||
|
||||
public DataBaseHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory, int i) {
|
||||
super(context, str, cursorFactory, i);
|
||||
}
|
||||
}
|
5
sources/com/ubt/jimu/base/db/proxy/data/TestBean.java
Normal file
5
sources/com/ubt/jimu/base/db/proxy/data/TestBean.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestBean {
|
||||
}
|
81
sources/com/ubt/jimu/base/db/proxy/data/TestSqlIte.java
Normal file
81
sources/com/ubt/jimu/base/db/proxy/data/TestSqlIte.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import com.ubt.jimu.base.db.proxy.BlocklyProjectImpl;
|
||||
import com.ubt.jimu.base.db.proxy.ConfigItemImpl;
|
||||
import com.ubt.jimu.base.db.proxy.DiyDBModelImpl;
|
||||
import com.ubt.jimu.base.db.proxy.JimuMotionImpl;
|
||||
import com.ubt.jimu.base.db.proxy.SqliteHelper;
|
||||
import com.ubt.jimu.base.db.proxy.TransportFileImpl;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import com.ubt.jimu.blockly.bean.JimuMotion;
|
||||
import com.ubt.jimu.transport.model.ConfigItem;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestSqlIte {
|
||||
private static final TestSqlIte INSTANCE = new TestSqlIte();
|
||||
|
||||
private TestSqlIte() {
|
||||
}
|
||||
|
||||
public static TestSqlIte getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void execSqlite(Context context) {
|
||||
SQLiteDatabase writableDatabase = new DataBaseHelper(context).getWritableDatabase();
|
||||
new DiyDBModelImpl();
|
||||
try {
|
||||
TestType.isCreate().moveDiyData(writableDatabase.rawQuery("select * from CustomModelBean", null));
|
||||
writableDatabase.execSQL("drop table CustomModelBean");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BlocklyProjectImpl blocklyProjectImpl = new BlocklyProjectImpl();
|
||||
try {
|
||||
Iterator it = new TestType().moveData(writableDatabase, "select * from BlocklyProject", BlocklyProject.class.getName()).iterator();
|
||||
while (it.hasNext()) {
|
||||
SqliteHelper.getInstance().init(blocklyProjectImpl).insert((BlocklyProject) it.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table BlocklyProject");
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
ConfigItemImpl configItemImpl = new ConfigItemImpl();
|
||||
try {
|
||||
Iterator it2 = new TestType().moveData(writableDatabase, "select * from ConfigItem", ConfigItem.class.getName()).iterator();
|
||||
while (it2.hasNext()) {
|
||||
SqliteHelper.getInstance().init(configItemImpl).insert((ConfigItem) it2.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table ConfigItem");
|
||||
} catch (Exception e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
JimuMotionImpl jimuMotionImpl = new JimuMotionImpl();
|
||||
try {
|
||||
Iterator it3 = new TestType().moveData(writableDatabase, "select * from JimuMotion ", JimuMotion.class.getName()).iterator();
|
||||
while (it3.hasNext()) {
|
||||
SqliteHelper.getInstance().init(jimuMotionImpl).insert((JimuMotion) it3.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table JimuMotion");
|
||||
} catch (Exception e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
TransportFileImpl transportFileImpl = new TransportFileImpl();
|
||||
try {
|
||||
long j = 1;
|
||||
for (TransportFile transportFile : new TestType().moveData(writableDatabase, "select * from syncFile ", TransportFile.class.getName())) {
|
||||
transportFile.setCustomFileId(Long.valueOf(j));
|
||||
SqliteHelper.getInstance().init(transportFileImpl).insert(transportFile);
|
||||
j++;
|
||||
}
|
||||
writableDatabase.execSQL("drop table syncFile");
|
||||
} catch (Exception e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
writableDatabase.close();
|
||||
}
|
||||
}
|
77
sources/com/ubt/jimu/base/db/proxy/data/TestType.java
Normal file
77
sources/com/ubt/jimu/base/db/proxy/data/TestType.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter;
|
||||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||||
import com.ubt.jimu.base.db.diy.DiyHelper;
|
||||
import com.ubt.jimu.diy.DiyRobotDbHandler;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestType<T> {
|
||||
private static TestType tt;
|
||||
|
||||
public static TestType isCreate() {
|
||||
if (tt == null) {
|
||||
tt = new TestType();
|
||||
}
|
||||
return tt;
|
||||
}
|
||||
|
||||
public ArrayList<T> moveData(SQLiteDatabase sQLiteDatabase, String str, String str2) throws Exception {
|
||||
AbstractReflectionConverter.ArraysList arraysList = (ArrayList<T>) new ArrayList();
|
||||
Cursor rawQuery = sQLiteDatabase.rawQuery(str, null);
|
||||
while (rawQuery.moveToNext()) {
|
||||
Class<?> cls = Class.forName(str2);
|
||||
Field[] declaredFields = cls.getDeclaredFields();
|
||||
Object newInstance = cls.newInstance();
|
||||
for (int i = 0; i < declaredFields.length; i++) {
|
||||
declaredFields[i].setAccessible(true);
|
||||
if (declaredFields[i].getGenericType().equals(String.class)) {
|
||||
declaredFields[i].set(newInstance, rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getString(rawQuery.getColumnIndex(declaredFields[i].getName())) : null);
|
||||
} else if (declaredFields[i].getGenericType().equals(Integer.class)) {
|
||||
declaredFields[i].set(newInstance, Integer.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getInt(rawQuery.getColumnIndex(declaredFields[i].getName())) : -10));
|
||||
} else if (declaredFields[i].getGenericType().equals(Long.class)) {
|
||||
declaredFields[i].set(newInstance, Long.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getLong(rawQuery.getColumnIndex(declaredFields[i].getName())) : -10L));
|
||||
} else if (declaredFields[i].getGenericType().equals(Boolean.class)) {
|
||||
declaredFields[i].set(newInstance, Boolean.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 && rawQuery.getLong(rawQuery.getColumnIndex(declaredFields[i].getName())) == 1));
|
||||
} else if (declaredFields[i].getGenericType().equals(Double.class)) {
|
||||
declaredFields[i].set(newInstance, Double.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getDouble(rawQuery.getColumnIndex(declaredFields[i].getName())) : 0.0d));
|
||||
}
|
||||
}
|
||||
arraysList.add(newInstance);
|
||||
}
|
||||
return arraysList;
|
||||
}
|
||||
|
||||
public void moveDiyData(Cursor cursor) {
|
||||
while (cursor.moveToNext()) {
|
||||
DiyDBModel diyDBModel = new DiyDBModel();
|
||||
diyDBModel.setCustomModelId(cursor.getString(cursor.getColumnIndex("customModelId")));
|
||||
diyDBModel.setModelName(cursor.getString(cursor.getColumnIndex(UnityActivity.pModelName)));
|
||||
diyDBModel.setCustomModelCategory(cursor.getInt(cursor.getColumnIndex("customModelCategory")));
|
||||
diyDBModel.setModifyTime(cursor.getInt(cursor.getColumnIndex("modifyTime")));
|
||||
boolean z = false;
|
||||
diyDBModel.setModify(Boolean.valueOf(cursor.getInt(cursor.getColumnIndex("isModify")) == 1));
|
||||
diyDBModel.setModelId(Integer.valueOf(cursor.getInt(cursor.getColumnIndex("modelId"))));
|
||||
if (cursor.getInt(cursor.getColumnIndex("useable")) == 1) {
|
||||
z = true;
|
||||
}
|
||||
diyDBModel.setUseable(z);
|
||||
diyDBModel.setVersion(cursor.getString(cursor.getColumnIndex(MediationMetaData.KEY_VERSION)));
|
||||
diyDBModel.setDescription(cursor.getString(cursor.getColumnIndex(SocialConstants.PARAM_COMMENT)));
|
||||
diyDBModel.setModelCreatedId(cursor.getString(cursor.getColumnIndex("modelCreatedId")));
|
||||
diyDBModel.setCompressImagePath(cursor.getString(cursor.getColumnIndex("compressImagePath")));
|
||||
diyDBModel.setFilePath(DiyRobotDbHandler.getCustomModelPath(cursor.getString(cursor.getColumnIndex("modelCreatedId"))) + diyDBModel.getCustomModelId() + File.separator + diyDBModel.getCustomModelId() + ".jpg");
|
||||
diyDBModel.setUploadState(Integer.valueOf(cursor.getInt(cursor.getColumnIndex("uploadState"))));
|
||||
diyDBModel.setStep1state(1);
|
||||
DiyHelper.getInstance().insertData(diyDBModel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.FirmwareVersion;
|
||||
import com.ubt.jimu.gen.FirmwareVersionDao;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FirmwareVersionDbHandler extends AbstractDaoHandler<FirmwareVersion> {
|
||||
private static FirmwareVersionDbHandler instance;
|
||||
|
||||
public FirmwareVersionDbHandler(AbstractDao<FirmwareVersion, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static synchronized FirmwareVersionDbHandler getInstance() {
|
||||
FirmwareVersionDbHandler firmwareVersionDbHandler;
|
||||
synchronized (FirmwareVersionDbHandler.class) {
|
||||
if (instance == null) {
|
||||
instance = new FirmwareVersionDbHandler(DatabaseUtils.getDaoSession(true).k());
|
||||
}
|
||||
firmwareVersionDbHandler = instance;
|
||||
}
|
||||
return firmwareVersionDbHandler;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public FirmwareVersion selectUnique(FirmwareVersion firmwareVersion) {
|
||||
QueryBuilder<FirmwareVersion> queryBuilder = getQueryBuilder();
|
||||
queryBuilder.a(FirmwareVersionDao.Properties.VersionType.a(firmwareVersion.getVersionType()), new WhereCondition[0]);
|
||||
return queryBuilder.c();
|
||||
}
|
||||
}
|
95
sources/com/ubt/jimu/base/db/robot/PackageDbHandler.java
Normal file
95
sources/com/ubt/jimu/base/db/robot/PackageDbHandler.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.gen.PackageDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PackageDbHandler {
|
||||
public static List<Package> findByEan(String str) {
|
||||
List<Package> b = DatabaseUtils.getDaoSession(false).q().k().b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<Package> it = b.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Package next = it.next();
|
||||
if (matchWords(str, next.getEAN())) {
|
||||
arrayList.add(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Package> findByUpc(String str) {
|
||||
List<Package> b = DatabaseUtils.getDaoSession(false).q().k().b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<Package> it = b.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Package next = it.next();
|
||||
if (matchWords(str, next.getUPC())) {
|
||||
arrayList.add(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Package> getPackageList() {
|
||||
QueryBuilder<Package> k = DatabaseUtils.getDaoSession(false).q().k();
|
||||
k.a(PackageDao.Properties.DisplayOrder);
|
||||
return k.b();
|
||||
}
|
||||
|
||||
private static boolean matchWords(String str, String str2) {
|
||||
if (!TextUtils.isEmpty(str2)) {
|
||||
for (String str3 : str2.split(",")) {
|
||||
if (str.equals(str3.trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<Package> list) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).q().c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Package selectById(long j) {
|
||||
try {
|
||||
return DatabaseUtils.getDaoSession(true).q().a(j);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(Package r1) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).q().j(r1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.PartFileInfo;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PartFileInfoDbHandler extends AbstractDaoHandler<PartFileInfo> {
|
||||
public PartFileInfoDbHandler(AbstractDao<PartFileInfo, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static boolean insertOrUpdate(List<PartFileInfo> list) {
|
||||
try {
|
||||
new PartFileInfoDbHandler(DatabaseUtils.getDaoSession(true).r()).insertOrUpdateInTx(list);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public PartFileInfo selectUnique(PartFileInfo partFileInfo) {
|
||||
return selectById(partFileInfo.getId());
|
||||
}
|
||||
}
|
98
sources/com/ubt/jimu/base/db/robot/RobotDbHandler.java
Normal file
98
sources/com/ubt/jimu/base/db/robot/RobotDbHandler.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.gen.RobotDao;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RobotDbHandler extends AbstractDaoHandler<Robot> {
|
||||
private static RobotDbHandler instance;
|
||||
|
||||
public RobotDbHandler(AbstractDao<Robot, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static synchronized RobotDbHandler getInstance() {
|
||||
RobotDbHandler robotDbHandler;
|
||||
synchronized (RobotDbHandler.class) {
|
||||
if (instance == null) {
|
||||
instance = new RobotDbHandler(DatabaseUtils.getDaoSession(true).s());
|
||||
}
|
||||
robotDbHandler = instance;
|
||||
}
|
||||
return robotDbHandler;
|
||||
}
|
||||
|
||||
public static Robot getRobotById(long j) {
|
||||
QueryBuilder<Robot> k = DatabaseUtils.getDaoSession(true).s().k();
|
||||
k.a(RobotDao.Properties.ModelId.a(Long.valueOf(j)), new WhereCondition[0]);
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static Robot getRobotByModelName(String str) {
|
||||
QueryBuilder<Robot> k = DatabaseUtils.getDaoSession(true).s().k();
|
||||
k.a(RobotDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static List<Robot> getRobotList(long j) {
|
||||
try {
|
||||
return DatabaseUtils.getDaoSession(true).q().h(Long.valueOf(j)).getRobotList();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<Robot> list) {
|
||||
try {
|
||||
RobotDao s = DatabaseUtils.getDaoSession(true).s();
|
||||
List<Robot> j = s.j();
|
||||
if (j == null || j.size() == 0) {
|
||||
s.c((Iterable) list);
|
||||
}
|
||||
for (Robot robot : list) {
|
||||
Iterator<Robot> it = j.iterator();
|
||||
while (true) {
|
||||
if (it.hasNext()) {
|
||||
Robot next = it.next();
|
||||
if (robot.getModelId() == next.getModelId()) {
|
||||
robot.setDownload(next.getDownload() && robot.getModelUpdateTime() == next.getModelUpdateTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
s.c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setRobotDownloadState(Robot robot) {
|
||||
RobotDao s = DatabaseUtils.getDaoSession(true).s();
|
||||
QueryBuilder<Robot> k = s.k();
|
||||
k.a(RobotDao.Properties.ModelName.a((Object) robot.getModelName()), new WhereCondition[0]);
|
||||
List<Robot> b = k.b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<Robot> it = b.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setDownload(robot.getDownload());
|
||||
}
|
||||
s.d((Iterable) b);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public Robot selectUnique(Robot robot) {
|
||||
QueryBuilder k = this.dao.k();
|
||||
k.a(RobotDao.Properties.ModelId.a(Long.valueOf(robot.getModelId())), new WhereCondition[0]);
|
||||
return (Robot) k.c();
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.RobotPackage;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RobotPackageDbHandler {
|
||||
public static void saveOrUpdate(List<RobotPackage> list) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(false).t().c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
81
sources/com/ubt/jimu/base/db/starcourse/CourseDbHandler.java
Normal file
81
sources/com/ubt/jimu/base/db/starcourse/CourseDbHandler.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.base.db.starcourse;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.gen.CourseDao;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseDbHandler {
|
||||
public static List<Course> getNewCourseList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Course> k = c.k();
|
||||
k.a(CourseDao.Properties.Lan.a((Object) g), CourseDao.Properties.StoryName.a((Object) Constant.SelectRobot.ASTROBOT_MINI));
|
||||
List<Course> b = k.b();
|
||||
arrayList.addAll(b);
|
||||
LogUtils.c("tList.getNewCourseList" + b.size());
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Course> getOldCourseList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Course> k = c.k();
|
||||
k.a(CourseDao.Properties.Lan.a((Object) g), CourseDao.Properties.StoryName.a((Object) "AstroBot"));
|
||||
arrayList.addAll(k.b());
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static void saveList(List<Course> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
Iterator<Course> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setLan(g);
|
||||
}
|
||||
c.c((Iterable) list);
|
||||
}
|
||||
|
||||
public static void setCourseComplete(Course course) {
|
||||
if (course == null) {
|
||||
return;
|
||||
}
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
course.setLan(g);
|
||||
course.setStatus(Course.STATUS_COMPLETED);
|
||||
c.j(course);
|
||||
String b = SPUtils.b(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY);
|
||||
List<Course> oldCourseList = (Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_CN.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_NA.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_GLOBAL.equals(b)) ? getOldCourseList() : getNewCourseList();
|
||||
Course course2 = null;
|
||||
boolean z = false;
|
||||
for (int i = 0; i < oldCourseList.size(); i++) {
|
||||
Course course3 = oldCourseList.get(i);
|
||||
if (course3.getNameKey().equals(course.getNextCourse())) {
|
||||
course2 = course3;
|
||||
}
|
||||
if (course3.getStatus().equals(Course.STATUS_RUNNING)) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (z || course2 == null) {
|
||||
return;
|
||||
}
|
||||
course2.setStatus(Course.STATUS_RUNNING);
|
||||
course2.setLan(g);
|
||||
c.b((Object[]) new Course[]{course2});
|
||||
}
|
||||
}
|
41
sources/com/ubt/jimu/base/db/starcourse/StoryDbHandler.java
Normal file
41
sources/com/ubt/jimu/base/db/starcourse/StoryDbHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.base.db.starcourse;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.gen.StoryDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StoryDbHandler {
|
||||
public static List<Story> getStoryList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Story> k = DatabaseUtils.getDaoSession(true).u().k();
|
||||
k.a(StoryDao.Properties.Lan.a((Object) g), new WhereCondition[0]);
|
||||
arrayList.addAll(k.b());
|
||||
return arrayList;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
public static void save(List<Story> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
String g = JimuApplication.l().g();
|
||||
StoryDao u = DatabaseUtils.getDaoSession(true).u();
|
||||
Iterator<Story> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setLan(g);
|
||||
}
|
||||
u.c((Iterable) list);
|
||||
}
|
||||
}
|
77
sources/com/ubt/jimu/base/db/user/UserDbHandler.java
Normal file
77
sources/com/ubt/jimu/base/db/user/UserDbHandler.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.base.db.user;
|
||||
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.gen.UserDao;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UserDbHandler {
|
||||
public static void clearUser() {
|
||||
JimuAnalytics.b().a("0", "google_play");
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static User getUser() {
|
||||
try {
|
||||
List<User> j = DatabaseUtils.getDaoSession(false).w().j();
|
||||
if (j != null && j.size() != 0) {
|
||||
return j.get(0);
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLogin() {
|
||||
User user = getUser();
|
||||
return user != null && user.getUserId() > 0;
|
||||
}
|
||||
|
||||
public static void save(User user) {
|
||||
if (user != null) {
|
||||
JimuAnalytics.b().a(String.valueOf(user.getUserId()), "google_play");
|
||||
}
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().g(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateUser(long j) {
|
||||
}
|
||||
|
||||
public static void updateUserInfo(User user) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().j(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateUserToken(String str) {
|
||||
try {
|
||||
UserDao w = DatabaseUtils.getDaoSession(false).w();
|
||||
QueryBuilder<User> k = w.k();
|
||||
k.a(UserDao.Properties.UserId.a(Long.valueOf(Cache.getInstance().getLoginUserIntId())), new WhereCondition[0]);
|
||||
User c = k.c();
|
||||
if (c != null) {
|
||||
c.setToken(str);
|
||||
}
|
||||
w.j(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/base/dialog/IDialogListener.java
Normal file
8
sources/com/ubt/jimu/base/dialog/IDialogListener.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IDialogListener {
|
||||
void onCancle();
|
||||
|
||||
void onOk();
|
||||
}
|
349
sources/com/ubt/jimu/base/dialog/JimuSimpleDialog.java
Normal file
349
sources/com/ubt/jimu/base/dialog/JimuSimpleDialog.java
Normal file
@@ -0,0 +1,349 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ubt.jimu.Channel;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.update.UpdateManager;
|
||||
import com.ubt.jimu.utils.NetWorkUtil;
|
||||
import com.ubt.jimu.utils.SystemUtils;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuSimpleDialog extends Dialog implements View.OnClickListener {
|
||||
public Button btnCancel;
|
||||
public Button btnOk;
|
||||
public String cancel;
|
||||
public int cancleBtnBg;
|
||||
public String content;
|
||||
private ImageView imgLogo;
|
||||
private OnDismissListener mOnDismissListener;
|
||||
public String ok;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
private TextView tvDialogTitle;
|
||||
private TextView tvTips;
|
||||
|
||||
public static class Builder {
|
||||
private String cancel;
|
||||
private int cancleBtnBg;
|
||||
private String content;
|
||||
private Context context;
|
||||
private String logoUrl;
|
||||
private String ok;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
private String title;
|
||||
private int logoResId = 0;
|
||||
private boolean canceledOnTouchOutside = true;
|
||||
private int gravity = 17;
|
||||
|
||||
public Builder(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public JimuSimpleDialog build() {
|
||||
int i;
|
||||
double d;
|
||||
int a;
|
||||
int a2;
|
||||
JimuSimpleDialog jimuSimpleDialog = new JimuSimpleDialog(this.context);
|
||||
jimuSimpleDialog.requestWindowFeature(1);
|
||||
jimuSimpleDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
jimuSimpleDialog.content = this.content;
|
||||
jimuSimpleDialog.ok = this.ok;
|
||||
jimuSimpleDialog.cancel = this.cancel;
|
||||
jimuSimpleDialog.onOkListener = this.onOkListener;
|
||||
jimuSimpleDialog.onCancelListener = this.onCancelListener;
|
||||
jimuSimpleDialog.cancleBtnBg = this.cancleBtnBg;
|
||||
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_simple, (ViewGroup) null, false);
|
||||
jimuSimpleDialog.intView(inflate, this);
|
||||
jimuSimpleDialog.setContentView(inflate);
|
||||
jimuSimpleDialog.setCanceledOnTouchOutside(this.canceledOnTouchOutside);
|
||||
Window window = jimuSimpleDialog.getWindow();
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
window.setBackgroundDrawableResource(R.color.translucent);
|
||||
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
|
||||
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
|
||||
if (JimuApplication.l().i()) {
|
||||
i = (int) (max * 0.5039d);
|
||||
d = 0.624d;
|
||||
} else {
|
||||
i = (int) (max * 0.5165d);
|
||||
d = 0.6088d;
|
||||
}
|
||||
int i2 = (int) (i * d);
|
||||
if (JimuApplication.l().i()) {
|
||||
a = DisplayUtil.a(this.context, 516.0f);
|
||||
a2 = DisplayUtil.a(this.context, 322.0f);
|
||||
} else {
|
||||
a = DisplayUtil.a(this.context, 344.55f);
|
||||
a2 = DisplayUtil.a(this.context, 209.75f);
|
||||
}
|
||||
if (a > i || a2 > i2) {
|
||||
i = a;
|
||||
i2 = a2;
|
||||
}
|
||||
attributes.width = i;
|
||||
attributes.height = i2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
return jimuSimpleDialog;
|
||||
}
|
||||
|
||||
public Builder cancel(String str) {
|
||||
this.cancel = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder canceledOnTouchOutside(boolean z) {
|
||||
this.canceledOnTouchOutside = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder cancleBtnBg(int i) {
|
||||
this.cancleBtnBg = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(String str) {
|
||||
this.content = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder gravity(int i) {
|
||||
this.gravity = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder logoResId(int i) {
|
||||
this.logoResId = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder logoUrl(String str) {
|
||||
this.logoUrl = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ok(String str) {
|
||||
this.ok = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onCancelListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onOkListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder title(String str) {
|
||||
this.title = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder cancel(int i) {
|
||||
this.cancel = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(int i) {
|
||||
this.content = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ok(int i) {
|
||||
this.ok = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder title(int i) {
|
||||
this.title = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnDismissListener {
|
||||
void onDismiss(Dialog dialog);
|
||||
}
|
||||
|
||||
public JimuSimpleDialog(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public static JimuSimpleDialog buildSimpleDialog(Activity activity, String str, String str2, String str3, String str4, int i, DialogInterface.OnClickListener onClickListener, DialogInterface.OnClickListener onClickListener2) {
|
||||
return new Builder(activity).title(str3).cancel(str2).ok(str).content(str4).gravity(i).onCancel(onClickListener).onOk(onClickListener2).build();
|
||||
}
|
||||
|
||||
public static boolean shouldShowWifiOnlyDialog(Context context) {
|
||||
return NetWorkUtil.a(context) == NetWorkUtil.NetworkType.MOBILE && Cache.getInstance().isWifiOnly() && !Cache.getInstance().isShowMobileDataTips();
|
||||
}
|
||||
|
||||
public static boolean showWifiOnlyDialog(Context context, final DialogInterface.OnClickListener onClickListener, final DialogInterface.OnClickListener onClickListener2, boolean z) {
|
||||
if (context != null && !z && shouldShowWifiOnlyDialog(context)) {
|
||||
new Builder(context).title(R.string.mobile_data_tips).cancel(R.string.cancel).ok(R.string.key_continue).content(R.string.tips_using_mobile_data).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.4
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
DialogInterface.OnClickListener onClickListener3 = onClickListener;
|
||||
if (onClickListener3 != null) {
|
||||
onClickListener3.onClick(dialogInterface, i);
|
||||
}
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.3
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
DialogInterface.OnClickListener onClickListener3 = onClickListener2;
|
||||
if (onClickListener3 != null) {
|
||||
onClickListener3.onClick(dialogInterface, i);
|
||||
Cache.getInstance().setShowMobileDataTips(true);
|
||||
}
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).build().show();
|
||||
return true;
|
||||
}
|
||||
if (onClickListener2 == null) {
|
||||
return false;
|
||||
}
|
||||
onClickListener2.onClick(null, -1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Dialog versionUpdateDialog(final Activity activity, boolean z, String str) {
|
||||
Builder builder = new Builder(activity);
|
||||
builder.title(R.string.update_title).ok(R.string.update_sure).content(str).gravity(3).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (Channel.GOOGLE_PLAY.getChannelName().equals("google_play")) {
|
||||
SystemUtils.a(activity);
|
||||
dialogInterface.dismiss();
|
||||
} else {
|
||||
UpdateManager.c().a(activity);
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}
|
||||
}).build();
|
||||
if (!z) {
|
||||
builder.cancel(R.string.cancel).canceledOnTouchOutside(true).onCancel(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.JimuSimpleDialog.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.content.DialogInterface
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
OnDismissListener onDismissListener = this.mOnDismissListener;
|
||||
if (onDismissListener != null) {
|
||||
onDismissListener.onDismiss(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void intView(View view, Builder builder) {
|
||||
this.tvDialogTitle = (TextView) view.findViewById(R.id.tvDialogTitle);
|
||||
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
|
||||
this.imgLogo = (ImageView) view.findViewById(R.id.imgLogo);
|
||||
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
|
||||
this.btnOk = (Button) view.findViewById(R.id.btnOk);
|
||||
this.btnCancel.setOnClickListener(this);
|
||||
this.btnOk.setOnClickListener(this);
|
||||
if (!TextUtils.isEmpty(this.content)) {
|
||||
this.tvTips.setText(this.content);
|
||||
this.tvTips.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
}
|
||||
if (this.onCancelListener == null) {
|
||||
this.btnCancel.setVisibility(8);
|
||||
}
|
||||
if (this.onOkListener == null) {
|
||||
this.btnOk.setVisibility(8);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.ok)) {
|
||||
this.btnOk.setText(this.ok);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.cancel)) {
|
||||
this.btnCancel.setText(this.cancel);
|
||||
}
|
||||
if (TextUtils.isEmpty(builder.title)) {
|
||||
this.tvDialogTitle.setVisibility(8);
|
||||
} else {
|
||||
this.tvDialogTitle.setVisibility(0);
|
||||
this.tvDialogTitle.setText(builder.title);
|
||||
}
|
||||
if (!TextUtils.isEmpty(builder.logoUrl)) {
|
||||
Glide.e(getContext()).a(builder.logoUrl).a(this.imgLogo);
|
||||
} else if (builder.logoResId != 0) {
|
||||
this.imgLogo.setImageResource(builder.logoResId);
|
||||
} else {
|
||||
this.imgLogo.setVisibility(8);
|
||||
}
|
||||
if (17 != builder.gravity) {
|
||||
this.tvTips.setGravity(builder.gravity);
|
||||
}
|
||||
int i = this.cancleBtnBg;
|
||||
if (i != 0) {
|
||||
this.btnCancel.setBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnCancel) {
|
||||
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(this, 0);
|
||||
return;
|
||||
} else {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id != R.id.btnOk) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
|
||||
if (onClickListener2 != null) {
|
||||
onClickListener2.onClick(this, 0);
|
||||
} else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnDismissListener(OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
public JimuSimpleDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
protected JimuSimpleDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
}
|
||||
}
|
259
sources/com/ubt/jimu/base/dialog/LegalExamineDialog.java
Normal file
259
sources/com/ubt/jimu/base/dialog/LegalExamineDialog.java
Normal file
@@ -0,0 +1,259 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
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.dialog.LegalExamineDialog;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LegalExamineDialog extends Dialog implements View.OnClickListener {
|
||||
public Button btnCancel;
|
||||
public Button btnOk;
|
||||
public String cancel;
|
||||
private CheckBox checkBox;
|
||||
public String content;
|
||||
private TextView contentTv;
|
||||
private Context context;
|
||||
private LegalResult legalResult;
|
||||
public String ok;
|
||||
private TextView tipTv;
|
||||
|
||||
public static class Builder {
|
||||
private Context context;
|
||||
private LegalResult legalResult;
|
||||
|
||||
public Builder(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
return i == 4;
|
||||
}
|
||||
|
||||
public LegalExamineDialog build() {
|
||||
int a;
|
||||
int a2;
|
||||
LegalExamineDialog legalExamineDialog = new LegalExamineDialog(this.context);
|
||||
legalExamineDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ubt.jimu.base.dialog.a
|
||||
@Override // android.content.DialogInterface.OnKeyListener
|
||||
public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
return LegalExamineDialog.Builder.a(dialogInterface, i, keyEvent);
|
||||
}
|
||||
});
|
||||
legalExamineDialog.context = this.context;
|
||||
legalExamineDialog.legalResult = this.legalResult;
|
||||
legalExamineDialog.requestWindowFeature(1);
|
||||
legalExamineDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_legal_examine, (ViewGroup) null, false);
|
||||
legalExamineDialog.intView(inflate, this);
|
||||
legalExamineDialog.setContentView(inflate);
|
||||
legalExamineDialog.setCanceledOnTouchOutside(false);
|
||||
Window window = legalExamineDialog.getWindow();
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
window.setBackgroundDrawableResource(R.color.translucent);
|
||||
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
|
||||
int max = (int) (Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l())) * 0.712d);
|
||||
int i = (int) (max * 0.657d);
|
||||
if (JimuApplication.l().i()) {
|
||||
a = DisplayUtil.a(this.context, 516.0f);
|
||||
a2 = DisplayUtil.a(this.context, 322.0f);
|
||||
} else {
|
||||
a = DisplayUtil.a(this.context, 344.55f);
|
||||
a2 = DisplayUtil.a(this.context, 209.75f);
|
||||
}
|
||||
if (a > max || a2 > i) {
|
||||
max = a;
|
||||
}
|
||||
attributes.width = max;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
return legalExamineDialog;
|
||||
}
|
||||
|
||||
public Builder onLegalResult(LegalResult legalResult) {
|
||||
this.legalResult = legalResult;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public interface LegalResult {
|
||||
void pass();
|
||||
|
||||
void reject();
|
||||
}
|
||||
|
||||
public LegalExamineDialog(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private SpannableStringBuilder buildChildPrivacy(final Context context, int i) {
|
||||
String string = context.getResources().getString(R.string.child_privaty_policy_with_punctuation);
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
|
||||
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
|
||||
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.4
|
||||
@Override // android.text.style.ClickableSpan
|
||||
public void onClick(View view) {
|
||||
Postcard a = ARouter.b().a("/page/web");
|
||||
a.a("url", "file:////android_asset/privacy/jimuChildren.html?language=" + LocaleUtils.c());
|
||||
a.a("title", "");
|
||||
a.a("type", 0);
|
||||
a.a("show_title", false);
|
||||
a.t();
|
||||
}
|
||||
|
||||
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
|
||||
public void updateDrawState(TextPaint textPaint) {
|
||||
super.updateDrawState(textPaint);
|
||||
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
|
||||
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
|
||||
textPaint.setUnderlineText(false);
|
||||
}
|
||||
}, 0, string.length(), 33);
|
||||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
private SpannableStringBuilder buildUserProtocol(final Context context, int i) {
|
||||
String string = context.getResources().getString(R.string.common_gdpr_content_02);
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
|
||||
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
|
||||
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.3
|
||||
@Override // android.text.style.ClickableSpan
|
||||
public void onClick(View view) {
|
||||
Postcard a = ARouter.b().a("/page/web");
|
||||
a.a("url", "file:////android_asset/user/index.html?language=" + LocaleUtils.c());
|
||||
a.a("title", "");
|
||||
a.a("type", 0);
|
||||
a.a("show_title", false);
|
||||
a.t();
|
||||
}
|
||||
|
||||
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
|
||||
public void updateDrawState(TextPaint textPaint) {
|
||||
super.updateDrawState(textPaint);
|
||||
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
|
||||
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
|
||||
textPaint.setUnderlineText(false);
|
||||
}
|
||||
}, 0, string.length(), 33);
|
||||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
private SpannableStringBuilder buildprivacy(final Context context, int i) {
|
||||
String string = context.getResources().getString(R.string.common_gdpr_content_04);
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
|
||||
spannableStringBuilder.setSpan(new TextAppearanceSpan(context, i), 0, string.length(), 33);
|
||||
spannableStringBuilder.setSpan(new ClickableSpan() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.2
|
||||
@Override // android.text.style.ClickableSpan
|
||||
public void onClick(View view) {
|
||||
Postcard a = ARouter.b().a("/page/web");
|
||||
a.a("url", "file:////android_asset/privacy/index.html?language=" + LocaleUtils.c());
|
||||
a.a("title", "");
|
||||
a.a("type", 0);
|
||||
a.a("show_title", false);
|
||||
a.t();
|
||||
}
|
||||
|
||||
@Override // android.text.style.ClickableSpan, android.text.style.CharacterStyle
|
||||
public void updateDrawState(TextPaint textPaint) {
|
||||
super.updateDrawState(textPaint);
|
||||
textPaint.setColor(context.getResources().getColor(R.color.bg_4AACF5));
|
||||
textPaint.bgColor = context.getResources().getColor(R.color.translucent);
|
||||
textPaint.setUnderlineText(false);
|
||||
}
|
||||
}, 0, string.length(), 33);
|
||||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.content.DialogInterface
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
public void intView(View view, Builder builder) {
|
||||
this.contentTv = (TextView) view.findViewById(R.id.content);
|
||||
this.tipTv = (TextView) view.findViewById(R.id.tips);
|
||||
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
|
||||
this.btnOk = (Button) view.findViewById(R.id.btnOk);
|
||||
this.checkBox = (CheckBox) view.findViewById(R.id.checkbox_agree);
|
||||
this.btnCancel.setOnClickListener(this);
|
||||
this.btnOk.setOnClickListener(this);
|
||||
this.contentTv.setMovementMethod(new LinkMovementMethod());
|
||||
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_01));
|
||||
this.contentTv.append(buildUserProtocol(this.context, R.style.JSpecilTextAppearance));
|
||||
this.contentTv.append(this.context.getResources().getString(R.string.comma));
|
||||
this.contentTv.append(buildprivacy(this.context, R.style.JSpecilTextAppearance));
|
||||
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_03));
|
||||
this.contentTv.append(buildChildPrivacy(this.context, R.style.JSpecilTextAppearance));
|
||||
this.contentTv.append(this.context.getResources().getString(R.string.common_gdpr_content_05));
|
||||
this.tipTv.setMovementMethod(new LinkMovementMethod());
|
||||
this.tipTv.append(this.context.getString(R.string.common_gdpr_tip_01));
|
||||
this.tipTv.append(buildUserProtocol(this.context, R.style.JSpecilTextAppearanceSmall));
|
||||
this.tipTv.append(this.context.getResources().getString(R.string.comma));
|
||||
this.tipTv.append(buildprivacy(this.context, R.style.JSpecilTextAppearanceSmall));
|
||||
this.tipTv.append(this.context.getResources().getString(R.string.common_gdpr_tip_02));
|
||||
this.tipTv.append(buildChildPrivacy(this.context, R.style.JSpecilTextAppearanceSmall));
|
||||
this.tipTv.append(this.context.getString(R.string.common_gdpr_tip_03));
|
||||
this.btnOk.setText(this.context.getResources().getString(R.string.dialog_legal_agree));
|
||||
this.btnCancel.setText(this.context.getString(R.string.dialog_legal_reject));
|
||||
this.btnCancel.setBackgroundResource(R.drawable.sel_common_negative_btn);
|
||||
this.btnOk.setEnabled(false);
|
||||
this.btnOk.setAlpha(0.5f);
|
||||
this.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // from class: com.ubt.jimu.base.dialog.LegalExamineDialog.1
|
||||
@Override // android.widget.CompoundButton.OnCheckedChangeListener
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
|
||||
if (z) {
|
||||
LegalExamineDialog.this.btnOk.setEnabled(true);
|
||||
LegalExamineDialog.this.btnOk.setAlpha(1.0f);
|
||||
} else {
|
||||
LegalExamineDialog.this.btnOk.setEnabled(false);
|
||||
LegalExamineDialog.this.btnOk.setAlpha(0.5f);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnCancel) {
|
||||
this.legalResult.reject();
|
||||
} else if (id != R.id.btnOk) {
|
||||
dismiss();
|
||||
} else {
|
||||
SPUtils.a(Constant.NoviceGuide.AGREE_LEGAL_EXAMINE, true);
|
||||
this.legalResult.pass();
|
||||
}
|
||||
}
|
||||
|
||||
public LegalExamineDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
protected LegalExamineDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
}
|
||||
}
|
95
sources/com/ubt/jimu/base/dialog/LoadingDialog.java
Normal file
95
sources/com/ubt/jimu/base/dialog/LoadingDialog.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LoadingDialog extends Dialog {
|
||||
private ImageView imgLoading;
|
||||
private Activity mActivity;
|
||||
private RotateAnimation rotateAnimation;
|
||||
private TextView tvProgress;
|
||||
|
||||
public LoadingDialog(Context context) {
|
||||
this(context, 0);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.tvProgress = (TextView) findViewById(R.id.tvProgress);
|
||||
this.imgLoading = (ImageView) findViewById(R.id.imgLoading);
|
||||
}
|
||||
|
||||
private void startAnimation() {
|
||||
RotateAnimation rotateAnimation = this.rotateAnimation;
|
||||
if (rotateAnimation != null) {
|
||||
rotateAnimation.cancel();
|
||||
this.imgLoading.clearAnimation();
|
||||
}
|
||||
this.rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
|
||||
this.rotateAnimation.setRepeatCount(-1);
|
||||
this.rotateAnimation.setDuration(800L);
|
||||
this.rotateAnimation.setInterpolator(new LinearInterpolator());
|
||||
this.rotateAnimation.setRepeatMode(1);
|
||||
this.imgLoading.startAnimation(this.rotateAnimation);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.content.DialogInterface
|
||||
public void dismiss() {
|
||||
RotateAnimation rotateAnimation = this.rotateAnimation;
|
||||
if (rotateAnimation != null) {
|
||||
rotateAnimation.cancel();
|
||||
}
|
||||
this.rotateAnimation = null;
|
||||
this.imgLoading.clearAnimation();
|
||||
Activity activity = this.mActivity;
|
||||
if (activity == null || activity.isFinishing() || this.mActivity.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
getWindow().requestFeature(1);
|
||||
setContentView(R.layout.dialog_loading);
|
||||
getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
getWindow().setLayout(-1, -1);
|
||||
setCanceledOnTouchOutside(false);
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
public void show() {
|
||||
super.show();
|
||||
startAnimation();
|
||||
}
|
||||
|
||||
public void updateProgress(String str) {
|
||||
TextView textView;
|
||||
if (TextUtils.isEmpty(str) || (textView = this.tvProgress) == null) {
|
||||
return;
|
||||
}
|
||||
textView.setText(str);
|
||||
}
|
||||
|
||||
public LoadingDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
this.mActivity = (Activity) context;
|
||||
}
|
||||
|
||||
public LoadingDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
this.mActivity = (Activity) context;
|
||||
}
|
||||
}
|
181
sources/com/ubt/jimu/base/dialog/LoginCheckCodeDialog.java
Normal file
181
sources/com/ubt/jimu/base/dialog/LoginCheckCodeDialog.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LoginCheckCodeDialog extends Dialog {
|
||||
private Button btnCancel;
|
||||
private Button btnOk;
|
||||
private Callback callback;
|
||||
private Context context;
|
||||
private String emailText;
|
||||
private EditText etCaptcha;
|
||||
private TextView get_emial_verify_code;
|
||||
private boolean isTablet;
|
||||
private int loginType;
|
||||
private String phoneText;
|
||||
private TextView tvTitle;
|
||||
|
||||
public interface Callback {
|
||||
void onCancel();
|
||||
|
||||
void onGetCaptcha();
|
||||
|
||||
void onOK(String str);
|
||||
}
|
||||
|
||||
public LoginCheckCodeDialog(Context context) {
|
||||
super(context, R.style.window_dialog);
|
||||
this.context = context;
|
||||
this.isTablet = JimuApplication.l().i();
|
||||
}
|
||||
|
||||
public void disableGetCodeTextView() {
|
||||
TextView textView = this.get_emial_verify_code;
|
||||
if (textView != null) {
|
||||
textView.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void enableGetCodeTextView() {
|
||||
TextView textView = this.get_emial_verify_code;
|
||||
if (textView != null) {
|
||||
textView.setClickable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
this.tvTitle = (TextView) findViewById(R.id.tv_title);
|
||||
this.tvTitle.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
this.etCaptcha = (EditText) findViewById(R.id.et_captcha);
|
||||
this.btnCancel = (Button) findViewById(R.id.btn_cancel);
|
||||
this.btnCancel.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (LoginCheckCodeDialog.this.callback != null) {
|
||||
LoginCheckCodeDialog.this.callback.onCancel();
|
||||
}
|
||||
LoginCheckCodeDialog.this.dismiss();
|
||||
}
|
||||
});
|
||||
this.btnOk = (Button) findViewById(R.id.btn_ok);
|
||||
this.btnOk.setEnabled(false);
|
||||
this.btnOk.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.2
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (LoginCheckCodeDialog.this.callback != null) {
|
||||
LoginCheckCodeDialog.this.callback.onOK(LoginCheckCodeDialog.this.etCaptcha.getText().toString().trim());
|
||||
}
|
||||
}
|
||||
});
|
||||
this.get_emial_verify_code = (TextView) findViewById(R.id.get_emial_verify_code);
|
||||
this.get_emial_verify_code.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (LoginCheckCodeDialog.this.callback != null) {
|
||||
LoginCheckCodeDialog.this.callback.onGetCaptcha();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.etCaptcha.addTextChangedListener(new TextWatcher() { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.4
|
||||
@Override // android.text.TextWatcher
|
||||
public void afterTextChanged(Editable editable) {
|
||||
}
|
||||
|
||||
@Override // android.text.TextWatcher
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
}
|
||||
|
||||
@Override // android.text.TextWatcher
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
if (TextUtils.isEmpty(charSequence)) {
|
||||
LoginCheckCodeDialog.this.btnOk.setEnabled(false);
|
||||
} else {
|
||||
if (LoginCheckCodeDialog.this.btnOk.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
LoginCheckCodeDialog.this.btnOk.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setContentView(R.layout.dialog_login_check_code);
|
||||
setUpWindows();
|
||||
initView();
|
||||
setCanceledOnTouchOutside(false);
|
||||
}
|
||||
|
||||
public void setCallback(Callback callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public void setUpWindows() {
|
||||
Window window = getWindow();
|
||||
window.setBackgroundDrawable(new ColorDrawable(0));
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
int a = DisplayUtil.a(this.context, this.isTablet ? 400.0f : 352.0f);
|
||||
int a2 = DisplayUtil.a(this.context, this.isTablet ? 300.0f : 220.0f);
|
||||
attributes.width = a;
|
||||
attributes.height = a2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
}
|
||||
|
||||
public void startCountDown() {
|
||||
TextView textView = this.get_emial_verify_code;
|
||||
if (textView == null) {
|
||||
return;
|
||||
}
|
||||
textView.setClickable(false);
|
||||
new CountDownTimer(60000L, 1000L) { // from class: com.ubt.jimu.base.dialog.LoginCheckCodeDialog.5
|
||||
@Override // android.os.CountDownTimer
|
||||
public void onFinish() {
|
||||
LoginCheckCodeDialog.this.get_emial_verify_code.setText(R.string.get_captcha);
|
||||
LoginCheckCodeDialog.this.get_emial_verify_code.setClickable(true);
|
||||
}
|
||||
|
||||
@Override // android.os.CountDownTimer
|
||||
public void onTick(long j) {
|
||||
LoginCheckCodeDialog.this.get_emial_verify_code.setText((j / 1000) + "s");
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
public LoginCheckCodeDialog(Context context, Callback callback) {
|
||||
super(context, R.style.window_dialog);
|
||||
this.context = context;
|
||||
this.callback = callback;
|
||||
this.isTablet = JimuApplication.l().i();
|
||||
}
|
||||
|
||||
public LoginCheckCodeDialog(Context context, int i, String str, String str2, Callback callback) {
|
||||
super(context, R.style.window_dialog);
|
||||
this.context = context;
|
||||
this.callback = callback;
|
||||
this.loginType = i;
|
||||
this.phoneText = str;
|
||||
this.emailText = str2;
|
||||
this.isTablet = JimuApplication.l().i();
|
||||
}
|
||||
}
|
301
sources/com/ubt/jimu/base/dialog/PermissionHintDialog.java
Normal file
301
sources/com/ubt/jimu/base/dialog/PermissionHintDialog.java
Normal file
@@ -0,0 +1,301 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtech.view.dialog.SimpleDialog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PermissionHintDialog extends Dialog implements View.OnClickListener {
|
||||
public Button btnCancel;
|
||||
public Button btnOk;
|
||||
public String cancel;
|
||||
public String content;
|
||||
private ImageView imgLogo;
|
||||
public String ok;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
private TextView tvDialogTitle;
|
||||
private TextView tvTips;
|
||||
|
||||
public static class Builder {
|
||||
private String cancel;
|
||||
private String content;
|
||||
private Context context;
|
||||
private String logoUrl;
|
||||
private String ok;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
private String title;
|
||||
private int logoResId = 0;
|
||||
private boolean canceledOnTouchOutside = true;
|
||||
private int gravity = 17;
|
||||
|
||||
public Builder(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public PermissionHintDialog build() {
|
||||
int i;
|
||||
double d;
|
||||
int a;
|
||||
int a2;
|
||||
PermissionHintDialog permissionHintDialog = new PermissionHintDialog(this.context);
|
||||
permissionHintDialog.requestWindowFeature(1);
|
||||
permissionHintDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
permissionHintDialog.content = this.content;
|
||||
permissionHintDialog.ok = this.ok;
|
||||
permissionHintDialog.cancel = this.cancel;
|
||||
permissionHintDialog.onOkListener = this.onOkListener;
|
||||
permissionHintDialog.onCancelListener = this.onCancelListener;
|
||||
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_permission_hint, (ViewGroup) null, false);
|
||||
permissionHintDialog.intView(inflate, this);
|
||||
permissionHintDialog.setContentView(inflate);
|
||||
permissionHintDialog.setCanceledOnTouchOutside(this.canceledOnTouchOutside);
|
||||
Window window = permissionHintDialog.getWindow();
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
window.setBackgroundDrawableResource(R.color.translucent);
|
||||
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
|
||||
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
|
||||
if (JimuApplication.l().i()) {
|
||||
i = (int) (max * 0.5039d);
|
||||
d = 0.624d;
|
||||
} else {
|
||||
i = (int) (max * 0.5165d);
|
||||
d = 0.6088d;
|
||||
}
|
||||
int i2 = (int) (i * d);
|
||||
if (JimuApplication.l().i()) {
|
||||
a = DisplayUtil.a(this.context, 516.0f);
|
||||
a2 = DisplayUtil.a(this.context, 322.0f);
|
||||
} else {
|
||||
a = DisplayUtil.a(this.context, 344.55f);
|
||||
a2 = DisplayUtil.a(this.context, 209.75f);
|
||||
}
|
||||
if (a > i || a2 > i2) {
|
||||
i = a;
|
||||
i2 = a2;
|
||||
}
|
||||
attributes.width = i;
|
||||
attributes.height = i2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
return permissionHintDialog;
|
||||
}
|
||||
|
||||
public Builder cancel(String str) {
|
||||
this.cancel = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder canceledOnTouchOutside(boolean z) {
|
||||
this.canceledOnTouchOutside = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(String str) {
|
||||
this.content = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder gravity(int i) {
|
||||
this.gravity = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder logoResId(int i) {
|
||||
this.logoResId = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder logoUrl(String str) {
|
||||
this.logoUrl = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ok(String str) {
|
||||
this.ok = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onCancelListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onOkListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder title(String str) {
|
||||
this.title = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder cancel(int i) {
|
||||
this.cancel = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(int i) {
|
||||
this.content = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ok(int i) {
|
||||
this.ok = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder title(int i) {
|
||||
this.title = this.context.getString(i);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public PermissionHintDialog(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public static PermissionHintDialog buildSimpleDialog(Activity activity, String str, String str2, String str3, String str4, int i, DialogInterface.OnClickListener onClickListener, DialogInterface.OnClickListener onClickListener2) {
|
||||
return new Builder(activity).title(str3).cancel(str2).ok(str).content(str4).gravity(i).onCancel(onClickListener).onOk(onClickListener2).build();
|
||||
}
|
||||
|
||||
public static boolean showBluetoothEnableFailedHint(Context context) {
|
||||
new SimpleDialog.Builder(context).d(R.string.permission_button_text_permission_denied_warning_dialog).a((CharSequence) context.getResources().getString(R.string.permission_waring_text_bluetooth_enable_failed)).b(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.4
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
dialogInterface.dismiss();
|
||||
}
|
||||
}).a().show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean showLocationPermissionDeniedHint(Context context) {
|
||||
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(String.format(context.getResources().getString(R.string.permission_prompt_open_permission_by_settings), context.getResources().getString(R.string.permission_location))).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.2
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
}).build().show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean showPermissionDeniedHint(Context context, String str) {
|
||||
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(str).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.1
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
}).build().show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean showStoragePermissionDeniedHint(Context context) {
|
||||
new Builder(context).ok(R.string.permission_button_text_permission_denied_warning_dialog).content(String.format(context.getResources().getString(R.string.permission_prompt_open_permission_by_settings), context.getResources().getString(R.string.permission_storage))).onOk(new DialogInterface.OnClickListener() { // from class: com.ubt.jimu.base.dialog.PermissionHintDialog.3
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
}
|
||||
}).build().show();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void intView(View view, Builder builder) {
|
||||
this.tvDialogTitle = (TextView) view.findViewById(R.id.tvDialogTitle);
|
||||
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
|
||||
this.imgLogo = (ImageView) view.findViewById(R.id.imgLogo);
|
||||
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
|
||||
this.btnOk = (Button) view.findViewById(R.id.btnOk);
|
||||
this.btnCancel.setOnClickListener(this);
|
||||
this.btnOk.setOnClickListener(this);
|
||||
if (!TextUtils.isEmpty(this.content)) {
|
||||
this.tvTips.setText(this.content);
|
||||
this.tvTips.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
}
|
||||
if (this.onCancelListener == null) {
|
||||
this.btnCancel.setVisibility(8);
|
||||
} else if (JimuApplication.l().i()) {
|
||||
this.btnCancel.setBackgroundResource(R.drawable.negative_btn_bg_pad);
|
||||
} else {
|
||||
this.btnCancel.setBackgroundResource(R.drawable.negative_btn_bg);
|
||||
}
|
||||
if (this.onOkListener == null) {
|
||||
this.btnOk.setVisibility(8);
|
||||
} else if (JimuApplication.l().i()) {
|
||||
this.btnOk.setBackgroundResource(R.drawable.positive_btn_bg_pad);
|
||||
} else {
|
||||
this.btnOk.setBackgroundResource(R.drawable.positive_btn_bg);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.ok)) {
|
||||
this.btnOk.setText(this.ok);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.cancel)) {
|
||||
this.btnCancel.setText(this.cancel);
|
||||
}
|
||||
if (TextUtils.isEmpty(builder.title)) {
|
||||
this.tvDialogTitle.setVisibility(8);
|
||||
} else {
|
||||
this.tvDialogTitle.setVisibility(0);
|
||||
this.tvDialogTitle.setText(builder.title);
|
||||
}
|
||||
if (!TextUtils.isEmpty(builder.logoUrl)) {
|
||||
Glide.e(getContext()).a(builder.logoUrl).a(this.imgLogo);
|
||||
} else if (builder.logoResId != 0) {
|
||||
this.imgLogo.setImageResource(builder.logoResId);
|
||||
} else {
|
||||
this.imgLogo.setVisibility(8);
|
||||
}
|
||||
if (17 != builder.gravity) {
|
||||
this.tvTips.setGravity(builder.gravity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnCancel) {
|
||||
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(this, 0);
|
||||
return;
|
||||
} else {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id != R.id.btnOk) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
|
||||
if (onClickListener2 == null) {
|
||||
dismiss();
|
||||
} else {
|
||||
onClickListener2.onClick(this, 0);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public PermissionHintDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
protected PermissionHintDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
}
|
||||
}
|
145
sources/com/ubt/jimu/base/dialog/SimpleQuestionDialog.java
Normal file
145
sources/com/ubt/jimu/base/dialog/SimpleQuestionDialog.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SimpleQuestionDialog extends DialogFragment implements View.OnClickListener {
|
||||
public static final int GRAVITY_CENTER = 2;
|
||||
public static final int GRAVITY_LEFT = 1;
|
||||
public static final String KEY_CANCELBUTTON = "cancel";
|
||||
public static final String KEY_OK_BUTTON = "ok";
|
||||
public static final String KEY_TIPS = "tips";
|
||||
public static final String KEY_TIPS_GRAVITY = "tipsGravity";
|
||||
public static final String KEY_TITLE = "title";
|
||||
private TextView cancelBtn;
|
||||
private String cancelButton;
|
||||
private IDialogListener listener;
|
||||
private TextView okBtn;
|
||||
private String okButton;
|
||||
private String tips;
|
||||
private int tipsGravity;
|
||||
private TextView tipsTxt;
|
||||
private String title;
|
||||
private TextView tvTitle;
|
||||
|
||||
public static SimpleQuestionDialog newInstance(String str) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(KEY_TIPS, str);
|
||||
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
|
||||
simpleQuestionDialog.setArguments(bundle);
|
||||
return simpleQuestionDialog;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (view.getId() == R.id.simple_question_dialog_ok) {
|
||||
IDialogListener iDialogListener = this.listener;
|
||||
if (iDialogListener != null) {
|
||||
iDialogListener.onOk();
|
||||
}
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
if (view.getId() == R.id.simple_question_dialog_cancel) {
|
||||
IDialogListener iDialogListener2 = this.listener;
|
||||
if (iDialogListener2 != null) {
|
||||
iDialogListener2.onCancle();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.DialogFragment, android.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setCancelable(false);
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments != null) {
|
||||
this.title = arguments.getString("title");
|
||||
this.tips = arguments.getString(KEY_TIPS);
|
||||
this.okButton = arguments.getString(KEY_OK_BUTTON);
|
||||
this.cancelButton = arguments.getString(KEY_CANCELBUTTON);
|
||||
this.tipsGravity = arguments.getInt(KEY_TIPS_GRAVITY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
getDialog().requestWindowFeature(1);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
View inflate = layoutInflater.inflate(R.layout.dialog_simple_question, viewGroup);
|
||||
this.tvTitle = (TextView) inflate.findViewById(R.id.simple_question_dialog_title);
|
||||
this.tipsTxt = (TextView) inflate.findViewById(R.id.simple_question_dialog_info);
|
||||
this.okBtn = (TextView) inflate.findViewById(R.id.simple_question_dialog_ok);
|
||||
this.cancelBtn = (TextView) inflate.findViewById(R.id.simple_question_dialog_cancel);
|
||||
this.okBtn.setOnClickListener(this);
|
||||
this.cancelBtn.setOnClickListener(this);
|
||||
this.tipsTxt.setText(this.tips + " ");
|
||||
if (!TextUtils.isEmpty(this.okButton)) {
|
||||
this.okBtn.setText(this.okButton);
|
||||
}
|
||||
if (!TextUtils.isEmpty(this.cancelButton)) {
|
||||
this.cancelBtn.setText(this.cancelButton);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.title)) {
|
||||
int a = DisplayUtil.a((Context) getActivity(), 46.0f);
|
||||
this.tipsTxt.setPadding(a, a, a, a);
|
||||
this.tvTitle.setVisibility(8);
|
||||
} else {
|
||||
this.tvTitle.setVisibility(0);
|
||||
this.tvTitle.setText(this.title);
|
||||
}
|
||||
int i = this.tipsGravity;
|
||||
if (i > 0) {
|
||||
setTextLeft(i);
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
|
||||
public void setListener(IDialogListener iDialogListener) {
|
||||
this.listener = iDialogListener;
|
||||
}
|
||||
|
||||
public void setTextLeft(int i) {
|
||||
TextView textView = this.tipsTxt;
|
||||
if (textView != null) {
|
||||
if (i == 1) {
|
||||
textView.setGravity(3);
|
||||
} else if (i == 2) {
|
||||
textView.setGravity(17);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static SimpleQuestionDialog newInstance(String str, String str2, String str3) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(KEY_OK_BUTTON, str);
|
||||
bundle.putString(KEY_CANCELBUTTON, str2);
|
||||
bundle.putString(KEY_TIPS, str3);
|
||||
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
|
||||
simpleQuestionDialog.setArguments(bundle);
|
||||
return simpleQuestionDialog;
|
||||
}
|
||||
|
||||
public static SimpleQuestionDialog newInstance(String str, String str2, String str3, String str4, int i) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("title", str);
|
||||
bundle.putString(KEY_OK_BUTTON, str2);
|
||||
bundle.putString(KEY_CANCELBUTTON, str3);
|
||||
bundle.putString(KEY_TIPS, str4);
|
||||
bundle.putInt(KEY_TIPS_GRAVITY, i);
|
||||
SimpleQuestionDialog simpleQuestionDialog = new SimpleQuestionDialog();
|
||||
simpleQuestionDialog.setArguments(bundle);
|
||||
return simpleQuestionDialog;
|
||||
}
|
||||
}
|
265
sources/com/ubt/jimu/base/dialog/UpdateDialog.java
Normal file
265
sources/com/ubt/jimu/base/dialog/UpdateDialog.java
Normal file
@@ -0,0 +1,265 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
import com.ubtech.view.widget.UButton;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UpdateDialog extends Dialog implements View.OnClickListener {
|
||||
private boolean backAble;
|
||||
private UButton btnCancel;
|
||||
private UButton btnOk;
|
||||
private String cancel;
|
||||
private boolean canceledOnTouchOutside;
|
||||
private String content;
|
||||
private ImageView imgLeft;
|
||||
private ImageView imgRight;
|
||||
private boolean isLeft;
|
||||
private boolean isRight;
|
||||
private int leftResId;
|
||||
private InteractionListner mInteractionListener;
|
||||
private String ok;
|
||||
private int rightResId;
|
||||
private String title;
|
||||
private TextView tvContent;
|
||||
private TextView tvDialogTitle;
|
||||
|
||||
public static class Builder {
|
||||
private String cancel;
|
||||
private String content;
|
||||
private int leftResId;
|
||||
private InteractionListner mInteractionListner;
|
||||
private String ok;
|
||||
private int rightResId;
|
||||
private String title;
|
||||
private boolean canceledOnTouchOutside = true;
|
||||
private boolean backAble = true;
|
||||
private boolean isLeft = false;
|
||||
private boolean isRight = false;
|
||||
|
||||
public Builder backAble(boolean z) {
|
||||
this.backAble = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder cancel(String str) {
|
||||
this.cancel = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder canceledOnTouchOutside(boolean z) {
|
||||
this.canceledOnTouchOutside = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(String str) {
|
||||
this.content = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder interactionListener(InteractionListner interactionListner) {
|
||||
this.mInteractionListner = interactionListner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder isLeft(boolean z) {
|
||||
this.isLeft = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder isRight(boolean z) {
|
||||
this.isRight = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder leftResId(int i) {
|
||||
this.leftResId = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder ok(String str) {
|
||||
this.ok = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder rightResId(int i) {
|
||||
this.rightResId = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder title(String str) {
|
||||
this.title = str;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public interface InteractionListner {
|
||||
void onCancelClick(UpdateDialog updateDialog);
|
||||
|
||||
void onLeftImgClick(UpdateDialog updateDialog);
|
||||
|
||||
void onOkClick(UpdateDialog updateDialog);
|
||||
|
||||
void onRightImgClick(UpdateDialog updateDialog);
|
||||
}
|
||||
|
||||
public UpdateDialog(Context context, Builder builder) {
|
||||
super(context);
|
||||
this.canceledOnTouchOutside = builder.canceledOnTouchOutside;
|
||||
this.backAble = builder.backAble;
|
||||
this.isLeft = builder.isLeft;
|
||||
this.isRight = builder.isRight;
|
||||
this.leftResId = builder.leftResId;
|
||||
this.rightResId = builder.rightResId;
|
||||
this.title = builder.title;
|
||||
this.content = builder.content;
|
||||
this.cancel = builder.cancel;
|
||||
this.ok = builder.ok;
|
||||
this.mInteractionListener = builder.mInteractionListner;
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
this.imgLeft = (ImageView) findViewById(R.id.imgLeft);
|
||||
this.imgRight = (ImageView) findViewById(R.id.imgRight);
|
||||
this.tvDialogTitle = (TextView) findViewById(R.id.tvDialogTitle);
|
||||
this.tvContent = (TextView) findViewById(R.id.tvContent);
|
||||
this.btnCancel = (UButton) findViewById(R.id.btnCancel);
|
||||
this.btnOk = (UButton) findViewById(R.id.btnOk);
|
||||
this.imgLeft.setOnClickListener(this);
|
||||
this.imgRight.setOnClickListener(this);
|
||||
this.btnCancel.setOnClickListener(this);
|
||||
this.btnOk.setOnClickListener(this);
|
||||
if (this.isLeft) {
|
||||
this.imgLeft.setVisibility(0);
|
||||
this.imgLeft.setImageResource(this.leftResId);
|
||||
} else {
|
||||
this.imgLeft.setVisibility(8);
|
||||
}
|
||||
if (this.isRight) {
|
||||
this.imgRight.setVisibility(0);
|
||||
this.imgRight.setImageResource(this.rightResId);
|
||||
} else {
|
||||
this.imgRight.setVisibility(8);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.cancel)) {
|
||||
this.btnCancel.setVisibility(8);
|
||||
} else {
|
||||
this.btnCancel.setVisibility(0);
|
||||
this.btnCancel.setText(this.cancel);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.ok)) {
|
||||
this.btnOk.setVisibility(8);
|
||||
} else {
|
||||
this.btnOk.setVisibility(0);
|
||||
this.btnOk.setText(this.ok);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.title)) {
|
||||
this.tvDialogTitle.setVisibility(4);
|
||||
} else {
|
||||
this.tvDialogTitle.setVisibility(0);
|
||||
this.tvDialogTitle.setText(this.title);
|
||||
}
|
||||
if (TextUtils.isEmpty(this.content)) {
|
||||
this.tvContent.setVisibility(4);
|
||||
return;
|
||||
}
|
||||
this.tvContent.setVisibility(0);
|
||||
this.tvContent.setText(this.content);
|
||||
this.tvContent.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
private void setupWindow() {
|
||||
int i;
|
||||
double d;
|
||||
int a;
|
||||
int a2;
|
||||
requestWindowFeature(1);
|
||||
setContentView(R.layout.firmware_update_dialog);
|
||||
Window window = getWindow();
|
||||
window.setBackgroundDrawable(new ColorDrawable(0));
|
||||
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
|
||||
if (JimuApplication.l().i()) {
|
||||
i = (int) (max * 0.5039d);
|
||||
d = 0.624d;
|
||||
} else {
|
||||
i = (int) (max * 0.5165d);
|
||||
d = 0.6088d;
|
||||
}
|
||||
int i2 = (int) (i * d);
|
||||
if (JimuApplication.l().i()) {
|
||||
a = DisplayUtil.a(getContext(), 516.0f);
|
||||
a2 = DisplayUtil.a(getContext(), 322.0f);
|
||||
} else {
|
||||
a = DisplayUtil.a(getContext(), 344.0f);
|
||||
a2 = DisplayUtil.a(getContext(), 222.5f);
|
||||
}
|
||||
if (a > i || a2 > i2) {
|
||||
i = a;
|
||||
i2 = a2;
|
||||
}
|
||||
attributes.width = i;
|
||||
attributes.height = i2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
setCanceledOnTouchOutside(this.canceledOnTouchOutside);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (this.mInteractionListener == null) {
|
||||
}
|
||||
switch (view.getId()) {
|
||||
case R.id.btnCancel /* 2131296362 */:
|
||||
this.mInteractionListener.onCancelClick(this);
|
||||
break;
|
||||
case R.id.btnOk /* 2131296369 */:
|
||||
this.mInteractionListener.onOkClick(this);
|
||||
break;
|
||||
case R.id.imgLeft /* 2131296847 */:
|
||||
this.mInteractionListener.onLeftImgClick(this);
|
||||
break;
|
||||
case R.id.imgRight /* 2131296875 */:
|
||||
this.mInteractionListener.onRightImgClick(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setupWindow();
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
if (this.backAble) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public UpdateDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
protected UpdateDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
}
|
||||
}
|
161
sources/com/ubt/jimu/base/dialog/UserExperienceDialog.java
Normal file
161
sources/com/ubt/jimu/base/dialog/UserExperienceDialog.java
Normal file
@@ -0,0 +1,161 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.dialog.UserExperienceDialog;
|
||||
import com.ubtech.utils.DisplayUtil;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UserExperienceDialog extends Dialog implements View.OnClickListener {
|
||||
public Button btnCancel;
|
||||
public Button btnOk;
|
||||
public String cancel;
|
||||
public String content;
|
||||
private Context context;
|
||||
public String ok;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
private TextView tvTips;
|
||||
|
||||
public static class Builder {
|
||||
private Context context;
|
||||
private DialogInterface.OnClickListener onCancelListener;
|
||||
private DialogInterface.OnClickListener onOkListener;
|
||||
|
||||
public Builder(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
|
||||
return i == 4;
|
||||
}
|
||||
|
||||
public UserExperienceDialog build() {
|
||||
int i;
|
||||
double d;
|
||||
int a;
|
||||
int a2;
|
||||
UserExperienceDialog userExperienceDialog = new UserExperienceDialog(this.context);
|
||||
userExperienceDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { // from class: com.ubt.jimu.base.dialog.b
|
||||
@Override // android.content.DialogInterface.OnKeyListener
|
||||
public final boolean onKey(DialogInterface dialogInterface, int i2, KeyEvent keyEvent) {
|
||||
return UserExperienceDialog.Builder.a(dialogInterface, i2, keyEvent);
|
||||
}
|
||||
});
|
||||
userExperienceDialog.context = this.context;
|
||||
userExperienceDialog.onOkListener = this.onOkListener;
|
||||
userExperienceDialog.onCancelListener = this.onCancelListener;
|
||||
userExperienceDialog.requestWindowFeature(1);
|
||||
userExperienceDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
|
||||
View inflate = LayoutInflater.from(this.context).inflate(R.layout.dialog_jimu_user_experience, (ViewGroup) null, false);
|
||||
userExperienceDialog.intView(inflate, this);
|
||||
userExperienceDialog.setContentView(inflate);
|
||||
userExperienceDialog.setCanceledOnTouchOutside(false);
|
||||
Window window = userExperienceDialog.getWindow();
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
window.setBackgroundDrawableResource(R.color.translucent);
|
||||
window.setWindowAnimations(R.style.dialogWindowAlphaIn);
|
||||
int max = Math.max(DisplayUtil.b(JimuApplication.l()), DisplayUtil.a(JimuApplication.l()));
|
||||
if (JimuApplication.l().i()) {
|
||||
i = (int) (max * 0.5039d);
|
||||
d = 0.624d;
|
||||
} else {
|
||||
i = (int) (max * 0.5165d);
|
||||
d = 0.6088d;
|
||||
}
|
||||
int i2 = (int) (i * d);
|
||||
if (JimuApplication.l().i()) {
|
||||
a = DisplayUtil.a(this.context, 516.0f);
|
||||
a2 = DisplayUtil.a(this.context, 322.0f);
|
||||
} else {
|
||||
a = DisplayUtil.a(this.context, 344.55f);
|
||||
a2 = DisplayUtil.a(this.context, 209.75f);
|
||||
}
|
||||
if (a > i || a2 > i2) {
|
||||
i = a;
|
||||
i2 = a2;
|
||||
}
|
||||
attributes.width = i;
|
||||
attributes.height = i2;
|
||||
attributes.gravity = 17;
|
||||
window.setAttributes(attributes);
|
||||
return userExperienceDialog;
|
||||
}
|
||||
|
||||
public Builder onCancel(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onCancelListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder onOk(DialogInterface.OnClickListener onClickListener) {
|
||||
this.onOkListener = onClickListener;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public UserExperienceDialog(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override // android.app.Dialog, android.content.DialogInterface
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
public void intView(View view, Builder builder) {
|
||||
this.tvTips = (TextView) view.findViewById(R.id.tvTips);
|
||||
this.btnCancel = (Button) view.findViewById(R.id.btnCancel);
|
||||
this.btnOk = (Button) view.findViewById(R.id.btnOk);
|
||||
this.btnCancel.setOnClickListener(this);
|
||||
this.btnOk.setOnClickListener(this);
|
||||
this.tvTips.setText("体验优化");
|
||||
this.btnOk.setText(this.context.getResources().getString(R.string.gdpr_agree));
|
||||
this.btnCancel.setText("暂不同意");
|
||||
this.btnCancel.setBackgroundResource(R.drawable.sel_common_negative_btn);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btnCancel) {
|
||||
DialogInterface.OnClickListener onClickListener = this.onCancelListener;
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(this, 0);
|
||||
return;
|
||||
} else {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (id != R.id.btnOk) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
DialogInterface.OnClickListener onClickListener2 = this.onOkListener;
|
||||
if (onClickListener2 != null) {
|
||||
onClickListener2.onClick(this, 0);
|
||||
} else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public UserExperienceDialog(Context context, int i) {
|
||||
super(context, i);
|
||||
}
|
||||
|
||||
protected UserExperienceDialog(Context context, boolean z, DialogInterface.OnCancelListener onCancelListener) {
|
||||
super(context, z, onCancelListener);
|
||||
}
|
||||
}
|
76
sources/com/ubt/jimu/base/dialog/WaitDialogSupport.java
Normal file
76
sources/com/ubt/jimu/base/dialog/WaitDialogSupport.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.ubt.jimu.base.dialog;
|
||||
|
||||
import android.R;
|
||||
import android.app.DialogFragment;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class WaitDialogSupport extends DialogFragment {
|
||||
private AnimationDrawable backgroundAnimation;
|
||||
private Animation rotateAnimaLow;
|
||||
private String tip;
|
||||
private TextView tipTv;
|
||||
|
||||
public static DialogFragment newInstance(String str) {
|
||||
WaitDialogSupport waitDialogSupport = new WaitDialogSupport();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("tip", str);
|
||||
waitDialogSupport.setArguments(bundle);
|
||||
return waitDialogSupport;
|
||||
}
|
||||
|
||||
@Override // android.app.DialogFragment
|
||||
public void dismiss() {
|
||||
try {
|
||||
super.dismiss();
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
Animation animation = this.rotateAnimaLow;
|
||||
if (animation != null) {
|
||||
animation.cancel();
|
||||
this.rotateAnimaLow = null;
|
||||
}
|
||||
AnimationDrawable animationDrawable = this.backgroundAnimation;
|
||||
if (animationDrawable != null) {
|
||||
animationDrawable.stop();
|
||||
this.backgroundAnimation = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.DialogFragment, android.app.Fragment
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
setStyle(0, R.style.Theme.Translucent.NoTitleBar.Fullscreen);
|
||||
this.tip = getArguments().getString("tip");
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
View inflate = layoutInflater.inflate(com.ubt.jimu.R.layout.dialog_wait, viewGroup, false);
|
||||
ImageView imageView = (ImageView) inflate.findViewById(com.ubt.jimu.R.id.wait_dialog_img);
|
||||
this.tipTv = (TextView) inflate.findViewById(com.ubt.jimu.R.id.dialog_wait_tv_loading_tips);
|
||||
if (TextUtils.isEmpty(this.tip)) {
|
||||
this.tipTv.setVisibility(8);
|
||||
} else {
|
||||
this.tipTv.setText(this.tip);
|
||||
}
|
||||
this.rotateAnimaLow = AnimationUtils.loadAnimation(getActivity(), com.ubt.jimu.R.anim.anima_dialog_wait);
|
||||
imageView.startAnimation(this.rotateAnimaLow);
|
||||
this.backgroundAnimation = (AnimationDrawable) imageView.getBackground();
|
||||
AnimationDrawable animationDrawable = this.backgroundAnimation;
|
||||
if (animationDrawable != null) {
|
||||
animationDrawable.start();
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
}
|
308
sources/com/ubt/jimu/base/download/DownloadInfo.java
Normal file
308
sources/com/ubt/jimu/base/download/DownloadInfo.java
Normal file
@@ -0,0 +1,308 @@
|
||||
package com.ubt.jimu.base.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Constants;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.db.FileDownloadRecordDbHandler;
|
||||
import com.ubt.jimu.base.db.course.JimuCourseDbHandler;
|
||||
import com.ubt.jimu.base.entities.FileDownloadRecord;
|
||||
import com.ubt.jimu.base.entities.FirmwareVersion;
|
||||
import com.ubt.jimu.base.entities.PartFileInfo;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import com.ubt.jimu.gen.PartFileInfoDao;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import com.ubt.jimu.transport3.dao.TransportFileDbHandler2;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DownloadInfo {
|
||||
public static final int COURSE = 4;
|
||||
public static final int COURSE_COMMON = 3;
|
||||
public static final int DIY_FILE = 7;
|
||||
public static final int FIRMWARE = 6;
|
||||
public static final int MODEL = 0;
|
||||
public static final int PARTS = 1;
|
||||
public static final int STAR_COURSE = 8;
|
||||
public static final int STORY_COMMON = 2;
|
||||
public static final int SYNC_FILE = 5;
|
||||
private static final String TAG = "DownloadInfo";
|
||||
private String savePath;
|
||||
private int type;
|
||||
private String url;
|
||||
|
||||
public DownloadInfo(int i, String str, String str2) {
|
||||
this.type = i;
|
||||
this.url = str;
|
||||
this.savePath = str2;
|
||||
}
|
||||
|
||||
private static List<PartFileInfo> getNeedDownPart(List<PartFileInfo> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (list != null && list.size() != 0) {
|
||||
for (PartFileInfo partFileInfo : list) {
|
||||
if (!isInDB(partFileInfo) || !isInDir(partFileInfo)) {
|
||||
arrayList.add(partFileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNeedDownloadCourse(JimuCourse jimuCourse) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
JimuCourse downloadedCourse = JimuCourseDbHandler.getDownloadedCourse(jimuCourse);
|
||||
String str = Constants.COURSE_RESOURCE_PATH;
|
||||
if (downloadedCourse != null && downloadedCourse.getDownload()) {
|
||||
if (new File(str + jimuCourse.getId()).exists() && jimuCourse.getUpdatedTime() == downloadedCourse.getUpdatedTime()) {
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
arrayList.add(new DownloadInfo(4, jimuCourse.getResourceZip(), str + jimuCourse.getFolderName() + ".zip"));
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNeedDownloadDiyRobotFile(String str, List<DiyRobotFile> list) {
|
||||
String str2;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (list != null && list.size() != 0) {
|
||||
String str3 = ExternalOverFroyoUtils.a(JimuApplication.l(), ModelType.DOWNLOAD) + str + File.separator;
|
||||
for (DiyRobotFile diyRobotFile : list) {
|
||||
if (513 == diyRobotFile.getFileType()) {
|
||||
str2 = str3 + "actions" + File.separator + diyRobotFile.getFileName();
|
||||
} else if (769 == diyRobotFile.getFileType()) {
|
||||
str2 = str3 + str + Utils.BLOCKLY_ADD_PATH + File.separator + diyRobotFile.getFileName();
|
||||
} else if (258 == diyRobotFile.getFileType()) {
|
||||
str2 = str3 + "servos" + File.separator + diyRobotFile.getFileName();
|
||||
} else if (257 == diyRobotFile.getFileType()) {
|
||||
str2 = str3 + str + ".xml";
|
||||
} else if (259 == diyRobotFile.getFileType()) {
|
||||
str2 = str3 + str + ".jpg";
|
||||
} else {
|
||||
str2 = str3 + diyRobotFile.getFileName();
|
||||
}
|
||||
arrayList.add(new DownloadInfo(7, diyRobotFile.getFileUrl(), str2));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNeedDownloadFirmware(Context context, List<FirmwareVersion> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (list != null && list.size() != 0) {
|
||||
for (FirmwareVersion firmwareVersion : list) {
|
||||
arrayList.add(new DownloadInfo(6, firmwareVersion.getVersionPath(), FirmwareVersion.getPath(context, firmwareVersion)));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNeedDownloadInfo(List<TransportFile> list) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (list != null && list.size() != 0) {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
for (TransportFile transportFile : list) {
|
||||
String fileUrl = transportFile.getFileUrl();
|
||||
if (!TextUtils.isEmpty(fileUrl)) {
|
||||
int indexOf = fileUrl.indexOf("?");
|
||||
fileUrl = indexOf < 0 ? fileUrl + "?t=" + currentTimeMillis : fileUrl.substring(0, indexOf) + "t=" + currentTimeMillis;
|
||||
}
|
||||
arrayList.add(new DownloadInfo(5, fileUrl, TransportFileDbHandler2.getAbsoluteModelFilePath(transportFile)));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:13:0x009f, code lost:
|
||||
|
||||
if (r2.getModelUpdateTime() == r8.getModelUpdateTime()) goto L17;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static com.ubt.jimu.base.download.DownloadInfo getNeedDownloadModelInfo(com.ubt.jimu.base.entities.Robot r8) {
|
||||
/*
|
||||
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||||
r0.<init>()
|
||||
com.ubt.jimu.JimuApplication r1 = com.ubt.jimu.JimuApplication.l()
|
||||
com.ubt.jimu.unity.ModelType r2 = com.ubt.jimu.unity.ModelType.DEFAULT
|
||||
java.lang.String r1 = com.ubt.jimu.utils.ExternalOverFroyoUtils.a(r1, r2)
|
||||
r0.append(r1)
|
||||
java.lang.String r1 = r8.getModelName()
|
||||
r0.append(r1)
|
||||
java.lang.String r0 = r0.toString()
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
r1.append(r0)
|
||||
java.lang.String r2 = ".zip"
|
||||
r1.append(r2)
|
||||
java.lang.String r1 = r1.toString()
|
||||
java.io.File r2 = new java.io.File
|
||||
r2.<init>(r0)
|
||||
r0 = 1
|
||||
java.lang.Object[] r3 = new java.lang.Object[r0]
|
||||
java.lang.String r4 = r8.toString()
|
||||
r5 = 0
|
||||
r3[r5] = r4
|
||||
java.lang.String r4 = "download"
|
||||
java.lang.String r6 = "robot from cache : %s"
|
||||
com.ubtech.utils.XLog.a(r4, r6, r3)
|
||||
boolean r2 = r2.exists()
|
||||
if (r2 == 0) goto La2
|
||||
com.ubt.jimu.gen.DaoSession r2 = com.ubt.jimu.base.db.DatabaseUtils.getDaoSession(r0)
|
||||
com.ubt.jimu.gen.RobotDao r2 = r2.s()
|
||||
org.greenrobot.greendao.query.QueryBuilder r2 = r2.k()
|
||||
org.greenrobot.greendao.Property r3 = com.ubt.jimu.gen.RobotDao.Properties.ModelName
|
||||
java.lang.String r6 = r8.getModelName()
|
||||
org.greenrobot.greendao.query.WhereCondition r3 = r3.a(r6)
|
||||
org.greenrobot.greendao.query.WhereCondition[] r6 = new org.greenrobot.greendao.query.WhereCondition[r5]
|
||||
r2.a(r3, r6)
|
||||
java.util.List r2 = r2.b()
|
||||
if (r2 == 0) goto La2
|
||||
int r3 = r2.size()
|
||||
if (r3 <= 0) goto La2
|
||||
int r3 = r2.size()
|
||||
if (r3 <= r0) goto L7c
|
||||
java.lang.String r3 = "There have more than one robot with the same modelName. Is there reinstall the app with different server"
|
||||
com.ubtech.utils.XLog.b(r4, r3)
|
||||
L7c:
|
||||
java.lang.Object r2 = r2.get(r5)
|
||||
com.ubt.jimu.base.entities.Robot r2 = (com.ubt.jimu.base.entities.Robot) r2
|
||||
java.lang.Object[] r3 = new java.lang.Object[r0]
|
||||
java.lang.String r6 = r2.toString()
|
||||
r3[r5] = r6
|
||||
java.lang.String r6 = "robot from db : %s"
|
||||
com.ubtech.utils.XLog.a(r4, r6, r3)
|
||||
boolean r3 = r2.getDownload()
|
||||
if (r3 == 0) goto La2
|
||||
long r2 = r2.getModelUpdateTime()
|
||||
long r6 = r8.getModelUpdateTime()
|
||||
int r4 = (r2 > r6 ? 1 : (r2 == r6 ? 0 : -1))
|
||||
if (r4 != 0) goto La2
|
||||
goto La3
|
||||
La2:
|
||||
r0 = 0
|
||||
La3:
|
||||
if (r0 != 0) goto Laf
|
||||
com.ubt.jimu.base.download.DownloadInfo r0 = new com.ubt.jimu.base.download.DownloadInfo
|
||||
java.lang.String r8 = r8.getJarUrl()
|
||||
r0.<init>(r5, r8, r1)
|
||||
goto Lb0
|
||||
Laf:
|
||||
r0 = 0
|
||||
Lb0:
|
||||
return r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.base.download.DownloadInfo.getNeedDownloadModelInfo(com.ubt.jimu.base.entities.Robot):com.ubt.jimu.base.download.DownloadInfo");
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNeedDownloadStory(Context context, Story story) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (story != null && !TextUtils.isEmpty(story.getResourceZip())) {
|
||||
List<FileDownloadRecord> fileDownloadRecordByUrl = FileDownloadRecordDbHandler.getFileDownloadRecordByUrl(story.getResourceZip(), FileDownloadRecord.Type.Star_Course.getValue());
|
||||
if (fileDownloadRecordByUrl != null && fileDownloadRecordByUrl.size() != 0) {
|
||||
Iterator<FileDownloadRecord> it = fileDownloadRecordByUrl.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
FileDownloadRecord next = it.next();
|
||||
if (next.getFileUrl().equals(story.getResourceZip()) && next.getUpdateTime() < story.getUpdateTime()) {
|
||||
arrayList.add(new DownloadInfo(FileDownloadRecord.Type.Star_Course.getValue(), story.getResourceZip(), Story.getSdcardSavePath(context, story.getResourceZip())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arrayList.add(new DownloadInfo(FileDownloadRecord.Type.Star_Course.getValue(), story.getResourceZip(), Story.getSdcardSavePath(context, story.getResourceZip())));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<DownloadInfo> getNewDownloadPartsInfo(Robot robot) {
|
||||
ArrayList arrayList;
|
||||
String str = ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + Constants.PARTS;
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
try {
|
||||
List<PartFileInfo> needDownPart = getNeedDownPart(robot.getComponentsFileInfos());
|
||||
arrayList = new ArrayList();
|
||||
if (needDownPart != null) {
|
||||
try {
|
||||
if (needDownPart.size() > 0) {
|
||||
for (PartFileInfo partFileInfo : needDownPart) {
|
||||
if (!TextUtils.isEmpty(partFileInfo.getAndroidFilePath())) {
|
||||
arrayList.add(new DownloadInfo(1, partFileInfo.getAndroidFilePath(), str + partFileInfo.getName() + ".assetbundle"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
e.printStackTrace();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
arrayList = null;
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private static boolean isInDB(PartFileInfo partFileInfo) {
|
||||
if (partFileInfo == null) {
|
||||
return true;
|
||||
}
|
||||
QueryBuilder<PartFileInfo> k = DatabaseUtils.getDaoSession(true).r().k();
|
||||
k.a(PartFileInfoDao.Properties.Id.a(partFileInfo.getId()), new WhereCondition[0]);
|
||||
PartFileInfo c = k.c();
|
||||
if (c == null || c.getUpdateTime() != partFileInfo.getUpdateTime()) {
|
||||
return false;
|
||||
}
|
||||
ALog.a(TAG).d("零件已是最新:" + c.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isInDir(PartFileInfo partFileInfo) {
|
||||
if (partFileInfo == null) {
|
||||
return true;
|
||||
}
|
||||
if (!new File(ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + Constants.PARTS).exists()) {
|
||||
return false;
|
||||
}
|
||||
String str = ExternalOverFroyoUtils.a(JimuApplication.l(), (ModelType) null) + Constants.PARTS + partFileInfo.getName() + ".assetbundle";
|
||||
if (!new File(str).exists()) {
|
||||
return false;
|
||||
}
|
||||
ALog.a(TAG).d("零件已在文件夹:" + str);
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getSavePath() {
|
||||
return this.savePath;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/base/download/DownloadTask.java
Normal file
44
sources/com/ubt/jimu/base/download/DownloadTask.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.base.download;
|
||||
|
||||
import com.liulishuo.filedownloader.BaseDownloadTask;
|
||||
import com.liulishuo.filedownloader.FileDownloadListener;
|
||||
import com.liulishuo.filedownloader.FileDownloadQueueSet;
|
||||
import com.liulishuo.filedownloader.FileDownloader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DownloadTask {
|
||||
private FileDownloadListener fileDownloadListener;
|
||||
private FileDownloadQueueSet queueSet;
|
||||
|
||||
public DownloadTask(List<DownloadInfo> list, IJimuFileDownloadListener iJimuFileDownloadListener) {
|
||||
this(list, false, iJimuFileDownloadListener);
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
if (this.queueSet != null) {
|
||||
FileDownloader.e().a(this.fileDownloadListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
this.queueSet.a();
|
||||
}
|
||||
|
||||
public DownloadTask(List<DownloadInfo> list, boolean z, IJimuFileDownloadListener iJimuFileDownloadListener) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (DownloadInfo downloadInfo : list) {
|
||||
BaseDownloadTask a = FileDownloader.e().a(downloadInfo.getUrl());
|
||||
a.a(downloadInfo.getSavePath(), false);
|
||||
a.a(Integer.valueOf(downloadInfo.getType()));
|
||||
a.a(z);
|
||||
a.c(3);
|
||||
a.a("Accept-Encoding", "identity");
|
||||
arrayList.add(a);
|
||||
}
|
||||
this.fileDownloadListener = new MyFileDownloadListener(arrayList.size(), iJimuFileDownloadListener);
|
||||
this.queueSet = new FileDownloadQueueSet(this.fileDownloadListener);
|
||||
this.queueSet.a(arrayList);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user