修改主页样式,修复时钟不准确
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.uiui.aios.activity.alarm;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -20,6 +23,9 @@ public class AlarmClockActivity extends BaseActivity implements AlarmClockContac
|
||||
|
||||
@BindView(R.id.recyclerView)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.iv_back)
|
||||
ImageView iv_back;
|
||||
|
||||
|
||||
private AlarmClockPresenter mPresenter;
|
||||
private AlarmAdapter mAlarmAdapter;
|
||||
@@ -39,7 +45,12 @@ public class AlarmClockActivity extends BaseActivity implements AlarmClockContac
|
||||
mAlarmAdapter = new AlarmAdapter();
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(AlarmClockActivity.this));
|
||||
recyclerView.setAdapter(mAlarmAdapter);
|
||||
|
||||
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -584,6 +584,8 @@ public class AlarmUtils {
|
||||
timestamp += (8 - day_of_week) * AlarmManager.INTERVAL_DAY;
|
||||
break;
|
||||
default:
|
||||
timestamp += (6 - day_of_week) * AlarmManager.INTERVAL_DAY;
|
||||
break;
|
||||
}
|
||||
Intent intent = new Intent(action);
|
||||
intent.putExtra("title", extra);
|
||||
|
||||
44
app/src/main/java/com/uiui/aios/bean/UserAvatarInfo.java
Normal file
44
app/src/main/java/com/uiui/aios/bean/UserAvatarInfo.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.uiui.aios.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class UserAvatarInfo implements Serializable {
|
||||
private static final long serialVersionUID = 7700643058775210597L;
|
||||
|
||||
String username;
|
||||
String avatar;
|
||||
String gread;
|
||||
int id;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getGread() {
|
||||
return gread;
|
||||
}
|
||||
|
||||
public void setGread(String gread) {
|
||||
this.gread = gread;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import android.widget.TextView;
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.Gson;
|
||||
import com.qweather.sdk.bean.base.Code;
|
||||
import com.qweather.sdk.bean.base.Lang;
|
||||
@@ -48,8 +49,10 @@ import com.uiui.aios.adapter.NotificationAdapter;
|
||||
import com.uiui.aios.adapter.SOSNnmberAdapter;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.AlarmItem;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.HealthCode;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.dialog.SingleDialog;
|
||||
import com.uiui.aios.manager.AmapManager;
|
||||
import com.uiui.aios.alarm.AlarmUtils;
|
||||
@@ -67,6 +70,9 @@ import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
|
||||
/**
|
||||
@@ -112,6 +118,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
RecyclerView rv_sos;
|
||||
@BindView(R.id.iv_note_nodata)
|
||||
ImageView iv_note_nodata;
|
||||
@BindView(R.id.iv_head)
|
||||
ImageView iv_head;
|
||||
|
||||
@BindView(R.id.cl_health)
|
||||
ConstraintLayout mClHealth;
|
||||
@@ -121,6 +129,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
ConstraintLayout mClFace;
|
||||
@BindView(R.id.cl_hand)
|
||||
ConstraintLayout mClHand;
|
||||
@BindView(R.id.tv_name)
|
||||
TextView tv_name;
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
@@ -418,6 +428,45 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo != null) {
|
||||
if (TextUtils.isEmpty(snInfo.getSn_name())) {
|
||||
tv_name.setText("未设置");
|
||||
} else {
|
||||
tv_name.setText(snInfo.getSn_name());
|
||||
}
|
||||
} else {
|
||||
tv_name.setText("未设置");
|
||||
}
|
||||
}
|
||||
});
|
||||
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) {
|
||||
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: ");
|
||||
}
|
||||
});
|
||||
initAmap();
|
||||
getAlarmClock();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.uiui.aios.bean.HealthCode;
|
||||
import com.uiui.aios.bean.NetDesktopIcon;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.SystemSettings;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.bean.UserId;
|
||||
import com.uiui.aios.disklrucache.CacheHelper;
|
||||
import com.uiui.aios.manager.ConnectManager;
|
||||
@@ -41,6 +42,7 @@ import com.uiui.aios.network.api.SendScreenshotApi;
|
||||
import com.uiui.aios.network.api.Setting;
|
||||
import com.uiui.aios.network.api.UpdateAlarmClockApi;
|
||||
import com.uiui.aios.network.api.UpdateDesktopApi;
|
||||
import com.uiui.aios.network.api.UserInfoControl;
|
||||
import com.uiui.aios.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiui.aios.utils.GsonUtils;
|
||||
import com.uiui.aios.utils.Utils;
|
||||
@@ -164,6 +166,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<UserAvatarInfo>> getUserAvatarInfoControl() {
|
||||
return mRetrofit.create(UserInfoControl.class)
|
||||
.getUserAvatarInfo(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<AlarmClockData>>> getAlarmClockObservable() {
|
||||
return mRetrofit
|
||||
.create(AlarmClockApi.class)
|
||||
|
||||
@@ -4,6 +4,8 @@ public class URLAddress {
|
||||
public static final String ROOT_URL = "https://led.zuoyepad.com/android/";
|
||||
/*设备信息接口*/
|
||||
public static final String SNINFO = "sn/getSnInfo";
|
||||
/*获取用户头像和信息*/
|
||||
public static final String GET_USER_AVATAR_INFO = "sn/getUserAvatarInfo";
|
||||
/*获取闹钟*/
|
||||
public static final String GET_ALARM_CLOCK = "getAlarmClock";
|
||||
/*应用使用记录*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.uiui.aios.network.api;
|
||||
|
||||
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.network.URLAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface UserInfoControl {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.GET_USER_AVATAR_INFO)
|
||||
Observable<BaseResponse<UserAvatarInfo>> getUserAvatarInfo(
|
||||
@Field("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class MainService extends BaseService implements MainSContact.MainSView,
|
||||
break;
|
||||
case AlarmUtils.WORKING_DAY:
|
||||
if (day_of_week < 5 || day_of_week == 7) {
|
||||
AlarmUtils.getInstance().setDayLoopAlarm(MainService.ALARMWAKEUP, alarmClockData.getTitle(), alarmClockData.getId(), alarmClockData.getTime());
|
||||
AlarmUtils.getInstance().setWorkDayAlarm(MainService.ALARMWAKEUP, alarmClockData.getTitle(), alarmClockData.getId(), alarmClockData.getTime());
|
||||
}
|
||||
break;
|
||||
case AlarmUtils.OFF_DAY:
|
||||
|
||||
Reference in New Issue
Block a user