version:2.2
fix: update:接口优化
This commit is contained in:
@@ -94,6 +94,11 @@ public class AppListFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
private View rootView;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -170,7 +170,7 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
ImageView iv_app;
|
||||
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
private static final String TAG = CustomFragment.class.getSimpleName();
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
private int[] mShaderColors = new int[]{0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300, 0xFFff9300};
|
||||
private int[] mShaderColorsRed = new int[]{0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000, 0xFFFF0000};
|
||||
@@ -232,6 +232,10 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
mMMKV = MMKV.defaultMMKV();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
@@ -330,7 +334,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
private BatteryReceiver batteryReceiver;
|
||||
|
||||
private class BatteryReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
@@ -385,7 +388,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
mCRv = mContext.getContentResolver();
|
||||
ButterKnife.bind(this, rootView);
|
||||
initView();
|
||||
initData();
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@@ -549,7 +551,6 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
startActivity(new Intent(mContext, ControlActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
@@ -628,36 +629,36 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
mCustomPresenter.getSnInfo();
|
||||
NetInterfaceManager.getInstance().getUserAvatarInfoControl()
|
||||
.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);
|
||||
if (userAvatarInfoBaseResponse.code == 200) {
|
||||
if (!mContext.isDestroyed()) {
|
||||
// Glide.with(iv_head).load(userAvatarInfoBaseResponse.data.getAvatar()).into(iv_head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getUserAvatarInfoControl()
|
||||
// .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);
|
||||
// if (userAvatarInfoBaseResponse.code == 200) {
|
||||
// if (!mContext.isDestroyed()) {
|
||||
//// Glide.with(iv_head).load(userAvatarInfoBaseResponse.data.getAvatar()).into(iv_head);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(@NonNull Throwable e) {
|
||||
// Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
// mCustomPresenter.getSnInfo();
|
||||
initAmap();
|
||||
getAlarmClock();
|
||||
getAlarmCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -824,6 +825,22 @@ public class CustomFragment extends BaseFragment implements CustomContact.Custom
|
||||
});
|
||||
}
|
||||
|
||||
private void getAlarmCache(){
|
||||
String jsonString = mCacheHelper.getAsString(URLAddress.GET_ALARM_CLOCK);
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<AlarmClockData>>() {
|
||||
}.getType();
|
||||
List<AlarmClockData> list = gson.fromJson(jsonString, type);
|
||||
if (list == null || list.size() == 0) {
|
||||
notificationAdapter.setDataList(list);
|
||||
rv_noti.setVisibility(View.VISIBLE);
|
||||
iv_note_nodata.setVisibility(View.GONE);
|
||||
} else {
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void getAlarmClock() {
|
||||
NetInterfaceManager.getInstance().getAlarmClock(new NetInterfaceManager.AlarmClockCallback() {
|
||||
@Override
|
||||
|
||||
@@ -43,11 +43,11 @@ public class CustomPresenter implements CustomContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
mView.setSnInfo(snInfo);
|
||||
}
|
||||
});
|
||||
// NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
// @Override
|
||||
// public void setSnInfo(SnInfo snInfo) {
|
||||
// mView.setSnInfo(snInfo);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +179,11 @@ public class SecondFragment extends BaseFragment implements SecondContact.View,
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fetchData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public android.view.View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
Reference in New Issue
Block a user