fix:
update:更改主页,增加联系人(未完全实现)
This commit is contained in:
2022-10-11 20:07:11 +08:00
parent a29160563c
commit 1970a27246
24 changed files with 523 additions and 139 deletions

View File

@@ -20,7 +20,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
@@ -32,7 +31,6 @@ 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.google.gson.reflect.TypeToken;
import com.qweather.sdk.bean.base.Code;
@@ -48,6 +46,7 @@ import com.uiui.aios.R;
import com.uiui.aios.activity.code.HealthCodeActivity;
import com.uiui.aios.activity.EmergencyActivity;
import com.uiui.aios.activity.alarm.AlarmClockActivity;
import com.uiui.aios.activity.contact.ContactActivity;
import com.uiui.aios.activity.weather.WeatherActivity;
import com.uiui.aios.adapter.NotificationAdapter;
import com.uiui.aios.adapter.SOSNnmberAdapter;
@@ -55,7 +54,7 @@ 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.SOSSetting;
import com.uiui.aios.bean.Contact;
import com.uiui.aios.bean.SnInfo;
import com.uiui.aios.bean.UserAvatarInfo;
import com.uiui.aios.dialog.SingleDialog;
@@ -75,7 +74,6 @@ import com.uiui.aios.utils.Utils;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
@@ -94,12 +92,21 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
// @BindView(R.id.cl_alarm)
// ConstraintLayout cl_alarm;
@BindView(R.id.cl_note)
ConstraintLayout cl_note;
@BindView(R.id.cl_sos)
ConstraintLayout cl_soso;
@BindView(R.id.cl_weather)
ConstraintLayout cl_weather;
@BindView(R.id.cl_shared_space)
ConstraintLayout cl_shared_space;
@BindView(R.id.cl_sos)
ConstraintLayout cl_soso;
@BindView(R.id.cl_guard)
ConstraintLayout cl_guard;
@BindView(R.id.cl_health)
ConstraintLayout cl_health;
@BindView(R.id.cl_contact)
ConstraintLayout cl_contact;
@BindView(R.id.cl_ai)
ConstraintLayout cl_ai;
// @BindView(R.id.cl_battery)
// ConstraintLayout cl_battery;
// @BindView(R.id.tv_add)
@@ -130,15 +137,6 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
ImageView iv_note_nodata;
@BindView(R.id.iv_head)
NiceImageView iv_head;
@BindView(R.id.cl_health)
ConstraintLayout mClHealth;
@BindView(R.id.cl_tongue)
ConstraintLayout mClTongue;
@BindView(R.id.cl_face)
ConstraintLayout mClFace;
@BindView(R.id.cl_hand)
ConstraintLayout mClHand;
@BindView(R.id.tv_name)
TextView tv_name;
@@ -356,7 +354,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
// ApkUtils.openPackage(mContext, "com.alarmclock.uiui");
// }
// });
cl_note.setOnClickListener(new View.OnClickListener() {
cl_guard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getAlarm();
@@ -382,9 +380,6 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
} else {
// wifi_ssid.setText("WiFi未连接");
}
// alarmClockAdapter = new AlarmClockAdapter();
// rv_clock.setLayoutManager(new LinearLayoutManager(mContext));
// rv_clock.setAdapter(alarmClockAdapter);
sosNnmberAdapter = new SOSNnmberAdapter();
rv_sos.setLayoutManager(new LinearLayoutManager(mContext));
rv_sos.setAdapter(sosNnmberAdapter);
@@ -400,56 +395,37 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
startActivity(new Intent(mContext, WeatherActivity.class));
}
});
// cl_battery.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
// ResolveInfo resolveInfo = mContext.getPackageManager().resolveActivity(powerUsageIntent, 0);
//// check that the Battery app exists on this device
// if (resolveInfo != null) {
// startActivity(powerUsageIntent);
// }
// }
// });
mClHealth.setOnClickListener(new View.OnClickListener() {
cl_shared_space.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtil.show("此功能暂未上线");
}
});
cl_health.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getHealthCode();
// SchemeUtils.openScheme(mContext, SchemeUtils.SCHEME_TONGUE);
}
});
mClTongue.setOnClickListener(new View.OnClickListener() {
cl_contact.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// startActivity(new Intent(mContext, CodeActivity.class));
// startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); //直接进入手机中的wifi网络设置界面
openScheme(SchemeUtils.SCHEME_TONGUE);
startActivity(new Intent(getActivity(), ContactActivity.class));
}
});
mClFace.setOnClickListener(new View.OnClickListener() {
cl_ai.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// startActivity(new Intent(mContext, CodeActivity.class));
openScheme(SchemeUtils.SCHEME_FACE);
}
});
mClHand.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// startActivity(new Intent(mContext, CodeActivity.class));
// mContext.startActivity(new Intent(mContext, APPListActivity.class));
openScheme(SchemeUtils.SCHEME_HAND);
}
});
// setAlarm();
refreshMemory();
}
private void checkSosNumber() {
NetInterfaceManager.getInstance().getSystemSettings(new NetInterfaceManager.SosNumberCallback() {
@Override
public void setSosNumber(List<SOSSetting> setting_sos) {
public void setSosNumber(List<Contact> setting_sos) {
Intent intent = new Intent(mContext, EmergencyActivity.class);
// intent.putExtra("setting_sos", phone);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -475,12 +451,12 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
public void setSnInfo(SnInfo snInfo) {
if (snInfo != null) {
if (TextUtils.isEmpty(snInfo.getSn_name())) {
tv_name.setText("未设置");
// tv_name.setText("未设置");
} else {
tv_name.setText(snInfo.getSn_name());
// tv_name.setText(snInfo.getSn_name());
}
} else {
tv_name.setText("未设置");
// tv_name.setText("未设置");
}
}
});
@@ -496,7 +472,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
Log.e("getUserAvatarInfoControl", "onNext: " + userAvatarInfoBaseResponse);
if (userAvatarInfoBaseResponse.code == 200) {
if (!mContext.isDestroyed()) {
Glide.with(iv_head).load(userAvatarInfoBaseResponse.data.getAvatar()).into(iv_head);
// Glide.with(iv_head).load(userAvatarInfoBaseResponse.data.getAvatar()).into(iv_head);
}
}
}
@@ -565,6 +541,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
dialog.setMessage("绑定手机才能使用");
dialog.show();
} else {
ApkUtils.openApp(mContext, "com.uiui.health");
SchemeUtils.openScheme(mContext, uri);
}
}
@@ -579,9 +556,9 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
// iv_sos.setVisibility(View.VISIBLE);
} else {
Gson gson = new Gson();
Type type = new TypeToken<List<SOSSetting>>() {
Type type = new TypeToken<List<Contact>>() {
}.getType();
List<SOSSetting> setting_sos = gson.fromJson(jsonString, type);
List<Contact> setting_sos = gson.fromJson(jsonString, type);
if (setting_sos == null || setting_sos.size() == 0) {
// rv_sos.setVisibility(View.VISIBLE);
// iv_sos.setVisibility(View.GONE);