version:8.1
fix: update:接口优化,地图低功耗
This commit is contained in:
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "com.uiui.aios"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 64
|
||||
versionName "7.3"
|
||||
versionCode 72
|
||||
versionName "8.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -196,7 +196,7 @@ dependencies {
|
||||
// implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
|
||||
// implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
//
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.uiui.aios;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AppInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5488458740561098181L;
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import com.uiui.aios.base.BaseActivity;
|
||||
import com.uiui.aios.base.BaseFragmentPagerAdapter;
|
||||
import com.uiui.aios.bean.AlarmItem;
|
||||
import com.uiui.aios.bean.DesktopIcon;
|
||||
import com.uiui.aios.config.CommonConfig;
|
||||
import com.uiui.aios.dialog.PasswordDialog;
|
||||
import com.uiui.aios.dialog.PrivacyPolicyDialog;
|
||||
import com.uiui.aios.fragment.AppListFragment;
|
||||
@@ -123,6 +124,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
mCustomFragment = new CustomFragment();
|
||||
mFragments.add(mCustomFragment);
|
||||
mMainPresenter.getSystemSettings();
|
||||
// mMainPresenter.getAdminSnSetting();
|
||||
ArrayList<DesktopIcon> desktopIcons = ApkUtils.queryFilterAppInfo(this);
|
||||
|
||||
int x = 0;
|
||||
@@ -329,6 +331,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Log.e(TAG, "onStart: ");
|
||||
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
getAlarmData();
|
||||
@@ -351,7 +354,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
ToastUtil.show("请授予\"" + getString(R.string.app_name) + "\"使用通知权");
|
||||
gotoNotificationAccessSetting(this);
|
||||
}
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), "uiui_activation", 0);
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
Log.e(TAG, "onResume: is_activation = " + is_activation);
|
||||
if (is_activation == 1) {
|
||||
LauncherUtils.setDefaultDesktop(MainActivity.this, BuildConfig.APPLICATION_ID, this.getClass().getName());
|
||||
@@ -359,8 +362,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
LauncherUtils.setDefaultDesktop(MainActivity.this, LauncherUtils.Launcher3, LauncherUtils.Launcher3Class);
|
||||
}
|
||||
addData();
|
||||
mMainPresenter.sendRunningInfo();
|
||||
mMainPresenter.getAdminSnSetting();
|
||||
addHomeWatcher();
|
||||
}
|
||||
|
||||
@@ -394,7 +395,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
public void onHomePressed() {
|
||||
//按了HOME键
|
||||
Log.e(TAG, "onHomePressed: ");
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), "uiui_activation", 0);
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
Log.e(TAG, "onHomePressed: is_activation = " + is_activation);
|
||||
if (is_activation == 0) {
|
||||
LauncherUtils.openLauncher3(MainActivity.this);
|
||||
@@ -461,12 +462,15 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
Log.e(TAG, "onRestart: ");
|
||||
mMainPresenter.sendAPPUsage();
|
||||
mMainPresenter.sendRunningInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
Log.e(TAG, "onPause: ");
|
||||
if (mHomeWatcher != null) {
|
||||
mHomeWatcher.stopWatch();// 在销毁时停止监听,不然会报错的。
|
||||
}
|
||||
@@ -475,6 +479,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
Log.e(TAG, "onStop: ");
|
||||
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
@@ -56,57 +56,57 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getSystemSettings() {
|
||||
NetInterfaceManager.getInstance().getSystemSettings(true, getLifecycle(), new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
public void setContact(List<Contact> contactList) {
|
||||
Intent intent = new Intent("setting_sos");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmpty() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
mView.setSystemSettings();
|
||||
}
|
||||
});
|
||||
|
||||
// NetInterfaceManager.getInstance().getSystemSettings(true, getLifecycle(), new NetInterfaceManager.ContactCallback() {
|
||||
// @Override
|
||||
// public void setContact(List<Contact> contactList) {
|
||||
// Intent intent = new Intent("setting_sos");
|
||||
// mContext.sendBroadcast(intent);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setEmpty() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
mView.setSystemSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopLayout() {
|
||||
NetInterfaceManager.getInstance().getDesktopLayoutObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<NetDesktopIcon>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getDesktopLayout", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<NetDesktopIcon>> listBaseResponse) {
|
||||
Log.e("getDesktopLayout", "onNext: " + listBaseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getDesktopLayout", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getDesktopLayout", "onComplete: ");
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getDesktopLayoutObservable()
|
||||
// .compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse<List<NetDesktopIcon>>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(@NonNull Disposable d) {
|
||||
// Log.e("getDesktopLayout", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(@NonNull BaseResponse<List<NetDesktopIcon>> listBaseResponse) {
|
||||
// Log.e("getDesktopLayout", "onNext: " + listBaseResponse);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(@NonNull Throwable e) {
|
||||
// Log.e("getDesktopLayout", "onError: " + e.getMessage());
|
||||
// onComplete();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getDesktopLayout", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,13 @@ import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class BaseFragment extends Fragment implements LifecycleProvider<FragmentEvent> {
|
||||
public abstract class BaseFragment extends Fragment implements LifecycleProvider<FragmentEvent> {
|
||||
public final BehaviorSubject<FragmentEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
protected boolean isViewInitiated;
|
||||
protected boolean isVisibleToUser;
|
||||
protected boolean isDataInitiated;
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
@@ -56,6 +60,35 @@ public class BaseFragment extends Fragment implements LifecycleProvider<Fragment
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
isViewInitiated = true;
|
||||
prepareFetchData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
this.isVisibleToUser = isVisibleToUser;
|
||||
prepareFetchData();
|
||||
}
|
||||
|
||||
public abstract void fetchData();
|
||||
|
||||
public boolean prepareFetchData() {
|
||||
return prepareFetchData(false);
|
||||
}
|
||||
|
||||
public boolean prepareFetchData(boolean forceUpdate) {
|
||||
if (isVisibleToUser && isViewInitiated && (!isDataInitiated || forceUpdate)) {
|
||||
fetchData();
|
||||
isDataInitiated = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
12
app/src/main/java/com/uiui/aios/config/CommonConfig.java
Normal file
12
app/src/main/java/com/uiui/aios/config/CommonConfig.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.uiui.aios.config;
|
||||
|
||||
public class CommonConfig {
|
||||
/*是否激活接口请求缓存*/
|
||||
public static final String ACTIVATIONBEAN_KEY = "UIUI_ACTIVATIONBEAN_KEY";
|
||||
/*是否激活*/
|
||||
public static final String UIUI_ACTIVATION_KEY = "uiui_activation";
|
||||
/*激活码类型*/
|
||||
public static final String UIUI_CODE_TYPE_KEY = "uiui_code_type";
|
||||
/*体验到期时间戳*/
|
||||
public static final String UIUI_EXPIRE_TIME_KEY = "uiui_expire_time";
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.uiui.aios.activity.code.HealthCodeActivity;
|
||||
import com.uiui.aios.base.BaseFragment;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.DesktopIcon;
|
||||
import com.uiui.aios.config.CommonConfig;
|
||||
import com.uiui.aios.dialog.CustomDialog;
|
||||
import com.uiui.aios.dialog.PasswordDialog;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
@@ -99,6 +100,11 @@ public class AppListFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
private View rootView;
|
||||
|
||||
@Override
|
||||
@@ -181,7 +187,7 @@ public class AppListFragment extends BaseFragment {
|
||||
Log.e(TAG, "onItemClick: " + desktopIcon.getPackageName());
|
||||
switch (desktopIcon.getPackageName()) {
|
||||
case "aios.exit":
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), "uiui_activation", 0);
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
if (is_activation == 0) {
|
||||
LauncherUtils.openLauncher3(mContext);
|
||||
} else {
|
||||
|
||||
@@ -176,6 +176,11 @@ public class SecondFragment extends BaseFragment implements NetworkUtils.OnNetwo
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
|
||||
public class CustomContact {
|
||||
public interface Presenter extends BasePresenter<CustomView> {
|
||||
void getNetSnIsActivation();
|
||||
void getSnIsActivation();
|
||||
void getSnInfo();
|
||||
void getUserAvatarInfo();
|
||||
@@ -18,6 +19,7 @@ public class CustomContact {
|
||||
}
|
||||
|
||||
public interface CustomView extends BaseView {
|
||||
void setNetSnIsActivation(boolean activation);
|
||||
void setSnIsActivation(boolean activation);
|
||||
void setSnInfo(SnInfo snInfo);
|
||||
void setUserAvatarInfo(UserAvatarInfo userAvatarInfo);
|
||||
|
||||
@@ -61,6 +61,7 @@ import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.bean.HealthCode;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.config.CommonConfig;
|
||||
import com.uiui.aios.dialog.SingleDialog;
|
||||
import com.uiui.aios.disklrucache.CacheHelper;
|
||||
import com.uiui.aios.manager.AmapManager;
|
||||
@@ -91,17 +92,19 @@ import butterknife.ButterKnife;
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class CustomFragment extends BaseFragment implements CustomContact.CustomView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = CustomFragment.class.getSimpleName();
|
||||
|
||||
|
||||
// @BindView(R.id.cl_alarm)
|
||||
// ConstraintLayout cl_alarm;
|
||||
|
||||
@BindView(R.id.cl_weather)
|
||||
ConstraintLayout cl_weather;
|
||||
@BindView(R.id.cl_activation)
|
||||
ConstraintLayout cl_activation;
|
||||
@BindView(R.id.cl_clean)
|
||||
ConstraintLayout cl_shared_space;
|
||||
ConstraintLayout cl_clean;
|
||||
@BindView(R.id.cl_sos)
|
||||
ConstraintLayout cl_soso;
|
||||
ConstraintLayout cl_sos;
|
||||
@BindView(R.id.cl_guard)
|
||||
ConstraintLayout cl_guard;
|
||||
@BindView(R.id.cl_health)
|
||||
@@ -133,8 +136,8 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
CircleProgressView cpv;
|
||||
// @BindView(R.id.iv_charging)
|
||||
// ImageView iv_charging;
|
||||
@BindView(R.id.rv_noti)
|
||||
RecyclerView rv_noti;
|
||||
// @BindView(R.id.rv_noti)
|
||||
// RecyclerView rv_noti;
|
||||
// @BindView(R.id.rv_clock)
|
||||
// RecyclerView rv_clock;
|
||||
// @BindView(R.id.wifi_ssid)
|
||||
@@ -154,13 +157,12 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
@BindView(R.id.tv_time)
|
||||
TextView tv_time;
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
private int[] mShaderColors = new int[]{0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f, 0xFF27602f};
|
||||
private int[] mShaderColorsRed = new int[]{0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000};
|
||||
private View rootView;
|
||||
private List<AlarmItem> alarmItemList;
|
||||
private NotificationAdapter notificationAdapter;
|
||||
// private NotificationAdapter notificationAdapter;
|
||||
// private AlarmClockAdapter alarmClockAdapter;
|
||||
private SOSNnmberAdapter sosNnmberAdapter;
|
||||
private MMKV mMMKV;
|
||||
@@ -214,8 +216,14 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
mMMKV = MMKV.defaultMMKV();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
Log.e(TAG, "fetchData: ");
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
@@ -269,7 +277,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerAlarmClockReceiver() {
|
||||
if (null == mAlarmClockReceiver) {
|
||||
mAlarmClockReceiver = new AlarmClockReceiver();
|
||||
@@ -291,7 +298,7 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getAlarmClock();
|
||||
mCustomPresenter.getAlarmClock();
|
||||
}
|
||||
}, 3456);
|
||||
}
|
||||
@@ -357,9 +364,9 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
||||
mContext = (Activity) rootView.getContext();
|
||||
@@ -370,7 +377,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
mCRv = mContext.getContentResolver();
|
||||
ButterKnife.bind(this, rootView);
|
||||
initView();
|
||||
initData();
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@@ -405,24 +411,28 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
cl_guard.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getAlarm();
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
getAlarm();
|
||||
}
|
||||
}
|
||||
});
|
||||
notificationAdapter = new NotificationAdapter();
|
||||
notificationAdapter.setOnClickListener(new NotificationAdapter.OnClickListener() {
|
||||
@Override
|
||||
public void onClick() {
|
||||
getAlarm();
|
||||
}
|
||||
});
|
||||
rv_noti.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getAlarm();
|
||||
}
|
||||
});
|
||||
rv_noti.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
rv_noti.setAdapter(notificationAdapter);
|
||||
// notificationAdapter = new NotificationAdapter();
|
||||
// notificationAdapter.setOnClickListener(new NotificationAdapter.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick() {
|
||||
// getAlarm();
|
||||
// }
|
||||
// });
|
||||
// rv_noti.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// getAlarm();
|
||||
// }
|
||||
// });
|
||||
// rv_noti.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
// rv_noti.setAdapter(notificationAdapter);
|
||||
if (isWifiConnect()) {
|
||||
// wifi_ssid.setText(getConnectWifiSsid());
|
||||
} else {
|
||||
@@ -431,16 +441,24 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
sosNnmberAdapter = new SOSNnmberAdapter();
|
||||
rv_sos.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
rv_sos.setAdapter(sosNnmberAdapter);
|
||||
cl_soso.setOnClickListener(new View.OnClickListener() {
|
||||
cl_sos.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkSosNumber();
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
checkSosNumber();
|
||||
}
|
||||
}
|
||||
});
|
||||
cl_weather.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
}
|
||||
}
|
||||
});
|
||||
cl_activation.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -449,24 +467,14 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
ApkUtils.openApp(mContext, "com.uiui.sn");
|
||||
}
|
||||
});
|
||||
cl_shared_space.setOnClickListener(new View.OnClickListener() {
|
||||
cl_clean.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
killBackgroundApp();
|
||||
// SingleDialog dialog = new SingleDialog(mContext);
|
||||
// dialog.setTitle("温馨提示")
|
||||
// .setMessage("此功能暂未上线")
|
||||
// .setPositive("确定")
|
||||
//// .setNegtive("拒绝")
|
||||
//// .setSingle(true)
|
||||
//
|
||||
// .setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
// @Override
|
||||
// public void onPositiveClick() {
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
// });
|
||||
// dialog.show();
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
killBackgroundApp();
|
||||
}
|
||||
}
|
||||
});
|
||||
cl_health.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -478,25 +486,37 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
cl_contact.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkContact();
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
checkContact();
|
||||
}
|
||||
}
|
||||
});
|
||||
cl_ai.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openScheme(SchemeUtils.SCHEME_HAND);
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
openScheme(SchemeUtils.SCHEME_HAND);
|
||||
}
|
||||
}
|
||||
});
|
||||
cl_app.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (TextUtils.isEmpty(quickAppPackagesName)) {
|
||||
int is_quick = Settings.Global.getInt(mContext.getContentResolver(), QuickAppActivity.QUICK_APP_ENABLED_KEY, 0);
|
||||
if (is_quick == 0) {
|
||||
startActivity(new Intent(mContext, QuickAppActivity.class));
|
||||
}
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, quickAppPackagesName);
|
||||
if (TextUtils.isEmpty(quickAppPackagesName)) {
|
||||
int is_quick = Settings.Global.getInt(mContext.getContentResolver(), QuickAppActivity.QUICK_APP_ENABLED_KEY, 0);
|
||||
if (is_quick == 0) {
|
||||
startActivity(new Intent(mContext, QuickAppActivity.class));
|
||||
}
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, quickAppPackagesName);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -515,12 +535,61 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
cl_appstore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApkUtils.openApp(mContext, "com.uiui.appstore");
|
||||
if (checkExpired()) {
|
||||
showExpired();
|
||||
} else {
|
||||
ApkUtils.openApp(mContext, "com.uiui.appstore");
|
||||
}
|
||||
}
|
||||
});
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
private void showExpired() {
|
||||
SingleDialog dialog = new SingleDialog(mContext);
|
||||
dialog.setTitle("温馨提示")
|
||||
.setMessage("体验时间已到期,请激活")
|
||||
.setPositive("确定")
|
||||
// .setNegtive("拒绝")
|
||||
// .setSingle(true)
|
||||
.setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
ApkUtils.openApp(mContext, "com.uiui.sn");
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public interface Activation {
|
||||
void ActivationCallback();
|
||||
}
|
||||
|
||||
private boolean checkExpired() {
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
int code_type = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_CODE_TYPE_KEY, -1);
|
||||
long expire_time = Settings.Global.getLong(mContext.getContentResolver(), CommonConfig.UIUI_EXPIRE_TIME_KEY, -1);
|
||||
if (is_activation == 0) {
|
||||
return true;
|
||||
} else if (is_activation == 1) {
|
||||
if (code_type == 0) {
|
||||
if (expire_time > 0) {
|
||||
long time = System.currentTimeMillis() / 1000;
|
||||
return time > expire_time;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (code_type == 1) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSosNumber() {
|
||||
NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
@@ -553,38 +622,49 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
}
|
||||
|
||||
private void checkContact() {
|
||||
NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
@Override
|
||||
public void setContact(List<Contact> contactList) {
|
||||
// if (contactList == null || contactList.size() == 0) {
|
||||
// showNoData("温馨提示", "请在小程序上设置通讯录");
|
||||
// } else {
|
||||
// startActivity(new Intent(mContext, ContactActivity.class));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmpty() {
|
||||
// showNoData("温馨提示", "请在小程序上设置通讯录");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
startActivity(new Intent(mContext, ContactActivity.class));
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getContactList(new NetInterfaceManager.ContactCallback() {
|
||||
// @Override
|
||||
// public void setContact(List<Contact> contactList) {
|
||||
//// if (contactList == null || contactList.size() == 0) {
|
||||
//// showNoData("温馨提示", "请在小程序上设置通讯录");
|
||||
//// } else {
|
||||
//// startActivity(new Intent(mContext, ContactActivity.class));
|
||||
//// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setEmergencyContact(List<Contact> emergencyContact) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setEmpty() {
|
||||
//// showNoData("温馨提示", "请在小程序上设置通讯录");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
startActivity(new Intent(mContext, ContactActivity.class));
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mCustomPresenter.getSnIsActivation();
|
||||
|
||||
initAmap();
|
||||
// getAlarmClock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetSnIsActivation(boolean activation) {
|
||||
if (activation) {
|
||||
cl_weather.setVisibility(View.VISIBLE);
|
||||
cl_activation.setVisibility(View.GONE);
|
||||
} else {
|
||||
cl_weather.setVisibility(View.GONE);
|
||||
cl_activation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mCustomPresenter.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -596,7 +676,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
cl_weather.setVisibility(View.GONE);
|
||||
cl_activation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mCustomPresenter.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -625,14 +704,7 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> clockDataList) {
|
||||
if (clockDataList != null && clockDataList.size() != 0) {
|
||||
notificationAdapter.setDataList(clockDataList);
|
||||
rv_noti.setVisibility(View.VISIBLE);
|
||||
iv_note_nodata.setVisibility(View.GONE);
|
||||
} else {
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -648,8 +720,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// setAlarm();
|
||||
getAlarmClock();
|
||||
setSosNumber();
|
||||
setQuickApp();
|
||||
mCustomPresenter.getSnIsActivation();
|
||||
@@ -686,7 +756,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
.setPositive("确定")
|
||||
// .setNegtive("拒绝")
|
||||
// .setSingle(true)
|
||||
|
||||
.setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
@@ -735,18 +804,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
}
|
||||
}
|
||||
|
||||
private void setAlarm() {
|
||||
if (rootView == null) return;
|
||||
if (alarmItemList == null) {
|
||||
// tv_add.setVisibility(View.VISIBLE);
|
||||
// rv_clock.setVisibility(View.GONE);
|
||||
} else {
|
||||
// tv_add.setVisibility(View.GONE);
|
||||
// rv_clock.setVisibility(View.VISIBLE);
|
||||
// alarmClockAdapter.setAlarmItemList(alarmItemList);
|
||||
}
|
||||
}
|
||||
|
||||
private void initAmap() {
|
||||
LocationClient locationClient = AmapManager.getInstance().getLocationClient();
|
||||
locationClient.stop();
|
||||
@@ -782,7 +839,7 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
@Override
|
||||
public void setAlarmClockEmpty() {
|
||||
showNoData("温馨提示", "请在小程序上设置爱心闹钟");
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
// rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -793,10 +850,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
});
|
||||
}
|
||||
|
||||
private void getAlarmClock() {
|
||||
|
||||
}
|
||||
|
||||
private void showNoData(String title, String msg) {
|
||||
SingleDialog dialog = new SingleDialog(mContext);
|
||||
dialog.setTitle(title)
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.uiui.aios.alarm.AlarmUtils;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.config.CommonConfig;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.utils.GsonUtils;
|
||||
|
||||
@@ -52,111 +52,87 @@ public class CustomPresenter implements CustomContact.Presenter {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNetSnIsActivation() {
|
||||
// NetInterfaceManager.getInstance()
|
||||
// .getSnIsActivationObservable()
|
||||
// .compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
// .subscribe(new Observer<BaseResponse>() {
|
||||
// @Override
|
||||
// public void onSubscribe(@NonNull Disposable d) {
|
||||
// Log.e("getSnIsActivation", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
// Log.e("getSnIsActivation", "onNext: " + baseResponse);
|
||||
// if (baseResponse.code == 200) {
|
||||
// JsonObject jsonObject = GsonUtils.getJsonObject(baseResponse.data.toString());
|
||||
// int is_activation = jsonObject.get("is_activation").getAsInt();
|
||||
// Settings.Global.putInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, is_activation);
|
||||
// mView.setNetSnIsActivation(is_activation == 1);
|
||||
// } else {
|
||||
// mView.setNetSnIsActivation(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(@NonNull Throwable e) {
|
||||
// Log.e("getSnIsActivation", "onError: " + e.getMessage());
|
||||
// int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
// mView.setNetSnIsActivation(is_activation == 1);
|
||||
// onComplete();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getSnIsActivation", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnIsActivation() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnIsActivationObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnIsActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("getSnIsActivation", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(baseResponse.data.toString());
|
||||
int is_activation = jsonObject.get("is_activation").getAsInt();
|
||||
Settings.Global.putInt(mContext.getContentResolver(), "uiui_activation", is_activation);
|
||||
mView.setSnIsActivation(is_activation == 1);
|
||||
// mView.setSnIsActivation(false);
|
||||
} else {
|
||||
mView.setSnIsActivation(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnIsActivation", "onError: " + e.getMessage());
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), "uiui_activation", 0);
|
||||
mView.setSnIsActivation(is_activation == 1);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnIsActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
mView.setSnIsActivation(is_activation == 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(getLifecycle(), new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
mView.setSnInfo(snInfo);
|
||||
}
|
||||
});
|
||||
mView.setSnInfo(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUserAvatarInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfoControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfoControl", "onNext: " + userAvatarInfoBaseResponse);
|
||||
mView.setUserAvatarInfo(userAvatarInfoBaseResponse.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
}
|
||||
});
|
||||
mView.setUserAvatarInfo(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlarmClock() {
|
||||
NetInterfaceManager.getInstance().getAlarmClockFragment(lifecycle, new NetInterfaceManager.AlarmClockCallback() {
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||
AlarmClockData alarmClockData = AlarmUtils.getInstance().getRecentAlarmClock();
|
||||
if (alarmClockData != null) {
|
||||
List<AlarmClockData> data = new ArrayList<>();
|
||||
data.add(alarmClockData);
|
||||
mView.setAlarmClock(data);
|
||||
} else {
|
||||
mView.setAlarmClock(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlarmClockEmpty() {
|
||||
mView.setAlarmClock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getAlarmClockFragment(lifecycle, new NetInterfaceManager.AlarmClockCallback() {
|
||||
// @Override
|
||||
// public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||
// AlarmClockData alarmClockData = AlarmUtils.getInstance().getRecentAlarmClock();
|
||||
// if (alarmClockData != null) {
|
||||
// List<AlarmClockData> data = new ArrayList<>();
|
||||
// data.add(alarmClockData);
|
||||
// mView.setAlarmClock(data);
|
||||
// } else {
|
||||
// mView.setAlarmClock(null);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setAlarmClockEmpty() {
|
||||
// mView.setAlarmClock(null);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
mView.setAlarmClock(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class AmapManager {
|
||||
mOption.setIsNeedLocationDescribe(true); // 可选,默认false,设置是否需要位置语义化结果,可以在BDLocation
|
||||
mOption.setIsNeedLocationPoiList(true); // 可选,默认false,设置是否需要POI结果,可以在BDLocation
|
||||
mOption.SetIgnoreCacheException(false); // 可选,默认false,设置是否收集CRASH信息,默认收集
|
||||
mOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备,模糊
|
||||
mOption.setLocationMode(LocationClientOption.LocationMode.Battery_Saving); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备,模糊
|
||||
mOption.setIsNeedAltitude(false); // 可选,默认false,设置定位时是否需要海拔信息,默认不需要,除基础定位版本都可用
|
||||
// 可选,设置首次定位时选择定位速度优先还是定位准确性优先,默认为速度优先
|
||||
// mOption.setFirstLocType(LocationClientOption.FirstLocType.SPEED_IN_FIRST_LOC);
|
||||
|
||||
@@ -930,7 +930,6 @@ public class NetInterfaceManager {
|
||||
} else {
|
||||
if (callback != null) callback.setContact(setting_sos);
|
||||
}
|
||||
if (callback != null) callback.onComplete();
|
||||
}
|
||||
onComplete();
|
||||
}
|
||||
@@ -1095,5 +1094,75 @@ public class NetInterfaceManager {
|
||||
};
|
||||
}
|
||||
|
||||
public void getUserAvatarInfo(boolean refresh, BehaviorSubject<FragmentEvent> lifecycle, onCompleteCallback callback) {
|
||||
ConnectMode connectMode = ConnectMode.ONE_MINUTE;
|
||||
if (refresh) {
|
||||
connectMode = ConnectMode.DEFAULT;
|
||||
}
|
||||
if (ConnectManager.getInstance().isNeedConnect(URLAddress.GET_ADMIN_SN_SETTING, connectMode)) {
|
||||
getUserAvatarInfo(lifecycle, callback);
|
||||
} else {
|
||||
String jsonString = mCacheHelper.getAsString(URLAddress.GET_ADMIN_SN_SETTING);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
getUserAvatarInfo(lifecycle, callback);
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<UserAvatarInfo>() {
|
||||
}.getType();
|
||||
UserAvatarInfo userAvatarInfo = gson.fromJson(jsonString, type);
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getUserAvatarInfo(BehaviorSubject<FragmentEvent> lifecycle, onCompleteCallback callback) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
.subscribe(getUserAvatarInfoObserver(callback));
|
||||
}
|
||||
|
||||
public void getUserAvatarInfo(onCompleteCallback callback) {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.subscribe(getUserAvatarInfoObserver(callback));
|
||||
}
|
||||
|
||||
public void getUserAvatarInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.subscribe(getUserAvatarInfoObserver(null));
|
||||
}
|
||||
|
||||
public Observer<BaseResponse<UserAvatarInfo>> getUserAvatarInfoObserver(onCompleteCallback callback) {
|
||||
return new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfoControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfoControl", "onNext: " + userAvatarInfoBaseResponse);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,5 @@ public class URLAddress {
|
||||
public static final String APP_ICON_UPDATE = "Control/appIconUpdate";
|
||||
|
||||
|
||||
|
||||
public static final String GET_USER_ID = "getUserId";
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.service.main.MainService;
|
||||
import com.uiui.aios.tpush.MessageReceiver;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -68,7 +70,9 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
default:
|
||||
break;
|
||||
case BOOT_COMPLETED:
|
||||
MainService.mPresenter.getAlarmClock();
|
||||
NetInterfaceManager.getInstance().getAlarmClock();
|
||||
Intent alarmIntent = new Intent(MessageReceiver.SET_ALARMCLOCK);
|
||||
context.sendBroadcast(alarmIntent);
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
|
||||
break;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
|
||||
mPresenter.getAlarmClock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -244,11 +244,6 @@ public class ApkUtils {
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
public static boolean appIsDisable(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
return pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
|
||||
public static boolean isSystemApp(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
ApplicationInfo applicationInfo = null;
|
||||
@@ -261,6 +256,11 @@ public class ApkUtils {
|
||||
return (applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
|
||||
}
|
||||
|
||||
public static boolean appIsDisable(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
return pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
|
||||
public static boolean disableApp(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -169,10 +168,8 @@
|
||||
android:src="@drawable/home_activation_icon"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_clean"
|
||||
android:layout_width="0dp"
|
||||
@@ -337,7 +334,6 @@
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_marginEnd="@dimen/dp_2"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_bg_guard">
|
||||
|
||||
@@ -435,7 +431,6 @@
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -485,7 +480,6 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_health"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_health"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_health" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -594,7 +588,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -524,7 +524,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView4"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -34,22 +33,24 @@
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="提醒时间"
|
||||
android:layout_margin="@dimen/dp_4"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.226" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_voice"
|
||||
android:layout_width="180dp"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/voice_background"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_time"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_time"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_time">
|
||||
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user