version:1.0.6
update: bugfixes:修改样式,删除无用类
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
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.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.ActivityBean;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityAdapter extends RecyclerView.Adapter<ActivityAdapter.Holder> {
|
||||
private static final String TAG = "ActivityAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private List<ActivityBean> mActivityBeans;
|
||||
|
||||
public void setActivityBeans(List<ActivityBean> list) {
|
||||
this.mActivityBeans = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new ActivityAdapter.Holder(LayoutInflater.from(mContext).inflate(R.layout.item_activity, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
ActivityBean activityBean = mActivityBeans.get(position);
|
||||
Glide.with(holder.iv_img).load(activityBean.getFile()).into(holder.iv_img);
|
||||
holder.tv_location.setText(activityBean.getLocation());
|
||||
holder.tv_desc.setText(getTime(activityBean.getAdd_time()));
|
||||
|
||||
}
|
||||
|
||||
private String getTime(long second) {
|
||||
long ms = second * 1000L;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
|
||||
Date date = new Date(ms);
|
||||
String time = sdf.format(date);
|
||||
Log.e(TAG, "getTime: " + time);
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mActivityBeans == null ? 0 : mActivityBeans.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ImageView iv_img;
|
||||
TextView tv_location, tv_desc;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_img = itemView.findViewById(R.id.iv_img);
|
||||
tv_location = itemView.findViewById(R.id.tv_location);
|
||||
tv_desc = itemView.findViewById(R.id.tv_desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
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.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.DesktopIcon;
|
||||
import com.xxpatx.os.manager.AppManager;
|
||||
import com.xxpatx.os.utils.BitmapUtils;
|
||||
import com.xxpatx.os.utils.IconUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AddAppAdapter extends RecyclerView.Adapter<AddAppAdapter.AppHolder> {
|
||||
private static final String TAG = "AddAppAdapter";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private List<DesktopIcon> desktopIcons;
|
||||
|
||||
public void setDesktopIcons(List<DesktopIcon> desktopIcons) {
|
||||
this.desktopIcons = desktopIcons;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private Set<String> packageSet;
|
||||
|
||||
public void setPackageSet(Set<String> packageSet) {
|
||||
this.packageSet = packageSet;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new AppHolder(LayoutInflater.from(mContext).inflate(R.layout.item_add_app, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AppHolder holder, int position) {
|
||||
DesktopIcon desktopIcon = desktopIcons.get(position);
|
||||
String lable = desktopIcon.getTitle();
|
||||
holder.tv_appname.setText(lable);
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon(mContext));
|
||||
String pkg = desktopIcon.getPackage();
|
||||
|
||||
if (packageSet != null) {
|
||||
if (packageSet.contains(pkg)) {
|
||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||
} else {
|
||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselected));
|
||||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "getView: " + pkg);
|
||||
int i = IconUtils.appClassNameList.indexOf(pkg);
|
||||
if (i != -1) {
|
||||
String val = IconUtils.appIconList.get(i);
|
||||
int resID = mContext.getResources().getIdentifier(val, "drawable", "com.uiui.zyos");
|
||||
if (resID == 0) {
|
||||
Log.e(TAG, "getView: not found src : " + pkg);
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon(mContext)));
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getResources().getDrawable(resID));
|
||||
}
|
||||
} else {
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon(mContext));
|
||||
} else {
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon(mContext)));
|
||||
}
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (packageSet.contains(pkg)) {
|
||||
packageSet.remove(pkg);
|
||||
AppManager.getInstance().removeAddPakcage(pkg);
|
||||
} else {
|
||||
if (packageSet.size() == 6) {
|
||||
Toaster.show("最多添加6个");
|
||||
} else {
|
||||
packageSet.add(pkg);
|
||||
AppManager.getInstance().addAddPakcage(pkg);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return desktopIcons == null ? 0 : desktopIcons.size();
|
||||
}
|
||||
|
||||
class AppHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
TextView tv_appname;
|
||||
ImageView iv_icon, iv_select;
|
||||
|
||||
public AppHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
tv_appname = itemView.findViewById(R.id.tv_appname);
|
||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||
iv_select = itemView.findViewById(R.id.iv_select);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package com.xxpatx.os.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.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.AddressInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AddressAdapter extends RecyclerView.Adapter<AddressAdapter.AddressHolder> {
|
||||
|
||||
private Context mContext;
|
||||
List<AddressInfo> mAddressInfoList;
|
||||
|
||||
public void setAddressInfoList(List<AddressInfo> addressInfoList) {
|
||||
mAddressInfoList = addressInfoList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public interface ClickListener {
|
||||
void onClickListener(AddressInfo addressInfo);
|
||||
}
|
||||
|
||||
private ClickListener mClickListener;
|
||||
|
||||
public void setClickListener(ClickListener clickListener) {
|
||||
mClickListener = clickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AddressHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new AddressAdapter.AddressHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_address, parent, false));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AddressHolder holder, int position) {
|
||||
AddressInfo addressInfo = mAddressInfoList.get(position);
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onClickListener(addressInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.tv_name.setText(addressInfo.getFullname());
|
||||
holder.tv_phone.setText(addressInfo.getTel());
|
||||
String area = addressInfo.getArea();
|
||||
List<String> areaList = new ArrayList<>(Arrays.asList(area.split(",")));
|
||||
holder.tv_address.setText(String.join(" ", areaList) + " " + addressInfo.getAddress());
|
||||
int isDefault = addressInfo.getIs_default();
|
||||
if (isDefault == 1) {
|
||||
holder.tv_default.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.tv_default.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mAddressInfoList == null ? 0 : mAddressInfoList.size();
|
||||
}
|
||||
|
||||
class AddressHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
ImageView iv_avatar;
|
||||
TextView tv_name, tv_phone, tv_default, tv_address;
|
||||
|
||||
public AddressHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
iv_avatar = itemView.findViewById(R.id.iv_avatar);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_phone = itemView.findViewById(R.id.tv_phone);
|
||||
tv_default = itemView.findViewById(R.id.tv_default);
|
||||
tv_address = itemView.findViewById(R.id.tv_address);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.article.ArticleActivity;
|
||||
import com.xxpatx.os.bean.ArticleInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ArticleAdapter extends RecyclerView.Adapter<ArticleAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<ArticleInfo> mArticleBeanList;
|
||||
|
||||
public void setArticleBeanList(List<ArticleInfo> list) {
|
||||
this.mArticleBeanList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new ArticleAdapter.Holder(LayoutInflater.from(mContext).inflate(R.layout.item_article, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
ArticleInfo articleInfo = mArticleBeanList.get(position);
|
||||
Glide.with(holder.iv_img).load(articleInfo.getImg()).into(holder.iv_img);
|
||||
holder.tv_title.setText(articleInfo.getTitle());
|
||||
holder.tv_content.setText(articleInfo.getContent());
|
||||
holder.tv_read.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(mContext, ArticleActivity.class);
|
||||
intent.putExtra("ArticleInfo", articleInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mArticleBeanList == null ? 0 : mArticleBeanList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
NiceImageView iv_img;
|
||||
TextView tv_title;
|
||||
TextView tv_content;
|
||||
TextView tv_read;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_img = itemView.findViewById(R.id.iv_img);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_content = itemView.findViewById(R.id.tv_content);
|
||||
tv_read = itemView.findViewById(R.id.tv_read);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.WiFiInfo;
|
||||
import com.xxpatx.os.dialog.WifiDialog;
|
||||
import com.xxpatx.os.utils.WiFiUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AvailableWiFiAdapter extends RecyclerView.Adapter<AvailableWiFiAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<WiFiInfo> mResultList;
|
||||
|
||||
public void setResultList(List<WiFiInfo> list) {
|
||||
this.mResultList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_wifi_available, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
WiFiInfo wiFiInfo = mResultList.get(position);
|
||||
holder.tv_name.setText(wiFiInfo.getSSID());
|
||||
if (wiFiInfo.isSaved()) {
|
||||
if (wiFiInfo.isAvailable()) {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_saved));
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_unavailable));
|
||||
}
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_available));
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// if (wiFiInfo.isSaved()) {
|
||||
//
|
||||
// } else {
|
||||
showPassword(wiFiInfo.getSSID());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showPassword(String ssid) {
|
||||
WifiDialog passwordDialog = new WifiDialog(mContext);
|
||||
passwordDialog.setTitle(String.format(mContext.getString(R.string.connect_wifi_ssid), ssid));
|
||||
passwordDialog.setOnClickBottomListener(new WifiDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
WiFiUtils.addWiFiNetwork(ssid, passwordDialog.getPassword());
|
||||
passwordDialog.dismiss();
|
||||
}
|
||||
});
|
||||
passwordDialog.show();
|
||||
passwordDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
passwordDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mResultList == null ? 0 : mResultList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ImageView iv_icon;
|
||||
TextView tv_name;
|
||||
ConstraintLayout root;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import com.hjq.toast.Toaster;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.records.RecordsActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
@@ -75,7 +74,7 @@ public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ContactH
|
||||
try {
|
||||
// mContext.startActivity(new Intent(Intent.ACTION_DIAL));
|
||||
// mContext.startActivity(new Intent(mContext, DialerActivity.class));
|
||||
mContext.startActivity(new Intent(mContext, RecordsActivity.class));
|
||||
// mContext.startActivity(new Intent(mContext, RecordsActivity.class));
|
||||
} catch (Exception e) {
|
||||
Toaster.show("无法打开电话功能");
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.details.DetailsActivity;
|
||||
import com.xxpatx.os.bean.GoodsInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GoodsAdapter extends RecyclerView.Adapter<GoodsAdapter.GoodsHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<GoodsInfo> goodsInfoList;
|
||||
|
||||
public void setGoodsInfoList(List<GoodsInfo> list) {
|
||||
this.goodsInfoList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GoodsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new GoodsAdapter.GoodsHolder(LayoutInflater.from(mContext).inflate(R.layout.item_goods, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GoodsHolder holder, int position) {
|
||||
GoodsInfo goodsInfo = goodsInfoList.get(position);
|
||||
if (!TextUtils.isEmpty(goodsInfo.getJump_url())) {
|
||||
// holder.tv_name.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Uri uri = Uri.parse(goodsInfo.getJump_url());
|
||||
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
// mContext.startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
Glide.with(holder.iv_goods).load(goodsInfo.getImg()).into(holder.iv_goods);
|
||||
holder.tv_name.setText(goodsInfo.getGoods_name());
|
||||
holder.tv_desc.setText(goodsInfo.getGoods_desc());
|
||||
holder.tv_price.setText("¥" + goodsInfo.getBuying_price());
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(mContext, DetailsActivity.class);
|
||||
intent.putExtra("GoodsInfo", goodsInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.tv_type.setText(goodsInfo.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return goodsInfoList == null ? 0 : goodsInfoList.size();
|
||||
}
|
||||
|
||||
static class GoodsHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView iv_goods;
|
||||
TextView tv_name, tv_desc, tv_buying_price, tv_price,tv_type;
|
||||
|
||||
public GoodsHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
iv_goods = itemView.findViewById(R.id.iv_img);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_desc = itemView.findViewById(R.id.tv_desc);
|
||||
tv_buying_price = itemView.findViewById(R.id.tv_buying_price);
|
||||
tv_price = itemView.findViewById(R.id.tv_price);
|
||||
tv_type = itemView.findViewById(R.id.tv_type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.details.DetailsActivity;
|
||||
import com.xxpatx.os.bean.GoodsInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GoodsListAdapter extends RecyclerView.Adapter<GoodsListAdapter.GoodsHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<GoodsInfo> goodsInfoList;
|
||||
|
||||
public void setGoodsInfoList(List<GoodsInfo> list) {
|
||||
this.goodsInfoList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GoodsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new GoodsListAdapter.GoodsHolder(LayoutInflater.from(mContext).inflate(R.layout.item_goods_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GoodsHolder holder, int position) {
|
||||
GoodsInfo goodsInfo = goodsInfoList.get(position);
|
||||
if (!TextUtils.isEmpty(goodsInfo.getJump_url())) {
|
||||
// holder.tv_name.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Uri uri = Uri.parse(goodsInfo.getJump_url());
|
||||
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
// mContext.startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
Glide.with(holder.iv_goods).load(goodsInfo.getImg()).into(holder.iv_goods);
|
||||
holder.tv_name.setText(goodsInfo.getGoods_name());
|
||||
holder.tv_desc.setText(goodsInfo.getGoods_desc());
|
||||
holder.tv_price.setText("全网低价¥" + goodsInfo.getOriginal_price());
|
||||
holder.tv_buying_price.setText("秒杀¥" + goodsInfo.getBuying_price());
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(mContext, DetailsActivity.class);
|
||||
intent.putExtra("GoodsInfo", goodsInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.tv_type.setText(goodsInfo.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return goodsInfoList == null ? 0 : goodsInfoList.size();
|
||||
}
|
||||
|
||||
static class GoodsHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView iv_goods;
|
||||
TextView tv_name, tv_desc, tv_buying_price, tv_price,tv_type;
|
||||
|
||||
public GoodsHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
iv_goods = itemView.findViewById(R.id.iv_img);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_desc = itemView.findViewById(R.id.tv_desc);
|
||||
tv_buying_price = itemView.findViewById(R.id.tv_buying_price);
|
||||
tv_price = itemView.findViewById(R.id.tv_price);
|
||||
tv_type = itemView.findViewById(R.id.tv_type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HealthCodeAdapter extends PagerAdapter {
|
||||
private List<ImageView> mImageViews;
|
||||
|
||||
public void setImageViews(List<ImageView> imageViews) {
|
||||
this.mImageViews = imageViews;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mImageViews == null ? 0 : mImageViews.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
|
||||
return view == object;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Object instantiateItem(@NonNull ViewGroup container, int position) {
|
||||
// 给 container 添加一个view
|
||||
container.addView(mImageViews.get(position));
|
||||
// 返回一个和该view相对的object
|
||||
return mImageViews.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
|
||||
container.removeView(mImageViews.get(position));
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
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.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.addicon.AddIconActivity;
|
||||
import com.xxpatx.os.bean.DesktopIcon;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.manager.AppManager;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.BitmapUtils;
|
||||
import com.xxpatx.os.utils.IconUtils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeAppAdapter extends RecyclerView.Adapter<HomeAppAdapter.AppHolder> {
|
||||
private static final String TAG = "HomeAppAdapter";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private List<DesktopIcon> desktopIcons;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new AppHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_app, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AppHolder holder, int position) {
|
||||
DesktopIcon desktopIcon = desktopIcons.get(position);
|
||||
String lable = desktopIcon.getTitle();
|
||||
holder.tv_appname.setText(lable);
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon(mContext));
|
||||
String pkg = desktopIcon.getPackage();
|
||||
Log.e(TAG, "getView: " + pkg);
|
||||
int i = IconUtils.appClassNameList.indexOf(pkg);
|
||||
if (i != -1) {
|
||||
String val = IconUtils.appIconList.get(i);
|
||||
int resID = mContext.getResources().getIdentifier(val, "drawable", "com.uiui.zyos");
|
||||
if (resID == 0) {
|
||||
Log.e(TAG, "getView: not found src : " + pkg);
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon(mContext)));
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getResources().getDrawable(resID));
|
||||
}
|
||||
} else {
|
||||
// if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
// holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
// } else if (AppManager.UPDATE_NAME.equals(pkg)) {
|
||||
// holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
// } else {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon(mContext));
|
||||
// }
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
mContext.startActivity(new Intent(mContext, AddIconActivity.class));
|
||||
// } else if (AppManager.UPDATE_NAME.equals(pkg)) {
|
||||
// Intent intent = new Intent();
|
||||
// ComponentName componentName = new ComponentName("com.uiui.zy", "com.uiui.zy.activity.update.UpdateActivity");
|
||||
// intent.setComponent(componentName);
|
||||
// mContext.startActivity(intent);
|
||||
} else {
|
||||
int setting_other_appInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (setting_other_appInstaller == 0
|
||||
&& !ApkUtils.isSystemApp(mContext, desktopIcon.getPackage()
|
||||
)) {
|
||||
Toaster.show("已禁止应用打开");
|
||||
} else {
|
||||
ApkUtils.openPackage(mContext, desktopIcon.getPackage(), desktopIcon.getClazz());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return desktopIcons == null ? 0 : desktopIcons.size();
|
||||
}
|
||||
|
||||
public List<DesktopIcon> getDesktopIcons() {
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
public void setDesktopIcons(List<DesktopIcon> desktopIcons) {
|
||||
this.desktopIcons = desktopIcons;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
class AppHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
TextView tv_appname;
|
||||
ImageView iv_icon;
|
||||
|
||||
public AppHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
tv_appname = itemView.findViewById(R.id.tv_appname);
|
||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.records.RecordsActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HomeContactAdapter extends RecyclerView.Adapter<HomeContactAdapter.ContactHolder> {
|
||||
private List<Contact> mContactList;
|
||||
private Context mContext;
|
||||
|
||||
public static final String DIALER_PACKAGE = "com.android.dialer";
|
||||
public static final String DIALER_ADD_CONTACT = "com.uiui.aios.contact.add";
|
||||
|
||||
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_home, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ContactHolder contactHolder, int position) {
|
||||
Contact contact = mContactList.get(position);
|
||||
contactHolder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// int qch_call_forbid = Settings.System.getInt(mContext.getContentResolver(), "qch_call_forbid", 0);
|
||||
// if (qch_call_forbid == 1) {
|
||||
// Toaster.show("电话功能被禁用");
|
||||
// icon_return;
|
||||
// }
|
||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||
String phone = contact.getMobile();
|
||||
if (DIALER_PACKAGE.equals(phone)) {
|
||||
try {
|
||||
// mContext.startActivity(new Intent(Intent.ACTION_DIAL));
|
||||
// mContext.startActivity(new Intent(mContext, DialerActivity.class));
|
||||
mContext.startActivity(new Intent(mContext, RecordsActivity.class));
|
||||
} catch (Exception e) {
|
||||
Toaster.show("无法打开电话功能");
|
||||
}
|
||||
} else if (DIALER_ADD_CONTACT.equals(contact.getMobile())) {
|
||||
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
} else if (!TextUtils.isEmpty(phone)) {
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
dialIntent.setData(data);
|
||||
mContext.startActivity(dialIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
contactHolder.tv_name.setText(contact.getName());
|
||||
if (DIALER_PACKAGE.equals(contact.getMobile())) {
|
||||
contactHolder.cl_contact.setVisibility(View.GONE);
|
||||
contactHolder.iv_head2.setVisibility(View.VISIBLE);
|
||||
contactHolder.tv_phone.setText("");
|
||||
Glide.with(contactHolder.iv_head).load(R.drawable.home_dialer_cion_circle).error(R.drawable.home_dialer_cion_circle).into(contactHolder.iv_head);
|
||||
} else if (DIALER_ADD_CONTACT.equals(contact.getMobile())) {
|
||||
Glide.with(contactHolder.iv_head).load(R.drawable.icon_contact_add).error(R.drawable.icon_contact_add).into(contactHolder.iv_head);
|
||||
} else {
|
||||
contactHolder.cl_contact.setVisibility(View.VISIBLE);
|
||||
contactHolder.iv_head2.setVisibility(View.GONE);
|
||||
contactHolder.tv_phone.setText(contact.getMobile());
|
||||
Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
}
|
||||
// int index = position % 3;
|
||||
// switch (index) {
|
||||
// case 0:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_rain));
|
||||
// break;
|
||||
// case 1:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_sun));
|
||||
// break;
|
||||
// case 2:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_sunny));
|
||||
// break;
|
||||
// default:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_rain));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mContactList == null ? 0 : mContactList.size();
|
||||
}
|
||||
|
||||
static class ContactHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
ConstraintLayout cl_contact;
|
||||
NiceImageView iv_head;
|
||||
NiceImageView iv_head2;
|
||||
TextView tv_name;
|
||||
TextView tv_phone;
|
||||
|
||||
public ContactHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
cl_contact = itemView.findViewById(R.id.cl_contact);
|
||||
iv_head = itemView.findViewById(R.id.iv_head);
|
||||
iv_head2 = itemView.findViewById(R.id.iv_head2);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_phone = itemView.findViewById(R.id.tv_phone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.InformationDetailsActivity;
|
||||
import com.xxpatx.os.bean.ArticleInfo;
|
||||
import com.xxpatx.os.utils.GlideLoadUtils;
|
||||
import com.xxpatx.os.utils.TimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InformationAdapter extends RecyclerView.Adapter<InformationAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<ArticleInfo> mArticleInfos;
|
||||
|
||||
public void setArticleInfos(List<ArticleInfo> articleInfos) {
|
||||
mArticleInfos = articleInfos;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new InformationAdapter.Holder(LayoutInflater.from(mContext).inflate(R.layout.item_information, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
ArticleInfo articleInfo = mArticleInfos.get(position);
|
||||
holder.tv_consult_title.setText(articleInfo.getTitle());
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, articleInfo.getImg(), holder.nv_consult);
|
||||
holder.tv_time.setText(TimeUtils.transferSecondgToHour(articleInfo.getUpdate_time()));
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, InformationDetailsActivity.class);
|
||||
intent.putExtra("articleInfo", articleInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mArticleInfos == null ? 0 : mArticleInfos.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView nv_consult;
|
||||
TextView tv_consult_title;
|
||||
TextView tv_time;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
nv_consult = itemView.findViewById(R.id.nv_consult);
|
||||
tv_consult_title = itemView.findViewById(R.id.tv_consult_title);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiui.video.bean.VideoInfo;
|
||||
import com.xxpatx.os.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class KnowledgeVideoAdapter extends RecyclerView.Adapter<KnowledgeVideoAdapter.LivenVideoHolder> {
|
||||
private static final String TAG = "KnowledgeVideoAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private ArrayList<VideoInfo> mKnowledgeVideoList;
|
||||
|
||||
public void setLivenVideoList(ArrayList<VideoInfo> livenVideoList) {
|
||||
mKnowledgeVideoList = livenVideoList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LivenVideoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new KnowledgeVideoAdapter.LivenVideoHolder(LayoutInflater.from(mContext).inflate(R.layout.item_knowledge_video, parent, false));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LivenVideoHolder holder, int position) {
|
||||
VideoInfo videoInfo = mKnowledgeVideoList.get(position);
|
||||
Glide.with(holder.nv_cover).load(videoInfo.getVideo_cover()).into(holder.nv_cover);
|
||||
holder.tv_title.setText(videoInfo.getName());
|
||||
holder.nv_cover.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setComponent(new ComponentName("com.uiui.video", "com.uiui.video.activity.main.OldMainActivity"));
|
||||
intent.putExtra("position", position);
|
||||
intent.putExtra("switchId", 1);
|
||||
intent.putParcelableArrayListExtra("list", mKnowledgeVideoList);
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onClick: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mKnowledgeVideoList == null ? 0 : mKnowledgeVideoList.size();
|
||||
}
|
||||
|
||||
class LivenVideoHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
NiceImageView nv_cover;
|
||||
TextView tv_title;
|
||||
|
||||
public LivenVideoHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
nv_cover = itemView.findViewById(R.id.nv_cover);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.uiui.video.bean.VideoInfo;
|
||||
import com.xxpatx.os.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LivenVideoAdapter extends RecyclerView.Adapter<LivenVideoAdapter.LivenVideoHolder> {
|
||||
private static final String TAG = "LivenVideoAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private ArrayList<VideoInfo> mLivenVideoList;
|
||||
|
||||
public void setLivenVideoList(ArrayList<VideoInfo> livenVideoList) {
|
||||
mLivenVideoList = livenVideoList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LivenVideoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new LivenVideoAdapter.LivenVideoHolder(LayoutInflater.from(mContext).inflate(R.layout.item_liven_video, parent, false));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LivenVideoHolder holder, int position) {
|
||||
VideoInfo videoInfo = mLivenVideoList.get(position);
|
||||
Glide.with(holder.iv_cover).load(videoInfo.getVideo_cover()).into(holder.iv_cover);
|
||||
holder.iv_cover.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setComponent(new ComponentName("com.uiui.video", "com.uiui.video.activity.main.OldMainActivity"));
|
||||
intent.putExtra("position", position);
|
||||
intent.putExtra("switchId", 0);
|
||||
intent.putParcelableArrayListExtra("list", mLivenVideoList);
|
||||
try {
|
||||
mContext.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onClick: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mLivenVideoList == null ? 0 : mLivenVideoList.size();
|
||||
}
|
||||
|
||||
class LivenVideoHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
NiceImageView iv_cover;
|
||||
|
||||
public LivenVideoHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_cover = itemView.findViewById(R.id.iv_cover);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.information.InformationActivity;
|
||||
import com.xxpatx.os.bean.ArticleInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewArticleAdapter extends RecyclerView.Adapter<NewArticleAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<ArticleInfo> mArticleBeanList;
|
||||
|
||||
public void setArticleBeanList(List<ArticleInfo> list) {
|
||||
this.mArticleBeanList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new NewArticleAdapter.Holder(LayoutInflater.from(mContext).inflate(R.layout.item_new_article, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
ArticleInfo articleInfo = mArticleBeanList.get(position);
|
||||
Glide.with(holder.nv_consult).load(articleInfo.getImg()).into(holder.nv_consult);
|
||||
holder.tv_consult_title.setText(articleInfo.getTitle());
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, InformationActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mArticleBeanList == null ? 0 : mArticleBeanList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView nv_consult;
|
||||
TextView tv_consult_title;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
nv_consult = itemView.findViewById(R.id.nv_consult);
|
||||
tv_consult_title = itemView.findViewById(R.id.tv_consult_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.details.DetailsActivity;
|
||||
import com.xxpatx.os.activity.GoodsActivity;
|
||||
import com.xxpatx.os.bean.GoodsInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewGoodsAdapter extends RecyclerView.Adapter<NewGoodsAdapter.GoodsHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<GoodsInfo> goodsInfoList;
|
||||
|
||||
public void setGoodsInfoList(List<GoodsInfo> list) {
|
||||
this.goodsInfoList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GoodsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new NewGoodsAdapter.GoodsHolder(LayoutInflater.from(mContext).inflate(R.layout.item_new_goods, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GoodsHolder holder, int position) {
|
||||
GoodsInfo goodsInfo = goodsInfoList.get(position);
|
||||
Glide.with(holder.nv_goods_pic).load(goodsInfo.getImg()).error(mContext.getResources().getDrawable(R.drawable.nodata)).into(holder.nv_goods_pic);
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mContext.startActivity(new Intent(mContext, GoodsActivity.class));
|
||||
}
|
||||
});
|
||||
holder.tv_goods_title.setText(goodsInfo.getGoods_desc());
|
||||
holder.tv_goods_pirce.setText("热卖促销¥" + goodsInfo.getBuying_price());
|
||||
holder.tv_buy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, DetailsActivity.class);
|
||||
intent.putExtra("GoodsInfo", goodsInfo);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return goodsInfoList == null ? 0 : goodsInfoList.size();
|
||||
}
|
||||
|
||||
static class GoodsHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
NiceImageView nv_goods_pic;
|
||||
TextView tv_goods_title;
|
||||
TextView tv_goods_pirce;
|
||||
TextView tv_buy;
|
||||
|
||||
public GoodsHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
nv_goods_pic = itemView.findViewById(R.id.nv_goods_pic);
|
||||
tv_goods_title = itemView.findViewById(R.id.tv_goods_title);
|
||||
tv_goods_pirce = itemView.findViewById(R.id.tv_goods_pirce);
|
||||
tv_buy = itemView.findViewById(R.id.tv_buy);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.MediaPlayer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.alarm.AlarmClockData;
|
||||
import com.xxpatx.os.utils.FFmpegUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapter.Holder> {
|
||||
private Context mContext;
|
||||
private List<AlarmClockData> dataList;
|
||||
private OnClickListener mOnClickListener;
|
||||
|
||||
public void setDataList(List<AlarmClockData> data) {
|
||||
this.dataList = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnClickListener listener) {
|
||||
this.mOnClickListener = listener;
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
void onClick();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_notification, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
switch (position%3){
|
||||
case 1:
|
||||
holder.root.setBackground(mContext.getDrawable(R.drawable.home_alarm_blue));
|
||||
break;
|
||||
case 2:
|
||||
holder.root.setBackground(mContext.getDrawable(R.drawable.home_alarm_green));
|
||||
break;
|
||||
case 0:
|
||||
holder.root.setBackground(mContext.getDrawable(R.drawable.home_alarm_red));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
AlarmClockData alarmClockData = dataList.get(position);
|
||||
// holder.tv_title.setText("提醒事件:" + alarmClockData.getTitle());
|
||||
String time = alarmClockData.getTime();
|
||||
if (time.length() > 5) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
SimpleDateFormat hours = new SimpleDateFormat("HH:mm");
|
||||
try {
|
||||
Date date = sdf.parse(time);
|
||||
String hourTime = hours.format(date);
|
||||
holder.tv_time.setText(hourTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
holder.tv_time.setText(time);
|
||||
}
|
||||
String file = alarmClockData.getFile();
|
||||
if (TextUtils.isEmpty(file)) {
|
||||
// Glide.with(holder.iv_cover).load(R.drawable.home_reminder_icon).into(holder.iv_cover);
|
||||
} else {
|
||||
FFmpegUtils.loadVideoScreenshot(file, new Observer<Bitmap>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Bitmap bitmap) {
|
||||
// Glide.with(holder.iv_cover).load(bitmap).into(holder.iv_cover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
String voice = alarmClockData.getVoice();
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mOnClickListener != null) {
|
||||
mOnClickListener.onClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (TextUtils.isEmpty(voice)) {
|
||||
// holder.cl_voice.setVisibility(View.GONE);
|
||||
} else {
|
||||
// holder.cl_voice.setVisibility(View.VISIBLE);
|
||||
MediaPlayer mMediaPlayer = new MediaPlayer();
|
||||
mMediaPlayer.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
||||
.build()
|
||||
);
|
||||
mMediaPlayer.setOnCompletionListener(mp -> Log.e("setOnCompletionListener", "onCompletion: "));
|
||||
mMediaPlayer.setOnPreparedListener(mp -> Log.e("setOnPreparedListener", "onPrepared: "));
|
||||
mMediaPlayer.setOnErrorListener((mp, what, extra) -> false);
|
||||
//设置音频文件到MediaPlayer对象中
|
||||
try {
|
||||
mMediaPlayer.setDataSource(voice);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//让MediaPlayer对象准备,用这个方法防止加载时耗时导致anr
|
||||
mMediaPlayer.prepareAsync();
|
||||
FFmpegUtils.getDurationInMilliseconds(voice, new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Integer integer) {
|
||||
// holder.tv_voice.setText(integer + "秒");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
// holder.cl_voice.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// mMediaPlayer.start();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataList == null ? 0 : dataList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
// TextView tv_title;
|
||||
TextView tv_time;
|
||||
// TextView tv_voice;
|
||||
// ConstraintLayout cl_voice;
|
||||
ConstraintLayout root;
|
||||
NiceImageView iv_cover;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
// tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_time = itemView.findViewById(R.id.tv_time);
|
||||
// tv_voice = itemView.findViewById(R.id.tv_voice);
|
||||
// cl_voice = itemView.findViewById(R.id.cl_voice);
|
||||
iv_cover = itemView.findViewById(R.id.iv_cover);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.contact.AddWechatContactActivity;
|
||||
import com.xxpatx.os.activity.records.RecordsActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OldContactAdapter extends RecyclerView.Adapter<OldContactAdapter.ContactHolder> {
|
||||
private List<Contact> mContactList;
|
||||
private Context mContext;
|
||||
|
||||
public static final String DIALER_PACKAGE = "com.android.dialer";
|
||||
public static final String DIALER_ADD_CONTACT = "com.uiui.aios.contact.add";
|
||||
|
||||
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_old, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ContactHolder contactHolder, int position) {
|
||||
Contact contact = mContactList.get(position);
|
||||
contactHolder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// int qch_call_forbid = Settings.System.getInt(mContext.getContentResolver(), "qch_call_forbid", 0);
|
||||
// if (qch_call_forbid == 1) {
|
||||
// Toaster.show("电话功能被禁用");
|
||||
// icon_return;
|
||||
// }
|
||||
Intent dialIntent = new Intent(Intent.ACTION_CALL);
|
||||
String phone = contact.getMobile();
|
||||
if (DIALER_PACKAGE.equals(phone)) {
|
||||
try {
|
||||
// mContext.startActivity(new Intent(Intent.ACTION_DIAL));
|
||||
// mContext.startActivity(new Intent(mContext, DialerActivity.class));
|
||||
mContext.startActivity(new Intent(mContext, RecordsActivity.class));
|
||||
} catch (Exception e) {
|
||||
Toaster.show("无法打开电话功能");
|
||||
}
|
||||
} else if (DIALER_ADD_CONTACT.equals(contact.getMobile())) {
|
||||
Intent intent = new Intent(mContext, AddWechatContactActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
} else if (!TextUtils.isEmpty(phone)) {
|
||||
Uri data = Uri.parse("tel:" + phone);
|
||||
dialIntent.setData(data);
|
||||
mContext.startActivity(dialIntent);
|
||||
}
|
||||
}
|
||||
});
|
||||
contactHolder.tv_name.setText(contact.getName());
|
||||
if (DIALER_PACKAGE.equals(contact.getMobile())) {
|
||||
contactHolder.cl_contact.setVisibility(View.GONE);
|
||||
contactHolder.iv_head2.setVisibility(View.VISIBLE);
|
||||
contactHolder.tv_phone.setText("");
|
||||
Glide.with(contactHolder.iv_head).load(R.drawable.home_dialer_cion_circle).error(R.drawable.home_dialer_cion_circle).into(contactHolder.iv_head);
|
||||
} else if (DIALER_ADD_CONTACT.equals(contact.getMobile())) {
|
||||
Glide.with(contactHolder.iv_head).load(R.drawable.icon_contact_add).error(R.drawable.icon_contact_add).into(contactHolder.iv_head);
|
||||
} else {
|
||||
contactHolder.cl_contact.setVisibility(View.VISIBLE);
|
||||
contactHolder.iv_head2.setVisibility(View.GONE);
|
||||
contactHolder.tv_phone.setText(contact.getMobile());
|
||||
Glide.with(contactHolder.iv_head).load(contact.getAvatar()).error(R.drawable.default_avatar).into(contactHolder.iv_head);
|
||||
}
|
||||
// int index = position % 3;
|
||||
// switch (index) {
|
||||
// case 0:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_rain));
|
||||
// break;
|
||||
// case 1:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_sun));
|
||||
// break;
|
||||
// case 2:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_sunny));
|
||||
// break;
|
||||
// default:
|
||||
// contactHolder.root.setBackground(mContext.getDrawable(R.drawable.background_weather_rain));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mContactList == null ? 0 : mContactList.size();
|
||||
}
|
||||
|
||||
static class ContactHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
ConstraintLayout cl_contact;
|
||||
NiceImageView iv_head;
|
||||
NiceImageView iv_head2;
|
||||
TextView tv_name;
|
||||
TextView tv_phone;
|
||||
|
||||
public ContactHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
cl_contact = itemView.findViewById(R.id.cl_contact);
|
||||
iv_head = itemView.findViewById(R.id.iv_head);
|
||||
iv_head2 = itemView.findViewById(R.id.iv_head2);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_phone = itemView.findViewById(R.id.tv_phone);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
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.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.ExpressActivity;
|
||||
import com.xxpatx.os.bean.OrderGoods;
|
||||
import com.xxpatx.os.bean.OrderIndexBean;
|
||||
import com.xxpatx.os.utils.GlideLoadUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderAdapter extends RecyclerView.Adapter<OrderAdapter.OrderHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<OrderIndexBean> mOrderIndexBeans;
|
||||
|
||||
public void setOrderIndexBeans(List<OrderIndexBean> orderIndexBeans) {
|
||||
mOrderIndexBeans = orderIndexBeans;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OrderHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new OrderAdapter.OrderHolder(LayoutInflater.from(mContext).inflate(R.layout.item_order, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull OrderHolder holder, int position) {
|
||||
OrderIndexBean orderIndexBean = mOrderIndexBeans.get(position);
|
||||
OrderGoods orderGoods = orderIndexBean.getGoods();
|
||||
int status = orderIndexBean.getStatus();
|
||||
switch (status) {
|
||||
default:
|
||||
case 0:
|
||||
holder.tv_statu.setText("待付款");
|
||||
break;
|
||||
case 1:
|
||||
holder.tv_statu.setText("待发货");
|
||||
break;
|
||||
case 2:
|
||||
holder.tv_statu.setText("待收货");
|
||||
break;
|
||||
case 3:
|
||||
holder.tv_statu.setText("已签收");
|
||||
break;
|
||||
case 20:
|
||||
holder.tv_statu.setText("已取消");
|
||||
break;
|
||||
}
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, orderGoods.getImage(), holder.iv_goods, R.drawable.he999);
|
||||
holder.tv_title.setText(orderGoods.getGoods_name());
|
||||
holder.tv_unit_price.setText("¥" + orderGoods.getBuy_price());
|
||||
holder.tv_amount.setText(String.valueOf(orderIndexBean.getGoods_total()));
|
||||
holder.tv_paid.setText("实付:¥" + orderIndexBean.getPrice_total() + "元");
|
||||
String latest_transport = orderIndexBean.getLatest_transport();
|
||||
if (TextUtils.isEmpty(latest_transport)) {
|
||||
holder.tv_express_info.setText("暂无物流信息");
|
||||
} else {
|
||||
holder.tv_express_info.setText(latest_transport);
|
||||
}
|
||||
holder.tv_express.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, ExpressActivity.class);
|
||||
intent.putExtra("order_sn",orderIndexBean.getOrder_sn());
|
||||
intent.putExtra("order_id",orderIndexBean.getId());
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mOrderIndexBeans == null ? 0 : mOrderIndexBeans.size();
|
||||
}
|
||||
|
||||
class OrderHolder extends RecyclerView.ViewHolder {
|
||||
TextView tv_statu, tv_title, tv_unit_price, tv_amount, tv_paid, tv_express, tv_express_info;
|
||||
ImageView iv_goods;
|
||||
|
||||
public OrderHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_statu = itemView.findViewById(R.id.tv_statu);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
tv_unit_price = itemView.findViewById(R.id.tv_unit_price);
|
||||
tv_amount = itemView.findViewById(R.id.tv_amount);
|
||||
tv_paid = itemView.findViewById(R.id.tv_paid);
|
||||
tv_express = itemView.findViewById(R.id.tv_express);
|
||||
iv_goods = itemView.findViewById(R.id.iv_goods);
|
||||
tv_express_info = itemView.findViewById(R.id.tv_express_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.WiFiInfo;
|
||||
import com.xxpatx.os.dialog.DeleWifiDialog;
|
||||
import com.xxpatx.os.dialog.WifiDialog;
|
||||
import com.xxpatx.os.utils.WiFiUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SavedWiFiAdapter extends RecyclerView.Adapter<SavedWiFiAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<WiFiInfo> mResultList;
|
||||
|
||||
public void setResultList(List<WiFiInfo> list) {
|
||||
this.mResultList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_wifi_info, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
WiFiInfo wiFiInfo = mResultList.get(position);
|
||||
holder.tv_name.setText(wiFiInfo.getSSID());
|
||||
if (wiFiInfo.isConnected()) {
|
||||
holder.tv_connected.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.tv_connected.setVisibility(View.GONE);
|
||||
}
|
||||
if (wiFiInfo.isSaved()) {
|
||||
if (wiFiInfo.isAvailable()) {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_saved));
|
||||
holder.tv_level.setText("信号:" + getWifiLevelText(wiFiInfo.getLevel()) + "(" + wiFiInfo.getLevel() + "dBm)");
|
||||
holder.tv_level.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_unavailable));
|
||||
holder.tv_level.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.icon_wifi_available));
|
||||
holder.tv_level.setText("信号:" + getWifiLevelText(wiFiInfo.getLevel()) + "(" + wiFiInfo.getLevel() + "dBm)");
|
||||
holder.tv_level.setVisibility(View.VISIBLE);
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// if (wiFiInfo.isSaved()) {
|
||||
//
|
||||
// } else {
|
||||
showPassword(wiFiInfo.getSSID());
|
||||
// }
|
||||
}
|
||||
});
|
||||
holder.root.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
showRemoveDialog(wiFiInfo.getSSID(), position);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showRemoveDialog(String ssid, int position) {
|
||||
DeleWifiDialog deleWifiDialog = new DeleWifiDialog(mContext);
|
||||
deleWifiDialog.setTitle("提醒");
|
||||
deleWifiDialog.setMessage(ssid);
|
||||
deleWifiDialog.setOnClickBottomListener(new DeleWifiDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
WiFiUtils.removeWiFiNetwork(ssid);
|
||||
deleWifiDialog.dismiss();
|
||||
mResultList.remove(position);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
deleWifiDialog.show();
|
||||
deleWifiDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
deleWifiDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
deleWifiDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
private static final int MIN_RSSI = -100;
|
||||
|
||||
private static final int MAX_RSSI = -55;
|
||||
|
||||
private String getWifiLevelText(int db) {
|
||||
if (db < MIN_RSSI) {
|
||||
return "微弱";
|
||||
} else if (db < -88) {
|
||||
return "一般";
|
||||
} else if (db < -77) {
|
||||
return "良好";
|
||||
} else if (db < MAX_RSSI) {
|
||||
return "极佳";
|
||||
}
|
||||
return "一般";
|
||||
}
|
||||
|
||||
private void showPassword(String ssid) {
|
||||
WifiDialog passwordDialog = new WifiDialog(mContext);
|
||||
passwordDialog.setTitle(String.format(mContext.getString(R.string.connect_wifi_ssid), ssid));
|
||||
passwordDialog.setOnClickBottomListener(new WifiDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
WiFiUtils.addWiFiNetwork(ssid, passwordDialog.getPassword());
|
||||
passwordDialog.dismiss();
|
||||
}
|
||||
});
|
||||
passwordDialog.show();
|
||||
passwordDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
passwordDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mResultList == null ? 0 : mResultList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
ImageView iv_icon;
|
||||
TextView tv_name, tv_level, tv_connected;
|
||||
ConstraintLayout root;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_level = itemView.findViewById(R.id.tv_level);
|
||||
tv_connected = itemView.findViewById(R.id.tv_connected);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.bean.CategoryBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TitleAdapter extends RecyclerView.Adapter<TitleAdapter.Holder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private List<CategoryBean> mCategoryList;
|
||||
private String mTitle = "";
|
||||
|
||||
public void setCategoryList(List<CategoryBean> categoryList) {
|
||||
mCategoryList = categoryList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
}
|
||||
|
||||
public interface TitleChangeCallback {
|
||||
void onTitleChange(CategoryBean categoryBean);
|
||||
}
|
||||
|
||||
private TitleChangeCallback mTitleChangeCallback;
|
||||
|
||||
public void setTitleChangeCallback(TitleChangeCallback titleChangeCallback) {
|
||||
mTitleChangeCallback = titleChangeCallback;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_title, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
CategoryBean videoCategory = mCategoryList.get(position);
|
||||
String title = videoCategory.getName();
|
||||
holder.tv_title.setText(title);
|
||||
if (mTitle.equals(title)) {
|
||||
holder.tv_title.setBackground(mContext.getDrawable(R.drawable.title_select_background));
|
||||
holder.tv_title.setTextColor(mContext.getColor(R.color.black));
|
||||
} else {
|
||||
holder.tv_title.setBackground(mContext.getDrawable(R.drawable.title_background));
|
||||
holder.tv_title.setTextColor(mContext.getColor(R.color.white));
|
||||
}
|
||||
holder.tv_title.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mTitle = title;
|
||||
notifyDataSetChanged();
|
||||
if (mTitleChangeCallback != null) {
|
||||
mTitleChangeCallback.onTitleChange(videoCategory);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mCategoryList == null ? 0 : mCategoryList.size();
|
||||
}
|
||||
|
||||
class Holder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView tv_title;
|
||||
|
||||
public Holder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_title = itemView.findViewById(R.id.tv_title);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
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.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.qweather.sdk.bean.weather.WeatherDailyBean;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherDayApdapter extends RecyclerView.Adapter<WeatherDayApdapter.WeatherHolder> {
|
||||
private static final String TAG = "WeatherDayApdapter";
|
||||
private List<WeatherDailyBean.DailyBean> mDailyBeans;
|
||||
private Context mContext;
|
||||
|
||||
public void setDailyBeans(List<WeatherDailyBean.DailyBean> dailyBeans) {
|
||||
this.mDailyBeans = dailyBeans;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public WeatherHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new WeatherHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_weather, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull WeatherHolder holder, int position) {
|
||||
WeatherDailyBean.DailyBean dailyBean = mDailyBeans.get(position);
|
||||
String dateString;
|
||||
switch (position) {
|
||||
// case 0:
|
||||
// dateString = "今天";
|
||||
// break;
|
||||
// case 1:
|
||||
// dateString = "明天";
|
||||
// break;
|
||||
// case 2:
|
||||
// dateString = "后天";
|
||||
// break;
|
||||
default:
|
||||
dateString = dailyBean.getFxDate();
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = sdf.parse(dailyBean.getFxDate());
|
||||
SimpleDateFormat now = new SimpleDateFormat("MM月dd日");
|
||||
dateString = now.format(date);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
holder.tv_date.setText(dateString);
|
||||
holder.tv_temp.setText(dailyBean.getTempMin() + "℃ - " + dailyBean.getTempMax() + "℃");
|
||||
holder.tv_weather.setText(dailyBean.getTextDay());
|
||||
String iconDay = dailyBean.getIconDay();
|
||||
switch (iconDay) {
|
||||
case "100":
|
||||
case "150":
|
||||
holder.iv_bg.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sun1));
|
||||
break;
|
||||
case "102":
|
||||
case "152":
|
||||
holder.iv_bg.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.background_weather_sunny1));
|
||||
break;
|
||||
default:
|
||||
holder.iv_bg.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.background_weather_rain1));
|
||||
}
|
||||
holder.iv_weather.setImageDrawable(getWeatherDrawable(iconDay));
|
||||
}
|
||||
|
||||
private Drawable getWeatherDrawable(String iconName) {
|
||||
int resID = mContext.getResources().getIdentifier("he" + iconName, "drawable", BuildConfig.APPLICATION_ID);
|
||||
if (resID == 0) {
|
||||
Log.e(TAG, "getView: not found src : " + iconName);
|
||||
return mContext.getResources().getDrawable(R.drawable.he100);
|
||||
} else {
|
||||
return mContext.getResources().getDrawable(resID);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDailyBeans == null ? 0 : mDailyBeans.size();
|
||||
}
|
||||
|
||||
static class WeatherHolder extends RecyclerView.ViewHolder {
|
||||
TextView tv_date;
|
||||
ImageView iv_weather;
|
||||
ImageView iv_bg;
|
||||
TextView tv_weather;
|
||||
TextView tv_temp;
|
||||
|
||||
public WeatherHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tv_date = itemView.findViewById(R.id.tv_date);
|
||||
iv_weather = itemView.findViewById(R.id.iv_weather);
|
||||
iv_bg = itemView.findViewById(R.id.iv_bg);
|
||||
tv_weather = itemView.findViewById(R.id.tv_weather);
|
||||
tv_temp = itemView.findViewById(R.id.tv_temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -59,7 +60,29 @@ 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));
|
||||
break;
|
||||
case 1:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround2));
|
||||
break;
|
||||
case 2:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround3));
|
||||
break;
|
||||
case 3:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround4));
|
||||
break;
|
||||
case 4:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround5));
|
||||
break;
|
||||
case 5:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround6));
|
||||
break;
|
||||
default:
|
||||
contactHolder.iv_bg.setImageDrawable(mContext.getDrawable(R.drawable.contact_card_backround1));
|
||||
}
|
||||
contactHolder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -105,6 +128,7 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
NiceImageView iv_head;
|
||||
TextView tv_name;
|
||||
TextView tv_phone;
|
||||
ImageView iv_bg;
|
||||
|
||||
public ContactHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -112,6 +136,7 @@ public class WechatContactAdapter extends RecyclerView.Adapter<WechatContactAdap
|
||||
iv_head = itemView.findViewById(R.id.iv_head);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
tv_phone = itemView.findViewById(R.id.tv_phone);
|
||||
iv_bg = itemView.findViewById(R.id.iv_bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user