version:
fix: update:更改主页,增加联系人(未完全实现)
This commit is contained in:
@@ -7,8 +7,6 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
@@ -19,7 +17,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.SOSSetting;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.disklrucache.CacheHelper;
|
||||
import com.uiui.aios.manager.AmapManager;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
@@ -28,8 +26,6 @@ import com.uiui.aios.receiver.BootReceiver;
|
||||
import com.uiui.aios.utils.ToastUtil;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -51,7 +47,7 @@ public class EmergencyActivity extends AppCompatActivity {
|
||||
private String TAG = EmergencyActivity.class.getSimpleName();
|
||||
private boolean needDial = false;
|
||||
private boolean isCalling = false;
|
||||
private List<SOSSetting> phoneListSet;
|
||||
private List<Contact> phoneListSet;
|
||||
private CacheHelper mCacheHelper;
|
||||
|
||||
@Override
|
||||
@@ -80,9 +76,9 @@ public class EmergencyActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.uiui.aios.activity.contact;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.adapter.ContactAdapter;
|
||||
import com.uiui.aios.base.BaseActivity;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class ContactActivity extends BaseActivity implements ContactContact.ContactView {
|
||||
@BindView(R.id.rv_contact)
|
||||
RecyclerView rv_contact;
|
||||
|
||||
private ContactPresenter mContactPresenter;
|
||||
private ContactAdapter mContactAdapter;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_contact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
mContactPresenter = new ContactPresenter(this);
|
||||
mContactPresenter.attachView(this);
|
||||
mContactPresenter.setLifecycle(lifecycleSubject);
|
||||
mContactAdapter = new ContactAdapter();
|
||||
rv_contact.setAdapter(mContactAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mContactPresenter.getContact();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContact(List<Contact> contactList) {
|
||||
mContactAdapter.setContactList(contactList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.uiui.aios.activity.contact;
|
||||
|
||||
import com.uiui.aios.base.BasePresenter;
|
||||
import com.uiui.aios.base.BaseView;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ContactContact {
|
||||
public interface Presenter extends BasePresenter<ContactView> {
|
||||
void getContact();
|
||||
}
|
||||
|
||||
public interface ContactView extends BaseView {
|
||||
void setContact(List<Contact> contactList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.uiui.aios.activity.contact;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class ContactPresenter implements ContactContact.Presenter {
|
||||
private Context mContext;
|
||||
private ContactContact.ContactView mView;
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycle() {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
ContactPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@NonNull ContactContact.ContactView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getContact() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getContactListObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<Contact>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getContactList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<Contact>> listBaseResponse) {
|
||||
Log.e("getContactList", "onNext: " + listBaseResponse);
|
||||
mView.setContact(listBaseResponse.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getContactList", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getContactList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.aios.BuildConfig;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.NetDesktopIcon;
|
||||
import com.uiui.aios.bean.SOSSetting;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.utils.ApkUtils;
|
||||
import com.uiui.aios.utils.AppUsedTimeUtils;
|
||||
@@ -59,7 +59,7 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
NetInterfaceManager.getInstance().getSystemSettings(true, getLifecycle(), new NetInterfaceManager.SosNumberCallback() {
|
||||
|
||||
@Override
|
||||
public void setSosNumber(List<SOSSetting> setting_sos) {
|
||||
public void setSosNumber(List<Contact> setting_sos) {
|
||||
Intent intent = new Intent("setting_sos");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
60
app/src/main/java/com/uiui/aios/adapter/ContactAdapter.java
Normal file
60
app/src/main/java/com/uiui/aios/adapter/ContactAdapter.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.uiui.aios.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactHolder> {
|
||||
private List<Contact> mContactList;
|
||||
private Context mContext;
|
||||
|
||||
public void setContactList(List<Contact> contactList) {
|
||||
this.mContactList = contactList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ContactHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new ContactHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_contact, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ContactHolder contactHolder, int position) {
|
||||
Contact contact = mContactList.get(position);
|
||||
Glide.with(contactHolder.iv_head).load(contact.getAvatar()).into(contactHolder.iv_head);
|
||||
contactHolder.tv_name.setText(contact.getName());
|
||||
contactHolder.tv_phone.setText(contact.getMobile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mContactList == null ? 0 : mContactList.size();
|
||||
}
|
||||
|
||||
static class ContactHolder extends RecyclerView.ViewHolder {
|
||||
ImageView iv_head;
|
||||
TextView tv_name;
|
||||
TextView tv_phone;
|
||||
|
||||
public ContactHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_head = itemView.findViewById(R.id.iv_head);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_phone = itemView.findViewById(R.id.tv_phone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,16 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.activity.EmergencyActivity;
|
||||
import com.uiui.aios.bean.SOSSetting;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
||||
private List<SOSSetting> phoneNumberList;
|
||||
private List<Contact> phoneNumberList;
|
||||
private Context mContext;
|
||||
|
||||
public void setPhoneNumberList(List<SOSSetting> sosSettingList) {
|
||||
this.phoneNumberList = sosSettingList;
|
||||
public void setPhoneNumberList(List<Contact> contactList) {
|
||||
this.phoneNumberList = contactList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
SOSSetting sosSetting = phoneNumberList.get(position);
|
||||
holder.tv_number.setText(sosSetting.getMobile());
|
||||
Contact contact = phoneNumberList.get(position);
|
||||
holder.tv_number.setText(contact.getMobile());
|
||||
holder.root.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||
intent.putExtra("setting_sos", sosSetting.getMobile());
|
||||
intent.putExtra("setting_sos", contact.getMobile());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SOSSetting implements Serializable {
|
||||
public class Contact implements Serializable {
|
||||
private static final long serialVersionUID = 8814155739557674021L;
|
||||
|
||||
int id;
|
||||
@@ -37,7 +37,7 @@ public class SystemSettings implements Serializable {
|
||||
int qch_restore;
|
||||
int setting_browserInput;
|
||||
int dev_mode;
|
||||
List<SOSSetting> setting_sos;
|
||||
List<Contact> setting_sos;
|
||||
String setting_volume;
|
||||
String setting_luminance;
|
||||
String setting_typeface;
|
||||
@@ -262,11 +262,11 @@ public class SystemSettings implements Serializable {
|
||||
this.setting_hotspot = setting_hotspot;
|
||||
}
|
||||
|
||||
public List<SOSSetting> getSetting_sos() {
|
||||
public List<Contact> getSetting_sos() {
|
||||
return setting_sos;
|
||||
}
|
||||
|
||||
public void setSetting_sos(List<SOSSetting> setting_sos) {
|
||||
public void setSetting_sos(List<Contact> setting_sos) {
|
||||
this.setting_sos = setting_sos;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.uiui.aios.network;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -20,7 +19,7 @@ import com.uiui.aios.bean.DemandBean;
|
||||
import com.uiui.aios.bean.GoodsInfo;
|
||||
import com.uiui.aios.bean.HealthCode;
|
||||
import com.uiui.aios.bean.NetDesktopIcon;
|
||||
import com.uiui.aios.bean.SOSSetting;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.SystemSettings;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
@@ -34,6 +33,7 @@ import com.uiui.aios.network.api.AppUsageRecordApi;
|
||||
import com.uiui.aios.network.api.ArticleListApi;
|
||||
import com.uiui.aios.network.api.DemandListApi;
|
||||
import com.uiui.aios.network.api.GetDesktopApi;
|
||||
import com.uiui.aios.network.api.GetMailList;
|
||||
import com.uiui.aios.network.api.GetUserIDApi;
|
||||
import com.uiui.aios.network.api.GoodsListApi;
|
||||
import com.uiui.aios.network.api.HealthCodeApi;
|
||||
@@ -239,6 +239,13 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<Contact>>> getContactListObservable() {
|
||||
return mRetrofit.create(GetMailList.class)
|
||||
.getContact(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public interface onCompleteCallback {
|
||||
void onComplete();
|
||||
}
|
||||
@@ -788,7 +795,7 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public interface SosNumberCallback {
|
||||
void setSosNumber(List<SOSSetting> setting_sos);
|
||||
void setSosNumber(List<Contact> setting_sos);
|
||||
|
||||
void setEmpty();
|
||||
|
||||
@@ -809,9 +816,9 @@ public class NetInterfaceManager {
|
||||
getSystemSettings(lifecycle, callback);
|
||||
} 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) {
|
||||
if (callback != null) callback.setEmpty();
|
||||
} else {
|
||||
@@ -853,7 +860,7 @@ public class NetInterfaceManager {
|
||||
mMMKV.encode("is_health", systemSettings.getIs_health());
|
||||
mMMKV.encode("is_shopping", systemSettings.getIs_shopping());
|
||||
mMMKV.encode("is_info", systemSettings.getIs_info());
|
||||
List<SOSSetting> setting_sos = systemSettings.getSetting_sos();
|
||||
List<Contact> setting_sos = systemSettings.getSetting_sos();
|
||||
if (setting_sos == null || setting_sos.size() == 0) {
|
||||
mCacheHelper.put(URLAddress.GET_SETTINGS, "");
|
||||
if (callback != null) callback.setEmpty();
|
||||
@@ -876,9 +883,9 @@ public class NetInterfaceManager {
|
||||
if (callback != null) callback.setEmpty();
|
||||
} 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) {
|
||||
if (callback != null) callback.setEmpty();
|
||||
} else {
|
||||
@@ -896,4 +903,28 @@ public class NetInterfaceManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void getContactList() {
|
||||
getContactListObservable().subscribe(new Observer<BaseResponse<List<Contact>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getContactList", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<Contact>> listBaseResponse) {
|
||||
Log.e("getContactList", "onNext: " + listBaseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getContactList", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getContactList", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ public class URLAddress {
|
||||
public static final String GET_DEMAND_LIST = "demandList";
|
||||
/*获取健康吗*/
|
||||
public static final String GET_HEALTH_CODE = "getHealthCode";
|
||||
/*获取联系人*/
|
||||
public static final String GET_MAIL_LIST = "Control/getMailList";
|
||||
|
||||
|
||||
public static final String GET_USER_ID = "getUserId";
|
||||
|
||||
18
app/src/main/java/com/uiui/aios/network/api/GetMailList.java
Normal file
18
app/src/main/java/com/uiui/aios/network/api/GetMailList.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.uiui.aios.network.api;
|
||||
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.network.URLAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GetMailList {
|
||||
@GET(URLAddress.GET_MAIL_LIST)
|
||||
Observable<BaseResponse<List<Contact>>> getContact(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user