version:1.2.4
fix: update:优化显示未读短信和未接来电,增加手电筒和数据开关
This commit is contained in:
@@ -58,6 +58,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
RecordsInfo recordsInfo = mRecordsInfoList.get(position);
|
||||
// Log.e(TAG, "onBindViewHolder: _id = " + recordsInfo.getId());
|
||||
String phone = recordsInfo.getNumber();
|
||||
holder.tv_phone.setText(phone);
|
||||
holder.tv_name.setText(getName(phone));
|
||||
@@ -84,32 +85,14 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
||||
break;
|
||||
}
|
||||
holder.tv_time.setText(mSimpleDateFormat.format(new Date(recordsInfo.getDate())));
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (Utils.isMultiSim(mContext)) {
|
||||
Intent intent = new Intent(mContext, SelectNumberActivity.class);
|
||||
intent.putExtra("phone_number", phone);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
try {
|
||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
dialIntent.setData(data);
|
||||
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(dialIntent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "callNumber: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.iv_avatar.setOnClickListener(view -> call(phone));
|
||||
holder.cl_info.setOnClickListener(view -> call(phone));
|
||||
|
||||
holder.iv_remove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String queryString = "number=" + recordsInfo.getNumber();
|
||||
try {
|
||||
mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI, queryString, null);
|
||||
mContext.getContentResolver().delete(CallLog.Calls.CONTENT_URI, CallLog.Calls._ID + "=?", new String[]{String.valueOf(recordsInfo.getId())});
|
||||
mRecordsInfoList.remove(position);
|
||||
notifyDataSetChanged();
|
||||
} catch (Exception e) {
|
||||
@@ -120,6 +103,24 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
||||
});
|
||||
}
|
||||
|
||||
private void call(String phone) {
|
||||
if (Utils.isMultiSim(mContext)) {
|
||||
Intent intent = new Intent(mContext, SelectNumberActivity.class);
|
||||
intent.putExtra("phone_number", phone);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
try {
|
||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
dialIntent.setData(data);
|
||||
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(dialIntent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "callNumber: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getName(String phone) {
|
||||
if (mContactMap != null) {
|
||||
if (mContactMap.get(phone) != null) {
|
||||
@@ -145,7 +146,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
ConstraintLayout root, cl_info;
|
||||
NiceImageView iv_avatar;
|
||||
ImageView iv_remove;
|
||||
ImageView tv_state;
|
||||
@@ -156,6 +157,7 @@ public class CallRecordAdapter extends RecyclerView.Adapter<CallRecordAdapter.Ho
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
cl_info = itemView.findViewById(R.id.cl_info);
|
||||
iv_avatar = itemView.findViewById(R.id.iv_avatar);
|
||||
iv_remove = itemView.findViewById(R.id.iv_remove);
|
||||
tv_state = itemView.findViewById(R.id.tv_state);
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -13,23 +13,19 @@ import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.service.ServiceActivity;
|
||||
import com.xxpatx.os.bean.BaseResponse;
|
||||
import com.xxpatx.os.bean.DailyAppBean;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.dialog.DailyAppDialog;
|
||||
import com.xxpatx.os.manager.AppStatusManager;
|
||||
import com.xxpatx.os.network.NetInterfaceManager;
|
||||
import com.xxpatx.os.service.NotificationService;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.AppUsedTimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class DailyAppAdapter extends RecyclerView.Adapter<DailyAppAdapter.Holder> {
|
||||
private static final String TAG = "DailyAppAdapter";
|
||||
|
||||
@@ -95,6 +91,11 @@ public class DailyAppAdapter extends RecyclerView.Adapter<DailyAppAdapter.Holder
|
||||
|
||||
|
||||
private void showDialog(DailyAppBean dailyAppBean) {
|
||||
int appLockCtrl = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.APP_LOCK_CTRL, 0);
|
||||
if (appLockCtrl == 0) {
|
||||
Toaster.showLong("已禁止桌面编辑");
|
||||
return;
|
||||
}
|
||||
DailyAppDialog dailyAppDialog = new DailyAppDialog(mContext);
|
||||
dailyAppDialog.setTitle("放到桌面");
|
||||
dailyAppDialog.setMessage(dailyAppBean.getAppName());
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.provider.CallLog;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -20,6 +23,7 @@ import com.xxpatx.os.utils.ApkUtils;
|
||||
import java.util.List;
|
||||
|
||||
public class DockAppGridAdapter extends BaseAdapter {
|
||||
private static final String TAG = "DockAppGridAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private List<DockApp> mDockApps;
|
||||
@@ -91,7 +95,16 @@ public class DockAppGridAdapter extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
});
|
||||
int size = NotificationService.getNotificationLength(pkg);
|
||||
int size;
|
||||
switch (pkg) {
|
||||
case "com.android.dialer":
|
||||
case "xxpatx.os.dialer":
|
||||
size = readMissCall();
|
||||
Log.e(TAG, "getView: readMissCall = " + size);
|
||||
break;
|
||||
default:
|
||||
size = NotificationService.getNotificationLength(pkg);
|
||||
}
|
||||
if (size == 0) {
|
||||
holder.bg.setVisibility(View.GONE);
|
||||
} else if (size < 99) {
|
||||
@@ -105,6 +118,20 @@ public class DockAppGridAdapter extends BaseAdapter {
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private int readMissCall() {
|
||||
int result = 0;
|
||||
Cursor cursor = mContext.getContentResolver().query(CallLog.Calls.CONTENT_URI,
|
||||
new String[]{CallLog.Calls._ID, CallLog.Calls.TYPE, CallLog.Calls.IS_READ},
|
||||
" " + CallLog.Calls.TYPE + "=? and " + CallLog.Calls.IS_READ + "=?",
|
||||
new String[]{String.valueOf(CallLog.Calls.MISSED_TYPE), "0"},
|
||||
CallLog.Calls.DEFAULT_SORT_ORDER);
|
||||
if (cursor != null) {
|
||||
result = cursor.getCount();
|
||||
cursor.close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static class ViewHolder {
|
||||
ConstraintLayout root;
|
||||
ImageView iv_icon;
|
||||
|
||||
@@ -90,14 +90,13 @@ public class PhoneAdapter extends RecyclerView.Adapter<PhoneAdapter.Holder> {
|
||||
|
||||
public class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
TextView tv_sim, tv_number;
|
||||
TextView tv_number;
|
||||
ImageView iv_card;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
iv_card = itemView.findViewById(R.id.iv_card);
|
||||
tv_sim = itemView.findViewById(R.id.tv_sim);
|
||||
tv_number = itemView.findViewById(R.id.tv_number);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user