修改主页样式,修复时钟不准确
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:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
BIN
app/src/main/res/drawable-hdpi/back_black.png
Normal file
BIN
app/src/main/res/drawable-hdpi/back_black.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable-hdpi/back_white.png
Normal file
BIN
app/src/main/res/drawable-hdpi/back_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -19,7 +19,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
android:src="@drawable/back_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
android:src="@drawable/back_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_head"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
@@ -114,6 +115,16 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_head"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_head"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_head" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_background">
|
||||
|
||||
@@ -170,9 +170,16 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
@@ -258,20 +265,14 @@
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_activity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/custom_background">
|
||||
@@ -389,6 +390,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_demand"
|
||||
android:layout_width="0dp"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
@@ -510,6 +512,4 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
android:src="@drawable/back_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
android:src="@drawable/back_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -7,8 +7,44 @@
|
||||
tools:context=".activity.alarm.AlarmClockActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="爱心闹钟"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout4">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
|
||||
Reference in New Issue
Block a user