更换app名,天气加入横屏,修复紧急联系人
This commit is contained in:
@@ -98,8 +98,7 @@
|
|||||||
android:screenOrientation="sensorPortrait" />
|
android:screenOrientation="sensorPortrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.weather.WeatherActivity"
|
android:name=".activity.weather.WeatherActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask" />
|
||||||
android:screenOrientation="sensorLandscape" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.EmergencyActivity"
|
android:name=".activity.EmergencyActivity"
|
||||||
android:launchMode="singleTask" />
|
android:launchMode="singleTask" />
|
||||||
|
|||||||
@@ -14,14 +14,20 @@ import android.view.View;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.uiui.aios.R;
|
import com.uiui.aios.R;
|
||||||
import com.uiui.aios.bean.BaseResponse;
|
import com.uiui.aios.bean.BaseResponse;
|
||||||
|
import com.uiui.aios.bean.SOSSetting;
|
||||||
|
import com.uiui.aios.disklrucache.CacheHelper;
|
||||||
import com.uiui.aios.manager.AmapManager;
|
import com.uiui.aios.manager.AmapManager;
|
||||||
import com.uiui.aios.network.NetInterfaceManager;
|
import com.uiui.aios.network.NetInterfaceManager;
|
||||||
|
import com.uiui.aios.network.URLAddress;
|
||||||
import com.uiui.aios.receiver.BootReceiver;
|
import com.uiui.aios.receiver.BootReceiver;
|
||||||
import com.uiui.aios.utils.ToastUtil;
|
import com.uiui.aios.utils.ToastUtil;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -45,13 +51,15 @@ public class EmergencyActivity extends AppCompatActivity {
|
|||||||
private String TAG = EmergencyActivity.class.getSimpleName();
|
private String TAG = EmergencyActivity.class.getSimpleName();
|
||||||
private boolean needDial = false;
|
private boolean needDial = false;
|
||||||
private boolean isCalling = false;
|
private boolean isCalling = false;
|
||||||
private List<String> phoneListSet;
|
private List<SOSSetting> phoneListSet;
|
||||||
|
private CacheHelper mCacheHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Log.e(TAG, "onCreate: ");
|
Log.e(TAG, "onCreate: ");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_emergency);
|
setContentView(R.layout.activity_emergency);
|
||||||
|
mCacheHelper = new CacheHelper(this);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
//发送紧急广播
|
//发送紧急广播
|
||||||
@@ -66,9 +74,19 @@ public class EmergencyActivity extends AppCompatActivity {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
String setting_sos = Settings.System.getString(getContentResolver(), "setting_sos");
|
String jsonString = mCacheHelper.getAsString(URLAddress.GET_SETTINGS);
|
||||||
if (TextUtils.isEmpty(setting_sos)) return;
|
//为 "" 是已经请求成功的
|
||||||
phoneListSet = new ArrayList<>(Arrays.asList(setting_sos.split(",")));
|
if (jsonString == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<SOSSetting>>() {
|
||||||
|
}.getType();
|
||||||
|
List<SOSSetting> setting_sos = gson.fromJson(jsonString, type);
|
||||||
|
if (setting_sos == null || setting_sos.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
phoneListSet = setting_sos;
|
||||||
Log.e(TAG, "onCreate: " + phoneListSet);
|
Log.e(TAG, "onCreate: " + phoneListSet);
|
||||||
|
|
||||||
final Long time = 3L;
|
final Long time = 3L;
|
||||||
@@ -111,7 +129,7 @@ public class EmergencyActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
needDial = true;
|
needDial = true;
|
||||||
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||||
Uri data = Uri.parse("tel:" + phoneListSet.get(0));
|
Uri data = Uri.parse("tel:" + phoneListSet.get(0).getMobile());
|
||||||
intent1.setData(data);
|
intent1.setData(data);
|
||||||
startActivity(intent1);
|
startActivity(intent1);
|
||||||
isCalling = true;
|
isCalling = true;
|
||||||
@@ -154,7 +172,8 @@ public class EmergencyActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
Intent intent1 = new Intent(Intent.ACTION_CALL);
|
||||||
Uri data = Uri.parse("tel:" + phoneListSet.get(0));
|
String phone = phoneListSet.get(0).getMobile();
|
||||||
|
Uri data = Uri.parse("tel:" + phone);
|
||||||
intent1.setData(data);
|
intent1.setData(data);
|
||||||
startActivity(intent1);
|
startActivity(intent1);
|
||||||
isCalling = true;
|
isCalling = true;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.uiui.aios.activity.main;
|
package com.uiui.aios.activity.main;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
|||||||
import com.uiui.aios.BuildConfig;
|
import com.uiui.aios.BuildConfig;
|
||||||
import com.uiui.aios.bean.BaseResponse;
|
import com.uiui.aios.bean.BaseResponse;
|
||||||
import com.uiui.aios.bean.NetDesktopIcon;
|
import com.uiui.aios.bean.NetDesktopIcon;
|
||||||
|
import com.uiui.aios.bean.SOSSetting;
|
||||||
import com.uiui.aios.network.NetInterfaceManager;
|
import com.uiui.aios.network.NetInterfaceManager;
|
||||||
import com.uiui.aios.utils.ApkUtils;
|
import com.uiui.aios.utils.ApkUtils;
|
||||||
import com.uiui.aios.utils.AppUsedTimeUtils;
|
import com.uiui.aios.utils.AppUsedTimeUtils;
|
||||||
@@ -55,9 +57,11 @@ public class MainPresenter implements MainContact.Presenter {
|
|||||||
@Override
|
@Override
|
||||||
public void getSystemSettings() {
|
public void getSystemSettings() {
|
||||||
NetInterfaceManager.getInstance().getSystemSettings(true, getLifecycle(), new NetInterfaceManager.SosNumberCallback() {
|
NetInterfaceManager.getInstance().getSystemSettings(true, getLifecycle(), new NetInterfaceManager.SosNumberCallback() {
|
||||||
@Override
|
|
||||||
public void setSosNumber(String json) {
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSosNumber(List<SOSSetting> setting_sos) {
|
||||||
|
Intent intent = new Intent("setting_sos");
|
||||||
|
mContext.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.uiui.aios.activity.weather;
|
package com.uiui.aios.activity.weather;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -40,10 +41,14 @@ public class WeatherActivity extends BaseActivity implements WeatherContact.Weat
|
|||||||
mPresenter.attachView(this);
|
mPresenter.attachView(this);
|
||||||
mPresenter.setLifecycle(lifecycleSubject);
|
mPresenter.setLifecycle(lifecycleSubject);
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||||
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
||||||
Resources resources = getResources();
|
Resources resources = getResources();
|
||||||
|
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||||
|
rv_weather.addItemDecoration(new HorizontalItemDecoration(30, this));//10表示10dp
|
||||||
|
} else {
|
||||||
|
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||||
|
}
|
||||||
rv_weather.setLayoutManager(linearLayoutManager);
|
rv_weather.setLayoutManager(linearLayoutManager);
|
||||||
rv_weather.addItemDecoration(new HorizontalItemDecoration(30, this));//10表示10dp
|
|
||||||
// rv_weather.setLayoutManager(new GridLayoutManager(this, 3));
|
// rv_weather.setLayoutManager(new GridLayoutManager(this, 3));
|
||||||
// rv_weather.addItemDecoration(new RecyclerItemDecoration(ScreenUtils.dp2px(resources, 10), ScreenUtils.dp2px(resources, 10), 3));
|
// rv_weather.addItemDecoration(new RecyclerItemDecoration(ScreenUtils.dp2px(resources, 10), ScreenUtils.dp2px(resources, 10), 3));
|
||||||
mWeatherDayApdapter = new WeatherDayApdapter();
|
mWeatherDayApdapter = new WeatherDayApdapter();
|
||||||
|
|||||||
@@ -13,15 +13,16 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.uiui.aios.R;
|
import com.uiui.aios.R;
|
||||||
import com.uiui.aios.activity.EmergencyActivity;
|
import com.uiui.aios.activity.EmergencyActivity;
|
||||||
|
import com.uiui.aios.bean.SOSSetting;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
||||||
private List<String> phoneNumberList;
|
private List<SOSSetting> phoneNumberList;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
public void setPhoneNumberList(List<String> phoneList) {
|
public void setPhoneNumberList(List<SOSSetting> sosSettingList) {
|
||||||
this.phoneNumberList = phoneList;
|
this.phoneNumberList = sosSettingList;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,11 +36,11 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
String phone = phoneNumberList.get(position);
|
SOSSetting sosSetting = phoneNumberList.get(position);
|
||||||
holder.tv_number.setText(phone);
|
holder.tv_number.setText(sosSetting.getMobile());
|
||||||
holder.root.setOnClickListener(v -> {
|
holder.root.setOnClickListener(v -> {
|
||||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||||
intent.putExtra("setting_sos", phone);
|
intent.putExtra("setting_sos", sosSetting.getMobile());
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
|
||||||
|
|||||||
64
app/src/main/java/com/uiui/aios/bean/SOSSetting.java
Normal file
64
app/src/main/java/com/uiui/aios/bean/SOSSetting.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package com.uiui.aios.bean;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class SOSSetting implements Serializable {
|
||||||
|
private static final long serialVersionUID = 8814155739557674021L;
|
||||||
|
|
||||||
|
int id;
|
||||||
|
String name;//名称
|
||||||
|
int is_urgent;//是否紧急联系人 0否1是
|
||||||
|
String mobile;//手机号
|
||||||
|
String avatar;//头像
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIs_urgent() {
|
||||||
|
return is_urgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_urgent(int is_urgent) {
|
||||||
|
this.is_urgent = is_urgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMobile() {
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMobile(String mobile) {
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SystemSettings implements Serializable {
|
public class SystemSettings implements Serializable {
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class SystemSettings implements Serializable {
|
|||||||
int qch_restore;
|
int qch_restore;
|
||||||
int setting_browserInput;
|
int setting_browserInput;
|
||||||
int dev_mode;
|
int dev_mode;
|
||||||
String setting_sos;
|
List<SOSSetting> setting_sos;
|
||||||
String setting_volume;
|
String setting_volume;
|
||||||
String setting_luminance;
|
String setting_luminance;
|
||||||
String setting_typeface;
|
String setting_typeface;
|
||||||
@@ -261,11 +262,11 @@ public class SystemSettings implements Serializable {
|
|||||||
this.setting_hotspot = setting_hotspot;
|
this.setting_hotspot = setting_hotspot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSetting_sos() {
|
public List<SOSSetting> getSetting_sos() {
|
||||||
return setting_sos;
|
return setting_sos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSetting_sos(String setting_sos) {
|
public void setSetting_sos(List<SOSSetting> setting_sos) {
|
||||||
this.setting_sos = setting_sos;
|
this.setting_sos = setting_sos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.amap.api.location.AMapLocationListener;
|
|||||||
import com.blankj.utilcode.util.NetworkUtils;
|
import com.blankj.utilcode.util.NetworkUtils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.qweather.sdk.bean.base.Code;
|
import com.qweather.sdk.bean.base.Code;
|
||||||
import com.qweather.sdk.bean.base.Lang;
|
import com.qweather.sdk.bean.base.Lang;
|
||||||
import com.qweather.sdk.bean.base.Unit;
|
import com.qweather.sdk.bean.base.Unit;
|
||||||
@@ -54,12 +55,15 @@ import com.uiui.aios.bean.AlarmClockData;
|
|||||||
import com.uiui.aios.bean.AlarmItem;
|
import com.uiui.aios.bean.AlarmItem;
|
||||||
import com.uiui.aios.bean.BaseResponse;
|
import com.uiui.aios.bean.BaseResponse;
|
||||||
import com.uiui.aios.bean.HealthCode;
|
import com.uiui.aios.bean.HealthCode;
|
||||||
|
import com.uiui.aios.bean.SOSSetting;
|
||||||
import com.uiui.aios.bean.SnInfo;
|
import com.uiui.aios.bean.SnInfo;
|
||||||
import com.uiui.aios.bean.UserAvatarInfo;
|
import com.uiui.aios.bean.UserAvatarInfo;
|
||||||
import com.uiui.aios.dialog.SingleDialog;
|
import com.uiui.aios.dialog.SingleDialog;
|
||||||
|
import com.uiui.aios.disklrucache.CacheHelper;
|
||||||
import com.uiui.aios.manager.AmapManager;
|
import com.uiui.aios.manager.AmapManager;
|
||||||
import com.uiui.aios.alarm.AlarmUtils;
|
import com.uiui.aios.alarm.AlarmUtils;
|
||||||
import com.uiui.aios.network.NetInterfaceManager;
|
import com.uiui.aios.network.NetInterfaceManager;
|
||||||
|
import com.uiui.aios.network.URLAddress;
|
||||||
import com.uiui.aios.tpush.MessageReceiver;
|
import com.uiui.aios.tpush.MessageReceiver;
|
||||||
import com.uiui.aios.utils.ApkUtils;
|
import com.uiui.aios.utils.ApkUtils;
|
||||||
import com.uiui.aios.utils.AppUtil;
|
import com.uiui.aios.utils.AppUtil;
|
||||||
@@ -69,6 +73,7 @@ import com.uiui.aios.utils.ToastUtil;
|
|||||||
import com.uiui.aios.utils.Utils;
|
import com.uiui.aios.utils.Utils;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -148,6 +153,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
private MMKV mMMKV;
|
private MMKV mMMKV;
|
||||||
private Activity mContext;
|
private Activity mContext;
|
||||||
private ContentResolver mCRv;
|
private ContentResolver mCRv;
|
||||||
|
private CacheHelper mCacheHelper;
|
||||||
|
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
@@ -323,6 +329,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
||||||
mContext = (Activity) rootView.getContext();
|
mContext = (Activity) rootView.getContext();
|
||||||
|
mCacheHelper = new CacheHelper(mContext);
|
||||||
mCRv = mContext.getContentResolver();
|
mCRv = mContext.getContentResolver();
|
||||||
ButterKnife.bind(this, rootView);
|
ButterKnife.bind(this, rootView);
|
||||||
initView();
|
initView();
|
||||||
@@ -442,7 +449,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
private void checkSosNumber() {
|
private void checkSosNumber() {
|
||||||
NetInterfaceManager.getInstance().getSystemSettings(new NetInterfaceManager.SosNumberCallback() {
|
NetInterfaceManager.getInstance().getSystemSettings(new NetInterfaceManager.SosNumberCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void setSosNumber(String json) {
|
public void setSosNumber(List<SOSSetting> setting_sos) {
|
||||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||||
// intent.putExtra("setting_sos", phone);
|
// intent.putExtra("setting_sos", phone);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
@@ -565,15 +572,24 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSosNumber() {
|
public void setSosNumber() {
|
||||||
String setting_sos = Settings.System.getString(mCRv, "setting_sos");
|
String jsonString = mCacheHelper.getAsString(URLAddress.GET_SETTINGS);
|
||||||
if (TextUtils.isEmpty(setting_sos)) {
|
//为 "" 是已经请求成功的
|
||||||
// rv_sos.setVisibility(View.GONE);
|
if (jsonString == null) {
|
||||||
|
// rv_sos.setVisibility(View.GONE);
|
||||||
// iv_sos.setVisibility(View.VISIBLE);
|
// iv_sos.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
// rv_sos.setVisibility(View.VISIBLE);
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<SOSSetting>>() {
|
||||||
|
}.getType();
|
||||||
|
List<SOSSetting> setting_sos = gson.fromJson(jsonString, type);
|
||||||
|
if (setting_sos == null || setting_sos.size() == 0) {
|
||||||
|
// rv_sos.setVisibility(View.VISIBLE);
|
||||||
// iv_sos.setVisibility(View.GONE);
|
// iv_sos.setVisibility(View.GONE);
|
||||||
List<String> phoneList = new ArrayList<>(Arrays.asList(setting_sos.split(",")));
|
sosNnmberAdapter.setPhoneNumberList(setting_sos);
|
||||||
sosNnmberAdapter.setPhoneNumberList(phoneList);
|
} else {
|
||||||
|
// rv_sos.setVisibility(View.GONE);
|
||||||
|
// iv_sos.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.uiui.aios.bean.DemandBean;
|
|||||||
import com.uiui.aios.bean.GoodsInfo;
|
import com.uiui.aios.bean.GoodsInfo;
|
||||||
import com.uiui.aios.bean.HealthCode;
|
import com.uiui.aios.bean.HealthCode;
|
||||||
import com.uiui.aios.bean.NetDesktopIcon;
|
import com.uiui.aios.bean.NetDesktopIcon;
|
||||||
|
import com.uiui.aios.bean.SOSSetting;
|
||||||
import com.uiui.aios.bean.SnInfo;
|
import com.uiui.aios.bean.SnInfo;
|
||||||
import com.uiui.aios.bean.SystemSettings;
|
import com.uiui.aios.bean.SystemSettings;
|
||||||
import com.uiui.aios.bean.UserAvatarInfo;
|
import com.uiui.aios.bean.UserAvatarInfo;
|
||||||
@@ -787,7 +788,7 @@ public class NetInterfaceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface SosNumberCallback {
|
public interface SosNumberCallback {
|
||||||
void setSosNumber(String json);
|
void setSosNumber(List<SOSSetting> setting_sos);
|
||||||
|
|
||||||
void setEmpty();
|
void setEmpty();
|
||||||
|
|
||||||
@@ -808,10 +809,10 @@ public class NetInterfaceManager {
|
|||||||
getSystemSettings(lifecycle, callback);
|
getSystemSettings(lifecycle, callback);
|
||||||
} else {
|
} else {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Type type = new TypeToken<String>() {
|
Type type = new TypeToken<List<SOSSetting>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
String setting_sos = gson.fromJson(jsonString, type);
|
List<SOSSetting> setting_sos = gson.fromJson(jsonString, type);
|
||||||
if (TextUtils.isEmpty(setting_sos)) {
|
if (setting_sos == null || setting_sos.size() == 0) {
|
||||||
if (callback != null) callback.setEmpty();
|
if (callback != null) callback.setEmpty();
|
||||||
} else {
|
} else {
|
||||||
if (callback != null) callback.setSosNumber(setting_sos);
|
if (callback != null) callback.setSosNumber(setting_sos);
|
||||||
@@ -852,12 +853,12 @@ public class NetInterfaceManager {
|
|||||||
mMMKV.encode("is_health", systemSettings.getIs_health());
|
mMMKV.encode("is_health", systemSettings.getIs_health());
|
||||||
mMMKV.encode("is_shopping", systemSettings.getIs_shopping());
|
mMMKV.encode("is_shopping", systemSettings.getIs_shopping());
|
||||||
mMMKV.encode("is_info", systemSettings.getIs_info());
|
mMMKV.encode("is_info", systemSettings.getIs_info());
|
||||||
String setting_sos = systemSettings.getSetting_sos();
|
List<SOSSetting> setting_sos = systemSettings.getSetting_sos();
|
||||||
if (TextUtils.isEmpty(setting_sos)) {
|
if (setting_sos == null || setting_sos.size() == 0) {
|
||||||
mCacheHelper.put(URLAddress.GET_SETTINGS, "");
|
mCacheHelper.put(URLAddress.GET_SETTINGS, "");
|
||||||
if (callback != null) callback.setEmpty();
|
if (callback != null) callback.setEmpty();
|
||||||
} else {
|
} else {
|
||||||
mCacheHelper.put(URLAddress.GET_SETTINGS, setting_sos);
|
mCacheHelper.put(URLAddress.GET_SETTINGS, GsonUtils.toJsonString(setting_sos));
|
||||||
if (callback != null) callback.setSosNumber(setting_sos);
|
if (callback != null) callback.setSosNumber(setting_sos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -869,11 +870,21 @@ public class NetInterfaceManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
Log.e("getSystemSettings", "onError: " + e.getMessage());
|
||||||
String setting_sos = mCacheHelper.getAsString(URLAddress.GET_SETTINGS);
|
String jsonString = mCacheHelper.getAsString(URLAddress.GET_SETTINGS);
|
||||||
if (TextUtils.isEmpty(setting_sos)) {
|
//为 "" 是已经请求成功的
|
||||||
|
if (jsonString == null) {
|
||||||
if (callback != null) callback.setEmpty();
|
if (callback != null) callback.setEmpty();
|
||||||
} else {
|
} else {
|
||||||
if (callback != null) callback.setSosNumber(setting_sos);
|
Gson gson = new Gson();
|
||||||
|
Type type = new TypeToken<List<SOSSetting>>() {
|
||||||
|
}.getType();
|
||||||
|
List<SOSSetting> setting_sos = gson.fromJson(jsonString, type);
|
||||||
|
if (setting_sos == null || setting_sos.size() == 0) {
|
||||||
|
if (callback != null) callback.setEmpty();
|
||||||
|
} else {
|
||||||
|
if (callback != null) callback.setSosNumber(setting_sos);
|
||||||
|
}
|
||||||
|
if (callback != null) callback.onComplete();
|
||||||
}
|
}
|
||||||
onComplete();
|
onComplete();
|
||||||
}
|
}
|
||||||
|
|||||||
74
app/src/main/res/layout-port/item_weather.xml
Normal file
74
app/src/main/res/layout-port/item_weather.xml
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:layout_margin="@dimen/dp_8"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:src="@drawable/background_weather_sun"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="36dp"
|
||||||
|
android:text="2022-01-21 17:48:48"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/iv_weather"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_weather"
|
||||||
|
android:layout_width="140dp"
|
||||||
|
android:layout_height="140dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/he100"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_weather"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/iv_weather" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_temp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="15-22"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="26sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_weather" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">桌面OS</string>
|
<string name="app_name">老人OS系统</string>
|
||||||
|
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user