version:1.0.9
update: bugfixes:修复微信无法自动接听,修复闹钟闪退
This commit is contained in:
@@ -17,7 +17,7 @@ import com.xxpatx.os.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.ViewHolder> {
|
||||
public class SosNnmberAdapter extends RecyclerView.Adapter<SosNnmberAdapter.ViewHolder> {
|
||||
private List<Contact> phoneNumberList;
|
||||
private Context mContext;
|
||||
|
||||
@@ -26,25 +26,18 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new SOSNnmberAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sosnumber, parent, false));
|
||||
return new SosNnmberAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sosnumber, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Contact contact = phoneNumberList.get(position);
|
||||
holder.tv_name.setText(contact.getName());
|
||||
holder.tv_number.setText(contact.getMobile());
|
||||
holder.root.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(mContext, EmergencyActivity.class);
|
||||
intent.putExtra("setting_sos", contact.getMobile());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,15 +46,14 @@ public class SOSNnmberAdapter extends RecyclerView.Adapter<SOSNnmberAdapter.View
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tv_number;
|
||||
TextView tv_dial;
|
||||
ConstraintLayout root;
|
||||
TextView tv_name,tv_number;
|
||||
|
||||
ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_number = itemView.findViewById(R.id.tv_number);
|
||||
tv_dial = itemView.findViewById(R.id.tv_dial);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
tv_number = itemView.findViewById(R.id.tv_number);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.callwechat.CallWechatActivity;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
import com.xxpatx.os.utils.AccessibilityUtils;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
Contact contact = mContactList.get(position);
|
||||
contactHolder.tv_name.setText(contact.getName());
|
||||
contactHolder.tv_phone.setText(contact.getMobile());
|
||||
// Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
switch (position % 6) {
|
||||
case 0:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround1));
|
||||
@@ -86,13 +87,18 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
contactHolder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(mContext)) {
|
||||
Intent intent = new Intent(mContext, CallWechatActivity.class);
|
||||
intent.putExtra("WechatInfo", contact);
|
||||
if ("未设置".equals(contact.getName())) {
|
||||
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(mContext, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
mContext.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(mContext)) {
|
||||
Intent intent = new Intent(mContext, CallWechatActivity.class);
|
||||
intent.putExtra("WechatInfo", contact);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(mContext, "请在无障碍服务中打开 - 关爱守护快捷服务", Toast.LENGTH_LONG).show();
|
||||
mContext.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user