33
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.AddBitmaps;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||
|
||||
public class AddCaseRecordAdapter extends BaseAdapter {
|
||||
private Activity mActivity;
|
||||
private List<AddBitmaps> mBitmaps;
|
||||
private AddBitmaps mAddBitmaps;
|
||||
|
||||
public AddCaseRecordAdapter(Activity mActivity, List<AddBitmaps> mBitmaps,
|
||||
AddBitmaps mAddBitmaps) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mActivity = mActivity;
|
||||
this.mBitmaps = mBitmaps;
|
||||
this.mAddBitmaps = mAddBitmaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mBitmaps.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mBitmaps.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
View view = UIUtils.inflate(R.layout.item_gv_case_record);
|
||||
ImageView iv_photo = (ImageView) view
|
||||
.findViewById(R.id.iv_item_gv_case_photo);
|
||||
ImageView iv_delete = (ImageView) view
|
||||
.findViewById(R.id.iv_item_gv_case_delete);
|
||||
if (mBitmaps.get(position).isAdd()) {
|
||||
iv_delete.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (mBitmaps.get(position).getBitmap() != null) {
|
||||
iv_photo.setImageBitmap(mBitmaps.get(position).getBitmap());
|
||||
}
|
||||
if (mBitmaps.get(position).getPath() != null) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + mBitmaps.get(position).getPath(), iv_photo,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
iv_delete.setVisibility(View.VISIBLE);
|
||||
ImageLoader.getInstance().loadImage(
|
||||
Url.urlHtml + mBitmaps.get(position).getPath(),
|
||||
new SimpleImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri,
|
||||
View view, Bitmap loadedImage) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||
mBitmaps.get(position).setBitmap(loadedImage);
|
||||
}
|
||||
});
|
||||
}
|
||||
iv_delete.setTag(position);
|
||||
iv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if ((Integer) v.getTag() < mBitmaps.size()) {
|
||||
mBitmaps.remove(mBitmaps.get((Integer) v.getTag()));
|
||||
}
|
||||
if (!mBitmaps.contains(mAddBitmaps)) {
|
||||
mBitmaps.add(mAddBitmaps);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.PhotoAlbumActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.SelectedPhotoActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.AddBitmaps;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class AddCaseRecordAdapter01 extends BaseAdapter {
|
||||
private Activity mActivity;
|
||||
private List<AddBitmaps> mBitmaps;
|
||||
|
||||
public AddCaseRecordAdapter01(Activity mActivity, List<AddBitmaps> mBitmaps) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mActivity = mActivity;
|
||||
this.mBitmaps = mBitmaps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mBitmaps.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mBitmaps.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
View view = UIUtils.inflate(R.layout.item_gv_case_record);
|
||||
ImageView iv_photo = (ImageView) view
|
||||
.findViewById(R.id.iv_item_gv_case_photo);
|
||||
ImageView iv_delete = (ImageView) view
|
||||
.findViewById(R.id.iv_item_gv_case_delete);
|
||||
if (mBitmaps.get(position).isAdd()) {
|
||||
iv_delete.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (mBitmaps.get(position).getBitmap() != null) {
|
||||
iv_photo.setImageBitmap(mBitmaps.get(position).getBitmap());
|
||||
}
|
||||
if (mBitmaps.get(position).getPath() != null) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + mBitmaps.get(position).getPath(), iv_photo,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
iv_delete.setVisibility(View.VISIBLE);
|
||||
ImageLoader.getInstance().loadImage(
|
||||
Url.urlHtml + mBitmaps.get(position).getPath(),
|
||||
new SimpleImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri,
|
||||
View view, Bitmap loadedImage) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||
mBitmaps.get(position).setBitmap(loadedImage);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
iv_delete.setTag(position);
|
||||
iv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if ((Integer) v.getTag() < mBitmaps.size()) {
|
||||
mBitmaps.remove(mBitmaps.get((Integer) v.getTag()));
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.PatientEducationApplyActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.MailanListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* Created by wangchengxin on 2019/4/24.
|
||||
*/
|
||||
|
||||
public class AppliedListAdapter extends BaseAdapter {
|
||||
private ArrayList<MailanListBean.DataBean.ListBean> beans;
|
||||
private Context context;
|
||||
public AppliedListAdapter(ArrayList<MailanListBean.DataBean.ListBean> beans, Context context) {
|
||||
this.beans = beans;
|
||||
this.context =context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return beans.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return beans.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_appliedlist);
|
||||
vh = new ViewHolder();
|
||||
vh.iv_edit = convertView.findViewById(R.id.iv_edit);
|
||||
vh.tv_infotime = convertView.findViewById(R.id.tv_infotime);
|
||||
vh.tv_topic = convertView.findViewById(R.id.tv_topic);
|
||||
vh.tv_type = convertView.findViewById(R.id.tv_type);
|
||||
vh.tv_time = convertView.findViewById(R.id.tv_time);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.iv_edit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, PatientEducationApplyActivity.class);
|
||||
intent.putExtra("topic",beans.get(position).getTopic());
|
||||
intent.putExtra("type",beans.get(position).getType());
|
||||
intent.putExtra("expect_date",beans.get(position).getExpect_date());
|
||||
intent.putExtra("uuid",beans.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
vh.tv_infotime.setText(beans.get(position).getCreate_date().replace("-","."));
|
||||
vh.tv_type.setText(beans.get(position).getType());
|
||||
vh.tv_topic.setText(beans.get(position).getTopic());
|
||||
vh.tv_time.setText(beans.get(position).getExpect_date().replace("-","."));
|
||||
return convertView;
|
||||
}
|
||||
public static class ViewHolder {
|
||||
|
||||
public TextView tv_type, tv_topic, tv_time,tv_infotime;
|
||||
public ImageView iv_edit;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ArrayAdapterNew extends ArrayAdapter<String> {
|
||||
|
||||
public ArrayAdapterNew(@NonNull Context context, int resource, @NonNull List<String> objects) {
|
||||
super(context, resource, objects);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
//返回数据的统计数量,大于0项则减去1项,从而不显示最后一项
|
||||
int i = super.getCount();
|
||||
return i>0?i-1:i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.Bank;
|
||||
import cn.shangyu.gdxzExpert.widget.CircleImageView;
|
||||
|
||||
public class BankListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<Bank> bank;
|
||||
|
||||
public BankListAdapter(Context mContext, List<Bank> bank) {
|
||||
this.mContext = mContext;
|
||||
this.bank=bank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return bank.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return bank.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext, R.layout.item_bank_list_card1, null);
|
||||
holder.img = (CircleImageView) convertView.findViewById(R.id.item_img);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.tv_bank_name);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
Bank bankItem = bank.get(position);
|
||||
holder.name.setText(bankItem.bankName);
|
||||
holder.img.setImageResource(bankItem.bankIcon);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
CircleImageView img;
|
||||
TextView name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
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 java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.RankingBean;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import me.zhouzhuo.zzhorizontalprogressbar.ZzHorizontalProgressBar;
|
||||
|
||||
public class BarAdapter extends RecyclerView.Adapter<BarAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<RankingBean.listRankingBean> list;
|
||||
public BarAdapter(Context context,List<RankingBean.listRankingBean> list) {
|
||||
this.context = context;
|
||||
this.list=list;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.bar_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
viewHolder.name=view.findViewById(R.id.name);
|
||||
viewHolder.num=view.findViewById(R.id.num);
|
||||
viewHolder.pb=view.findViewById(R.id.pb);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
if(StringUtil.isEmpty(list.get(position).getName()))
|
||||
{
|
||||
holder.name.setText(list.get(position).getHospitalName()+"");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.name.setText(list.get(position).getName()+
|
||||
"("+list.get(position).getHospitalName() +")");
|
||||
}
|
||||
|
||||
holder.num.setText(list.get(position).getNum()+"");
|
||||
holder.pb.setProgress(list.get(position).getNum());
|
||||
holder.pb.setMax(list.get(0).getNum());
|
||||
holder.pb.setBgColor(Color.parseColor("#F5F5F5"));
|
||||
holder.pb.setProgressColor(Color.parseColor("#56A5EB"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
TextView name,num;
|
||||
ZzHorizontalProgressBar pb;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
public class BaseFragemetAdapter extends FragmentStatePagerAdapter {
|
||||
ArrayList<Fragment> fgs;
|
||||
private String[] mTitles;
|
||||
public Fragment currentFragment;
|
||||
|
||||
public void setFgs(ArrayList<Fragment> fgs, String[] mTitles){
|
||||
this.fgs=fgs;
|
||||
this.mTitles=mTitles;
|
||||
}
|
||||
public BaseFragemetAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrimaryItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
|
||||
|
||||
this.currentFragment = (Fragment) object;
|
||||
super.setPrimaryItem(container, position, object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
|
||||
return fgs.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fgs.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitles[position];//很重要,起到与tableLayout关联的作用,
|
||||
// 否则会报错
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.BillListBean.PingOrder.PingOrderBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class BillDetailAdapter extends BaseAdapter {
|
||||
List<PingOrderBean> list;
|
||||
|
||||
public BillDetailAdapter(List<PingOrderBean> list) {
|
||||
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_bill_detail_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_bill_detail);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_money = (TextView) convertView
|
||||
.findViewById(R.id.tv_order_money);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_order_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_order_time);
|
||||
vh.mTv_type = (TextView) convertView
|
||||
.findViewById(R.id.tv_order_type);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTv_money.setText(list.get(position).getAccountstr());
|
||||
|
||||
vh.mTv_type.setText(list.get(position).getType_name());
|
||||
vh.mTv_name.setText(list.get(position).getUser_name());
|
||||
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//
|
||||
// String sd = sdf.format(new Date(Long.parseLong(list.get(position)
|
||||
// .getCreate_time()) * 1000));
|
||||
// vh.mTv_time.setText(sd);
|
||||
vh.mTv_time.setText(list.get(position).getCreate_time().substring(0, 10));
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_type, mTv_name, mTv_time, mTv_money;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.AddCaseRecordActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.CaseRecordActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CaseRecordBean.DatasCase;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.MyGridView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.media.Image;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class CaseRecordAdapter extends BaseAdapter {
|
||||
ArrayList<DatasCase> mDatas;
|
||||
CaseRecordActivity macActivity;
|
||||
|
||||
public CaseRecordAdapter(ArrayList<DatasCase> mDatas,
|
||||
CaseRecordActivity macActivity) {
|
||||
this.mDatas = mDatas;
|
||||
this.macActivity = macActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mDatas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
// ImageLoader.getInstance().displayImage(Url.urlHtml + news.headImg,
|
||||
// mHolder.ivImage,
|
||||
// ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_lv_caserecord);
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_case_time);
|
||||
vh.mTv_context = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_case_context);
|
||||
vh.mGv_photo = (MyGridView) convertView
|
||||
.findViewById(R.id.item_gv_photo);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTv_time.setText(mDatas.get(position).getCreate_date());
|
||||
vh.mTv_context.setText(mDatas.get(position).getDes());
|
||||
if (vh.mGv_photo != null) {
|
||||
PhotoAdapter mAdapter = new PhotoAdapter(mDatas.get(position)
|
||||
.getPhoto());
|
||||
vh.mGv_photo.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
vh.mGv_photo.setTag(position);
|
||||
vh.mGv_photo.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
// TODO Auto-generated method stub
|
||||
int Num = (int) parent.getTag();
|
||||
Intent intent = new Intent(macActivity,
|
||||
AddCaseRecordActivity.class);
|
||||
intent.setType("modify");
|
||||
intent.putExtra("caseRecord", (Serializable) mDatas.get(Num));
|
||||
macActivity.startActivityForResult(intent, 202);
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_time, mTv_context;
|
||||
MyGridView mGv_photo;
|
||||
PhotoAdapter mAdapter;
|
||||
|
||||
// public ViewHolder(View view) {
|
||||
// mTv_time = (TextView) view.findViewById(R.id.tv_item_case_time);
|
||||
// mTv_context = (TextView) view
|
||||
// .findViewById(R.id.tv_item_case_context);
|
||||
// mGv_photo = (MyGridView) view.findViewById(R.id.item_gv_photo);
|
||||
// mAdapter = new PhotoAdapter();
|
||||
// mGv_photo.setAdapter(mAdapter);
|
||||
// view.setTag(this);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.Image;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.AddcasediscussionActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.CaseCussionDetailActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.MyCasediscussionBean.DataBean.MYCasediscussion;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* CasediscussionAdapter 病例讨论适配器
|
||||
*/
|
||||
public class Casediscussion01Adapter extends BaseAdapter {
|
||||
private Activity context;
|
||||
private List<MYCasediscussion> casediscussion;
|
||||
private ArrayList<ImageView> imageSource;
|
||||
private ArrayList<Image> imagelist;
|
||||
private MyPagerAdapter myPagerAdapter;
|
||||
private MYCasediscussion caseDic;
|
||||
List<String> mImagePath;
|
||||
|
||||
public Casediscussion01Adapter(Activity context,
|
||||
List<MYCasediscussion> casediscussion) {
|
||||
this.context = context;
|
||||
this.casediscussion = casediscussion;
|
||||
this.caseDic = caseDic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return casediscussion.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
NewsViewHolder mHolder;
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context,
|
||||
R.layout.item_case_discussion_01, null);
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.im_pic = convertView
|
||||
.findViewById(R.id.im_pic);
|
||||
mHolder.case_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_name);
|
||||
mHolder.case_hos = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_hos);
|
||||
mHolder.vp = (ViewPager) convertView.findViewById(R.id.vp);
|
||||
mHolder.dots = (LinearLayout) convertView
|
||||
.findViewById(R.id.ll_dots_item01);
|
||||
mHolder.lytag = (LinearLayout) convertView
|
||||
.findViewById(R.id.ly_tag);
|
||||
mHolder.top_fl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.top_fl);
|
||||
mHolder.case_rl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_all_delmess);
|
||||
|
||||
// label_one_ac_cu
|
||||
|
||||
mHolder.case_rl_tag = (RadioGroup) convertView
|
||||
.findViewById(R.id.label_one_ac_cu);
|
||||
mHolder.case_date = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_date);
|
||||
mHolder.tv_bt = (TextView) convertView.findViewById(R.id.tv_bt_bj);
|
||||
mHolder.tag_1 = (TextView) convertView.findViewById(R.id.tag_1);
|
||||
mHolder.tag_2 = (TextView) convertView.findViewById(R.id.tag_2);
|
||||
mHolder.tag_3 = (TextView) convertView.findViewById(R.id.tag_3);
|
||||
mHolder.case_mess = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_mess);
|
||||
mHolder.comment_num = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_num);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
caseDic = casediscussion.get(position);
|
||||
mHolder.comment_num.setText("评论" + "(" + caseDic.getCommentNum() + ")");
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + caseDic.getExpert_photo(), mHolder.im_pic);
|
||||
if (!TextUtils.isEmpty(caseDic.getExpert_name())) {
|
||||
mHolder.case_name.setText(caseDic.getExpert_name());
|
||||
} else {
|
||||
mHolder.case_name.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getExpert_hospital_name())) {
|
||||
mHolder.case_hos.setText(caseDic.getExpert_hospital_name());
|
||||
} else {
|
||||
mHolder.case_hos.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getCreate_date())) {
|
||||
String date = caseDic.getCreate_date().substring(5, 16);
|
||||
mHolder.case_date.setText(date);
|
||||
} else {
|
||||
mHolder.case_date.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getDes())) {
|
||||
mHolder.case_mess.setText(caseDic.getDes());
|
||||
} else {
|
||||
mHolder.case_mess.setText("");
|
||||
}
|
||||
if (TextUtils.isEmpty(caseDic.getTag1()) && TextUtils.isEmpty(caseDic.getTag2())
|
||||
&& TextUtils.isEmpty(caseDic.getTag3())) {
|
||||
mHolder.lytag.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.lytag.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(caseDic.getTag1())) {
|
||||
mHolder.tag_1.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_1.setText(caseDic.getTag1());
|
||||
} else {
|
||||
mHolder.tag_1.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getTag2())) {
|
||||
mHolder.tag_2.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_2.setText(caseDic.getTag2());
|
||||
} else {
|
||||
mHolder.tag_2.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getTag3())) {
|
||||
mHolder.tag_3.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_3.setText(caseDic.getTag3());
|
||||
} else {
|
||||
mHolder.tag_3.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (caseDic.getPhoto().size() == 0) {
|
||||
mHolder.top_fl.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.top_fl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if("0".equals(caseDic.getExamine_status()))
|
||||
{
|
||||
mHolder.tv_bt.setText("待审核");
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.tv_bt.setText("编辑");
|
||||
mHolder.tv_bt.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,
|
||||
AddcasediscussionActivity.class);
|
||||
intent.setType("modify");
|
||||
intent.putExtra("caseRecord",
|
||||
(Serializable) casediscussion.get(position));
|
||||
LogUtil.i("casediscussion================="
|
||||
+ casediscussion.get(position));
|
||||
context.startActivityForResult(intent, 202);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
mHolder.case_rl.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mHolder.case_mess.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* mHolder.case_rl_tag.setOnClickListener(new OnClickListener() {
|
||||
*
|
||||
* @Override public void onClick(View v) { // TODO Auto-generated method
|
||||
* Intent intent = new Intent(context,CaseCussionDetailActivity.class);
|
||||
* intent.putExtra("uuid", casediscussion.get(position).uuid);
|
||||
* context.startActivity(intent); } });
|
||||
*/
|
||||
|
||||
mHolder.lytag.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
init(mHolder);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return casediscussion.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
public RadioGroup case_rl_tag;
|
||||
public RelativeLayout case_rl;
|
||||
public TextView tv_bt;
|
||||
public LinearLayout lytag;
|
||||
public ImageView im_pic;
|
||||
public TextView case_name;
|
||||
public TextView case_hos;
|
||||
public TextView case_date;
|
||||
public RelativeLayout top_fl;
|
||||
public ViewPager vp;
|
||||
public LinearLayout dots;
|
||||
public TextView tag_1;
|
||||
public TextView tag_2;
|
||||
public TextView tag_3;
|
||||
public TextView case_mess;
|
||||
public TextView comment_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能说明: 更新首页轮播图
|
||||
*
|
||||
* @param mHolder
|
||||
*/
|
||||
private void init(NewsViewHolder mHolder) {
|
||||
// 将要显示的图片放到list集合中
|
||||
imageSource = new ArrayList<ImageView>();
|
||||
imageSource.clear();
|
||||
mHolder.dots.removeAllViews();
|
||||
initImageResource(mHolder);
|
||||
// 为viewPager设置适配器
|
||||
myPagerAdapter = new MyPagerAdapter(context, imageSource);
|
||||
mHolder.vp.setAdapter(myPagerAdapter);
|
||||
myPagerAdapter.getPath(mImagePath);
|
||||
// 为viewPager添加监听器,该监听器用于当图片变换时,点也跟着变化
|
||||
MyPageChangeListener listener = new MyPageChangeListener(mHolder);
|
||||
mHolder.vp.setOnPageChangeListener(listener);
|
||||
// mHolder.vp.setOnTouchListener(new OnTouchListener() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// ViewPager vPager = (ViewPager) v;
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 监听ViewPager的变化
|
||||
private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
|
||||
public NewsViewHolder mHolder;
|
||||
private int currPage = 0;// 当前显示的页
|
||||
private int oldPage = 0;// 上一次显示的页
|
||||
|
||||
public MyPageChangeListener(NewsViewHolder mHolder) {
|
||||
this.mHolder = mHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当显示的图片发生变化之后
|
||||
// 设置标题
|
||||
mHolder.dots.getChildAt(position).setEnabled(true);
|
||||
mHolder.dots.getChildAt(oldPage).setEnabled(false);
|
||||
oldPage = position;
|
||||
currPage = position;
|
||||
}
|
||||
}
|
||||
|
||||
public void initImageResource(NewsViewHolder mHolder) {
|
||||
mImagePath = new ArrayList<String>();
|
||||
for (int i = 0; i < caseDic.getPhoto().size(); i++) {
|
||||
/**
|
||||
* 加载图片并放在集合中
|
||||
*/
|
||||
mImagePath.add(caseDic.getPhoto().get(i));
|
||||
ImageView imageview = new ImageView(context);
|
||||
imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.showImageOnLoading(R.drawable.home_scroll_default)
|
||||
.showImageOnFail(R.drawable.home_scroll_default)
|
||||
.showImageForEmptyUri(R.drawable.home_scroll_default)
|
||||
.cacheInMemory(true).cacheOnDisk(true)
|
||||
.imageScaleType(ImageScaleType.EXACTLY)// 设置图片以如何的编码方式显示在DisplayImageOptions选项中设置.imageScaleType(ImageScaleType.IN_SAMPLE_INT)或者imageScaleType(ImageScaleType.EXACTLY)
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型//
|
||||
.displayer(new FadeInBitmapDisplayer(100))// 淡入
|
||||
.build();
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + caseDic.getPhoto().get(i), imageview, options);
|
||||
imageSource.add(imageview);
|
||||
|
||||
if (imageSource.size() != 0 && imageSource.size() == 1) {
|
||||
mHolder.dots.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.dots.setVisibility(View.VISIBLE);
|
||||
}
|
||||
/**
|
||||
* 初始化小圆点并放在集合中
|
||||
*/
|
||||
ImageView viewPoint = new ImageView(context);
|
||||
viewPoint.setBackgroundResource(R.drawable.select_yes_no);
|
||||
if (i == 0) {
|
||||
viewPoint.setEnabled(true);
|
||||
} else {
|
||||
viewPoint.setEnabled(false);
|
||||
}
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
-2, -2);
|
||||
params.leftMargin = 20;
|
||||
mHolder.dots.addView(viewPoint, params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.Image;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.CaseCussionDetailActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CasediscussionBean.DataBean.Casediscussion;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* CasediscussionAdapter 病例讨论适配器
|
||||
*/
|
||||
public class CasediscussionAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
private List<Casediscussion> casediscussion;
|
||||
private ArrayList<ImageView> imageSource;
|
||||
private ArrayList<Image> imagelist;
|
||||
private MyPagerAdapter myPagerAdapter;
|
||||
private Casediscussion caseDic;
|
||||
List<String> mImagePath;
|
||||
|
||||
public CasediscussionAdapter(Context context,
|
||||
List<Casediscussion> casediscussion) {
|
||||
this.context = context;
|
||||
this.casediscussion = casediscussion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return casediscussion.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
NewsViewHolder mHolder;
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context, R.layout.item_case_discussion_big,
|
||||
null);
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.im_pic = convertView
|
||||
.findViewById(R.id.im_pic);
|
||||
mHolder.ra_all = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_all_delmess);
|
||||
mHolder.case_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_name);
|
||||
mHolder.case_hos = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_hos);
|
||||
mHolder.vp = (ViewPager) convertView.findViewById(R.id.vp);
|
||||
mHolder.dots = (LinearLayout) convertView
|
||||
.findViewById(R.id.ll_dots_item);
|
||||
mHolder.lytag = (LinearLayout) convertView
|
||||
.findViewById(R.id.ly_tag);
|
||||
mHolder.top_fl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.top_fl_case);
|
||||
mHolder.case_date = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_date);
|
||||
mHolder.tag_1 = (TextView) convertView.findViewById(R.id.tag_1);
|
||||
mHolder.tag_2 = (TextView) convertView.findViewById(R.id.tag_2);
|
||||
mHolder.tag_3 = (TextView) convertView.findViewById(R.id.tag_3);
|
||||
mHolder.case_mess = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_mess);
|
||||
mHolder.comment_num = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_num);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
// 给控件赋值.
|
||||
caseDic = casediscussion.get(position);
|
||||
mHolder.comment_num.setText("评论" + "(" + caseDic.getCommentNum() + ")");
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + caseDic.getExpert_photo(), mHolder.im_pic, ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
if (!TextUtils.isEmpty(caseDic.getExpert_name())) {
|
||||
mHolder.case_name.setText(caseDic.getExpert_name());
|
||||
} else {
|
||||
mHolder.case_name.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getExpert_hospital_name())) {
|
||||
mHolder.case_hos.setText(caseDic.getExpert_hospital_name());
|
||||
} else {
|
||||
mHolder.case_hos.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getCreate_date())) {
|
||||
String date = caseDic.getCreate_date().substring(5, 16);
|
||||
mHolder.case_date.setText(date);
|
||||
} else {
|
||||
mHolder.case_date.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getDes())) {
|
||||
mHolder.case_mess.setText(caseDic.getDes());
|
||||
} else {
|
||||
mHolder.case_mess.setText("");
|
||||
}
|
||||
if (TextUtils.isEmpty(caseDic.getTag1())
|
||||
&& TextUtils.isEmpty(caseDic.getTag2())
|
||||
&& TextUtils.isEmpty(caseDic.getTag3())) {
|
||||
mHolder.lytag.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.lytag.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(caseDic.getTag1())) {
|
||||
mHolder.tag_1.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_1.setText(caseDic.getTag1());
|
||||
} else {
|
||||
mHolder.tag_1.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getTag2())) {
|
||||
mHolder.tag_2.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_2.setText(caseDic.getTag2());
|
||||
} else {
|
||||
mHolder.tag_2.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.getTag3())) {
|
||||
mHolder.tag_3.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_3.setText(caseDic.getTag3());
|
||||
} else {
|
||||
mHolder.tag_3.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (caseDic.getPhoto().size() == 0) {
|
||||
mHolder.top_fl.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.top_fl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mHolder.case_mess.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mHolder.ra_all.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
mHolder.lytag.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,
|
||||
CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussion.get(position).getUuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
init(mHolder);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return casediscussion.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
public RelativeLayout ra_all;
|
||||
public LinearLayout lytag;
|
||||
public ImageView im_pic;
|
||||
public TextView case_name;
|
||||
public TextView case_hos;
|
||||
public TextView case_date;
|
||||
public RelativeLayout top_fl;
|
||||
public ViewPager vp;
|
||||
public LinearLayout dots;
|
||||
public TextView tag_1;
|
||||
public TextView tag_2;
|
||||
public TextView tag_3;
|
||||
public TextView case_mess;
|
||||
public TextView comment_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能说明: 更新首页轮播图
|
||||
*
|
||||
* @param mHolder
|
||||
*/
|
||||
private void init(NewsViewHolder mHolder) {
|
||||
// 将要显示的图片放到list集合中
|
||||
imageSource = new ArrayList<ImageView>();
|
||||
imageSource.clear();
|
||||
mHolder.dots.removeAllViews();
|
||||
initImageResource(mHolder);
|
||||
// 为viewPager设置适配器
|
||||
myPagerAdapter = new MyPagerAdapter(context, imageSource);
|
||||
mHolder.vp.setAdapter(myPagerAdapter);
|
||||
myPagerAdapter.getPath(mImagePath);
|
||||
// 为viewPager添加监听器,该监听器用于当图片变换时,点也跟着变化
|
||||
MyPageChangeListener listener = new MyPageChangeListener(mHolder);
|
||||
mHolder.vp.setOnPageChangeListener(listener);
|
||||
// mHolder.vp.setOnTouchListener(new OnTouchListener() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// ViewPager vPager = (ViewPager) v;
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 监听ViewPager的变化
|
||||
private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
|
||||
public NewsViewHolder mHolder;
|
||||
private int currPage = 0;// 当前显示的页
|
||||
private int oldPage = 0;// 上一次显示的页
|
||||
|
||||
public MyPageChangeListener(NewsViewHolder mHolder) {
|
||||
this.mHolder = mHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当显示的图片发生变化之后
|
||||
// 设置标题
|
||||
mHolder.dots.getChildAt(position).setEnabled(true);
|
||||
mHolder.dots.getChildAt(oldPage).setEnabled(false);
|
||||
oldPage = position;
|
||||
currPage = position;
|
||||
}
|
||||
}
|
||||
|
||||
public void initImageResource(NewsViewHolder mHolder) {
|
||||
mImagePath = new ArrayList<String>();
|
||||
for (int i = 0; i < caseDic.getPhoto().size(); i++) {
|
||||
/**
|
||||
* 加载图片并放在集合中
|
||||
*/
|
||||
mImagePath.add(caseDic.getPhoto().get(i));
|
||||
ImageView imageview = new ImageView(context);
|
||||
imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.showImageOnLoading(R.drawable.home_scroll_default)
|
||||
.showImageOnFail(R.drawable.home_scroll_default)
|
||||
.showImageForEmptyUri(R.drawable.home_scroll_default)
|
||||
.cacheInMemory(true).cacheOnDisk(true)
|
||||
.imageScaleType(ImageScaleType.EXACTLY)// 设置图片以如何的编码方式显示在DisplayImageOptions选项中设置.imageScaleType(ImageScaleType.IN_SAMPLE_INT)或者imageScaleType(ImageScaleType.EXACTLY)
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型//
|
||||
.displayer(new FadeInBitmapDisplayer(100))// 淡入
|
||||
.build();
|
||||
ImageLoader.getInstance()
|
||||
.displayImage(Url.urlHtml + caseDic.getPhoto().get(i),
|
||||
imageview, options);
|
||||
imageSource.add(imageview);
|
||||
/**
|
||||
* 初始化小圆点并放在集合中
|
||||
*/
|
||||
ImageView viewPoint = new ImageView(context);
|
||||
viewPoint.setBackgroundResource(R.drawable.select_yes_no);
|
||||
|
||||
if (imageSource.size() != 0 && imageSource.size() == 1) {
|
||||
mHolder.dots.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.dots.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
viewPoint.setEnabled(true);
|
||||
} else {
|
||||
viewPoint.setEnabled(false);
|
||||
}
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
-2, -2);
|
||||
params.leftMargin = 20;
|
||||
mHolder.dots.addView(viewPoint, params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.CaseCussionDetailActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CasediscussionCollentBean.CasediscussionCollent;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* CasediscussionAdapter 病例讨论适收藏病例适配器
|
||||
*/
|
||||
public class CasediscussionCollentAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
private List<CasediscussionCollent> casediscussionCollents ;
|
||||
private ArrayList<ImageView> imageSource;
|
||||
private MyPagerAdapter myPagerAdapter;
|
||||
private CasediscussionCollent caseDic;
|
||||
List<String> mImagePath;
|
||||
|
||||
public CasediscussionCollentAdapter(Context context,
|
||||
List<CasediscussionCollent> casediscussionCollents) {
|
||||
this.context = context;
|
||||
this.casediscussionCollents = casediscussionCollents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return casediscussionCollents.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
NewsViewHolder mHolder;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_case_discussion,
|
||||
null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_case_discussion_big,
|
||||
null);
|
||||
}
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.tv_case_num = convertView
|
||||
.findViewById(R.id.tv_case_num);
|
||||
|
||||
mHolder.im_pic = convertView
|
||||
.findViewById(R.id.im_pic);
|
||||
mHolder.ra_all = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_all_delmess);
|
||||
mHolder.case_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_name);
|
||||
mHolder.case_hos = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_hos);
|
||||
mHolder.vp = (ViewPager) convertView.findViewById(R.id.vp);
|
||||
mHolder.dots = (LinearLayout) convertView
|
||||
.findViewById(R.id.ll_dots_item);
|
||||
mHolder.lytag = (LinearLayout) convertView
|
||||
.findViewById(R.id.ly_tag);
|
||||
mHolder.top_fl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.top_fl_case);
|
||||
mHolder.case_date = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_date);
|
||||
mHolder.tag_1 = (TextView) convertView.findViewById(R.id.tag_1);
|
||||
mHolder.tag_2 = (TextView) convertView.findViewById(R.id.tag_2);
|
||||
mHolder.tag_3 = (TextView) convertView.findViewById(R.id.tag_3);
|
||||
mHolder.case_mess = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_mess);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
mHolder.tv_case_num.setVisibility(View.GONE);
|
||||
// 给控件赋值.
|
||||
caseDic = casediscussionCollents.get(position);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + caseDic.expert_photo, mHolder.im_pic);
|
||||
if (!TextUtils.isEmpty(caseDic.expert_name)) {
|
||||
mHolder.case_name.setText(caseDic.expert_name);
|
||||
} else {
|
||||
mHolder.case_name.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.expert_hospital_name)) {
|
||||
mHolder.case_hos.setText(caseDic.expert_hospital_name);
|
||||
} else {
|
||||
mHolder.case_hos.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.create_date)) {
|
||||
String date = caseDic.create_date.substring(5, 16);
|
||||
mHolder.case_date.setText(date);
|
||||
} else {
|
||||
mHolder.case_date.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(caseDic.des)) {
|
||||
mHolder.case_mess.setText(caseDic.des);
|
||||
} else {
|
||||
mHolder.case_mess.setText("");
|
||||
}
|
||||
if (TextUtils.isEmpty(caseDic.tag1) && TextUtils.isEmpty(caseDic.tag2)
|
||||
&& TextUtils.isEmpty(caseDic.tag3)) {
|
||||
mHolder.lytag.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.lytag.setVisibility(View.VISIBLE);
|
||||
if(!TextUtils.isEmpty(caseDic.tag1)){
|
||||
mHolder.tag_1.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_1.setText(caseDic.tag1);
|
||||
}else{
|
||||
mHolder.tag_1.setVisibility(View.GONE);
|
||||
}
|
||||
if(!TextUtils.isEmpty(caseDic.tag2)){
|
||||
mHolder.tag_2.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_2.setText(caseDic.tag2);
|
||||
}else{
|
||||
mHolder.tag_2.setVisibility(View.GONE);
|
||||
}
|
||||
if(!TextUtils.isEmpty(caseDic.tag3)){
|
||||
mHolder.tag_3.setVisibility(View.VISIBLE);
|
||||
mHolder.tag_3.setText(caseDic.tag3);
|
||||
}else{
|
||||
mHolder.tag_3.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (caseDic.photo.size() == 0) {
|
||||
mHolder.top_fl.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHolder.top_fl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mHolder.case_mess.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussionCollents.get(position).uuid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mHolder.ra_all.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussionCollents.get(position).uuid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
mHolder.lytag.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(context,CaseCussionDetailActivity.class);
|
||||
intent.putExtra("uuid", casediscussionCollents.get(position).uuid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
init(mHolder);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return casediscussionCollents.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
public RelativeLayout ra_all;
|
||||
public LinearLayout lytag;
|
||||
public ImageView im_pic;
|
||||
public TextView case_name;
|
||||
public TextView case_hos;
|
||||
public TextView case_date;
|
||||
public RelativeLayout top_fl;
|
||||
public ViewPager vp;
|
||||
public LinearLayout dots;
|
||||
public TextView tag_1;
|
||||
public TextView tag_2;
|
||||
public TextView tag_3;
|
||||
public TextView case_mess,tv_case_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能说明: 更新首页轮播图
|
||||
*
|
||||
* @param mHolder
|
||||
*/
|
||||
private void init(NewsViewHolder mHolder) {
|
||||
// 将要显示的图片放到list集合中
|
||||
imageSource = new ArrayList<ImageView>();
|
||||
imageSource.clear();
|
||||
mHolder.dots.removeAllViews();
|
||||
initImageResource(mHolder);
|
||||
// 为viewPager设置适配器
|
||||
myPagerAdapter = new MyPagerAdapter(context, imageSource);
|
||||
mHolder.vp.setAdapter(myPagerAdapter);
|
||||
myPagerAdapter.getPath(mImagePath);
|
||||
// 为viewPager添加监听器,该监听器用于当图片变换时,点也跟着变化
|
||||
MyPageChangeListener listener = new MyPageChangeListener(mHolder);
|
||||
mHolder.vp.setOnPageChangeListener(listener);
|
||||
// mHolder.vp.setOnTouchListener(new OnTouchListener() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// ViewPager vPager = (ViewPager) v;
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 监听ViewPager的变化
|
||||
private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
|
||||
public NewsViewHolder mHolder;
|
||||
private int currPage = 0;// 当前显示的页
|
||||
private int oldPage = 0;// 上一次显示的页
|
||||
|
||||
public MyPageChangeListener(NewsViewHolder mHolder) {
|
||||
this.mHolder = mHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当显示的图片发生变化之后
|
||||
// 设置标题
|
||||
mHolder.dots.getChildAt(position).setEnabled(true);
|
||||
mHolder.dots.getChildAt(oldPage).setEnabled(false);
|
||||
oldPage = position;
|
||||
currPage = position;
|
||||
}
|
||||
}
|
||||
|
||||
public void initImageResource(NewsViewHolder mHolder) {
|
||||
mImagePath = new ArrayList<String>();
|
||||
for (int i = 0; i < caseDic.photo.size(); i++) {
|
||||
/**
|
||||
* 加载图片并放在集合中
|
||||
*/
|
||||
mImagePath.add(caseDic.photo.get(i));
|
||||
ImageView imageview = new ImageView(context);
|
||||
imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.showImageOnLoading(R.drawable.home_scroll_default)
|
||||
.showImageOnFail(R.drawable.home_scroll_default)
|
||||
.showImageForEmptyUri(R.drawable.home_scroll_default)
|
||||
.cacheInMemory(true).cacheOnDisk(true)
|
||||
.imageScaleType(ImageScaleType.EXACTLY)// 设置图片以如何的编码方式显示在DisplayImageOptions选项中设置.imageScaleType(ImageScaleType.IN_SAMPLE_INT)或者imageScaleType(ImageScaleType.EXACTLY)
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型//
|
||||
.displayer(new FadeInBitmapDisplayer(100))// 淡入
|
||||
.build();
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + caseDic.photo.get(i), imageview, options);
|
||||
imageSource.add(imageview);
|
||||
/**
|
||||
* 初始化小圆点并放在集合中
|
||||
*/
|
||||
ImageView viewPoint = new ImageView(context);
|
||||
viewPoint.setBackgroundResource(R.drawable.select_yes_no);
|
||||
|
||||
if(imageSource.size() != 0 && imageSource.size() == 1){
|
||||
mHolder.dots.setVisibility(View.GONE);
|
||||
}else{
|
||||
mHolder.dots.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
viewPoint.setEnabled(true);
|
||||
} else {
|
||||
viewPoint.setEnabled(false);
|
||||
}
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
-2, -2);
|
||||
params.leftMargin = 20;
|
||||
mHolder.dots.addView(viewPoint, params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.HomeBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
|
||||
public class CellAdapter extends RecyclerView.Adapter<CellAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<HomeBean.IconBean> datas;
|
||||
|
||||
|
||||
public CellAdapter(Context context, List<HomeBean.IconBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.gongge_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.mImageView = (ImageView) view.findViewById(R.id.iv_g);
|
||||
viewHolder.mTextView = (TextView) view.findViewById(R.id.tv_g);
|
||||
viewHolder.mLayout = (RelativeLayout) view.findViewById(R.id.rl_g);
|
||||
viewHolder.iv_red=view.findViewById(R.id.iv_red);
|
||||
viewHolder.mLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_c);
|
||||
if(position==getItemCount()-1)
|
||||
{
|
||||
holder.mTextView.setText("更多");
|
||||
holder.iv_red.setVisibility(View.GONE);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
"",
|
||||
holder.mImageView,
|
||||
ImageOptions.getImageOptions(R.drawable.home_more));
|
||||
}
|
||||
else
|
||||
{
|
||||
if((datas.get(position).getRed()==null||!datas.get(position).getRed())
|
||||
&&(datas.get(position).getRed1()==null||!datas.get(position).getRed1()))
|
||||
{
|
||||
|
||||
holder.iv_red.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
holder.iv_red.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
holder.mTextView.setText(datas.get(position).getName());
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getImg(),
|
||||
holder.mImageView,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size()+1;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
private TextView mTextView;
|
||||
private ImageView mImageView,iv_red;
|
||||
private RelativeLayout mLayout;
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package cn.shangyu.gdxzExpert.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 java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.GethonorDetailBean;
|
||||
|
||||
public class CellHonorAdapter extends RecyclerView.Adapter<CellHonorAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<GethonorDetailBean.DataBean.HonorlistBean> datas;
|
||||
|
||||
|
||||
public CellHonorAdapter(Context context, List<GethonorDetailBean.DataBean.HonorlistBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_honor,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.mTextView = view.findViewById(R.id.tv_nick_name);
|
||||
|
||||
// viewHolder.mLayout.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
holder.mTextView.setText(datas.get(position).getNick_name());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
private TextView mTextView;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CollectNewsBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* Created by wangchengxin on 2019/2/25.
|
||||
*/
|
||||
|
||||
public class CollcetNewsAdataper extends BaseAdapter{
|
||||
List<CollectNewsBean.DataBean> DataList;
|
||||
|
||||
public CollcetNewsAdataper(List<CollectNewsBean.DataBean> dataList) {
|
||||
DataList = dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (DataList != null) {
|
||||
return DataList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return DataList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
CollcetNewsAdataper.ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_collect_video_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_collect_video);
|
||||
}
|
||||
vh = new CollcetNewsAdataper.ViewHolder();
|
||||
vh.mIv_imag = convertView
|
||||
.findViewById(R.id.iv_video_image);
|
||||
vh.mTv_content = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_title);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name);
|
||||
convertView.setTag(vh);
|
||||
|
||||
} else {
|
||||
vh = (CollcetNewsAdataper.ViewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
DataList.get(position).getImgpath(), vh.mIv_imag,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
vh.mTv_content.setText(DataList.get(position).getTitle());
|
||||
vh.mTv_name.setVisibility(View.GONE);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
public ImageView mIv_imag;
|
||||
public TextView mTv_content, mTv_name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CollectVideoBean.CollectVideo;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class CollectVideoAdapter extends BaseAdapter {
|
||||
List<CollectVideo> DataList;
|
||||
|
||||
public CollectVideoAdapter(List<CollectVideo> dataList) {
|
||||
DataList = dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (DataList != null) {
|
||||
return DataList.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return DataList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_collect_video_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_collect_video);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_imag = (ImageView) convertView
|
||||
.findViewById(R.id.iv_video_image);
|
||||
vh.mTv_content = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_title);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name);
|
||||
convertView.setTag(vh);
|
||||
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + DataList.get(position).getImgpath(), vh.mIv_imag,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
vh.mTv_content.setText(DataList.get(position).getTitle());
|
||||
vh.mTv_name.setText(DataList.get(position).getPublic_name());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
public ImageView mIv_imag;
|
||||
public TextView mTv_content, mTv_name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.GDEventDetailTopActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.SettingFeedbackActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CommentBean.CommentData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.MyTextView;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
|
||||
public class CommentAdapter extends BaseAdapter {
|
||||
List<CommentData> datas;
|
||||
GDEventDetailTopActivity mActivity;
|
||||
String uuid;
|
||||
ForegroundColorSpan redSpan, greySpan;
|
||||
|
||||
public CommentAdapter(GDEventDetailTopActivity mActivity, String uuid) {
|
||||
this.uuid = uuid;
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
redSpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
greySpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
|
||||
}
|
||||
|
||||
public void getDatas(List<CommentData> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (datas == null) {
|
||||
return 0;
|
||||
}
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_comment);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_delete = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_comment_delete);
|
||||
vh.mIv_tou = (ImageView) convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
vh.mTv_content = (MyTextView) convertView
|
||||
.findViewById(R.id.item_comment_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_time);
|
||||
vh.mTv_hf = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_hf);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getPhoto())
|
||||
&& !"null".equals(datas.get(position).getPhoto())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto(),
|
||||
vh.mIv_tou,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.mIv_tou.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
String content = datas.get(position).getComment().replaceAll(":", ":").replaceAll(" ", "")
|
||||
.replaceAll(" ", " ");
|
||||
if (content.contains("||")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.top_title));
|
||||
int i=content.indexOf("||");
|
||||
String sss=content.replaceAll("\\|\\|", "\n\n");
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(sss);
|
||||
builder.setSpan(greySpan, i, sss.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
// vh.mTv_content.setSpecifiedTextsColor(content, "||",
|
||||
// Color.parseColor("#FF0000"), builder);
|
||||
} else if (content.contains("回复") && content.contains(":")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.darkGrey));
|
||||
if (content.indexOf(":") - content.indexOf("回复") > 0) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(
|
||||
content);
|
||||
builder.setSpan(redSpan, 3, content.indexOf(":"),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
} else {
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
} else {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.darkGrey));
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
if (datas.get(position).getCreate_date().length() > 16) {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date()
|
||||
.substring(5, 16));
|
||||
} else {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date());
|
||||
}
|
||||
|
||||
vh.mTv_name.setText(datas.get(position).getRealname());
|
||||
if (!StringUtil.isEmpty(datas.get(position).getExpert_uuid())) {
|
||||
if (uuid.equals(datas.get(position).getExpert_uuid())) {
|
||||
vh.mIv_delete.setVisibility(View.VISIBLE);
|
||||
vh.mTv_hf.setVisibility(View.GONE);
|
||||
} else {
|
||||
vh.mIv_delete.setVisibility(View.GONE);
|
||||
vh.mTv_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (uuid.equals(datas.get(position).getUser_uuid())) {
|
||||
vh.mIv_delete.setVisibility(View.VISIBLE);
|
||||
vh.mTv_hf.setVisibility(View.GONE);
|
||||
} else {
|
||||
vh.mIv_delete.setVisibility(View.GONE);
|
||||
vh.mTv_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
vh.mIv_delete.setTag(position);
|
||||
vh.mIv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
delVisit((Integer) v.getTag());
|
||||
|
||||
}
|
||||
});
|
||||
vh.mTv_hf.setTag(position);
|
||||
vh.mTv_hf.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity,
|
||||
SettingFeedbackActivity.class);
|
||||
intent.setType("comment");
|
||||
intent.putExtra("name", datas.get((Integer) v.getTag())
|
||||
.getRealname());
|
||||
intent.putExtra("uuid", datas.get((Integer) v.getTag())
|
||||
.getExpert_uuid());
|
||||
intent.putExtra("content", datas.get((Integer) v.getTag())
|
||||
.getComment());
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_HF_COMMENT_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView mIv_tou, mIv_delete;
|
||||
TextView mTv_name, mTv_time, mTv_hf;
|
||||
MyTextView mTv_content;
|
||||
}
|
||||
|
||||
ECAlertDialog buildAlert;
|
||||
|
||||
public void delVisit(final int positions) {
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, "删除此评论?", "取消", "确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.Child;
|
||||
import cn.shangyu.gdxzExpert.bean.NewCommentBean;
|
||||
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
|
||||
|
||||
/**
|
||||
* Author: Moos
|
||||
* E-mail: moosphon@gmail.com
|
||||
* Date: 18/4/20.
|
||||
* Desc: 评论与回复列表的适配器
|
||||
*/
|
||||
|
||||
public class CommentExpandAdapter1 extends BaseExpandableListAdapter {
|
||||
private static final String TAG = "CommentExpandAdapter";
|
||||
private List<NewCommentBean> commentBeanList;
|
||||
private List<NewCommentBean> replyBeanList;
|
||||
private Context context;
|
||||
private int pageIndex = 1;
|
||||
private String puuid;
|
||||
ECAlertDialog buildAlert;
|
||||
public CommentExpandAdapter1(Context context, List<NewCommentBean> commentBeanList) {
|
||||
this.context = context;
|
||||
this.commentBeanList = commentBeanList;
|
||||
puuid = SharePrefUtil.getString(context, "uuid", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
return commentBeanList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int i) {
|
||||
if(commentBeanList.get(i).getChildList() == null){
|
||||
return 0;
|
||||
}else {
|
||||
return commentBeanList.get(i).getChildList().size()>0 ? commentBeanList.get(i).getChildList().size():0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGroup(int i) {
|
||||
return commentBeanList.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int i, int i1) {
|
||||
return commentBeanList.get(i).getChildList().get(i1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
return getCombinedChildId(groupPosition, childPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
boolean isLike = false;
|
||||
|
||||
@Override
|
||||
public View getGroupView(final int groupPosition, boolean isExpand, View convertView, ViewGroup viewGroup) {
|
||||
final GroupHolder groupHolder;
|
||||
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.item_comment_new_p, viewGroup, false);
|
||||
groupHolder = new GroupHolder(convertView);
|
||||
convertView.setTag(groupHolder);
|
||||
}else {
|
||||
groupHolder = (GroupHolder) convertView.getTag();
|
||||
}
|
||||
if(puuid.equals(commentBeanList.get(groupPosition).getUser_uuid()))
|
||||
{
|
||||
groupHolder.iv_item_comment_delete.setVisibility(View.VISIBLE);
|
||||
groupHolder.item_comment_hf.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupHolder.iv_item_comment_delete.setVisibility(View.GONE);
|
||||
groupHolder.item_comment_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(commentBeanList.get(groupPosition).getPhoto())) {
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.drawable.icon_touxiang_persion_gray_big);
|
||||
requestOptions.error(R.drawable.icon_touxiang_persion_gray_big);
|
||||
Glide.with(context).load(
|
||||
Url.urlHtml + commentBeanList.get(groupPosition).getPhoto()).apply(requestOptions).into(groupHolder.logo);
|
||||
}
|
||||
else
|
||||
{
|
||||
Glide.with(context).load(R.drawable.icon_touxiang_persion_gray_big).into(groupHolder.logo);
|
||||
}
|
||||
// if (!TextUtils.isEmpty(commentBeanList.get(groupPosition).getPhoto())) {
|
||||
// ImageLoader
|
||||
// .getInstance()
|
||||
// .displayImage(
|
||||
// Url.urlHtml + commentBeanList.get(groupPosition).getPhoto(),
|
||||
// groupHolder.logo,
|
||||
// ImageOptions
|
||||
// .getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
// }
|
||||
groupHolder.tv_name.setText(commentBeanList.get(groupPosition).getName());
|
||||
groupHolder.tv_time.setText(commentBeanList.get(groupPosition).getCreate_date());
|
||||
groupHolder.tv_content.setText(commentBeanList.get(groupPosition).getContent());
|
||||
groupHolder.iv_item_comment_delete.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
buildAlert = ECAlertDialog.buildAlert(
|
||||
context, "确定删除评论吗?", "取消",
|
||||
"确定", new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {// 取消
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
|
||||
}, new DialogInterface.OnClickListener() {// 确定
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("删除评论");
|
||||
buildAlert.setCanceledOnTouchOutside(false);
|
||||
buildAlert.show();
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(final int groupPosition, int childPosition, boolean b, View convertView, ViewGroup viewGroup) {
|
||||
final ChildHolder childHolder;
|
||||
if(convertView == null){
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.item_comment_new,viewGroup, false);
|
||||
childHolder = new ChildHolder(convertView);
|
||||
convertView.setTag(childHolder);
|
||||
}
|
||||
else {
|
||||
childHolder = (ChildHolder) convertView.getTag();
|
||||
}
|
||||
if(puuid.equals(commentBeanList.get(groupPosition).getUser_uuid()))
|
||||
{
|
||||
childHolder.iv_item_comment_delete.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
childHolder.iv_item_comment_delete.setVisibility(View.GONE);
|
||||
}
|
||||
// if (!TextUtils.isEmpty(commentBeanList.get(groupPosition).getChildList().get(childPosition).getPhoto())) {
|
||||
// ImageLoader
|
||||
// .getInstance()
|
||||
// .displayImage(
|
||||
// Url.urlHtml + commentBeanList.get(groupPosition).getChildList().get(childPosition).getPhoto(),
|
||||
// childHolder.logo,
|
||||
// ImageOptions
|
||||
// .getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
// }
|
||||
if (!TextUtils.isEmpty(commentBeanList.get(groupPosition).getChildList().get(childPosition).getPhoto())) {
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.drawable.icon_touxiang_persion_gray_big);
|
||||
requestOptions.error(R.drawable.icon_touxiang_persion_gray_big);
|
||||
Glide.with(context).
|
||||
load( Url.urlHtml + commentBeanList.get(groupPosition).getChildList().get(childPosition).getPhoto())
|
||||
.apply(requestOptions).into(childHolder.logo);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Glide.with(context).load(R.drawable.icon_touxiang_persion_gray_big).into( childHolder.logo);
|
||||
}
|
||||
String replyUser = commentBeanList.get(groupPosition).getChildList().get(childPosition).getName();
|
||||
if(!TextUtils.isEmpty(replyUser)){
|
||||
childHolder.tv_name.setText(replyUser + ":");
|
||||
}else {
|
||||
childHolder.tv_name.setText("无名"+":");
|
||||
}
|
||||
|
||||
childHolder.tv_content.setText(commentBeanList.get(groupPosition).getChildList().get(childPosition).getContent());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int i, int i1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private class GroupHolder{
|
||||
private ImageView logo;
|
||||
private ImageView iv_item_comment_delete;
|
||||
private TextView tv_name, tv_content, tv_time,item_comment_hf;
|
||||
// private ImageView iv_like;
|
||||
public GroupHolder(View view) {
|
||||
logo = view.findViewById(R.id.iv_patient_touxiang);
|
||||
tv_content = (TextView) view.findViewById(R.id.item_comment_content);
|
||||
tv_name = (TextView) view.findViewById(R.id.item_comment_name);
|
||||
tv_time = (TextView) view.findViewById(R.id.item_comment_time);
|
||||
item_comment_hf=view.findViewById(R.id.item_comment_hf);
|
||||
iv_item_comment_delete=view.findViewById(R.id.iv_item_comment_delete);
|
||||
// iv_like = (ImageView) view.findViewById(R.id.comment_item_like);
|
||||
}
|
||||
}
|
||||
|
||||
private class ChildHolder{
|
||||
private ImageView logo;
|
||||
private ImageView iv_item_comment_delete;
|
||||
private TextView tv_name, tv_content, tv_time;
|
||||
public ChildHolder(View view) {
|
||||
logo = view.findViewById(R.id.iv_patient_touxiang);
|
||||
tv_content = (TextView) view.findViewById(R.id.item_comment_content);
|
||||
tv_name = (TextView) view.findViewById(R.id.item_comment_name);
|
||||
tv_time = (TextView) view.findViewById(R.id.item_comment_time);
|
||||
iv_item_comment_delete=view.findViewById(R.id.iv_item_comment_delete);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* by moos on 2018/04/20
|
||||
* func:评论成功后插入一条数据
|
||||
* @param commentDetailBean 新的评论数据
|
||||
*/
|
||||
public void addTheCommentData(NewCommentBean commentDetailBean){
|
||||
if(commentDetailBean!=null){
|
||||
|
||||
commentBeanList.add(commentDetailBean);
|
||||
notifyDataSetChanged();
|
||||
}else {
|
||||
throw new IllegalArgumentException("评论数据为空!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* by moos on 2018/04/20
|
||||
* func:回复成功后插入一条数据
|
||||
* @param replyDetailBean 新的回复数据
|
||||
*/
|
||||
public void addTheReplyData(Child replyDetailBean, int groupPosition){
|
||||
if(replyDetailBean!=null){
|
||||
Log.e(TAG, "addTheReplyData: >>>>该刷新回复列表了:"+replyDetailBean.toString() );
|
||||
if(commentBeanList.get(groupPosition).getChildList() != null ){
|
||||
commentBeanList.get(groupPosition).getChildList().add(replyDetailBean);
|
||||
}else {
|
||||
List<Child> replyList = new ArrayList<>();
|
||||
replyList.add(replyDetailBean);
|
||||
commentBeanList.get(groupPosition).setChildList(replyList);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}else {
|
||||
throw new IllegalArgumentException("回复数据为空!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* by moos on 2018/04/20
|
||||
* func:添加和展示所有回复
|
||||
* @param replyBeanList 所有回复数据
|
||||
* @param groupPosition 当前的评论
|
||||
*/
|
||||
private void addReplyList(List<Child> replyBeanList, int groupPosition){
|
||||
if(commentBeanList.get(groupPosition).getChildList() != null ){
|
||||
commentBeanList.get(groupPosition).getChildList().clear();
|
||||
commentBeanList.get(groupPosition).getChildList().addAll(replyBeanList);
|
||||
}else {
|
||||
|
||||
commentBeanList.get(groupPosition).setChildList(replyBeanList);
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MailanListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* Created by wangchengxin on 2019/4/24.
|
||||
*/
|
||||
|
||||
public class CompletedListAdapter extends BaseAdapter {
|
||||
private ArrayList<MailanListBean.DataBean.ListBean> beans;
|
||||
private Context context;
|
||||
public CompletedListAdapter(ArrayList<MailanListBean.DataBean.ListBean> beans, FragmentActivity activity) {
|
||||
this.beans = beans;
|
||||
this.context =context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return beans.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return beans.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_completedlist);
|
||||
vh = new ViewHolder();
|
||||
vh.tv_topic = convertView.findViewById(R.id.tv_topic);
|
||||
vh.tv_type = convertView.findViewById(R.id.tv_type);
|
||||
vh.tv_time = convertView.findViewById(R.id.tv_time);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.tv_type.setText(beans.get(position).getType());
|
||||
vh.tv_topic.setText(beans.get(position).getTopic());
|
||||
vh.tv_time.setText(beans.get(position).getExpect_date().replace("-","."));
|
||||
return convertView;
|
||||
}
|
||||
public static class ViewHolder {
|
||||
|
||||
public TextView tv_type, tv_topic, tv_time,tv_infotime;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.gongwen.marqueen.MarqueeFactory;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.HomeBean;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.ecdemo.common.utils.CommomUtil.simpleDateFormat2;
|
||||
import static cn.shangyu.gdxzExpert.ecdemo.common.utils.CommomUtil.simpleDateFormat3;
|
||||
import static com.netease.nim.uikit.common.util.sys.TimeUtil.isSameDay;
|
||||
|
||||
public class ComplexViewMF extends MarqueeFactory<RelativeLayout, HomeBean.MettingBean> {
|
||||
private LayoutInflater inflater;
|
||||
|
||||
public ComplexViewMF(Context mContext) {
|
||||
super(mContext);
|
||||
inflater = LayoutInflater.from(mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelativeLayout generateMarqueeItemView(HomeBean.MettingBean data) {
|
||||
RelativeLayout mView = (RelativeLayout) inflater.inflate(R.layout.complex_view, null);
|
||||
|
||||
((TextView) mView.findViewById(R.id.tv_title)).setText(data.getTitle());
|
||||
switch (data.getState()+"")
|
||||
{
|
||||
case "1":
|
||||
if(isSameDay(new Date(Long.valueOf(data.getBegin_date_timestamp())),
|
||||
new Date(System.currentTimeMillis())))
|
||||
{
|
||||
((TextView) mView.findViewById(R.id.tv_time)).setText("开播"+simpleDateFormat3.format(new Date(Long.valueOf(data.getBegin_date_timestamp()))));
|
||||
Glide.with(mContext).load(R.drawable.sign).into((ImageView) mView.findViewById(R.id.im_s));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Glide.with(mContext).load(R.drawable.jing_sign).into((ImageView) mView.findViewById(R.id.im_s));
|
||||
((TextView) mView.findViewById(R.id.tv_time)).setText(simpleDateFormat2.format(new Date(Long.valueOf(data.getBegin_date_timestamp()))));
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
((TextView) mView.findViewById(R.id.tv_time)).setText("正在直播");
|
||||
Glide.with(mContext).load(R.drawable.sign).into((ImageView) mView.findViewById(R.id.im_s));
|
||||
break;
|
||||
default:
|
||||
Glide.with(mContext).load(R.drawable.jing_sign).into((ImageView) mView.findViewById(R.id.im_s));
|
||||
((TextView) mView.findViewById(R.id.tv_time)).setText(simpleDateFormat2.format(new Date(Long.valueOf(data.getBegin_date_timestamp()))));
|
||||
break;
|
||||
|
||||
}
|
||||
return mView;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MailanListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* Created by wangchengxin on 2019/4/24.
|
||||
*/
|
||||
|
||||
public class ConfirmedListAdapter extends BaseAdapter {
|
||||
private ArrayList<MailanListBean.DataBean.ListBean> beans;
|
||||
private Context context;
|
||||
public ConfirmedListAdapter(ArrayList<MailanListBean.DataBean.ListBean> beans, FragmentActivity activity) {
|
||||
this.beans = beans;
|
||||
this.context =context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return beans.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return beans.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_confirmedlist);
|
||||
vh = new ViewHolder();
|
||||
vh.tv_infotime = convertView.findViewById(R.id.tv_infotime);
|
||||
vh.tv_topic = convertView.findViewById(R.id.tv_topic);
|
||||
vh.tv_type = convertView.findViewById(R.id.tv_type);
|
||||
vh.tv_time = convertView.findViewById(R.id.tv_time);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.tv_type.setText(beans.get(position).getType());
|
||||
vh.tv_topic.setText(beans.get(position).getTopic());
|
||||
vh.tv_time.setText(beans.get(position).getExpect_date().replace("-","."));
|
||||
vh.tv_infotime.setText(beans.get(position).getCreate_date().replace("-","."));
|
||||
return convertView;
|
||||
}
|
||||
public static class ViewHolder {
|
||||
|
||||
public TextView tv_type, tv_topic, tv_time,tv_infotime;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.msg.MsgService;
|
||||
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.RecentContact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.PublicServiceDetailsActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.ConsultListBean.DataList;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.storage.PatientSqlManager;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
|
||||
/**
|
||||
* 公益咨询适配器
|
||||
*
|
||||
* 类名称:ConsultAdapter 类描述:TODO 创建人:苏三元 时间:2015-9-24 下午3:12:22
|
||||
* 版权:河南商宇科技有限公司--版权所有 (c) 2015
|
||||
*
|
||||
*/
|
||||
public class ConsultAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<DataList> DataList;
|
||||
// 是否是历史咨询
|
||||
private boolean isHistory = false;
|
||||
|
||||
/**
|
||||
* 公益咨询列表的适配器 创建一个新的实例 ConsultAdapter.
|
||||
*
|
||||
* @param context
|
||||
* @param isHistory
|
||||
* 是否是历史咨询
|
||||
* @param dataList
|
||||
* list数据
|
||||
*/
|
||||
public ConsultAdapter(Context context, boolean isHistory,
|
||||
ArrayList<DataList> dataList) {
|
||||
this.context = context;
|
||||
this.DataList = dataList;
|
||||
this.isHistory = isHistory;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return DataList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder mHolder = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_consuit_list1_big,
|
||||
null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_consuit_list1,
|
||||
null);
|
||||
}
|
||||
|
||||
mHolder = new Holder();
|
||||
// mHolder.ivImage = (ImageView) convertView
|
||||
// .findViewById(R.id.iv_patient_touxiang);
|
||||
// mHolder.prospect_iv = (ImageView) convertView
|
||||
// .findViewById(R.id.avatar_prospect_iv);
|
||||
// // mHolder.ivChat = (ImageView)
|
||||
// // convertView.findViewById(R.id.iv_chat);
|
||||
// mHolder.tvContent = (TextView) convertView
|
||||
// .findViewById(R.id.tv_patient_content);
|
||||
// mHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
|
||||
// mHolder.tv_date = (TextView) convertView.findViewById(R.id.tv_date);
|
||||
// mHolder.tipcnt_tv = (TextView) convertView
|
||||
// .findViewById(R.id.tipcnt_tv);
|
||||
// mHolder.tv_deaseName = (TextView) convertView
|
||||
// .findViewById(R.id.tv_dieasename);
|
||||
// // 新的公益咨询头像不可以有点击事件
|
||||
// if (isHistory) {
|
||||
// mHolder.ivImage.setFocusable(false);
|
||||
// mHolder.ivImage.setClickable(true);
|
||||
// mHolder.ivImage.setEnabled(true);
|
||||
// }
|
||||
|
||||
mHolder.tv_name = convertView.findViewById(R.id.tv_name);
|
||||
mHolder.tv_state = convertView.findViewById(R.id.tv_state);
|
||||
mHolder.tv_contant = convertView.findViewById(R.id.tv_contant);
|
||||
mHolder.tv_questiondetail = convertView.findViewById(R.id.tv_questiondetail);
|
||||
mHolder.tv_drungtype = convertView.findViewById(R.id.tv_drungtype);
|
||||
mHolder.tv_redpoint = convertView.findViewById(R.id.tv_redpoint);
|
||||
|
||||
|
||||
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
final DataList p = DataList.get(position);
|
||||
// 标题
|
||||
if (isHistory) {
|
||||
// if (3 == p.getState()) {
|
||||
// mHolder.tvContent.setTextColor(context.getResources().getColor(
|
||||
// R.color.gray));
|
||||
// mHolder.tv_name.setTextColor(context.getResources().getColor(
|
||||
// R.color.gray));
|
||||
// } else {
|
||||
// mHolder.tvContent.setTextColor(context.getResources().getColor(
|
||||
// R.color.text_color));
|
||||
// mHolder.tv_name.setTextColor(context.getResources().getColor(
|
||||
// R.color.text_color));
|
||||
// }
|
||||
// 未读提醒设置
|
||||
OnUpdateMsgUnreadCounts(mHolder, p.getPatientUuid(),p.getState());
|
||||
}
|
||||
// int sex = p.getSex();
|
||||
// String sex1;
|
||||
// if (sex==0){
|
||||
// sex1 = "男";
|
||||
// }else {
|
||||
// sex1 = "女";
|
||||
// }
|
||||
// String s = p.getBirthDate().split(" ")[0];
|
||||
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// int age = 0;
|
||||
// try {
|
||||
// Date parse = simpleDateFormat.parse(s);
|
||||
// age = DateGetAge.getAge(parse);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
if("0".equals(p.getUser_status()))
|
||||
{
|
||||
mHolder.tv_name.setText(context.getResources().getString(com.netease.nim.uikit.R.string.cancellation));
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.tv_name.setText(p.getRealName());
|
||||
}
|
||||
|
||||
String time = p.getCreateDate();
|
||||
if (!TextUtils.isEmpty(time) && time.length() > 16) {
|
||||
mHolder.tv_state.setText(time.substring(0, 16));
|
||||
} else if (!TextUtils.isEmpty(time)) {
|
||||
mHolder.tv_state.setText(time);
|
||||
}
|
||||
mHolder.tv_contant.setText(p.getContent());
|
||||
if (p.getDiseaseName().contains("甲、乙、丙、丁")) {
|
||||
mHolder.tv_drungtype.setText("肝炎");
|
||||
} else {
|
||||
mHolder.tv_drungtype.setText(p.getDiseaseName());
|
||||
}
|
||||
mHolder.tv_questiondetail.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String name = p.getRealName();
|
||||
String mobile = p.getMobile();
|
||||
String birthDate = p.getBirthDate();
|
||||
String content = p.getContent();
|
||||
String photo = p.getPhoto();
|
||||
int sex = p.getSex();
|
||||
String patientUuid = p.getPatientUuid();
|
||||
String consultUuid = p.getUuid();
|
||||
int state = p.getState();
|
||||
String diseaseName = p.getDiseaseName();
|
||||
String createDate = p.getCreateDate();
|
||||
|
||||
Intent intent = new Intent(context,
|
||||
PublicServiceDetailsActivity.class);
|
||||
intent.putExtra("realName", name);
|
||||
intent.putExtra("photo", photo);
|
||||
intent.putExtra("content", content);
|
||||
intent.putExtra("patientUuid", patientUuid);
|
||||
intent.putExtra("mobile", mobile);
|
||||
intent.putExtra("sex", sex);
|
||||
intent.putExtra("birthDate", birthDate);
|
||||
intent.putExtra("consultUuid", consultUuid);
|
||||
intent.putExtra("drungtype",diseaseName);
|
||||
intent.putExtra("createDate",createDate);
|
||||
intent.putExtra("isCloseAnswer", true);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
// mHolder.tvContent.setText(p.getContent());
|
||||
// String name = p.getRealName();
|
||||
// if (!TextUtils.isEmpty(name) && !"null".equals(name)) {
|
||||
// mHolder.tv_name.setText(name);
|
||||
// }
|
||||
// if (p.getDiseaseName().contains("甲、乙、丙、丁")) {
|
||||
// mHolder.tv_deaseName.setText("肝炎");
|
||||
// } else {
|
||||
// mHolder.tv_deaseName.setText(p.getDiseaseName());
|
||||
// }
|
||||
//
|
||||
// String time = p.getCreateDate();
|
||||
// if (!TextUtils.isEmpty(time) && time.length() > 16) {
|
||||
// mHolder.tv_date.setText(time.substring(0, 16));
|
||||
// } else if (!TextUtils.isEmpty(time)) {
|
||||
// mHolder.tv_date.setText(time);
|
||||
// }
|
||||
// String photo = p.getPhoto();
|
||||
// // 头像
|
||||
// if (!TextUtils.isEmpty(photo) && !"null".equals(photo)) {
|
||||
// ImageLoader
|
||||
// .getInstance()
|
||||
// .displayImage(
|
||||
// Url.urlHtml + photo,
|
||||
// mHolder.ivImage,
|
||||
// ImageOptions
|
||||
// .getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||||
// } else {
|
||||
// mHolder.ivImage
|
||||
// .setImageResource(R.drawable.icon_touxiang_persion_gray);
|
||||
// }
|
||||
//
|
||||
// // 新的公益咨询去掉头像点击事件
|
||||
// if (isHistory) {
|
||||
// mHolder.ivImage.setOnClickListener(new OnClickListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// String name = p.getRealName();
|
||||
// String mobile = p.getMobile();
|
||||
// String birthDate = p.getBirthDate();
|
||||
// String content = p.getContent();
|
||||
// String photo = p.getPhoto();
|
||||
// int sex = p.getSex();
|
||||
// String patientUuid = p.getPatientUuid();
|
||||
// String consultUuid = p.getUuid();
|
||||
// int state = p.getState();
|
||||
//
|
||||
// // 原来是启动患者详情页面
|
||||
// /*
|
||||
// * Intent intent = new Intent(context,
|
||||
// * PatientActivity.class); intent.putExtra("mobile",
|
||||
// * mobile); intent.putExtra("realName", name);
|
||||
// * intent.putExtra("patientUuid", patientUuid); if
|
||||
// * (isHistory) { intent.putExtra("state", state);
|
||||
// * intent.putExtra("isHistory", isHistory); }else{
|
||||
// * intent.putExtra("state", 0); } intent.putExtra("type",
|
||||
// * Constant.typeConsult); intent.putExtra("consultUuid",
|
||||
// * consultUuid); context.startActivity(intent);//启动患者详情界面 //
|
||||
// * ToastUtil.showMsgCustomToast(name+"的患者详情"+",联系:"+mobile);
|
||||
// */
|
||||
// // 启动公益咨询详情页面
|
||||
// Intent intent = new Intent(context,
|
||||
// PublicServiceDetailsActivity.class);
|
||||
// intent.putExtra("realName", name);
|
||||
// intent.putExtra("photo", photo);
|
||||
// intent.putExtra("content", content);
|
||||
// intent.putExtra("patientUuid", patientUuid);
|
||||
// intent.putExtra("mobile", mobile);
|
||||
// intent.putExtra("sex", sex);
|
||||
// intent.putExtra("birthDate", birthDate);
|
||||
// intent.putExtra("consultUuid", consultUuid);
|
||||
// intent.putExtra("isCloseAnswer", true);
|
||||
// context.startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
/*
|
||||
* mHolder.ivChat.setOnClickListener(new OnClickListener() {
|
||||
*
|
||||
* @Override public void onClick(View v) { // TODO Auto-generated method
|
||||
* stub // 云通讯扩展字段,传输内容及格式:send_type(发送方类型 1.患者 2.专家), //
|
||||
* receiver_type(接收方类型 1.患者 2.专家), // chat_from(来源1.公益咨询 2.随访 3.vip), //
|
||||
* chat_from_uuid(如果是公益咨询,则存uuid,否则0)
|
||||
* CCPAppManager.startChattingAction(context, p.patientUuid, p.realName,
|
||||
* "2,1,1,"+p.uuid, p.patientUuid); } });
|
||||
*/
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计未读消息数,以后要区分我的患者,朋友圈,公益咨询,这个有点复杂 OnUpdateMsgUnreadCounts
|
||||
*
|
||||
* void
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public void OnUpdateMsgUnreadCounts(Holder mViewHolder, String patientUuid,int state) {
|
||||
// int consultUnreadCount =
|
||||
// IMessageSqlManager.getUnByTypeUnreadCount(Constant.typeConsult);
|
||||
// int unreadCount = IMessageSqlManager.getBySessionIdUnreadCount(
|
||||
// Constant.Patient_AppKey + patientUuid, Constant.typeConsult);
|
||||
// LogUtil.i("UnreadCount="+unreadCount);
|
||||
int unreadCount=0;
|
||||
RecentContact recentContact= NIMClient.getService(MsgService.class).queryRecentContact(patientUuid.toLowerCase(), SessionTypeEnum.P2P);
|
||||
if (recentContact!=null&&!PatientSqlManager.isPatient(Constant.Patient_AppKey + recentContact.getContactId()))
|
||||
{
|
||||
unreadCount=recentContact.getUnreadCount();
|
||||
}
|
||||
|
||||
String msgPatientCount = unreadCount > 100 ? "..." : String
|
||||
.valueOf(unreadCount);
|
||||
mViewHolder.tv_redpoint.setText(msgPatientCount);
|
||||
if (unreadCount == 0||state==3) {
|
||||
mViewHolder.tv_redpoint.setVisibility(View.GONE);
|
||||
// mViewHolder.prospect_iv.setVisibility(View.GONE);
|
||||
} else {
|
||||
// mViewHolder.prospect_iv.setVisibility(View.GONE);
|
||||
mViewHolder.tv_redpoint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private class Holder {
|
||||
|
||||
public ImageView prospect_iv;
|
||||
public TextView tipcnt_tv;
|
||||
public TextView tv_date;
|
||||
public TextView tv_name;
|
||||
public TextView tv_redpoint;
|
||||
public TextView tv_state;
|
||||
public TextView tv_contant;
|
||||
public TextView tv_drungtype;
|
||||
public TextView tv_questiondetail;
|
||||
public ImageView ivImage;
|
||||
// public ImageView ivChat;
|
||||
public TextView tvContent;
|
||||
public TextView tv_deaseName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
|
||||
|
||||
public class CourseAdapter extends RecyclerView.Adapter<CourseAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.TypeBean> datas;
|
||||
|
||||
|
||||
public CourseAdapter(Context context, List<CourseIndexBean.TypeBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.course_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_c = view.findViewById(R.id.im_c);
|
||||
viewHolder.tv_c = view.findViewById(R.id.tv_c);
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels - CommonUtil.dip2px(context, 5)) / 4.5f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);平分屏幕宽度,显示4个半
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels ) / 4f),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
viewHolder.l_c.setLayoutParams(params);
|
||||
viewHolder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Glide.with(context).asBitmap().load(datas.get(position).getImg())
|
||||
.into(holder.im_c);
|
||||
// ImageLoader.getInstance().displayImage(
|
||||
// datas.get(position).getImg(),
|
||||
// holder.im_c,
|
||||
// ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
if("为您推荐".equals(datas.get(position).getName()))
|
||||
{
|
||||
holder.tv_c.setText("近期热门");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_c.setText(datas.get(position).getName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
ImageView im_c;
|
||||
TextView tv_c;
|
||||
LinearLayout l_c;
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
|
||||
|
||||
public class CourseFirstAdapter extends RecyclerView.Adapter<CourseFirstAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.TypeBean> datas;
|
||||
|
||||
|
||||
public CourseFirstAdapter(Context context, List<CourseIndexBean.TypeBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.course_first_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_c = view.findViewById(R.id.im_c);
|
||||
viewHolder.tv_c = view.findViewById(R.id.tv_c);
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels - CommonUtil.dip2px(context, 5)) / 4.5f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);平分屏幕宽度,显示4个半
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels ) / 3f),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
viewHolder.l_c.setLayoutParams(params);
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
Glide.with(context).asBitmap().load(datas.get(position).getImg())
|
||||
.into(holder.im_c);
|
||||
// ImageLoader.getInstance().displayImage(
|
||||
// datas.get(position).getImg(),
|
||||
// holder.im_c,
|
||||
// ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
holder.tv_c.setText(datas.get(position).getName());
|
||||
holder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
ImageView im_c;
|
||||
TextView tv_c;
|
||||
LinearLayout l_c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.StringUtil.fenGetYuanFormat1;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
||||
import cn.shangyu.gdxzExpert.widget.WordWrapView;
|
||||
|
||||
|
||||
public class CourseFirstListAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.VideoListBean> datas;
|
||||
|
||||
|
||||
public CourseFirstListAdapter(Context context, List<CourseIndexBean.VideoListBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View view, ViewGroup parent) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.course_jing_item2);
|
||||
holder = new ViewHolder();
|
||||
holder.im_j = view.findViewById(R.id.im_j);
|
||||
holder.tv_j = view.findViewById(R.id.tv_j);
|
||||
holder.tv_n=view.findViewById(R.id.tv_n);
|
||||
holder.l_tag=view.findViewById(R.id.l_tag);
|
||||
holder.tv_yh=view.findViewById(R.id.tv_yh);
|
||||
holder.tv_pr=view.findViewById(R.id.tv_pr);
|
||||
holder.tv_ppr=view.findViewById(R.id.tv_ppr);
|
||||
holder.tv_b=view.findViewById(R.id.tv_b);
|
||||
holder.tv_pr0=view.findViewById(R.id.tv_pr0);
|
||||
holder.r_h=view.findViewById(R.id.r_h);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else {
|
||||
holder = (ViewHolder) view.getTag();
|
||||
}
|
||||
if(position==getCount()-1)
|
||||
{
|
||||
holder.r_h.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.r_h.setVisibility(View.GONE);
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getIndex_img(),holder.im_j,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
// Glide.with(context).asBitmap().load()
|
||||
// .into();
|
||||
|
||||
|
||||
if(!StringUtil.isEmpty(datas.get(position).getStudy_num())&&Integer.valueOf(datas.get(position).getStudy_num())>4)
|
||||
{
|
||||
holder.tv_j.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_j.setVisibility(View.GONE);
|
||||
}
|
||||
holder.tv_j.setText(datas.get(position).getStudy_num()+"人学");
|
||||
holder.tv_n.setText(Html.fromHtml(datas.get(position).getTitle()));
|
||||
holder.l_tag.removeAllViews();
|
||||
if(!StringUtil.isEmpty(datas.get(position).getTags()))
|
||||
{
|
||||
String[]tags=datas.get(position).getTags().split(",");
|
||||
for(String tag:tags)
|
||||
{
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
// LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// params.setMargins(0, 0, 20, 0);
|
||||
TextView textView=new TextView(context);
|
||||
textView.setText(tag);
|
||||
textView.setTextColor(Color.parseColor("#666666"));
|
||||
textView.setTextSize(11);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setPadding(8,1,8,1);
|
||||
// textView.setLayoutParams(params);
|
||||
textView.setBackground(context.getResources().getDrawable(R.drawable.tag_bg));
|
||||
holder.l_tag.addView(textView);
|
||||
}
|
||||
}
|
||||
switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
|
||||
case "福利课堂":
|
||||
holder.tv_b.setText("奖励"+datas.get(position).getFuli_bon()+"积分");
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case "学完返现":
|
||||
if(StringUtil.isEmpty(datas.get(position).getBack_bon())||
|
||||
Integer.valueOf(datas.get(position).getBack_bon())<0.1)
|
||||
{
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
holder.tv_b.setText("返"+datas.get(position).getBack_bon()+"积分");
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
//
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
//// holder.tv_yh.setText("永久优惠");
|
||||
//// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
//// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
//// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
//// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
//
|
||||
// break;
|
||||
// case "2":
|
||||
//// holder.tv_yh.setText("限时优惠");
|
||||
//// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
{
|
||||
switch (datas.get(position).getDiscount_type())
|
||||
{
|
||||
case "0":
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
break;
|
||||
case "1":
|
||||
holder.tv_yh.setText("永久优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
|
||||
break;
|
||||
case "2":
|
||||
holder.tv_yh.setText("限时优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public class ViewHolder
|
||||
{
|
||||
CircularRectangle im_j;
|
||||
TextView tv_j;
|
||||
TextView tv_n;
|
||||
WordWrapView l_tag;
|
||||
TextView tv_yh;
|
||||
TextView tv_pr,tv_pr0;
|
||||
TextView tv_ppr;
|
||||
TextView tv_b;
|
||||
RelativeLayout r_h;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
||||
|
||||
|
||||
public class CourseFuAdapter extends RecyclerView.Adapter<CourseFuAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.VideoListBean> datas;
|
||||
|
||||
|
||||
public CourseFuAdapter(Context context, List<CourseIndexBean.VideoListBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.course_item_big,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_c = view.findViewById(R.id.im_c);
|
||||
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels - CommonUtil.dip2px(context, 5)) / 4.5f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);平分屏幕宽度,显示4个半
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels- CommonUtil.dip2px(context, 10) ) / 1.8f),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
viewHolder.l_c.setLayoutParams(params);
|
||||
viewHolder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_c);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getIndex_img(),
|
||||
holder.im_c,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
CircularRectangle im_c;
|
||||
LinearLayout l_c;
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MyCourseBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
||||
import cn.shangyu.gdxzExpert.widget.WordWrapView;
|
||||
|
||||
public class CourseMyListAdapter extends BaseAdapter {
|
||||
private Context context;
|
||||
private List<MyCourseBean.MyBean> datas;
|
||||
|
||||
|
||||
public CourseMyListAdapter(Context context, List<MyCourseBean.MyBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View view, ViewGroup parent) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.course_jing_item);
|
||||
holder = new ViewHolder();
|
||||
holder.im_j = view.findViewById(R.id.im_j);
|
||||
holder.tv_j = view.findViewById(R.id.tv_j);
|
||||
holder.tv_n=view.findViewById(R.id.tv_n);
|
||||
holder.l_tag=view.findViewById(R.id.l_tag);
|
||||
holder.tv_yh=view.findViewById(R.id.tv_yh);
|
||||
holder.tv_pr=view.findViewById(R.id.tv_pr);
|
||||
holder.tv_ppr=view.findViewById(R.id.tv_ppr);
|
||||
holder.tv_b=view.findViewById(R.id.tv_b);
|
||||
holder.tv_pr0=view.findViewById(R.id.tv_pr0);
|
||||
holder.r_h=view.findViewById(R.id.r_h);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else {
|
||||
holder = (ViewHolder) view.getTag();
|
||||
}
|
||||
if(position==getCount()-1)
|
||||
{
|
||||
holder.r_h.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.r_h.setVisibility(View.GONE);
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getExcellencourse_index_img(),holder.im_j,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
// Glide.with(context).asBitmap().load()
|
||||
// .into();
|
||||
|
||||
// if(Integer.valueOf(datas.get(position).getStudy_num())>4)
|
||||
// {
|
||||
// holder.tv_j.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// holder.tv_j.setVisibility(View.GONE);
|
||||
// }
|
||||
// holder.tv_j.setText(datas.get(position).getStudy_num()+"人学");
|
||||
holder.tv_n.setText(Html.fromHtml(datas.get(position).getExcellencourse_title()));
|
||||
holder.l_tag.removeAllViews();
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getTags()))
|
||||
// {
|
||||
// String[]tags=datas.get(position).getTags().split(",");
|
||||
// for(String tag:tags)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
if(datas.get(position).getExcellencourse_video_num().equals(datas.get(position).getExcellencourse_upload_num()))
|
||||
{
|
||||
if(datas.get(position).getExcellencourse_video_num().equals(datas.get(position).getStudy_num()))
|
||||
{
|
||||
holder.tv_pr.setText(
|
||||
datas.get(position).getExcellencourse_video_num()+"节•"
|
||||
+"已完结•"+"已学完");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(
|
||||
datas.get(position).getExcellencourse_video_num()+"节•"
|
||||
+"已完结•"+"已学"+datas.get(position).getStudy_num()+"节");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(
|
||||
datas.get(position).getExcellencourse_video_num()+"节•"+
|
||||
"更新"+datas.get(position).getExcellencourse_upload_num()+"节•"+"已学"+datas.get(position).getStudy_num()+"节");
|
||||
}
|
||||
holder.tv_pr.setTextColor(Color.parseColor("#666666"));
|
||||
holder.tv_pr.setTextSize(15);
|
||||
switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
case "课程推荐":
|
||||
case "为您推荐":
|
||||
case "精品小课":
|
||||
break;
|
||||
case "福利课堂":
|
||||
case "学完返现":
|
||||
TextView textView=new TextView(context);
|
||||
textView.setText(datas.get(position).getSpecial_type_name());
|
||||
textView.setTextColor(Color.parseColor("#ffffff"));
|
||||
textView.setTextSize(11);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setBackground(context.getResources().getDrawable(R.drawable.xianshi));
|
||||
textView.setPadding(8,0,8,0);
|
||||
holder.l_tag.addView(textView);
|
||||
break;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public class ViewHolder
|
||||
{
|
||||
CircularRectangle im_j;
|
||||
TextView tv_j;
|
||||
TextView tv_n;
|
||||
WordWrapView l_tag;
|
||||
TextView tv_yh;
|
||||
TextView tv_pr,tv_pr0;
|
||||
TextView tv_ppr;
|
||||
TextView tv_b;
|
||||
RelativeLayout r_h;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
||||
import cn.shangyu.gdxzExpert.widget.WordWrapView;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.StringUtil.fenGetYuanFormat1;
|
||||
|
||||
|
||||
public class CourseTuiAdapter extends RecyclerView.Adapter<CourseTuiAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.VideoListBean> datas;
|
||||
|
||||
|
||||
public CourseTuiAdapter(Context context, List<CourseIndexBean.VideoListBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.course_jing_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_j = view.findViewById(R.id.im_j);
|
||||
viewHolder.tv_j = view.findViewById(R.id.tv_j);
|
||||
viewHolder.tv_n=view.findViewById(R.id.tv_n);
|
||||
viewHolder.l_tag=view.findViewById(R.id.l_tag);
|
||||
viewHolder.tv_yh=view.findViewById(R.id.tv_yh);
|
||||
viewHolder.tv_pr=view.findViewById(R.id.tv_pr);
|
||||
viewHolder.tv_ppr=view.findViewById(R.id.tv_ppr);
|
||||
viewHolder.tv_b=view.findViewById(R.id.tv_b);
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
viewHolder.tv_pr0=view.findViewById(R.id.tv_pr0);
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_j);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getIndex_img(),
|
||||
holder.im_j,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
if(!StringUtil.isEmpty(datas.get(position).getStudy_num())&&Integer.valueOf(datas.get(position).getStudy_num())>4)
|
||||
{
|
||||
holder.tv_j.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_j.setVisibility(View.GONE);
|
||||
}
|
||||
holder.tv_j.setText(datas.get(position).getStudy_num()+"人学");
|
||||
holder.tv_n.setText(Html.fromHtml(datas.get(position).getTitle()));
|
||||
holder.l_tag.removeAllViews();
|
||||
if(!StringUtil.isEmpty(datas.get(position).getTags()))
|
||||
{
|
||||
String[]tags=datas.get(position).getTags().split(",");
|
||||
for(String tag:tags)
|
||||
{
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
// LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// params.setMargins(0, 0, 20, 0);
|
||||
TextView textView=new TextView(context);
|
||||
textView.setText(tag);
|
||||
textView.setTextColor(Color.parseColor("#666666"));
|
||||
textView.setTextSize(11);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setPadding(8,1,8,1);
|
||||
textView.setBackground(context.getResources().getDrawable(R.drawable.tag_bg));
|
||||
// textView.setLayoutParams(params);
|
||||
// LinearLayout ll = new LinearLayout(context); // + 增加行
|
||||
// ll.setOrientation(LinearLayout.VERTICAL); // + 增加行
|
||||
// ll.addView(textView);
|
||||
holder.l_tag.addView(textView);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
//
|
||||
// case "福利课堂":
|
||||
// holder.tv_yh.setText("奖励"+datas.get(position).getFuli_bon()+"积分");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr.setVisibility(View.GONE);
|
||||
// holder.tv_pr0.setVisibility(View.VISIBLE);
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
// {
|
||||
// holder.tv_pr0.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// }
|
||||
// else
|
||||
// holder.tv_pr0.setText("免费");
|
||||
//
|
||||
// break;
|
||||
// case "学完返现":
|
||||
// if(StringUtil.isEmpty(datas.get(position).getBack_bon())||
|
||||
// Integer.valueOf(datas.get(position).getBack_bon())<0.1)
|
||||
// {
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// holder.tv_yh.setText("返"+datas.get(position).getBack_bon()+"积分");
|
||||
//// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr.setVisibility(View.GONE);
|
||||
// holder.tv_pr0.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr0.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// break;
|
||||
// default:
|
||||
//// case "为您推荐":
|
||||
//// case "精品小课":
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
// {
|
||||
// holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
//
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
|
||||
case "福利课堂":
|
||||
holder.tv_b.setText("奖励"+datas.get(position).getFuli_bon()+"积分");
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case "学完返现":
|
||||
if(StringUtil.isEmpty(datas.get(position).getBack_bon())||
|
||||
Integer.valueOf(datas.get(position).getBack_bon())<0.1)
|
||||
{
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
holder.tv_b.setText("返"+datas.get(position).getBack_bon()+"积分");
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
//
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
{
|
||||
switch (datas.get(position).getDiscount_type())
|
||||
{
|
||||
case "0":
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
break;
|
||||
case "1":
|
||||
holder.tv_yh.setText("永久优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
|
||||
break;
|
||||
case "2":
|
||||
holder.tv_yh.setText("限时优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
holder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
CircularRectangle im_j;
|
||||
TextView tv_j;
|
||||
TextView tv_n;
|
||||
WordWrapView l_tag;
|
||||
RelativeLayout l_c;
|
||||
TextView tv_yh;
|
||||
TextView tv_pr,tv_pr0;
|
||||
TextView tv_ppr;
|
||||
TextView tv_b;
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CourseIndexBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
||||
import cn.shangyu.gdxzExpert.widget.WordWrapView;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.StringUtil.fenGetYuanFormat1;
|
||||
|
||||
|
||||
public class CourseTuiAdapter1 extends RecyclerView.Adapter<CourseTuiAdapter1.ViewHolder> {
|
||||
private Context context;
|
||||
private List<CourseIndexBean.VideoListBean> datas;
|
||||
|
||||
|
||||
public CourseTuiAdapter1(Context context, List<CourseIndexBean.VideoListBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.course_jing_item3,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_j = view.findViewById(R.id.im_j);
|
||||
viewHolder.tv_j = view.findViewById(R.id.tv_j);
|
||||
viewHolder.tv_n=view.findViewById(R.id.tv_n);
|
||||
viewHolder.l_tag=view.findViewById(R.id.l_tag);
|
||||
viewHolder.tv_yh=view.findViewById(R.id.tv_yh);
|
||||
viewHolder.tv_pr=view.findViewById(R.id.tv_pr);
|
||||
viewHolder.tv_ppr=view.findViewById(R.id.tv_ppr);
|
||||
viewHolder.tv_b=view.findViewById(R.id.tv_b);
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
viewHolder.tv_pr0=view.findViewById(R.id.tv_pr0);
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_j);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getIndex_img(),
|
||||
holder.im_j,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
if(!StringUtil.isEmpty(datas.get(position).getStudy_num())&&Integer.valueOf(datas.get(position).getStudy_num())>4)
|
||||
{
|
||||
holder.tv_j.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_j.setVisibility(View.GONE);
|
||||
}
|
||||
holder.tv_j.setText(datas.get(position).getStudy_num()+"人学");
|
||||
holder.tv_n.setText(Html.fromHtml(datas.get(position).getTitle()));
|
||||
holder.l_tag.removeAllViews();
|
||||
if(!StringUtil.isEmpty(datas.get(position).getTags()))
|
||||
{
|
||||
String[]tags=datas.get(position).getTags().split(",");
|
||||
for(String tag:tags)
|
||||
{
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
// LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// params.setMargins(0, 0, 20, 0);
|
||||
TextView textView=new TextView(context);
|
||||
textView.setText(tag);
|
||||
textView.setTextColor(Color.parseColor("#666666"));
|
||||
textView.setTextSize(11);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setPadding(8,1,8,1);
|
||||
textView.setBackground(context.getResources().getDrawable(R.drawable.tag_bg));
|
||||
// textView.setLayoutParams(params);
|
||||
holder.l_tag.addView(textView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
//
|
||||
// case "福利课堂":
|
||||
// holder.tv_yh.setText("奖励"+datas.get(position).getFuli_bon()+"积分");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr.setVisibility(View.GONE);
|
||||
// holder.tv_pr0.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr0.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
//
|
||||
//
|
||||
// break;
|
||||
// case "学完返现":
|
||||
// if(StringUtil.isEmpty(datas.get(position).getBack_bon())||
|
||||
// Integer.valueOf(datas.get(position).getBack_bon())<0.1)
|
||||
// {
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// holder.tv_yh.setText("返"+datas.get(position).getBack_bon()+"积分");
|
||||
//// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr.setVisibility(View.GONE);
|
||||
// holder.tv_pr0.setVisibility(View.VISIBLE);
|
||||
// holder.tv_pr0.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// break;
|
||||
// default:
|
||||
//// case "为您推荐":
|
||||
//// case "精品小课":
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
// {
|
||||
// holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
//
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat(datas.get(position).getAccount()));
|
||||
//
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
switch (datas.get(position).getSpecial_type_name()+"") {
|
||||
|
||||
case "福利课堂":
|
||||
holder.tv_b.setText("奖励"+datas.get(position).getFuli_bon()+"积分");
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case "学完返现":
|
||||
if(StringUtil.isEmpty(datas.get(position).getBack_bon())||
|
||||
Integer.valueOf(datas.get(position).getBack_bon())<0.1)
|
||||
{
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
holder.tv_b.setText("返"+datas.get(position).getBack_bon()+"积分");
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
// {
|
||||
// switch (datas.get(position).getDiscount_type())
|
||||
// {
|
||||
// case "0":
|
||||
// holder.tv_yh.setVisibility(View.GONE);
|
||||
// holder.tv_ppr.setVisibility(View.GONE);
|
||||
// break;
|
||||
// case "1":
|
||||
// holder.tv_yh.setText("永久优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
//
|
||||
// break;
|
||||
// case "2":
|
||||
// holder.tv_yh.setText("限时优惠");
|
||||
// holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
// holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
// holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
holder.tv_b.setVisibility(View.GONE);
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_price()))
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getDiscount_price()));
|
||||
if(!StringUtil.isEmpty(datas.get(position).getDiscount_type()))
|
||||
{
|
||||
switch (datas.get(position).getDiscount_type())
|
||||
{
|
||||
case "0":
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
break;
|
||||
case "1":
|
||||
holder.tv_yh.setText("永久优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
|
||||
break;
|
||||
case "2":
|
||||
holder.tv_yh.setText("限时优惠");
|
||||
holder.tv_yh.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_ppr.setVisibility(View.VISIBLE);
|
||||
holder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_pr.setText(fenGetYuanFormat1(datas.get(position).getAccount()));
|
||||
holder.tv_yh.setVisibility(View.GONE);
|
||||
holder.tv_ppr.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
holder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
CircularRectangle im_j;
|
||||
TextView tv_j;
|
||||
TextView tv_n;
|
||||
WordWrapView l_tag;
|
||||
RelativeLayout l_c;
|
||||
TextView tv_yh;
|
||||
TextView tv_pr,tv_pr0;
|
||||
TextView tv_ppr;
|
||||
TextView tv_b;
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.CaseCussionDetailActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.SettingFeedbackActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CommentBean.CommentData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.MyTextView;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
|
||||
public class DetailCommentAdapter extends BaseAdapter {
|
||||
List<CommentData> datas;
|
||||
CaseCussionDetailActivity mActivity;
|
||||
String uuid;
|
||||
ForegroundColorSpan redSpan, greySpan;
|
||||
|
||||
public DetailCommentAdapter(CaseCussionDetailActivity mActivity, String uuid) {
|
||||
this.uuid = uuid;
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
redSpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
greySpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
// redSpan2 = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
// R.color.red));
|
||||
}
|
||||
|
||||
public void getDatas(List<CommentData> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (datas == null) {
|
||||
return 0;
|
||||
}
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_comment);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_delete = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_comment_delete);
|
||||
vh.mIv_tou = (ImageView) convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
vh.mTv_content = (MyTextView) convertView
|
||||
.findViewById(R.id.item_comment_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_time);
|
||||
vh.mTv_hf = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_hf);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getPhoto())
|
||||
&& !"null".equals(datas.get(position).getPhoto())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto(),
|
||||
vh.mIv_tou,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.mIv_tou.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
|
||||
String content = datas.get(position).getComment().replaceAll(":", ":").replaceAll(" ", "")
|
||||
.replaceAll(" ", " ");
|
||||
if (content.contains("||")) {
|
||||
// SpannableStringBuilder builder = new SpannableStringBuilder(content);
|
||||
// builder.setSpan(greySpan, content.indexOf("||"), content.length(),
|
||||
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// // vh.mTv_content.setText(builder);
|
||||
// // builder.setSpan(redSpan2, content.indexOf("||"),
|
||||
// // content.indexOf("||") + 2,
|
||||
// // Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// vh.mTv_content.setSpecifiedTextsColor(content, "||",
|
||||
// Color.parseColor("#FF0000"), builder);
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.top_title));
|
||||
int i=content.indexOf("||");
|
||||
String sss=content.replaceAll("\\|\\|", "\n\n");
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(sss);
|
||||
builder.setSpan(greySpan, i, sss.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
|
||||
} else if (content.contains("回复") && content.contains(":")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.darkGrey));
|
||||
if (content.indexOf(":") - content.indexOf("回复") > 0) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(
|
||||
content);
|
||||
builder.setSpan(redSpan, 3, content.indexOf(":"),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
} else {
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
} else {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(R.color.darkGrey));
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
if (datas.get(position).getCreate_date().length() > 16) {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date()
|
||||
.substring(5, 16));
|
||||
} else {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date());
|
||||
}
|
||||
|
||||
vh.mTv_name.setText(datas.get(position).getRealname());
|
||||
if (uuid.equals(datas.get(position).getExpert_uuid())) {
|
||||
vh.mIv_delete.setVisibility(View.VISIBLE);
|
||||
vh.mTv_hf.setVisibility(View.GONE);
|
||||
} else {
|
||||
vh.mIv_delete.setVisibility(View.GONE);
|
||||
vh.mTv_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
vh.mIv_delete.setTag(position);
|
||||
vh.mIv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
delVisit((Integer) v.getTag());
|
||||
|
||||
}
|
||||
});
|
||||
vh.mTv_hf.setTag(position);
|
||||
vh.mTv_hf.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity,
|
||||
SettingFeedbackActivity.class);
|
||||
intent.setType("commentY");
|
||||
intent.putExtra("name", datas.get((Integer) v.getTag())
|
||||
.getRealname());
|
||||
intent.putExtra("uuid", datas.get((Integer) v.getTag())
|
||||
.getExpert_uuid());
|
||||
intent.putExtra("content", datas.get((Integer) v.getTag())
|
||||
.getComment());
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_HF_COMMENT_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView mIv_tou, mIv_delete;
|
||||
TextView mTv_name, mTv_time, mTv_hf;
|
||||
MyTextView mTv_content;
|
||||
}
|
||||
|
||||
ECAlertDialog buildAlert;
|
||||
|
||||
public void delVisit(final int positions) {
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, "删除此评论?", "取消", "确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
//mActivity.getDeleteComment(positions);
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LibraryListBean.LibraryData;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我的图书馆(下载和收藏页面)适配器
|
||||
*/
|
||||
public class DownloadCollectAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<LibraryData> mList;
|
||||
|
||||
public DownloadCollectAdapter(Context context, List<LibraryData> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext, R.layout.fragment_library_list_item, null);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
|
||||
final LibraryData data = mList.get(position);
|
||||
holder.name.setText(data.name);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
TextView name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.model.DownloadModel;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* 功能说明:英文杂志下载适配器
|
||||
*/
|
||||
@SuppressLint("ResourceAsColor")
|
||||
public class ENDownloadAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<DownloadModel> mList;
|
||||
private int[] progress;
|
||||
public ENDownloadAdapter(Context context, ArrayList<DownloadModel> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
this.progress = new int[mList.size()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
final Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(mContext, R.layout.activity_endownload_list_item_big, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(mContext, R.layout.activity_endownload_list_item, null);
|
||||
}
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_en_name);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.item_en_date);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
final DownloadModel data = mList.get(position);
|
||||
holder.name.setText(data.getTitle());
|
||||
holder.date.setText(data.getTime());
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
public TextView date;
|
||||
public TextView name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* downloadPdf
|
||||
* @param position
|
||||
* @param holder
|
||||
*
|
||||
* @param path
|
||||
* void
|
||||
* @param title
|
||||
*//*
|
||||
private String filePath = Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
+ "/gdxzExpert/download/治疗指南/";
|
||||
private HttpHandler<File> hand;
|
||||
private int[] progress;
|
||||
private ArrayList<String> currentprogress = new ArrayList<String>();
|
||||
|
||||
|
||||
protected void downloadPdf(String url, final String name, final int position, final Holder holder) {
|
||||
// TODO Auto-generated method stub
|
||||
// 下载pdf
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
// sdcard存在
|
||||
HttpUtils http = new HttpUtils();
|
||||
final String path = filePath + name + ".pdf";
|
||||
//下载的路径,及app安装包的命名
|
||||
//***************************************************
|
||||
hand = http.download(url, path,
|
||||
false, // 如果目标文件存在,接着未完成的部分继续下载。服务器不支持RANGE时将从新下载。
|
||||
true, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。
|
||||
new RequestCallBack<File>() {
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
ToastUtil.showToast("开始下载"+name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoading(long total, long current,
|
||||
boolean isUploading) {
|
||||
// progress[position] = (int) (current * 100 / total);
|
||||
// currentprogress.add(position, progress[position]+"");
|
||||
// LogUtil.i(name+"下载进度:"+progress[position]);
|
||||
|
||||
//插入
|
||||
// DownloadModel downloadModel = new DownloadModel(mList.get(position).uuid);
|
||||
// downloadModel.setTitle(mList.get(position).title);
|
||||
// downloadModel.setTime(mList.get(position).updateTime);
|
||||
// downloadModel.setPath(mList.get(position).path);
|
||||
// downloadModel.setFilePath(path);
|
||||
// downloadModel.setFilePath(path);
|
||||
// downloadModel.setFileFormat(".pdf");
|
||||
// downloadModel.setState(1);// 0未下载,1下载中,2已下载
|
||||
// BookDownloadSqlManager.insertDownload(downloadModel);
|
||||
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
// holder.tv_down.setText(progress[position]+"%");
|
||||
holder.tv_down.setText("下载中");
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<File> responseInfo) {
|
||||
ToastUtil.showToast(name+"下载完成!");
|
||||
//插入
|
||||
DownloadModel downloadModel = new DownloadModel(mList.get(position).getUuid());
|
||||
downloadModel.setFilePath(path);
|
||||
downloadModel.setState(2);// 0未下载,1下载中,2已下载
|
||||
ENBookDownloadSqlManager.insertDownload(downloadModel);
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
holder.tv_down.setText("查看");
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//打开文件
|
||||
// openFile(path);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException error, String msg) {
|
||||
ToastUtil.showToast(name+"下载失败!");
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.VISIBLE);
|
||||
holder.tv_down.setVisibility(View.GONE);
|
||||
}
|
||||
//maybe the file has downloaded completely
|
||||
// if (msg.contains("maybe the file has downloaded completely")) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showToast("SD卡不存在,无法下载");
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.CollectListBean.CollectList;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
|
||||
|
||||
public class EnglishCollectAdapter extends BaseAdapter {
|
||||
List<CollectList> mList;
|
||||
|
||||
Context con;
|
||||
|
||||
public EnglishCollectAdapter(List<CollectList> mList,Context con) {
|
||||
this.mList = mList;
|
||||
this.con = con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
//找到自定义item布局 并赋值给 convertView
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(con, R.layout.activity_endownload_list_item_big, null);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_en_name);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.item_en_date);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(con, R.layout.activity_bookshelf_list_item, null);
|
||||
holder.iv_down = convertView
|
||||
.findViewById(R.id.item_iv_down);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.item_date);
|
||||
holder.tv_down = (TextView) convertView.findViewById(R.id.item_tv_down);
|
||||
holder.iv_right = (ImageView) convertView.findViewById(R.id.item_iv_right);
|
||||
|
||||
//收藏
|
||||
holder.iv_right.setVisibility(View.VISIBLE);
|
||||
holder.tv_down.setVisibility(View.GONE);
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
final CollectList data = mList.get(position);
|
||||
holder.name.setText(data.title);
|
||||
if (!TextUtils.isEmpty(data.secondTitle)) {
|
||||
holder.date.setText(data.secondTitle);
|
||||
}else{
|
||||
holder.date.setText("");
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public class Holder {
|
||||
public ImageView iv_right;
|
||||
public TextView tv_down;
|
||||
public View iv_down;
|
||||
public TextView date;
|
||||
public TextView name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.GDLiveBroadcastBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import android.app.Activity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GDLiveBroadcastAdapter extends BaseAdapter {
|
||||
|
||||
public List<GDLiveBroadcastBean.DataBean.ListBean> datas;
|
||||
public Activity mActivity;
|
||||
|
||||
public GDLiveBroadcastAdapter(
|
||||
List<GDLiveBroadcastBean.DataBean.ListBean> datas,
|
||||
Activity mActivity) {
|
||||
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_gd_live);
|
||||
vh = new ViewHolder();
|
||||
vh.mTitle = (TextView) convertView.findViewById(R.id.tv_title);
|
||||
vh.mTime = (TextView) convertView.findViewById(R.id.tv_time);
|
||||
vh.mName = (TextView) convertView.findViewById(R.id.tv_name);
|
||||
vh.mType = (TextView) convertView.findViewById(R.id.tv_type);
|
||||
vh.mImage = (ImageView) convertView.findViewById(R.id.iv_img);
|
||||
vh.mReview = (TextView) convertView.findViewById(R.id.tv_review);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTitle.setText(datas.get(position).getTitle());// 标题
|
||||
// if (datas.get(position).getEnd_date().length() >= 11) {
|
||||
// String date = datas.get(position).getBegin_date().substring(0, 16)
|
||||
// + "-" + datas.get(position).getEnd_date().substring(11, 16);
|
||||
vh.mTime.setText("时间:"
|
||||
+ GetDate(datas.get(position).getBegin_date(),
|
||||
datas.get(position).getEnd_date()));// 时间
|
||||
// }
|
||||
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getLiveimg().toString(),
|
||||
vh.mImage,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default));// 圖片
|
||||
vh.mName.setText(datas.get(position).keywords);// 关键字
|
||||
// 预告 直播 结束
|
||||
if (datas.get(position).getStatus() == 1) {
|
||||
vh.mType.setText("预 告");
|
||||
vh.mType.setBackgroundDrawable(UIUtils
|
||||
.getDrawable(R.drawable.bg_blue));
|
||||
vh.mReview.setVisibility(View.GONE);
|
||||
|
||||
} else if (datas.get(position).getStatus() == 2) {
|
||||
vh.mType.setText("直播中");
|
||||
// vh.mType.setBackground(UIUtils.getDrawable(R.drawable.bg_red));
|
||||
vh.mType.setBackgroundDrawable(UIUtils
|
||||
.getDrawable(R.drawable.bg_red));
|
||||
vh.mReview.setVisibility(View.GONE);
|
||||
} else if (datas.get(position).getStatus() == 3) {
|
||||
if (position == 0) {
|
||||
vh.mReview.setVisibility(View.VISIBLE);
|
||||
} else if (datas.get(position - 1).getStatus() != 3) {
|
||||
vh.mReview.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.mReview.setVisibility(View.GONE);
|
||||
}
|
||||
vh.mType.setText("已结束");
|
||||
vh.mType.setBackgroundDrawable(UIUtils
|
||||
.getDrawable(R.drawable.bg_grays));
|
||||
}
|
||||
|
||||
// if (!TextUtils.isEmpty(datas.get(position).getImgpath())
|
||||
// && !"null".equals(datas.get(position).getImgpath())) {
|
||||
// ImageLoader.getInstance().displayImage(
|
||||
// Url.imgUrl + datas.get(position).getImgpath(),
|
||||
// vh.mImage,
|
||||
// ImageOptions
|
||||
// .getImageOptions(R.drawable.home_scroll_default));
|
||||
// } else {
|
||||
// vh.mImage.setImageResource(R.drawable.home_scroll_default);
|
||||
// }
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTime, mName, mType, mReview;
|
||||
ImageView mImage;
|
||||
|
||||
}
|
||||
|
||||
public String GetDate(String startTime, String endTime) {
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat newsdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
||||
SimpleDateFormat datedf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
SimpleDateFormat datesdf = new SimpleDateFormat("MM月dd日");
|
||||
SimpleDateFormat hoursdf = new SimpleDateFormat("HH:mm");
|
||||
Calendar startcalendar = Calendar.getInstance();
|
||||
Calendar endcalendar = Calendar.getInstance();
|
||||
try {
|
||||
Date startdate = sdf.parse(startTime);
|
||||
startcalendar.setTime(startdate);
|
||||
Date enddate = sdf.parse(endTime);
|
||||
endcalendar.setTime(enddate);
|
||||
if (startcalendar.get(Calendar.YEAR) != endcalendar.get(Calendar.YEAR)) {
|
||||
return datedf.format(startdate) + "-" + datedf.format(enddate);
|
||||
} else if (startcalendar.get(Calendar.MONTH) != endcalendar.get(Calendar.MONTH)) {
|
||||
return datedf.format(startdate) + "-" + datesdf.format(enddate);
|
||||
} else if (startcalendar.get(Calendar.DAY_OF_MONTH) != endcalendar.get(Calendar.DAY_OF_MONTH)) {
|
||||
|
||||
return datedf.format(startdate) + "-" + datesdf.format(enddate);
|
||||
}
|
||||
return newsdf.format(startdate) + "-" + hoursdf.format(enddate);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.EventListBean.EventBase;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GanDanAdapter extends BaseAdapter {
|
||||
|
||||
public List<EventBase> datas;
|
||||
public Activity mActivity;
|
||||
|
||||
public GanDanAdapter(List<EventBase> datas, Activity mActivity) {
|
||||
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_gd_event);
|
||||
vh = new ViewHolder();
|
||||
vh.mTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_gdtitle);
|
||||
vh.mTime = (TextView) convertView.findViewById(R.id.tv_item_gdtime);
|
||||
vh.mUp = (TextView) convertView.findViewById(R.id.tv_item_gdup);
|
||||
vh.mOverTime = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_gdisover);
|
||||
vh.mImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_gdimage);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTitle.setText(datas.get(position).getTitle());
|
||||
vh.mTime.setText("活动截至:"
|
||||
+ datas.get(position).getEnd_date().substring(0, 10));
|
||||
if ("0".equals(datas.get(position).getSort())) {
|
||||
vh.mUp.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.mUp.setVisibility(View.GONE);
|
||||
}
|
||||
if ("0".equals(datas.get(position).getStatus())) {
|
||||
vh.mOverTime.setVisibility(View.VISIBLE);
|
||||
vh.mTitle.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.hint_text_color));
|
||||
} else {
|
||||
vh.mOverTime.setVisibility(View.GONE);
|
||||
vh.mTitle.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.black));
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getImgpath())
|
||||
&& !"null".equals(datas.get(position).getImgpath())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getImgpath(),
|
||||
vh.mImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.home_scroll_default1));
|
||||
} else {
|
||||
vh.mImage.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTime, mUp, mOverTime;
|
||||
ImageView mImage;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.GandanDoctorListBean;
|
||||
import cn.shangyu.gdxzExpert.bean.GandanDoctorListBean.DataBean.ListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class GanDanDoctorAdapter extends BaseAdapter{
|
||||
|
||||
|
||||
private List<ListBean> gandanDoctorList;
|
||||
private Context context;
|
||||
public static final int TYPE1 = 0; //两种类型
|
||||
public static final int TYPE2 = 1;
|
||||
public GanDanDoctorAdapter(List<ListBean> gandanDoctorList,
|
||||
Context context, boolean b) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.gandanDoctorList = gandanDoctorList;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
public void getDatas(List<ListBean> gandanDoctorList) {
|
||||
// TODO Auto-generated method stub
|
||||
this.gandanDoctorList = gandanDoctorList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
if (gandanDoctorList.get(position).getName().length()>5){
|
||||
return TYPE1;
|
||||
}else {
|
||||
return TYPE2;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return gandanDoctorList!=null&&gandanDoctorList.size()>0?gandanDoctorList.size():0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return gandanDoctorList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
Holder holder;
|
||||
Holder2 holder2 ;
|
||||
switch (getItemViewType(position)){
|
||||
case TYPE1:
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context, R.layout.item_gandan_doc2,null);
|
||||
holder = new Holder();
|
||||
holder.rl_doc_bg = (RelativeLayout) convertView.findViewById(R.id.rl_doc_bg);
|
||||
holder.tv_hospital_name = (TextView) convertView.findViewById(R.id.tv_hospital_name);
|
||||
holder.tv_keshi_name = (TextView) convertView.findViewById(R.id.tv_keshi_name);
|
||||
holder.tv_patientnum = (TextView) convertView.findViewById(R.id.tv_patientnum);
|
||||
holder.tv_consulnum = (TextView) convertView.findViewById(R.id.tv_consulnum);
|
||||
holder.tv_doc_name = (TextView) convertView.findViewById(R.id.tv_doc_name);
|
||||
holder.tv_zhicheng = (TextView) convertView.findViewById(R.id.tv_zhicheng);
|
||||
holder.iv_doc_headimg = (ImageView) convertView.findViewById(R.id.iv_doc_headimg);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
holder.tv_hospital_name.setText(gandanDoctorList.get(position).getHospital_name());
|
||||
holder.tv_keshi_name.setText(gandanDoctorList.get(position).getOffice_name());
|
||||
holder.tv_consulnum.setText(":"+gandanDoctorList.get(position).getConsult_num());
|
||||
holder.tv_patientnum.setText(":"+gandanDoctorList.get(position).getApply_num());
|
||||
holder.tv_doc_name.setText(gandanDoctorList.get(position).getName());
|
||||
holder.tv_zhicheng.setText(gandanDoctorList.get(position).getPosition_name());
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml + gandanDoctorList.get(position).getImg(),
|
||||
holder.iv_doc_headimg,
|
||||
ImageOptions.getImageOptions(R.drawable.img_news_empty));
|
||||
|
||||
switch (position%5) {
|
||||
case 0:
|
||||
holder.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_1);
|
||||
break;
|
||||
case 1:
|
||||
holder.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_2);
|
||||
break;
|
||||
case 2:
|
||||
holder.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_3);
|
||||
break;
|
||||
case 3:
|
||||
holder.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_4);
|
||||
break;
|
||||
case 4:
|
||||
holder.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_5);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TYPE2:
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context, R.layout.item_gandan_doc1,null);
|
||||
holder2 = new Holder2();
|
||||
holder2.rl_doc_bg = (RelativeLayout) convertView.findViewById(R.id.rl_doc_bg);
|
||||
holder2.tv_hospital_name = (TextView) convertView.findViewById(R.id.tv_hospital_name);
|
||||
holder2.tv_keshi_name = (TextView) convertView.findViewById(R.id.tv_keshi_name);
|
||||
holder2.tv_tag_01 = (TextView) convertView.findViewById(R.id.tv_tag_01);
|
||||
holder2.tv_patientnum = (TextView) convertView.findViewById(R.id.tv_patientnum);
|
||||
holder2.tv_consulnum = (TextView) convertView.findViewById(R.id.tv_consulnum);
|
||||
holder2.tv_doc_name = (TextView) convertView.findViewById(R.id.tv_doc_name);
|
||||
holder2.tv_zhicheng = (TextView) convertView.findViewById(R.id.tv_zhicheng);
|
||||
holder2.iv_doc_headimg = (ImageView) convertView.findViewById(R.id.iv_doc_headimg);
|
||||
convertView.setTag(holder2);
|
||||
} else {
|
||||
holder2 = (Holder2) convertView.getTag();
|
||||
}
|
||||
|
||||
int is_star = gandanDoctorList.get(position).getIs_star();
|
||||
if (holder2.tv_tag_01!=null) {
|
||||
if (is_star==0) {
|
||||
holder2.tv_tag_01.setVisibility(View.INVISIBLE);
|
||||
}else {
|
||||
holder2.tv_tag_01.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
holder2.tv_hospital_name.setText(gandanDoctorList.get(position).getHospital_name());
|
||||
holder2.tv_keshi_name.setText(gandanDoctorList.get(position).getOffice_name());
|
||||
holder2.tv_consulnum.setText(":"+gandanDoctorList.get(position).getConsult_num());
|
||||
holder2.tv_patientnum.setText(":"+gandanDoctorList.get(position).getApply_num());
|
||||
holder2.tv_doc_name.setText(gandanDoctorList.get(position).getName());
|
||||
holder2.tv_zhicheng.setText(gandanDoctorList.get(position).getPosition_name());
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml + gandanDoctorList.get(position).getImg(),
|
||||
holder2.iv_doc_headimg,
|
||||
ImageOptions.getImageOptions(R.drawable.img_news_empty));
|
||||
|
||||
switch (position%5) {
|
||||
case 0:
|
||||
holder2.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_1);
|
||||
break;
|
||||
case 1:
|
||||
holder2.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_2);
|
||||
break;
|
||||
case 2:
|
||||
holder2.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_3);
|
||||
break;
|
||||
case 3:
|
||||
holder2.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_4);
|
||||
break;
|
||||
case 4:
|
||||
holder2.rl_doc_bg.setBackgroundResource(R.drawable.bg_doc_5);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
class Holder {
|
||||
// RoundImageView img;
|
||||
RelativeLayout rl_doc_bg;
|
||||
ImageView iv_doc_headimg;
|
||||
TextView tv_hospital_name,tv_keshi_name,tv_tag_01,tv_patientnum,tv_consulnum,tv_doc_name,tv_zhicheng;
|
||||
}
|
||||
class Holder2{
|
||||
// RoundImageView img;
|
||||
RelativeLayout rl_doc_bg;
|
||||
ImageView iv_doc_headimg;
|
||||
TextView tv_hospital_name,tv_keshi_name,tv_tag_01,tv_patientnum,tv_consulnum,tv_doc_name,tv_zhicheng;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.GanDanHospitalBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.TwoRoundImageView;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GanDanHospitalAdapter extends BaseAdapter {
|
||||
|
||||
private List<GanDanHospitalBean.DataBean.ListBean> datas;
|
||||
private Context context;
|
||||
private boolean isHos;
|
||||
|
||||
public GanDanHospitalAdapter(
|
||||
List<GanDanHospitalBean.DataBean.ListBean> datas, Context context,
|
||||
boolean isHos) {
|
||||
this.datas = datas;
|
||||
this.context = context;
|
||||
this.isHos = isHos;
|
||||
}
|
||||
|
||||
public GanDanHospitalAdapter(Context context, boolean isHos) {
|
||||
this.context = context;
|
||||
this.isHos = isHos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas == null ? 0 : datas.size();
|
||||
}
|
||||
|
||||
public void getDatas(List<GanDanHospitalBean.DataBean.ListBean> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_gandan_hospital);
|
||||
vh = new ViewHolder();
|
||||
vh.iv_hospital = (TwoRoundImageView) convertView
|
||||
.findViewById(R.id.iv_hospital);
|
||||
|
||||
vh.tv_hospital_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_hospital_name);
|
||||
vh.tv_hospital_score = (TextView) convertView
|
||||
.findViewById(R.id.tv_hospital_score);
|
||||
vh.tv_hospital_follow = (TextView) convertView
|
||||
.findViewById(R.id.tv_hospital_follow);
|
||||
vh.tv_hospital_type = (TextView) convertView
|
||||
.findViewById(R.id.tv_hospital_type);
|
||||
vh.ll_name = (LinearLayout) convertView.findViewById(R.id.ll_name);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getImg())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getImg(), vh.iv_hospital,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default1));
|
||||
|
||||
} else {
|
||||
vh.iv_hospital.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
vh.tv_hospital_name.setText(datas.get(position).getName());
|
||||
vh.tv_hospital_score.setText(Math.round(Double.parseDouble(datas.get(
|
||||
position).getScoretotal()) * 10)
|
||||
/ 10.0 + "分");
|
||||
vh.tv_hospital_follow.setText(String.valueOf(datas.get(position)
|
||||
.getFcousnum()));
|
||||
if (isHos) {
|
||||
vh.tv_hospital_type.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.tv_hospital_type.setVisibility(View.GONE);
|
||||
}
|
||||
if (datas.get(position).getLevel() == 1) {
|
||||
vh.tv_hospital_type.setText("三级甲等");
|
||||
} else if (datas.get(position).getLevel() == 2) {
|
||||
vh.tv_hospital_type.setText("三级医院");
|
||||
} else if (datas.get(position).getLevel() == 3) {
|
||||
vh.tv_hospital_type.setText("二级医院");
|
||||
} else {
|
||||
vh.tv_hospital_type.setText("其他等级");
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
// dp到像素的转换
|
||||
public static int dip2px(Context context, double d) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (d * scale + 0.5f);
|
||||
}
|
||||
|
||||
public static class ViewHolder {
|
||||
public TwoRoundImageView iv_hospital;// 医院照片
|
||||
public TextView tv_hospital_name, tv_hospital_follow,
|
||||
tv_hospital_score, tv_hospital_type;// 医院名称,评分,关注数量
|
||||
public LinearLayout ll_name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.TopicAcitivty;
|
||||
import cn.shangyu.gdxzExpert.bean.HouseBean.HouseList;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.common.CCPAppManager;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.ViewImageInfo;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
//import com.baidu.location.LLSInterface;
|
||||
|
||||
public class GanDanHouseAdapter extends BaseAdapter {
|
||||
|
||||
private List<HouseList> datas;
|
||||
private Context context;
|
||||
private ArrayList<ImageView> imageSource;
|
||||
private String tag1, tag2, tag3;
|
||||
|
||||
public GanDanHouseAdapter(List<HouseList> datas, Context context) {
|
||||
this.datas = datas;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_house_list);
|
||||
vh = new ViewHolder();
|
||||
vh.im_pic = convertView.findViewById(R.id.im_pic);
|
||||
|
||||
vh.tv_case_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_name);
|
||||
vh.tv_gandan_comments = (TextView) convertView
|
||||
.findViewById(R.id.tv_gandan_comments);
|
||||
vh.tv_comment = (TextView) convertView
|
||||
.findViewById(R.id.tv_gandan_comment);
|
||||
vh.tv_tag_2 = (TextView) convertView.findViewById(R.id.tv_tag_02);
|
||||
vh.tv_tag_1 = (TextView) convertView.findViewById(R.id.tv_tag_01);
|
||||
|
||||
vh.tv_tag_3 = (TextView) convertView.findViewById(R.id.tv_tag_03);
|
||||
vh.tv_case_date = (TextView) convertView
|
||||
.findViewById(R.id.tv_case_date);
|
||||
vh.dis_img_01 = (ImageView) convertView
|
||||
.findViewById(R.id.dis_img_01);
|
||||
vh.dis_img_02 = (ImageView) convertView
|
||||
.findViewById(R.id.dis_img_02);
|
||||
vh.dis_img_03 = (ImageView) convertView
|
||||
.findViewById(R.id.dis_img_03);
|
||||
vh.ll_imgs = (LinearLayout) convertView.findViewById(R.id.ll_imgs);
|
||||
vh.ll_tags = (LinearLayout) convertView.findViewById(R.id.ll_tags);
|
||||
vh.im_pic = convertView.findViewById(R.id.im_pic);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
// 加载头像
|
||||
if (!TextUtils.isEmpty(datas.get(position).getExpert_photo())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + datas.get(position).getExpert_photo(),
|
||||
vh.im_pic,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.im_pic.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
|
||||
// 评论的内容
|
||||
vh.tv_gandan_comments.setText(datas.get(position).getContent());
|
||||
// 评论数量
|
||||
if (datas.get(position).getCommentnum() == null) {
|
||||
vh.tv_comment.setText("0");
|
||||
} else {
|
||||
vh.tv_comment.setText(String.valueOf(datas.get(position)
|
||||
.getCommentnum()));
|
||||
}
|
||||
String[] stringArr = null;
|
||||
// 标签
|
||||
if (!TextUtils.isEmpty(datas.get(position).getTags())) {
|
||||
|
||||
stringArr = datas.get(position).getTags().split(",");
|
||||
|
||||
if (stringArr.length == 1) {
|
||||
vh.tv_tag_1.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_1.setText(stringArr[0]);
|
||||
|
||||
// tag1 = vh.tv_tag_1.getText().toString();
|
||||
|
||||
vh.tv_tag_2.setVisibility(View.GONE);
|
||||
vh.tv_tag_3.setVisibility(View.GONE);
|
||||
} else if (stringArr.length == 2) {
|
||||
vh.tv_tag_1.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_1.setText(stringArr[0]);
|
||||
vh.tv_tag_2.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_2.setText(stringArr[1]);
|
||||
vh.tv_tag_3.setVisibility(View.GONE);
|
||||
// tag1 = vh.tv_tag_1.getText().toString();
|
||||
// tag2 = vh.tv_tag_2.getText().toString();
|
||||
|
||||
} else if (stringArr.length == 3) {
|
||||
vh.tv_tag_1.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_1.setText(stringArr[0]);
|
||||
vh.tv_tag_2.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_2.setText(stringArr[1]);
|
||||
vh.tv_tag_3.setVisibility(View.VISIBLE);
|
||||
vh.tv_tag_3.setText(stringArr[2]);
|
||||
// tag1 = vh.tv_tag_1.getText().toString();
|
||||
// tag2 = vh.tv_tag_2.getText().toString();
|
||||
// tag3 = vh.tv_tag_3.getText().toString();
|
||||
}
|
||||
} else {
|
||||
vh.tv_tag_1.setVisibility(View.GONE);
|
||||
vh.tv_tag_2.setVisibility(View.GONE);
|
||||
vh.tv_tag_3.setVisibility(View.GONE);
|
||||
}
|
||||
vh.tv_tag_1.setTag(datas.get(position).getTags().split(","));
|
||||
vh.tv_tag_2.setTag(datas.get(position).getTags().split(","));
|
||||
vh.tv_tag_3.setTag(datas.get(position).getTags().split(","));
|
||||
|
||||
vh.tv_tag_1.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
String[] stringArr = (String[]) v.getTag();
|
||||
Intent in = new Intent(context, TopicAcitivty.class);
|
||||
in.putExtra("topic", stringArr[0]);
|
||||
StringUtil.TOPIC = tag1;
|
||||
ToastUtil.showMessage(tag1);
|
||||
context.startActivity(in);
|
||||
}
|
||||
});
|
||||
vh.tv_tag_2.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String[] stringArr = (String[]) v.getTag();
|
||||
// TODO Auto-generated method stub
|
||||
Intent in = new Intent(context, TopicAcitivty.class);
|
||||
in.putExtra("topic", stringArr[1]);
|
||||
StringUtil.TOPIC = stringArr[1];
|
||||
context.startActivity(in);
|
||||
}
|
||||
});
|
||||
vh.tv_tag_3.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String[] stringArr = (String[]) v.getTag();
|
||||
// TODO Auto-generated method stub
|
||||
Intent in = new Intent(context, TopicAcitivty.class);
|
||||
in.putExtra("topic", stringArr[2]);
|
||||
StringUtil.TOPIC = stringArr[2];
|
||||
context.startActivity(in);
|
||||
}
|
||||
});
|
||||
|
||||
if (datas.get(position).getPhoto().size() == 0) {
|
||||
vh.ll_imgs.setVisibility(View.GONE);
|
||||
vh.dis_img_01.setVisibility(View.INVISIBLE);
|
||||
vh.dis_img_02.setVisibility(View.INVISIBLE);
|
||||
vh.dis_img_03.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
|
||||
ArrayList<ImageView> imageSource = new ArrayList<>();
|
||||
vh.ll_imgs.setVisibility(View.VISIBLE);
|
||||
if (datas.get(position).getPhoto().size() == 1) {
|
||||
vh.dis_img_01.setVisibility(View.VISIBLE);
|
||||
vh.dis_img_02.setVisibility(View.INVISIBLE);
|
||||
vh.dis_img_03.setVisibility(View.INVISIBLE);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(0),
|
||||
vh.dis_img_01,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
} else if (datas.get(position).getPhoto().size() == 2) {
|
||||
vh.dis_img_01.setVisibility(View.VISIBLE);
|
||||
vh.dis_img_02.setVisibility(View.VISIBLE);
|
||||
vh.dis_img_03.setVisibility(View.INVISIBLE);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(0),
|
||||
vh.dis_img_01,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(1),
|
||||
vh.dis_img_02,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
} else if (datas.get(position).getPhoto().size() == 3) {
|
||||
vh.dis_img_01.setVisibility(View.VISIBLE);
|
||||
vh.dis_img_02.setVisibility(View.VISIBLE);
|
||||
vh.dis_img_03.setVisibility(View.VISIBLE);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(0),
|
||||
vh.dis_img_01,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(1),
|
||||
vh.dis_img_02,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto().get(2),
|
||||
vh.dis_img_03,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.img_gandan_house));
|
||||
}
|
||||
|
||||
imageSource.add(vh.dis_img_01);
|
||||
imageSource.add(vh.dis_img_02);
|
||||
imageSource.add(vh.dis_img_03);
|
||||
|
||||
for (int i = 0; i < imageSource.size(); i++) {
|
||||
imageSource.get(i).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (datas.get(position).getPhoto().size() > 0) {
|
||||
ArrayList<ViewImageInfo> urls = new ArrayList<ViewImageInfo>();
|
||||
for (int i = 0; i < datas.get(position).getPhoto()
|
||||
.size(); i++) {
|
||||
urls.add(new ViewImageInfo(i,
|
||||
Url.urlHtml
|
||||
+ datas.get(position)
|
||||
.getPhoto().get(i),
|
||||
Url.urlHtml
|
||||
+ datas.get(position)
|
||||
.getPhoto().get(i)));
|
||||
}
|
||||
|
||||
CCPAppManager.startChattingImageViewAction(context,
|
||||
0, urls);
|
||||
// DiscussionFragment.isLookingImg = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 名称
|
||||
vh.tv_case_name.setText(datas.get(position).getExpert_name());
|
||||
// 日期
|
||||
if("0".equals(datas.get(position).getExamine_status()))
|
||||
{
|
||||
vh.tv_case_date.setText("待审核");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
vh.tv_case_date.setText(datas.get(position).getTime() + "");
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
// dp到像素的转换
|
||||
public static int dip2px(Context context, double d) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (d * scale + 0.5f);
|
||||
}
|
||||
|
||||
public static class ViewHolder {
|
||||
public ImageView im_pic;
|
||||
public TextView tv_case_name, tv_case_hos, tv_case_date, tv_comment,
|
||||
tv_gandan_comments, tv_tag_1, tv_tag_2, tv_tag_3;
|
||||
public LinearLayout ll_imgs, ll_tags;
|
||||
public ImageView dis_img_01, dis_img_02, dis_img_03;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.AddGroupActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.GroupingActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.GroupPatientList.Group;
|
||||
import cn.shangyu.gdxzExpert.bean.GroupPatientList.PatientData;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class GroupingAdapter extends BaseExpandableListAdapter {
|
||||
Activity mActivity;
|
||||
List<Group> group;
|
||||
|
||||
public GroupingAdapter(Activity mActivity, List<Group> group) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mActivity = mActivity;
|
||||
this.group = group;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
// TODO Auto-generated method stub
|
||||
for (int i = group.size()-1;i>=0;i--){
|
||||
if (group.get(i)==null){
|
||||
group.remove(i);
|
||||
}
|
||||
}
|
||||
return group.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
for (int i = group.get(groupPosition).patientList.size()-1;i>=0;i--){
|
||||
if (group.get(groupPosition).patientList.get(i)==null){
|
||||
group.get(groupPosition).patientList.remove(i);
|
||||
}
|
||||
}
|
||||
return group.get(groupPosition).patientList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGroup(int groupPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
return group.get(groupPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
return group.get(groupPosition).patientList.get(childPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
return childPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded,
|
||||
View convertView, ViewGroup parent) {
|
||||
GroupViewHolder gvh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_group_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_group);
|
||||
}
|
||||
gvh = new GroupViewHolder();
|
||||
gvh.mGroupName = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_group_name);
|
||||
gvh.mGroupCount = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_group_num);
|
||||
gvh.mGroupChenge = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_group_chenge);
|
||||
gvh.mGroupJianTou = (ImageView) convertView
|
||||
.findViewById(R.id.iv_group_jiantou);
|
||||
convertView.setTag(gvh);
|
||||
} else {
|
||||
gvh = (GroupViewHolder) convertView.getTag();
|
||||
}
|
||||
gvh.mGroupName.setText(group.get(groupPosition).name);
|
||||
gvh.mGroupCount.setText(group.get(groupPosition).patientNum);
|
||||
|
||||
if (isExpanded) {
|
||||
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
gvh.mGroupJianTou.setImageResource(R.drawable.groupup_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
gvh.mGroupJianTou.setImageResource(R.drawable.groupup);
|
||||
}
|
||||
} else {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
gvh.mGroupJianTou.setImageResource(R.drawable.groupright_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
gvh.mGroupJianTou.setImageResource(R.drawable.groupright);
|
||||
}
|
||||
}
|
||||
gvh.mGroupChenge.setTag(groupPosition);
|
||||
gvh.mGroupChenge.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity, AddGroupActivity.class);
|
||||
intent.putExtra("uuid", group.get((Integer) v.getTag()).uuid);
|
||||
intent.putExtra("groupname",group.get((Integer) v.getTag()).name);
|
||||
// intent.putExtra("type",group.get((Integer) v.getTag()).type);
|
||||
mActivity.startActivityForResult(intent,
|
||||
GroupingActivity.GET_GROUP_RESULt);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (group.get(groupPosition).type==1||"0".equals(group.get(groupPosition).uuid)){//系统建的分组和uuid="0"不显示编辑
|
||||
gvh.mGroupChenge.setVisibility(View.GONE);
|
||||
|
||||
}else {
|
||||
gvh.mGroupChenge.setVisibility(View.VISIBLE);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(int groupPosition, int childPosition,
|
||||
boolean isLastChild, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ChildViewHolder mHolder = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_patient_list_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_patient_list);
|
||||
}
|
||||
|
||||
mHolder = new ChildViewHolder();
|
||||
mHolder.ivImage = convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_patient_name);
|
||||
mHolder.tvnickname = (TextView) convertView
|
||||
.findViewById(R.id.tv_nick_name);
|
||||
mHolder.tv_followtime=convertView.findViewById(R.id.tv_followtime);
|
||||
mHolder.iv_editpatient=convertView.findViewById(R.id.iv_editpatient);
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.v0=convertView.findViewById(R.id.v0);
|
||||
mHolder.v1=convertView.findViewById(R.id.v1);
|
||||
}
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (ChildViewHolder) convertView.getTag();
|
||||
}
|
||||
// 给控件赋值.
|
||||
PatientData p = group.get(groupPosition).patientList.get(childPosition);
|
||||
// 1.随访关系 2.包月服务关系 (type==2即为VIP)3.既是随访又是vip
|
||||
Drawable rightDrawable;
|
||||
if (p!=null){
|
||||
if (2 == p.type || 3 == p.type) {
|
||||
rightDrawable = mActivity.getResources()
|
||||
.getDrawable(R.drawable.vip);
|
||||
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(),
|
||||
rightDrawable.getMinimumHeight());
|
||||
} else {
|
||||
rightDrawable = null;
|
||||
}
|
||||
mHolder.tvTitle.setCompoundDrawables(null, null, rightDrawable, null);
|
||||
// 姓名
|
||||
if (StringUtil.isEmpty(p.nickname)){
|
||||
mHolder.tvTitle.setText(p.realName);
|
||||
}else {
|
||||
mHolder.tvTitle.setText(p.nickname);
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
mHolder.tv_followtime.setVisibility(View.VISIBLE);
|
||||
if (!StringUtil.isEmpty(p.join_date)){
|
||||
mHolder.iv_editpatient.setVisibility(View.INVISIBLE);
|
||||
mHolder.tv_followtime.setText("随访于"+p.join_date.split(" ")[0]);
|
||||
}else {
|
||||
mHolder.tv_followtime.setVisibility(View.GONE);
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
if(isLastChild)
|
||||
{
|
||||
mHolder.v0.setVisibility(View.GONE);
|
||||
mHolder.v1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.v0.setVisibility(View.VISIBLE);
|
||||
mHolder.v1.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
|
||||
private class GroupViewHolder {
|
||||
TextView mGroupName;
|
||||
TextView mGroupCount;
|
||||
TextView mGroupChenge;
|
||||
ImageView mGroupJianTou;
|
||||
}
|
||||
|
||||
private class ChildViewHolder {
|
||||
public TextView tvnickname;
|
||||
public ImageView ivImage;
|
||||
public TextView tvTitle,tv_followtime;
|
||||
public ImageView iv_editpatient;
|
||||
public View v0,v1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientCaseBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class HbsagAdapter extends BaseAdapter {
|
||||
Context context;
|
||||
List<PatientCaseBean.CaseBean> list;
|
||||
public HbsagAdapter(Context context,List<PatientCaseBean.CaseBean> list) {
|
||||
this.context=context;
|
||||
this.list=list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view= UIUtils.inflate(R.layout.hbsa_item);
|
||||
holder=new ViewHolder();
|
||||
holder.title=view.findViewById(R.id.title);
|
||||
holder.num1=view.findViewById(R.id.num1);
|
||||
holder.num2=view.findViewById(R.id.num2);
|
||||
holder.num3=view.findViewById(R.id.num3);
|
||||
holder.num4=view.findViewById(R.id.num4);
|
||||
holder.status1=view.findViewById(R.id.status1);
|
||||
holder.status2=view.findViewById(R.id.status2);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder= (ViewHolder) view.getTag();
|
||||
}
|
||||
if(list.get(i).getGroupNo()!=null&&list.get(i).getGroupNo().length()>3)
|
||||
{
|
||||
holder.title.setText("病例入组编号:"+list.get(i).getGroupNo().substring(3));
|
||||
}
|
||||
|
||||
holder.num1.setText("患者编号:"+list.get(i).getPatientNo());
|
||||
holder.num2.setText("研究中心:"+list.get(i).getDepartmentName());
|
||||
holder.num3.setText("创建医生:"+list.get(i).getEmployeeName());
|
||||
holder.num4.setText("修改时间:"+list.get(i).getUpdateTime());
|
||||
if("0".equals(list.get(i).getFreezeFlag()))
|
||||
{
|
||||
holder.status1.setBackground(context.getDrawable(R.drawable.status2_bg));
|
||||
holder.status1.setText("冻结");
|
||||
holder.status1.setTextColor( Color.parseColor("#999999"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.status1.setBackground(context.getDrawable(R.drawable.status1_bg));
|
||||
holder.status1.setText("正常");
|
||||
holder.status1.setTextColor( Color.parseColor("#498DE1"));
|
||||
|
||||
}
|
||||
if("0".equals(list.get(i).getSdvStatus()))
|
||||
{
|
||||
holder.status2.setBackground(context.getDrawable(R.drawable.status3_bg));
|
||||
holder.status2.setText("未SDV");
|
||||
holder.status2.setTextColor( Color.parseColor("#ffff4d4f"));
|
||||
|
||||
}
|
||||
else if("1".equals(list.get(i).getSdvStatus()))
|
||||
{
|
||||
holder.status2.setBackground(context.getDrawable(R.drawable.status4_bg));
|
||||
holder.status2.setText("部分SDV");
|
||||
holder.status2.setTextColor( Color.parseColor("#ff52c41a"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.status2.setBackground(context.getDrawable(R.drawable.status5_bg));
|
||||
holder.status2.setText("已SDV");
|
||||
holder.status2.setTextColor( Color.parseColor("#ff3cc7c0"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
TextView title,num1,num2,num3,num4,status1,status2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MeetingBean.MeatingList;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class HistoryAdapter extends BaseAdapter {
|
||||
Activity mActivity;
|
||||
List<MeatingList> mList;
|
||||
|
||||
// public List<String> Positions;
|
||||
|
||||
public HistoryAdapter(Activity mActivity, List<MeatingList> mList) {
|
||||
|
||||
this.mActivity = mActivity;
|
||||
this.mList = mList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_meeting);
|
||||
vh = new ViewHolder();
|
||||
vh.mDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_date);
|
||||
vh.mTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_title);
|
||||
vh.mTTime = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_ttime);
|
||||
vh.mLocation = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_location);
|
||||
vh.mTDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_tdate);
|
||||
vh.mImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_meeting_image);
|
||||
vh.mV_color = convertView.findViewById(R.id.item_color);
|
||||
vh.mRl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_item_meeting);
|
||||
vh.mFl = (FrameLayout) convertView.findViewById(R.id.fl_meeting);
|
||||
vh.mZhiBo = (TextView) convertView.findViewById(R.id.tv_meeting);
|
||||
vh.mIv_bofang = (ImageView) convertView
|
||||
.findViewById(R.id.iv_meeting_bofang);
|
||||
// vh.mSpareZhiBo = (TextView) convertView
|
||||
// .findViewById(R.id.tv_meeting_bei);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (mList.get(position).getCount() == 0) {
|
||||
vh.mTDate.setVisibility(View.VISIBLE);
|
||||
vh.mTDate.setText(mList.get(position).getBegin_date()
|
||||
.substring(0, 4)
|
||||
+ "年"
|
||||
+ mList.get(position).getBegin_date().substring(5, 7)
|
||||
+ "月");
|
||||
} else {
|
||||
vh.mTDate.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
vh.mTTime.setText(mList.get(position).getBegin_date().substring(8));
|
||||
vh.mDate.setText(getTime(mList.get(position).getBegin_date(), mList
|
||||
.get(position).getEnd_date()));
|
||||
vh.mTitle.setText(mList.get(position).getTitle());
|
||||
vh.mLocation.setText(mList.get(position).getLocation());
|
||||
|
||||
if (mList.get(position).getCount() % 4 == 0) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu1);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu1));
|
||||
} else if (mList.get(position).getCount() % 4 == 1) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius2);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu2));
|
||||
} else if (mList.get(position).getCount() % 4 == 2) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius3);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu3));
|
||||
} else {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu4);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu4));
|
||||
}
|
||||
vh.mZhiBo.setVisibility(View.GONE);
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.VISIBLE);
|
||||
|
||||
// vh.mSpareZhiBo.setVisibility(View.VISIBLE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
|
||||
vh.mFl.setTag(position);
|
||||
if (!TextUtils.isEmpty(mList.get(position).getLiveimg())
|
||||
&& !"null".equals(mList.get(position).getLiveimg())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + mList.get(position).getLiveimg(),
|
||||
vh.mImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.home_scroll_default1));
|
||||
} else {
|
||||
vh.mImage.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTTime, mDate, mLocation, mTDate, mZhiBo;
|
||||
// mSpareZhiBo;
|
||||
View mV_color;
|
||||
ImageView mImage, mIv_bofang;
|
||||
RelativeLayout mRl;
|
||||
FrameLayout mFl;
|
||||
}
|
||||
|
||||
public String getTime(String str1, String str2) {
|
||||
if (str1.subSequence(0, 10).equals(str2.subSequence(0, 10))) {
|
||||
return str1.replaceAll("-", ".").subSequence(0, 10).toString();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str1.replaceAll("-", ".").subSequence(0, 10));
|
||||
sb.append("-");
|
||||
sb.append(str2.replaceAll("-", ".").subSequence(0, 10));
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
public static int dip2px(Context context, double d) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (d * scale + 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.ZhiBoActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.MeetingBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class HistoryMeetingAdapter extends BaseAdapter {
|
||||
Activity mActivity;
|
||||
List<MeetingBean.MeatingList> mList;
|
||||
|
||||
// public List<String> Positions;
|
||||
|
||||
public HistoryMeetingAdapter(Activity mActivity, List<MeetingBean.MeatingList> mList) {
|
||||
|
||||
this.mActivity = mActivity;
|
||||
this.mList = mList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_meeting_his);
|
||||
vh = new ViewHolder();
|
||||
vh.mDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_date);
|
||||
vh.mTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_title);
|
||||
vh.mTTime = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_ttime);
|
||||
vh.mLocation = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_location);
|
||||
vh.mTDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_tdate);
|
||||
vh.mImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_meeting_image);
|
||||
vh.mV_color = convertView.findViewById(R.id.item_color);
|
||||
vh.mRl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_item_meeting);
|
||||
vh.mFl = (FrameLayout) convertView.findViewById(R.id.fl_meeting);
|
||||
vh.mZhiBo = (TextView) convertView.findViewById(R.id.tv_meeting);
|
||||
vh.mIv_bofang = (ImageView) convertView
|
||||
.findViewById(R.id.iv_meeting_bofang);
|
||||
// vh.mSpareZhiBo = (TextView) convertView
|
||||
// .findViewById(R.id.tv_meeting_bei);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
// if (mList.get(position).getCount() == 0) {
|
||||
// vh.mTDate.setVisibility(View.VISIBLE);
|
||||
// vh.mTDate.setText(mList.get(position).getBegin_date()
|
||||
// .substring(0, 4)
|
||||
// + "年"
|
||||
// + mList.get(position).getBegin_date().substring(5, 7)
|
||||
// + "月");
|
||||
// } else {
|
||||
// vh.mTDate.setVisibility(View.GONE);
|
||||
// }
|
||||
|
||||
vh.mTTime.setText(mList.get(position).getBegin_date().substring(8));
|
||||
vh.mDate.setText(getTime(mList.get(position).getBegin_date(), mList
|
||||
.get(position).getEnd_date()));
|
||||
vh.mTitle.setText(mList.get(position).getTitle());
|
||||
vh.mLocation.setText(mList.get(position).getLocation());
|
||||
|
||||
if (mList.get(position).getCount() % 4 == 0) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu1);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu1));
|
||||
} else if (mList.get(position).getCount() % 4 == 1) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius2);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu2));
|
||||
} else if (mList.get(position).getCount() % 4 == 2) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius3);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu3));
|
||||
} else {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu4);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu4));
|
||||
}
|
||||
if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("1")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.VISIBLE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.VISIBLE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("预告");
|
||||
} else if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("2")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.VISIBLE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.VISIBLE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("直播中");
|
||||
} else if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("3")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.GONE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.GONE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("已结束");
|
||||
} else {
|
||||
vh.mIv_bofang.setVisibility(View.GONE);
|
||||
vh.mZhiBo.setVisibility(View.GONE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.GONE);
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
pp.height = dip2px(mActivity, 75);
|
||||
vh.mFl.setVisibility(View.GONE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
}
|
||||
vh.mFl.setTag(position);
|
||||
vh.mFl.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if (mList.get((Integer) v.getTag()).getStatus().equals("3")) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(mActivity, ZhiBoActivity.class);
|
||||
intent.putExtra("newsTitle", mList.get((Integer) v.getTag())
|
||||
.getTitle());
|
||||
intent.putExtra("url", mList.get((Integer) v.getTag())
|
||||
.getLiveurl());
|
||||
intent.putExtra("summary", mList.get((Integer) v.getTag())
|
||||
.getLiveimg());
|
||||
intent.setType("zhibo");
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
if (!TextUtils.isEmpty(mList.get(position).getLiveimg())
|
||||
&& !"null".equals(mList.get(position).getLiveimg())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + mList.get(position).getLiveimg(),
|
||||
vh.mImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.home_scroll_default1));
|
||||
} else {
|
||||
vh.mImage.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTTime, mDate, mLocation, mTDate, mZhiBo;
|
||||
// mSpareZhiBo;
|
||||
View mV_color;
|
||||
ImageView mImage, mIv_bofang;
|
||||
RelativeLayout mRl;
|
||||
FrameLayout mFl;
|
||||
}
|
||||
|
||||
public String getTime(String str1, String str2) {
|
||||
if (str1.subSequence(0, 10).equals(str2.subSequence(0, 10))) {
|
||||
return str1.replaceAll("-", ".").subSequence(0, 10).toString();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str1.replaceAll("-", ".").subSequence(0, 10));
|
||||
sb.append("-");
|
||||
sb.append(str2.replaceAll("-", ".").subSequence(0, 10));
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
public static int dip2px(Context context, double d) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (d * scale + 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.shangyu.gdxzExpert.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 com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MyNewBean;
|
||||
|
||||
public class HonorAdapter extends RecyclerView.Adapter<HonorAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<MyNewBean.HonorBean> datas;
|
||||
int ranking;
|
||||
|
||||
|
||||
public HonorAdapter(Context context, List<MyNewBean.HonorBean> datas,int ranking) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
this.ranking=ranking;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.honor_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.tv_h = view.findViewById(R.id.tv_h);
|
||||
viewHolder.im_yx = view.findViewById(R.id.im_yx);
|
||||
|
||||
viewHolder.tv_h.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
if(ranking>0&&position==0)
|
||||
{
|
||||
holder.tv_h.setText("随访达人 | "+"排名"+ranking);
|
||||
Glide.with(context).asBitmap().load(R.drawable.suifang)
|
||||
.into(holder.im_yx);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ranking>0)
|
||||
{
|
||||
holder.tv_h.setText(datas.get(position-1).getNick_name());
|
||||
Glide.with(context).asBitmap().load(R.drawable.yxb)
|
||||
.into(holder.im_yx);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_h.setText(datas.get(position).getNick_name());
|
||||
Glide.with(context).asBitmap().load(R.drawable.yxb)
|
||||
.into(holder.im_yx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(ranking>0)
|
||||
{
|
||||
return datas.size()+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
private TextView tv_h;
|
||||
private ImageView im_yx;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.CommonUtil.BigModule;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class HospitalAdapter extends BaseAdapter {
|
||||
String[] strTools;
|
||||
int[] strStatus;
|
||||
Context context;
|
||||
public HospitalAdapter(Context context, String[] strTools, int[] strStatus) {
|
||||
this.strTools=strTools;
|
||||
this.strStatus=strStatus;
|
||||
this.context=context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return strTools.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder holder;
|
||||
if(view==null){
|
||||
if(BigModule())
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.item_list_points_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.item_list_points);
|
||||
}
|
||||
|
||||
holder = new ViewHolder();
|
||||
|
||||
holder.item_name=view.findViewById(R.id.item_name);
|
||||
|
||||
view.setTag(holder);
|
||||
}
|
||||
else {
|
||||
holder = (ViewHolder) view.getTag();
|
||||
}
|
||||
holder.item_name.setText(strTools[i]);
|
||||
if(strStatus[i]==1)
|
||||
{
|
||||
holder.item_name.setTextColor(context.getResources().getColor(R.color.tab_text_sel));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(BigModule())
|
||||
{
|
||||
holder.item_name.setTextColor(context.getResources().getColor(com.netease.nim.uikit.R.color.color_333333));
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.item_name.setTextColor(context.getResources().getColor(R.color.tab_text_nor));
|
||||
}
|
||||
|
||||
}
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
|
||||
TextView item_name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.forward.androids.views.ShapeImageView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
|
||||
public class HuiAdapter extends RecyclerView.Adapter<HuiAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<String> datas;
|
||||
|
||||
|
||||
public HuiAdapter(Context context, List<String> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.hui_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_c = view.findViewById(R.id.im_c);
|
||||
viewHolder.r_c=view.findViewById(R.id.r_c);
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels- CommonUtil.dip2px(context, 30) ) / 2f),
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
viewHolder.r_c.setLayoutParams(params);
|
||||
// viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels - CommonUtil.dip2px(context, 5)) / 4.5f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);平分屏幕宽度,显示4个半
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels- CommonUtil.dip2px(context, 10) ) / 1.8f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
// viewHolder.l_c.setLayoutParams(params);
|
||||
// viewHolder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
viewHolder.im_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_c);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position),
|
||||
holder.im_c,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
ShapeImageView im_c;
|
||||
RelativeLayout r_c;
|
||||
// LinearLayout l_c;
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
|
||||
/**
|
||||
* Created by wangchengxin on 2019/7/25.
|
||||
*/
|
||||
|
||||
public class ImageIllnessAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private String[] split;
|
||||
public ImageIllnessAdapter(Context context, String imgs) {
|
||||
this.context = context;
|
||||
split = imgs.split(",");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return split.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return split[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder holder;
|
||||
if (convertView == null) {
|
||||
holder = new ViewHolder();
|
||||
convertView = UIUtils.inflate(R.layout.item_imgillness);
|
||||
holder.iv = convertView.findViewById(R.id.iv_imgillness);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
// ImageLoader.getInstance().displayImage(Url.urlHtml+ split[position],holder.iv);
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.drawable.img_gandan_house);
|
||||
requestOptions.error(R.drawable.img_gandan_house);
|
||||
Glide.with(context)
|
||||
.load(Url.urlHtml+ split[position])
|
||||
.apply(requestOptions)
|
||||
.into(holder.iv);
|
||||
return convertView;
|
||||
}
|
||||
class ViewHolder {
|
||||
ImageView iv;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.OrderBean.OrderData;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:收支明细适配器
|
||||
*/
|
||||
public class IncomeDetailsAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<OrderData> mList;
|
||||
|
||||
public IncomeDetailsAdapter(Context context, List<OrderData> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext, R.layout.item_income_details, null);
|
||||
|
||||
holder.order = (TextView) convertView.findViewById(R.id.item_order);
|
||||
holder.time = (TextView) convertView.findViewById(R.id.item_time);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.type = (TextView) convertView.findViewById(R.id.item_type);
|
||||
holder.price = (TextView) convertView.findViewById(R.id.item_price);
|
||||
holder.status = (TextView) convertView.findViewById(R.id.item_status);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
final OrderData data = mList.get(position);
|
||||
holder.order.setText("订单编号:" + data.getOrderNum());
|
||||
|
||||
if (!TextUtils.isEmpty(data.getOrderDate()) && data.getOrderDate().length() >= 10) {
|
||||
holder.time.setText(data.getOrderDate().substring(0, 10));
|
||||
}else if(!TextUtils.isEmpty(data.getOrderDate())){
|
||||
holder.time.setText(data.getOrderDate());
|
||||
}
|
||||
holder.name.setText(data.getRealName());
|
||||
|
||||
String strType = "";
|
||||
int type = Integer.parseInt(data.getOrderType());
|
||||
if (type == 1) {
|
||||
strType = "电话咨询";
|
||||
} else if (type == 2) {
|
||||
strType = "门诊预约";
|
||||
} else if (type == 3) {
|
||||
strType = "按月定制";
|
||||
} else if (type == 4) {
|
||||
strType = "鲜花";
|
||||
}
|
||||
holder.type.setText(strType);
|
||||
if ("1".equals(data.getIsMonth())) {//是不是包月 1是 0 不是
|
||||
holder.price.setText("包月免费");
|
||||
}else{
|
||||
holder.price.setText("¥" + data.getPrice());
|
||||
}
|
||||
String strStatus = "";
|
||||
int status = Integer.parseInt(data.getOrderStatus());
|
||||
if (status == 1) {
|
||||
strStatus = "待审核";
|
||||
} else if (status == 2) {
|
||||
strStatus = "已审核";
|
||||
} else if (status == 3) {
|
||||
strStatus = "未通过审核";
|
||||
} else if (status == 4) {
|
||||
strStatus = "订单已失效";
|
||||
} else if (status == 5) {
|
||||
strStatus = "患者取消订单";
|
||||
} else if (status == 6) {
|
||||
strStatus = "患者取消订单";
|
||||
} else if (status == 7) {
|
||||
strStatus = "医生取消订单";
|
||||
} else if (status == 8) {
|
||||
strStatus = "已完成";
|
||||
} else if (status == 9) {
|
||||
strStatus = "已结算";
|
||||
}
|
||||
holder.status.setText(strStatus);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
TextView order, time, name, type, price, status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cn.forward.androids.views.ShapeImageView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.HomeBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
|
||||
public class JingAdapter extends RecyclerView.Adapter<JingAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<HomeBean.CourseBean> datas;
|
||||
|
||||
|
||||
public JingAdapter(Context context, List<HomeBean.CourseBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
if(datas.size()==1)
|
||||
{
|
||||
view = LayoutInflater.from(context).inflate(R.layout.jing_item1,
|
||||
parent, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
view = LayoutInflater.from(context).inflate(R.layout.jing_item,
|
||||
parent, false);
|
||||
}
|
||||
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.im_c = view.findViewById(R.id.im_c);
|
||||
viewHolder.tv_n=view.findViewById(R.id.tv_n);
|
||||
viewHolder.tv_update=view.findViewById(R.id.tv_update);
|
||||
|
||||
// viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels - CommonUtil.dip2px(context, 5)) / 4.5f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);平分屏幕宽度,显示4个半
|
||||
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) ((context.getResources().getDisplayMetrics().widthPixels- CommonUtil.dip2px(context, 10) ) / 1.8f),
|
||||
// ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
// viewHolder.l_c.setLayoutParams(params);
|
||||
// viewHolder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
viewHolder.im_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_c);
|
||||
|
||||
ImageLoader.getInstance().displayImage(
|
||||
datas.get(position).getIndex_img(),
|
||||
holder.im_c,
|
||||
ImageOptions.getImageOptions(R.drawable.home_scroll_default));
|
||||
holder.tv_n.setText(datas.get(position).getTitle());
|
||||
if(datas.get(position).getUpload_num().equals(datas.get(position).getVideo_num()))
|
||||
{
|
||||
holder.tv_update.setText("已完结");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_update.setText("已更新"+datas.get(position).getUpload_num()+"课时");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
ShapeImageView im_c;
|
||||
TextView tv_n,tv_update;
|
||||
// LinearLayout l_c;
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.StaUtil.EXPERT_HOME_COURSEWARE_CHECK;
|
||||
import static cn.shangyu.gdxzExpert.utils.StaUtil.EXPERT_HOME_GUIDE_CHECK;
|
||||
import static cn.shangyu.gdxzExpert.utils.StaUtil.EXPERT_HOME_GUIDE_DOWNLOAD;
|
||||
import static cn.shangyu.gdxzExpert.utils.UIUtils.getContext;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.github.dfqin.grantor.PermissionListener;
|
||||
import com.github.dfqin.grantor.PermissionsUtil;
|
||||
import com.hjq.window.EasyWindow;
|
||||
import com.lidroid.xutils.HttpUtils;
|
||||
import com.lidroid.xutils.exception.HttpException;
|
||||
import com.lidroid.xutils.http.HttpHandler;
|
||||
import com.lidroid.xutils.http.ResponseInfo;
|
||||
import com.lidroid.xutils.http.callback.RequestCallBack;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.CourseUrlDetailActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.MainActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.PdfViewActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.HomeBean;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.storage.BookDownloadSqlManager;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.storage.CoursewareBookDownloadSqlManager;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.model.DownloadModel;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
import cn.shangyu.gdxzExpert.utils.DateUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class KejianAdapter extends RecyclerView.Adapter<KejianAdapter.ViewHolder>{
|
||||
private Context context;
|
||||
private List<HomeBean.GuideBean> datas;
|
||||
private Boolean guide;
|
||||
|
||||
public KejianAdapter(Context context, List<HomeBean.GuideBean> datas) {
|
||||
this.context=context;
|
||||
this.datas=datas;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setGuide(Boolean guide) {
|
||||
this.guide = guide;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.kejian_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
|
||||
viewHolder.tv_open = view.findViewById(R.id.tv_open);
|
||||
viewHolder.tv_n=view.findViewById(R.id.tv_n);
|
||||
viewHolder.r_kj=view.findViewById(R.id.r_kj);
|
||||
viewHolder.item_iv_down=view.findViewById(R.id.item_iv_down);
|
||||
|
||||
|
||||
// viewHolder.tv_open.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick(viewHolder.itemView, viewHolder.getAdapterPosition());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return viewHolder;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
holder.tv_n.setText(datas.get(position).getTitle());
|
||||
if(2==getDownloadS(datas.get(position).getArticle_uuid())||4==getDownloadS(datas.get(position).getArticle_uuid()))
|
||||
{
|
||||
holder.tv_open.setText("查看");
|
||||
holder.tv_open.setVisibility(View.VISIBLE);
|
||||
holder.item_iv_down.setVisibility(View.GONE);
|
||||
}
|
||||
else if(1==getDownloadS(datas.get(position).getArticle_uuid())||5==getDownloadS(datas.get(position).getArticle_uuid()))
|
||||
{
|
||||
holder.tv_open.setText("下载中");
|
||||
holder.tv_open.setVisibility(View.VISIBLE);
|
||||
holder.item_iv_down.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.tv_open.setText("未下载");
|
||||
holder.tv_open.setVisibility(View.GONE);
|
||||
holder.item_iv_down.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
holder.r_kj.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(guide)
|
||||
{
|
||||
if(2==getDownloadS(datas.get(position).getArticle_uuid()))
|
||||
|
||||
{
|
||||
String downloadFilePath = BookDownloadSqlManager
|
||||
.getDownloadFilePath(datas.get(position).getArticle_uuid());
|
||||
if(downloadFilePath.contains(Constant.OldfilePath))
|
||||
{
|
||||
// 路径为空,则删除不存在文件的记录
|
||||
|
||||
// DownloadModel downloadModel = new DownloadModel(datas
|
||||
// .get(position).getArticle_uuid());
|
||||
// downloadModel.setState(4);// 0未下载,1下载中,2已下载,4曾经下载过但是路径换了
|
||||
// BookDownloadSqlManager
|
||||
// .updateDownloadState(downloadModel);
|
||||
// BookDownloadSqlManager.delDownladInfo(datas.get(position).getArticle_uuid());
|
||||
// notifyDataSetChanged();
|
||||
// ToastUtil.showToast("文件不存在,请重新下载");
|
||||
showDialog(Url.urlHtml +datas.get(position).getPath(), datas.get(position).getTitle(),position);
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isEmpty(downloadFilePath)) {
|
||||
MobclickAgent.onEvent(context,EXPERT_HOME_GUIDE_CHECK);
|
||||
// 路径不为空,打开该指南
|
||||
libraryUuid=datas.get(position).getArticle_uuid();
|
||||
if(context instanceof MainActivity)
|
||||
{
|
||||
( (MainActivity)context).needreportDetail("诊疗指南", datas.get(position).getTags(),datas.get(position).getTitle());
|
||||
}
|
||||
openFile(downloadFilePath);
|
||||
} else {
|
||||
// 路径为空,则删除不存在文件的记录
|
||||
BookDownloadSqlManager.delDownladInfo(datas.get(position).getArticle_uuid());
|
||||
notifyDataSetChanged();
|
||||
ToastUtil.showToast("文件不存在,请重新下载");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (PermissionsUtil.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
// 下载
|
||||
downloadPdfen(
|
||||
Url.urlHtml +datas.get(position).getPath(),
|
||||
datas.get(position).getTitle(), position,
|
||||
holder);
|
||||
} else {
|
||||
EasyWindow.with((Activity) context).setGravity(Gravity.TOP).setYOffset(200).setWidth(1000)
|
||||
|
||||
.setContentView(R.layout.float_top_dialog_download).show();
|
||||
PermissionsUtil.requestPermission((Activity)context, new PermissionListener() {
|
||||
@Override
|
||||
public void permissionGranted(@NonNull String[] permissions) {
|
||||
EasyWindow.cancelAll();
|
||||
// 下载
|
||||
downloadPdfen(
|
||||
Url.urlHtml +datas.get(position).getPath(),
|
||||
datas.get(position).getTitle(), position,
|
||||
holder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void permissionDenied(@NonNull String[] permissions) {
|
||||
EasyWindow.cancelAll();
|
||||
//用户拒绝了访问读写的申请
|
||||
//
|
||||
}
|
||||
|
||||
}, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE});
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// 下载
|
||||
downloadPdfen(
|
||||
Url.urlHtml +datas.get(position).getPath(),
|
||||
datas.get(position).getTitle(), position,
|
||||
holder);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MobclickAgent.onEvent(context,EXPERT_HOME_COURSEWARE_CHECK);
|
||||
Intent intent = new Intent(context, CourseUrlDetailActivity.class);
|
||||
intent.putExtra("url", datas.get(position).getPath());
|
||||
intent.putExtra("title", datas.get(position).getTitle());
|
||||
intent.putExtra("uuid", datas.get(position).getArticle_uuid());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Glide.with(context).asBitmap().load(datas.get(position).getIndex_img())
|
||||
// .into(holder.im_c);
|
||||
// ImageLoader.getInstance().displayImage(
|
||||
// datas.get(position),
|
||||
// holder.im_c,
|
||||
// ImageOptions.getImageOptions(R.drawable.home_scroll_default));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库查询下载状态 0未下载,1下载中,2已下载
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
private int getDownloadS(String uuid) {
|
||||
// TODO Auto-generated method stub
|
||||
int downloadState;
|
||||
if(guide)
|
||||
{
|
||||
downloadState = BookDownloadSqlManager.getDownloadState(uuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadState = CoursewareBookDownloadSqlManager.getDownloadState(uuid);
|
||||
Log.d("aaaaaa","downloadState"+downloadState+uuid);
|
||||
}
|
||||
|
||||
|
||||
return downloadState;
|
||||
}
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
TextView tv_open,tv_n;
|
||||
RelativeLayout r_kj;
|
||||
ImageView item_iv_down;
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
String libraryUuid="";
|
||||
public void openFile(final String path) {
|
||||
File file = new File(path);
|
||||
|
||||
|
||||
if (file.exists()) {
|
||||
if(path.contains("pdf")){
|
||||
Intent intent1 = new Intent(context, PdfViewActivity.class);
|
||||
intent1.putExtra("path",path);
|
||||
intent1.putExtra("title","文献详情");
|
||||
context.startActivity(intent1);
|
||||
}else {
|
||||
Uri path1 = Uri.fromFile(file);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(path1, "application/pdf");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
ToastUtil.showToast("打开失败, 请安装相应应用!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// 路径为空,则删除不存在文件的记录
|
||||
BookDownloadSqlManager.delDownladInfo(libraryUuid);
|
||||
notifyDataSetChanged();
|
||||
ToastUtil.showToast("文件不存在,请重新下载");
|
||||
}
|
||||
}
|
||||
// private String filePath = Environment.getExternalStorageDirectory()
|
||||
// .getAbsolutePath() + "/gdxzExpert/download/治疗指南/";
|
||||
private String filePath =getContext().getExternalFilesDir("").getAbsolutePath()+"/gdxzExpert/download/治疗指南/";
|
||||
private HttpHandler<File> hand;
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
*
|
||||
*/
|
||||
protected void downloadPdfen(String url, final String name,
|
||||
final int position, final ViewHolder holder) {
|
||||
MobclickAgent.onEvent(context,EXPERT_HOME_GUIDE_DOWNLOAD);
|
||||
// TODO Auto-generated method stub
|
||||
if(StringUtil.isEmpty(url))
|
||||
{
|
||||
ToastUtil.showToast("下载地址有误"+url);
|
||||
return;
|
||||
}
|
||||
if(context instanceof MainActivity)
|
||||
{
|
||||
( (MainActivity)context).needreportDown(name,datas.get(position).getTags(),datas.get(position).getGuide_type(),1+"","诊疗指南");
|
||||
}
|
||||
// 下载pdf
|
||||
if (Environment.getExternalStorageState().equals(
|
||||
Environment.MEDIA_MOUNTED)) {
|
||||
// sdcard存在
|
||||
HttpUtils http = new HttpUtils();
|
||||
String[] split = name.split(":");
|
||||
String name1 = split[split.length-1];
|
||||
final String path = filePath + name1 + ".pdf";
|
||||
// 下载的路径,及app安装包的命名
|
||||
// ***************************************************
|
||||
hand = http.download(url, path, false, // 如果目标文件存在,接着未完成的部分继续下载。服务器不支持RANGE时将从新下载。
|
||||
true, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。
|
||||
new RequestCallBack<File>() {
|
||||
|
||||
private DownloadModel downloadModel;
|
||||
|
||||
/** 下载开始 **/
|
||||
@Override
|
||||
public void onStart() {
|
||||
ToastUtil.showToast("开始下载" + name);
|
||||
|
||||
// 插入下载数据库
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
downloadModel.setTitle(datas.get(position).getTitle());// 设置标题
|
||||
// downloadModel.setTime(datas.get(position).getTitle());// 设置标题
|
||||
if(!StringUtil.isEmpty(datas.get(position).getCreate_date())) {
|
||||
downloadModel.setTime(datas.get(position).getCreate_date());
|
||||
} else {
|
||||
downloadModel.setTime(DateUtil
|
||||
.getCurDateStr("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
downloadModel.setPath(datas.get(position).getPath());// 设置url路劲
|
||||
downloadModel.setFilePath(path);// 设置文件下载路径
|
||||
downloadModel.setFileFormat(".pdf");// 设置文件格式
|
||||
downloadModel.setState(1);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager
|
||||
.insertDownload(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/** 下载中与进度 **/
|
||||
@Override
|
||||
public void onLoading(long total, long current,
|
||||
boolean isUploading) {
|
||||
|
||||
}
|
||||
|
||||
/** 下载完成 **/
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<File> responseInfo) {
|
||||
|
||||
// 更新下载状态为完成
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
}
|
||||
downloadModel.setState(2);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager
|
||||
.insertDownload(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
// if ((int) holder.bt_down_load.getTag() == position) {
|
||||
// // 异步显示
|
||||
// // holder.bt_down_load.setText("查看全文");
|
||||
// holder.bt_down_load.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.lookmess));
|
||||
// holder.tv_down.setVisibility(View.GONE);
|
||||
// }
|
||||
// if (BookshelfListActivity.getInstance() != null) {
|
||||
// BookshelfListActivity.getInstance()
|
||||
// .notifyAdapter();
|
||||
// }
|
||||
// if (MyDownloadActivity.getInstance() != null) {
|
||||
// MyDownloadActivity.getInstance()
|
||||
// .notifyAdapter();
|
||||
// }
|
||||
ToastUtil.showToast(name + "下载完成!");
|
||||
// 打开文件
|
||||
// openFile(path);
|
||||
}
|
||||
|
||||
/** 下载失败 **/
|
||||
@Override
|
||||
public void onFailure(HttpException error, String msg) {
|
||||
|
||||
ToastUtil.showToast(name + "下载失败!");
|
||||
// 更新下载状态为未下载
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
}
|
||||
downloadModel.setState(0);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
// if ((int) holder.bt_down_load.getTag() == position) {
|
||||
// 异步显示
|
||||
// holder.bt_down_load.setText("下载全文");
|
||||
// holder.bt_down_load
|
||||
// .setBackgroundDrawable(mContext
|
||||
// .getResources()
|
||||
// .getDrawable(
|
||||
// R.drawable.download));
|
||||
// holder.tv_down.setVisibility(View.GONE);
|
||||
// }
|
||||
// if (BookshelfListActivity.getInstance() != null) {
|
||||
// BookshelfListActivity.getInstance()
|
||||
// .notifyAdapter();
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showToast("SD卡不存在,无法下载");
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void showDialog(String url, final String name,
|
||||
final int position)
|
||||
{
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.dialog_notification, null);
|
||||
AlertDialog dialog4 = new AlertDialog.Builder(context).create();
|
||||
TextView tv_tishi = layout.findViewById(R.id.tv_tishi);
|
||||
tv_tishi.setText(context.getResources().getString(R.string.redoenload));
|
||||
Button btn_sure = (Button) layout.findViewById(R.id.btn_sure);
|
||||
Button btn_cancel = (Button) layout.findViewById(R.id.btn_cancel);
|
||||
dialog4.show();
|
||||
Window window =dialog4.getWindow();
|
||||
// window.setGravity(Gravity.CENTER);
|
||||
WindowManager.LayoutParams layoutParams = window.getAttributes();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(layoutParams);
|
||||
dialog4.getWindow().setContentView(layout);
|
||||
btn_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
dialog4.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
btn_sure.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
downloadPdfennew(url,name,position);
|
||||
dialog4.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
protected void downloadPdfennew(String url, final String name,
|
||||
final int position) {
|
||||
MobclickAgent.onEvent(context,EXPERT_HOME_GUIDE_DOWNLOAD);
|
||||
// TODO Auto-generated method stub
|
||||
if(StringUtil.isEmpty(url))
|
||||
{
|
||||
ToastUtil.showToast("下载地址有误"+url);
|
||||
return;
|
||||
}
|
||||
if(context instanceof MainActivity)
|
||||
{
|
||||
( (MainActivity)context).needreportDown(name,datas.get(position).getTags(),datas.get(position).getGuide_type(),1+"","诊疗指南");
|
||||
}
|
||||
|
||||
// 下载pdf
|
||||
if (Environment.getExternalStorageState().equals(
|
||||
Environment.MEDIA_MOUNTED)) {
|
||||
// sdcard存在
|
||||
HttpUtils http = new HttpUtils();
|
||||
String[] split = name.split(":");
|
||||
String name1 = split[split.length-1];
|
||||
final String path = filePath + name1 + ".pdf";
|
||||
// 下载的路径,及app安装包的命名
|
||||
// ***************************************************
|
||||
hand = http.download(url, path, false, // 如果目标文件存在,接着未完成的部分继续下载。服务器不支持RANGE时将从新下载。
|
||||
true, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。
|
||||
new RequestCallBack<File>() {
|
||||
|
||||
private DownloadModel downloadModel;
|
||||
|
||||
/** 下载开始 **/
|
||||
@Override
|
||||
public void onStart() {
|
||||
ToastUtil.showToast("开始下载" + name);
|
||||
|
||||
// 插入下载数据库
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
// downloadModel.setTitle(datas.get(position).getTitle());// 设置标题
|
||||
// if(!StringUtil.isEmpty(datas.get(position).getCreate_date())) {
|
||||
// downloadModel.setTime(datas.get(position).getCreate_date());
|
||||
// } else {
|
||||
// downloadModel.setTime(DateUtil
|
||||
// .getCurDateStr("yyyy-MM-dd HH:mm:ss"));
|
||||
// }
|
||||
downloadModel.setPath(datas.get(position).getPath());// 设置url路劲
|
||||
downloadModel.setFilePath(path);// 设置文件下载路径
|
||||
// downloadModel.setFileFormat(".pdf");// 设置文件格式
|
||||
downloadModel.setState(5);// 0未下载,1下载中,2已下载,4更改路径重新下载,但未下载,5,下载中
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
// BookDownloadSqlManager
|
||||
// .insertDownload(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/** 下载中与进度 **/
|
||||
@Override
|
||||
public void onLoading(long total, long current,
|
||||
boolean isUploading) {
|
||||
|
||||
}
|
||||
|
||||
/** 下载完成 **/
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<File> responseInfo) {
|
||||
|
||||
// 更新下载状态为完成
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
}
|
||||
downloadModel.setState(2);// 0未下载,1下载中,2已下载
|
||||
// BookDownloadSqlManager
|
||||
// .insertDownload(downloadModel);
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadFilePath(downloadModel);
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
ToastUtil.showToast(name + "下载完成!");
|
||||
// 打开文件
|
||||
// openFile(path);
|
||||
}
|
||||
|
||||
/** 下载失败 **/
|
||||
@Override
|
||||
public void onFailure(HttpException error, String msg) {
|
||||
|
||||
ToastUtil.showToast(name + "下载失败!");
|
||||
// 更新下载状态为未下载
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(datas
|
||||
.get(position).getArticle_uuid());
|
||||
}
|
||||
downloadModel.setState(4);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showToast("SD卡不存在,无法下载");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LibraryListBean.LibraryData;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* LibraryBookshelfAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25 Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我的图书馆书架适配器
|
||||
*/
|
||||
public class LibraryBookshelfAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<LibraryData> mList;
|
||||
private int type;
|
||||
|
||||
public LibraryBookshelfAdapter(Context context, List<LibraryData> list,
|
||||
int type) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(mContext,
|
||||
R.layout.fragment_bookshelf_item_big, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(mContext,
|
||||
R.layout.fragment_bookshelf_item, null);
|
||||
}
|
||||
|
||||
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);// 标题名字
|
||||
holder.img = (ImageView) convertView.findViewById(R.id.item_img);
|
||||
holder.tv_num = (TextView) convertView.findViewById(R.id.tv_num);
|
||||
holder.item = convertView.findViewById(R.id.item_view);
|
||||
|
||||
// 计算GridView的列宽
|
||||
// int width = mContext.getResources().getDisplayMetrics().widthPixels;
|
||||
// int w = width - CommonUtil.dip2px(mContext, 40);
|
||||
// double h = (w / 3) * 1.415;
|
||||
// LayoutParams i = holder.img.getLayoutParams();
|
||||
// i.width = LayoutParams.WRAP_CONTENT;
|
||||
// i.height = (int) h;
|
||||
// holder.img.setLayoutParams(i);
|
||||
// LogUtil.i("width=" + width + "w=" + w + "h=" + h);
|
||||
|
||||
if (type == 1) {
|
||||
holder.name.setVisibility(View.INVISIBLE);
|
||||
holder.tv_num.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.tv_num.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
if (position>=0){
|
||||
final LibraryData data = mList.get(position);
|
||||
if (type == 1) {
|
||||
holder.name.setText(" ");
|
||||
} else {
|
||||
holder.name.setText(data.name);
|
||||
holder.tv_num.setText("(共"+data.total+"份)");
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(data.imgs)) {
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml + data.imgs,
|
||||
holder.img,
|
||||
ImageOptions.getImageOptions(R.drawable.book_default));
|
||||
|
||||
} else {
|
||||
holder.img.setImageResource(R.drawable.book_default);
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public class Holder {
|
||||
public ImageView img;
|
||||
public TextView name;
|
||||
public TextView tv_num;
|
||||
View item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LibraryListBean.LibraryData;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我的图书馆(权威速递、常用工具)适配器
|
||||
*/
|
||||
public class LibraryListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<LibraryData> mList;
|
||||
|
||||
public LibraryListAdapter(Context context, List<LibraryData> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext, R.layout.fragment_library_list_item, null);
|
||||
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
final LibraryData data = mList.get(position);
|
||||
holder.name.setText(data.name);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
TextView name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.EventListBean.EventBase;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class LinChuangAdapter extends BaseAdapter {
|
||||
|
||||
public List<EventBase> datas;
|
||||
public Activity mActivity;
|
||||
|
||||
public LinChuangAdapter(List<EventBase> datas, Activity mActivity) {
|
||||
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_gd_event);
|
||||
vh = new ViewHolder();
|
||||
vh.mTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_gdtitle);
|
||||
vh.mTime = (TextView) convertView.findViewById(R.id.tv_item_gdtime);
|
||||
vh.mUp = (TextView) convertView.findViewById(R.id.tv_item_gdup);
|
||||
vh.mOverTime = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_gdisover);
|
||||
vh.mImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_gdimage);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTitle.setText(datas.get(position).getTitle());
|
||||
vh.mTime.setText("招募截至:"
|
||||
+ datas.get(position).getEnd_date().substring(0, 10));
|
||||
if ("0".equals(datas.get(position).getSort())) {
|
||||
vh.mUp.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.mUp.setVisibility(View.GONE);
|
||||
}
|
||||
if ("0".equals(datas.get(position).getStatus())) {
|
||||
vh.mOverTime.setVisibility(View.VISIBLE);
|
||||
vh.mTitle.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.hint_text_color));
|
||||
} else {
|
||||
vh.mOverTime.setVisibility(View.GONE);
|
||||
vh.mTitle.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.black));
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getImgpath())
|
||||
&& !"null".equals(datas.get(position).getImgpath())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + datas.get(position).getImgpath(),
|
||||
vh.mImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.home_scroll_default1));
|
||||
} else {
|
||||
vh.mImage.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTime, mUp, mOverTime;
|
||||
ImageView mImage;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static com.netease.nim.uikit.common.util.sys.TimeUtil.isSameYear;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LogisticsBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class LogistAdapter extends BaseAdapter {
|
||||
List<LogisticsBean.LoBean> beanList;
|
||||
|
||||
public LogistAdapter(List<LogisticsBean.LoBean> beanList) {
|
||||
this.beanList = beanList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return beanList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return beanList.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View convertView, ViewGroup viewGroup) {
|
||||
viewHolder viewHolder=null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.logist_item);
|
||||
viewHolder=new viewHolder();
|
||||
viewHolder.time1=convertView.findViewById(R.id.time1);
|
||||
viewHolder.time2=convertView.findViewById(R.id.time2);
|
||||
viewHolder.tv_content=convertView.findViewById(R.id.tv_content);
|
||||
viewHolder.imview=convertView.findViewById(R.id.imview);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
viewHolder= (viewHolder) convertView.getTag();
|
||||
}
|
||||
if(isSameYear(beanList.get(i).getFtime().substring(0, 4)))
|
||||
{
|
||||
viewHolder.time1.setText(beanList.get(i).getFtime().substring(5, 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
viewHolder.time1.setText(beanList.get(i).getFtime().substring(0, 10));
|
||||
|
||||
}
|
||||
viewHolder.time2.setText(beanList.get(i).getFtime().substring(11, 16));
|
||||
if(beanList.get(i).getStatusCode().contains("3"))
|
||||
{
|
||||
viewHolder.imview.setImageResource(R.drawable.log_checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
viewHolder.imview.setImageResource(R.drawable.log_check);
|
||||
}
|
||||
viewHolder.tv_content.setText(beanList.get(i).getContext());
|
||||
return convertView;
|
||||
}
|
||||
public class viewHolder
|
||||
{
|
||||
TextView time1,time2,tv_content;
|
||||
ImageView imview;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LoveListBean.LoveData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* ScienceListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-6 上午9:48:06 Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:爱心捐助列表的适配器
|
||||
*/
|
||||
public class LoveListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<LoveData> mData;
|
||||
|
||||
public LoveListAdapter(Context context, List<LoveData> mList) {
|
||||
this.mContext = context;
|
||||
this.mData = mList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = UIUtils.inflate(R.layout.love_list_item);
|
||||
holder.img =convertView
|
||||
.findViewById(R.id.item_img);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.time = (TextView) convertView.findViewById(R.id.item_time);
|
||||
holder.subtitle = (TextView) convertView
|
||||
.findViewById(R.id.item_subtitle);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
LoveData love = mData.get(position);
|
||||
|
||||
String img = love.photo;
|
||||
if (StringUtil.notEmpty(img)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + img,
|
||||
holder.img,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
holder.img.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
String name = love.name;
|
||||
if (StringUtil.notEmpty(name)) {
|
||||
holder.name.setText(name);
|
||||
} else {
|
||||
holder.name.setText("为空");
|
||||
}
|
||||
String strTime = love.createDate;
|
||||
if (!TextUtils.isEmpty(love.createDate)
|
||||
&& love.createDate.length() > 10) {
|
||||
strTime = love.createDate.substring(0, 10);
|
||||
}
|
||||
// if (StringUtil.notEmpty(strTime)) {
|
||||
// if (strTime.length() > 10) {
|
||||
// strTime = strTime.substring(0, 10);
|
||||
// }
|
||||
// } else {
|
||||
// strTime = "";
|
||||
// }
|
||||
holder.time.setText(strTime);
|
||||
holder.subtitle.setText(love.content);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
ImageView img;
|
||||
TextView name, time, subtitle;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.ZhiBoActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.MeetingBean.MeatingList;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class MeetingAdapter extends BaseAdapter {
|
||||
Activity mActivity;
|
||||
List<MeatingList> mList;
|
||||
|
||||
// public List<String> Positions;
|
||||
|
||||
public MeetingAdapter(Activity mActivity, List<MeatingList> mList) {
|
||||
|
||||
this.mActivity = mActivity;
|
||||
this.mList = mList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_meeting);
|
||||
vh = new ViewHolder();
|
||||
vh.mDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_date);
|
||||
vh.mTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_title);
|
||||
vh.mTTime = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_ttime);
|
||||
vh.mLocation = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_location);
|
||||
vh.mTDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_item_meeting_tdate);
|
||||
vh.mImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_meeting_image);
|
||||
vh.mV_color = convertView.findViewById(R.id.item_color);
|
||||
vh.mRl = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_item_meeting);
|
||||
vh.mFl = (FrameLayout) convertView.findViewById(R.id.fl_meeting);
|
||||
vh.mZhiBo = (TextView) convertView.findViewById(R.id.tv_meeting);
|
||||
vh.mIv_bofang = (ImageView) convertView
|
||||
.findViewById(R.id.iv_meeting_bofang);
|
||||
// vh.mSpareZhiBo = (TextView) convertView
|
||||
// .findViewById(R.id.tv_meeting_bei);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (mList.get(position).getCount() == 0) {
|
||||
vh.mTDate.setVisibility(View.VISIBLE);
|
||||
vh.mTDate.setText(mList.get(position).getBegin_date()
|
||||
.substring(0, 4)
|
||||
+ "年"
|
||||
+ mList.get(position).getBegin_date().substring(5, 7)
|
||||
+ "月");
|
||||
} else {
|
||||
vh.mTDate.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
vh.mTTime.setText(mList.get(position).getBegin_date().substring(8));
|
||||
vh.mDate.setText(getTime(mList.get(position).getBegin_date(), mList
|
||||
.get(position).getEnd_date()));
|
||||
vh.mTitle.setText(mList.get(position).getTitle());
|
||||
vh.mLocation.setText(mList.get(position).getLocation());
|
||||
|
||||
if (mList.get(position).getCount() % 4 == 0) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu1);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu1));
|
||||
} else if (mList.get(position).getCount() % 4 == 1) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius2);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu2));
|
||||
} else if (mList.get(position).getCount() % 4 == 2) {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radius3);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu3));
|
||||
} else {
|
||||
vh.mV_color.setBackgroundResource(R.drawable.radiu4);
|
||||
vh.mTTime.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.radiu4));
|
||||
}
|
||||
if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("1")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.VISIBLE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.VISIBLE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("预告");
|
||||
} else if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("2")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.VISIBLE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.VISIBLE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("直播中");
|
||||
} else if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("3")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.GONE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.GONE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("已结束");
|
||||
}else if (mList.get(position).getStatus() != null
|
||||
&& mList.get(position).getStatus().equals("4")) {
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
vh.mIv_bofang.setVisibility(View.GONE);
|
||||
vh.mZhiBo.setVisibility(View.VISIBLE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.GONE);
|
||||
pp.height = dip2px(mActivity, 247);
|
||||
vh.mFl.setVisibility(View.VISIBLE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
vh.mZhiBo.setText("回放中");
|
||||
} else {
|
||||
vh.mIv_bofang.setVisibility(View.GONE);
|
||||
vh.mZhiBo.setVisibility(View.GONE);
|
||||
// vh.mSpareZhiBo.setVisibility(View.GONE);
|
||||
ViewGroup.LayoutParams pp = vh.mRl.getLayoutParams();
|
||||
vh.mRl.getLayoutParams();
|
||||
pp.height = dip2px(mActivity, 75);
|
||||
vh.mFl.setVisibility(View.GONE);
|
||||
vh.mRl.setLayoutParams(pp);
|
||||
}
|
||||
vh.mFl.setTag(position);
|
||||
vh.mFl.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if (mList.get((Integer) v.getTag()).getStatus().equals("3")) {
|
||||
return;
|
||||
}
|
||||
// if(mActivity instanceof MainActivity) {
|
||||
// ((MainActivity)mActivity).needreportSome("watch_live", mList.get((Integer) v.getTag())
|
||||
// .getTitle(),mList.get((Integer) v.getTag()).getTags());
|
||||
// }
|
||||
Intent intent = new Intent(mActivity, ZhiBoActivity.class);
|
||||
intent.putExtra("newsTitle", mList.get((Integer) v.getTag())
|
||||
.getTitle());
|
||||
intent.putExtra("url", mList.get((Integer) v.getTag())
|
||||
.getLiveurl());
|
||||
intent.putExtra("summary", mList.get((Integer) v.getTag())
|
||||
.getLiveimg());
|
||||
intent.setType("zhibo");
|
||||
mActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
if (!TextUtils.isEmpty(mList.get(position).getLiveimg())
|
||||
&& !"null".equals(mList.get(position).getLiveimg())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + mList.get(position).getLiveimg(),
|
||||
vh.mImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.home_scroll_default1));
|
||||
} else {
|
||||
vh.mImage.setImageResource(R.drawable.home_scroll_default1);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTitle, mTTime, mDate, mLocation, mTDate, mZhiBo;
|
||||
// mSpareZhiBo;
|
||||
View mV_color;
|
||||
ImageView mImage, mIv_bofang;
|
||||
RelativeLayout mRl;
|
||||
FrameLayout mFl;
|
||||
}
|
||||
|
||||
public String getTime(String str1, String str2) {
|
||||
if (str1.subSequence(0, 10).equals(str2.subSequence(0, 10))) {
|
||||
return str1.replaceAll("-", ".").subSequence(0, 10).toString();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str1.replaceAll("-", ".").subSequence(0, 10));
|
||||
sb.append("-");
|
||||
sb.append(str2.replaceAll("-", ".").subSequence(0, 10));
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
public static int dip2px(Context context, double d) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (d * scale + 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
// 显示时间的adapter类
|
||||
public class MeetingTimeAdapter extends BaseAdapter {
|
||||
private ArrayList<String> list;
|
||||
private int position;
|
||||
|
||||
public MeetingTimeAdapter(ArrayList<String> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return list.get(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int arg0, View arg1, ViewGroup arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder viewHolder;
|
||||
if (arg1 == null) {
|
||||
viewHolder = new ViewHolder();
|
||||
arg1 = UIUtils.inflate(R.layout.item_meeting_time);
|
||||
viewHolder.tv_time = (TextView) arg1.findViewById(R.id.tv_time);
|
||||
viewHolder. v_line = (View) arg1.findViewById(R.id.v_line);
|
||||
viewHolder. iv_time = (ImageView) arg1.findViewById(R.id.iv_time);
|
||||
arg1.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) arg1.getTag();
|
||||
}
|
||||
|
||||
viewHolder.tv_time.setText(list.get(arg0).toString());
|
||||
if (position==arg0) {
|
||||
viewHolder.iv_time.setVisibility(View.VISIBLE);
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.top_title));
|
||||
viewHolder.tv_time.setTextColor(UIUtils.getColor(R.color.top_title));
|
||||
}else{
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.devider_line));
|
||||
viewHolder.tv_time.setTextColor(UIUtils.getColor(R.color.tab_text_nor));
|
||||
viewHolder.iv_time.setVisibility(View.GONE);
|
||||
}
|
||||
return arg1;
|
||||
}
|
||||
|
||||
class ViewHolder{
|
||||
TextView tv_time;
|
||||
View v_line;
|
||||
ImageView iv_time;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MessageBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class MessageAdapter extends BaseAdapter
|
||||
{
|
||||
private List<MessageBean.BeanData.DetailBean> list;
|
||||
public MessageAdapter(List<MessageBean.BeanData.DetailBean> messageBeans) {
|
||||
list=messageBeans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder viewHolder;
|
||||
if (view == null) {
|
||||
viewHolder = new ViewHolder();
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.message_item_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.message_item);
|
||||
}
|
||||
|
||||
viewHolder.tv_time = view.findViewById(R.id.tv_time);
|
||||
viewHolder. tv_title = view.findViewById(R.id.tv_title);
|
||||
viewHolder. tv_content = view.findViewById(R.id.tv_content);
|
||||
|
||||
view.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) view.getTag();
|
||||
}
|
||||
viewHolder.tv_time.setText(list.get(i).getCreate_date());
|
||||
viewHolder. tv_title.setText(list.get(i).getTitle());
|
||||
if("1".equals(list.get(i).getIs_read()))
|
||||
{
|
||||
viewHolder. tv_title.setTextColor(Color.parseColor("#333333"));
|
||||
}
|
||||
else
|
||||
{
|
||||
viewHolder. tv_title.setTextColor(Color.parseColor("#EB322D"));
|
||||
}
|
||||
viewHolder. tv_content.setText(list.get(i).getContent());
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder{
|
||||
TextView tv_time,tv_title,tv_content;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.ExpertMindList.mindList.expertMind;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class MindAdapter extends BaseAdapter {
|
||||
private List<expertMind> beanlists;
|
||||
|
||||
public MindAdapter(List<expertMind> beanlists) {
|
||||
this.beanlists = beanlists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_get_mind_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_get_mind);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_pic = convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
vh.mTv_content = (TextView) convertView
|
||||
.findViewById(R.id.item_mind_comtent);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_mind_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_mind_time);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(beanlists.get(position).getUser_photo())
|
||||
&& !"null".equals(beanlists.get(position).getUser_photo())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + beanlists.get(position).getUser_photo(),
|
||||
vh.mIv_pic,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.mIv_pic.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
vh.mTv_content.setText(beanlists.get(position).getMessage());
|
||||
vh.mTv_name.setText(beanlists.get(position).getUser_name());
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//
|
||||
// String sd = sdf.format(new Date(Long.parseLong(beanlists.get(position)
|
||||
// .getCreate_date()) * 1000));
|
||||
// vh.mTv_time.setText(sd);
|
||||
vh.mTv_time.setText(beanlists.get(position).getCreate_date().substring(0, 10));
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
public ImageView mIv_pic;
|
||||
public TextView mTv_time, mTv_name, mTv_content;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MoreNoticeAdapter extends BaseAdapter {
|
||||
|
||||
private Context mContent;
|
||||
private List<String> list1;
|
||||
|
||||
public MoreNoticeAdapter(Context mContent, List<String> list1) {
|
||||
super();
|
||||
this.mContent = mContent;
|
||||
this.list1 = list1;
|
||||
}
|
||||
|
||||
public MoreNoticeAdapter() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return list1.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return list1.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
Holder holder;
|
||||
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContent, R.layout.item_more_notice,
|
||||
null);
|
||||
holder.tv_more_notice = (TextView) convertView
|
||||
.findViewById(R.id.tv_more_notice);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.tv_more_notice.setText(list1.get(position));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
// RoundImageView img;
|
||||
TextView tv_more_notice;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.LibraryListBean.LibraryData;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我的图书馆(权威速递、常用工具)适配器
|
||||
*/
|
||||
public class MyCollectAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<LibraryData> mList;
|
||||
|
||||
public MyCollectAdapter(Context context, List<LibraryData> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext, R.layout.activity_my_collect_item, null);
|
||||
holder.img = (ImageView) convertView.findViewById(R.id.item_img);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.summary = (TextView) convertView.findViewById(R.id.item_summary);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
|
||||
final LibraryData data = mList.get(position);
|
||||
holder.name.setText(data.title);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
ImageView img;
|
||||
TextView name, summary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.utils.UIUtils.getContext;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.lidroid.xutils.HttpUtils;
|
||||
import com.lidroid.xutils.exception.HttpException;
|
||||
import com.lidroid.xutils.http.HttpHandler;
|
||||
import com.lidroid.xutils.http.ResponseInfo;
|
||||
import com.lidroid.xutils.http.callback.RequestCallBack;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.storage.BookDownloadSqlManager;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.model.DownloadModel;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
|
||||
/**
|
||||
* LibraryListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-4 上午11:15:25
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我的图书馆(权威速递、常用工具)适配器
|
||||
*/
|
||||
@SuppressLint("ResourceAsColor")
|
||||
public class MyDownloadAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<DownloadModel> mList;
|
||||
public MyDownloadAdapter(Context context, ArrayList<DownloadModel> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
this.progress = new int[mList.size()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
final Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(mContext, R.layout.activity_bookshelf_list_item_big, null);
|
||||
holder.iv_down = convertView
|
||||
.findViewById(R.id.item_tv_down1);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(mContext, R.layout.activity_bookshelf_list_item, null);
|
||||
holder.iv_down = (ImageView) convertView.findViewById(R.id.item_iv_down);
|
||||
}
|
||||
|
||||
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.item_date);
|
||||
holder.tv_down = (TextView) convertView.findViewById(R.id.item_tv_down);
|
||||
|
||||
holder.iv_right = (ImageView) convertView.findViewById(R.id.item_iv_right);
|
||||
holder.iv_right.setVisibility(View.GONE);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
final DownloadModel data = mList.get(position);
|
||||
if(data.getFilePath()!=null&&data.getFilePath().contains(Constant.OldfilePath)
|
||||
&&(data.getState() == 2||data.getState() == 4))
|
||||
{
|
||||
holder.tv_down.setVisibility(View.GONE);
|
||||
holder.iv_down.setVisibility(View.VISIBLE);
|
||||
holder.tv_down.setText("未下载");
|
||||
}
|
||||
else if (BookDownloadSqlManager.getDownloadState(data.getUuid())== 1||BookDownloadSqlManager.getDownloadState(data.getUuid()) == 5) {//0未下载,1下载中,2已下载
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
holder.tv_down.setText("下载中");
|
||||
}else if(BookDownloadSqlManager.getDownloadState(data.getUuid()) == 2){
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
holder.tv_down.setText("查看");
|
||||
}else{
|
||||
holder.tv_down.setVisibility(View.GONE);
|
||||
holder.iv_down.setVisibility(View.VISIBLE);
|
||||
holder.tv_down.setText("未下载");
|
||||
}
|
||||
holder.name.setText(data.getTitle());
|
||||
// if(data.getTime() != null){
|
||||
// if(data.getTime().length() > 10){
|
||||
// String tim = data.getTime().substring(0,10);
|
||||
// holder.date.setText(tim);
|
||||
// }else{
|
||||
// holder.date.setText(data.getTime());
|
||||
// }
|
||||
// }
|
||||
if (!TextUtils.isEmpty(data.getTime()) && data.getTime().length() > 10) {
|
||||
holder.date.setText(data.getTime().substring(0,10));
|
||||
}else if(!TextUtils.isEmpty(data.getTime())){
|
||||
holder.date.setText(data.getTime());
|
||||
}
|
||||
|
||||
holder.iv_down.setTag(position);
|
||||
holder.tv_down.setTag(position);
|
||||
// holder.iv_down.setOnClickListener(new OnClickListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// // TODO Auto-generated method stub
|
||||
// // ToastUtil.showMessage("下载已完成");
|
||||
// if (TextUtils.isEmpty(data.getPath())) {
|
||||
// ToastUtil.showToast("不存在此指南,无法下载。");
|
||||
// return;
|
||||
// }
|
||||
// if(data.getState()==5)
|
||||
// {
|
||||
// ToastUtil.showToast("下载中...");
|
||||
// return;
|
||||
// }
|
||||
// downloadPdfen(Url.urlHtml+data.getPath(), data.getTitle(), position);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
public ImageView iv_right;
|
||||
public View iv_down;
|
||||
public TextView tv_down;
|
||||
public TextView date;
|
||||
ImageView img;
|
||||
TextView name, size, time, state;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* downloadPdf
|
||||
* @param position
|
||||
* @param holder
|
||||
*
|
||||
* @param path
|
||||
* void
|
||||
* @param title
|
||||
*/
|
||||
// private String filePath = Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
// + "/gdxzExpert/download/治疗指南/";
|
||||
private String filePath =getContext().getExternalFilesDir("").getAbsolutePath()+"/gdxzExpert/download/治疗指南/";
|
||||
private HttpHandler<File> hand;
|
||||
private int[] progress;
|
||||
private ArrayList<String> currentprogress = new ArrayList<String>();
|
||||
|
||||
|
||||
protected void downloadPdf(final String url, final String name, final int position, final Holder holder) {
|
||||
// TODO Auto-generated method stub
|
||||
// 下载pdf
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
// sdcard存在
|
||||
HttpUtils http = new HttpUtils();
|
||||
final String path = filePath + name + ".pdf";
|
||||
//下载的路径,及app安装包的命名
|
||||
//***************************************************
|
||||
|
||||
hand = http.download(url, path,
|
||||
false, // 如果目标文件存在,接着未完成的部分继续下载。服务器不支持RANGE时将从新下载。
|
||||
true, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。
|
||||
new RequestCallBack<File>() {
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
ToastUtil.showToast("开始下载"+name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoading(long total, long current,
|
||||
boolean isUploading) {
|
||||
// progress[position] = (int) (current * 100 / total);
|
||||
// currentprogress.add(position, progress[position]+"");
|
||||
// LogUtil.i(name+"下载进度:"+progress[position]);
|
||||
|
||||
//插入
|
||||
// DownloadModel downloadModel = new DownloadModel(mList.get(position).uuid);
|
||||
// downloadModel.setTitle(mList.get(position).title);
|
||||
// downloadModel.setTime(mList.get(position).updateTime);
|
||||
// downloadModel.setPath(mList.get(position).path);
|
||||
// downloadModel.setFilePath(path);
|
||||
// downloadModel.setFilePath(path);
|
||||
// downloadModel.setFileFormat(".pdf");
|
||||
// downloadModel.setState(1);// 0未下载,1下载中,2已下载
|
||||
// BookDownloadSqlManager.insertDownload(downloadModel);
|
||||
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
// holder.tv_down.setText(progress[position]+"%");
|
||||
holder.tv_down.setText("下载中");
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<File> responseInfo) {
|
||||
ToastUtil.showToast(name+"下载完成!");
|
||||
//插入
|
||||
DownloadModel downloadModel = new DownloadModel(mList.get(position).getUuid());
|
||||
downloadModel.setFilePath(path);
|
||||
downloadModel.setState(2);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager.insertDownload(downloadModel);
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.GONE);
|
||||
holder.tv_down.setText("查看");
|
||||
holder.tv_down.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//打开文件
|
||||
// openFile(path);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException error, String msg) {
|
||||
ToastUtil.showToast(name+"下载失败!");
|
||||
LogUtil.i("下载失败msg = "+msg+",error = "+error.getExceptionCode()+","+error.getMessage());
|
||||
if ((int) holder.iv_down.getTag() == position) {
|
||||
//异步显示
|
||||
holder.iv_down.setVisibility(View.VISIBLE);
|
||||
holder.tv_down.setVisibility(View.GONE);
|
||||
}
|
||||
//maybe the file has downloaded completely
|
||||
// if (msg.contains("maybe the file has downloaded completely")) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showToast("SD卡不存在,无法下载");
|
||||
return;
|
||||
}
|
||||
}
|
||||
private String filePathnew =getContext().getExternalFilesDir("").getAbsolutePath()+"/gdxzExpert/download/治疗指南/";
|
||||
protected void downloadPdfen(String url, final String name,final int position) {
|
||||
// MobclickAgent.onEvent(context,EXPERT_HOME_GUIDE_DOWNLOAD);
|
||||
// TODO Auto-generated method stub
|
||||
if(StringUtil.isEmpty(url))
|
||||
{
|
||||
ToastUtil.showToast("下载地址有误"+url);
|
||||
return;
|
||||
}
|
||||
// 下载pdf
|
||||
if (Environment.getExternalStorageState().equals(
|
||||
Environment.MEDIA_MOUNTED)) {
|
||||
// sdcard存在
|
||||
HttpUtils http = new HttpUtils();
|
||||
String[] split = name.split(":");
|
||||
String name1 = split[split.length-1];
|
||||
final String path = filePathnew + name1 + ".pdf";
|
||||
// 下载的路径,及app安装包的命名
|
||||
// ***************************************************
|
||||
hand = http.download(url, path, false, // 如果目标文件存在,接着未完成的部分继续下载。服务器不支持RANGE时将从新下载。
|
||||
true, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。
|
||||
new RequestCallBack<File>() {
|
||||
|
||||
private DownloadModel downloadModel;
|
||||
|
||||
/** 下载开始 **/
|
||||
@Override
|
||||
public void onStart() {
|
||||
ToastUtil.showToast("开始下载" + name);
|
||||
|
||||
// 插入下载数据库
|
||||
downloadModel = new DownloadModel(mList
|
||||
.get(position).getUuid());
|
||||
downloadModel.setFilePath(path);
|
||||
downloadModel.setState(5);// 0未下载,1下载中,2已下载
|
||||
mList.get(position).setState(5);
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/** 下载中与进度 **/
|
||||
@Override
|
||||
public void onLoading(long total, long current,
|
||||
boolean isUploading) {
|
||||
|
||||
}
|
||||
|
||||
/** 下载完成 **/
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<File> responseInfo) {
|
||||
mList.get(position).setFilePath(path);
|
||||
|
||||
// 更新下载状态为完成
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(mList
|
||||
.get(position).getUuid());
|
||||
}
|
||||
downloadModel.setState(2);// 0未下载,1下载中,2已下载
|
||||
mList.get(position).setState(2);
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
BookDownloadSqlManager.updateDownloadFilePath(downloadModel);
|
||||
mList.get(position).setFilePath(path);
|
||||
notifyDataSetChanged();
|
||||
ToastUtil.showToast(name + "下载完成!");
|
||||
// 打开文件
|
||||
// openFile(path,"",position,"","");
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** 下载失败 **/
|
||||
@Override
|
||||
public void onFailure(HttpException error, String msg) {
|
||||
|
||||
ToastUtil.showToast(name + "下载失败!");
|
||||
// 更新下载状态为未下载
|
||||
if (downloadModel == null) {
|
||||
downloadModel = new DownloadModel(mList
|
||||
.get(position).getUuid());
|
||||
}
|
||||
downloadModel.setState(4);// 0未下载,1下载中,2已下载
|
||||
BookDownloadSqlManager
|
||||
.updateDownloadState(downloadModel);
|
||||
notifyDataSetChanged();
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showToast("SD卡不存在,无法下载");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.ExpertMindList.mindList.expertMind;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MyMindAdapter extends BaseAdapter {
|
||||
private List<expertMind> beanlists;
|
||||
|
||||
public MyMindAdapter(List<expertMind> beanlists) {
|
||||
this.beanlists = beanlists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_my_mind);
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_jine = (TextView) convertView
|
||||
.findViewById(R.id.tv_my_mind_jine);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_my_mind_time);
|
||||
vh.mTv_type = (TextView) convertView
|
||||
.findViewById(R.id.tv_my_mind_type);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String sd = sdf.format(new Date(Long.parseLong(beanlists.get(position)
|
||||
.getCreate_date())*1000));
|
||||
vh.mTv_time.setText(sd);
|
||||
|
||||
vh.mTv_jine.setText(String.format("%.2f", beanlists.get(position)
|
||||
.getXinyi() / 100));
|
||||
if (beanlists.get(position).getOrder_status().equals("canceled")) {
|
||||
vh.mTv_type.setText("已取消");
|
||||
} else if (beanlists.get(position).getOrder_status().equals("paid")) {
|
||||
vh.mTv_type.setText("已支付");
|
||||
} else {
|
||||
vh.mTv_type.setText("待支付");
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_time, mTv_jine, mTv_type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.common.CCPAppManager;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.ViewImageInfo;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class MyPagerAdapter extends PagerAdapter {
|
||||
public Context ct;
|
||||
public ArrayList<ImageView> imageSource;
|
||||
public List<String> paths;
|
||||
|
||||
public MyPagerAdapter(Context ct, ArrayList<ImageView> imageSource) {
|
||||
this.ct = ct;
|
||||
this.imageSource = imageSource;
|
||||
|
||||
}
|
||||
|
||||
public void getPath(List<String> paths) {
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return imageSource.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View arg0, Object arg1) {
|
||||
return arg0 == arg1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
// 销毁该图片
|
||||
container.removeView(imageSource.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, final int position) {
|
||||
container.addView(imageSource.get(position));
|
||||
imageSource.get(position).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
if (imageSource.size() > 0) {
|
||||
ArrayList<ViewImageInfo> urls = new ArrayList<ViewImageInfo>();
|
||||
for (int i = 0; i < imageSource.size(); i++) {
|
||||
urls.add(new ViewImageInfo(i, Url.urlHtml
|
||||
+ paths.get(i), Url.urlHtml
|
||||
+ paths.get(i)));
|
||||
}
|
||||
CCPAppManager.startChattingImageViewAction(ct, position,urls);
|
||||
}
|
||||
}
|
||||
});
|
||||
return imageSource.get(position);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.proMyListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class MyProjectAdapter extends BaseAdapter {
|
||||
List<proMyListBean.mylistBean> list;
|
||||
public MyProjectAdapter(List<proMyListBean.mylistBean> list) {
|
||||
this.list=list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view= UIUtils.inflate(R.layout.my_project_item);
|
||||
holder=new ViewHolder();
|
||||
holder.title=view.findViewById(R.id.title);
|
||||
holder.num1=view.findViewById(R.id.num1);
|
||||
holder.num2=view.findViewById(R.id.num2);
|
||||
holder.num3=view.findViewById(R.id.num3);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder= (ViewHolder) view.getTag();
|
||||
}
|
||||
holder.title.setText(list.get(i).getName());
|
||||
holder.num1.setText(list.get(i).getCentreNum());
|
||||
holder.num2.setText(list.get(i).getUserNum());
|
||||
if(StringUtil.isEmpty(list.get(i).getPlannedNum()))
|
||||
{
|
||||
if(StringUtil.isEmpty(list.get(i).getCaseNum()))
|
||||
{
|
||||
holder.num3.setText("-/-");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.num3.setText(list.get(i).getCaseNum()+"/-");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(StringUtil.isEmpty(list.get(i).getCaseNum()))
|
||||
{
|
||||
holder.num3.setText("-/"+list.get(i).getPlannedNum());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.num3.setText(list.get(i).getCaseNum()+"/"+list.get(i).getPlannedNum());
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
TextView title,num1,num2,num3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.GetUserIconBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.ItemDragHelperCallback;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
|
||||
/**
|
||||
* Created by WANGChengXin on 2020/3/9.
|
||||
*/
|
||||
|
||||
public class MyUserIconAdapter extends RecyclerView.Adapter<MyUserIconAdapter.ChannelViewHolder> implements ItemDragHelperCallback.OnItemMoveListener {
|
||||
private final Context context;
|
||||
private final LayoutInflater inflater;
|
||||
private List<GetUserIconBean.DataBean> mTables;
|
||||
private ItemDragHelperCallback mItemDragHelperCallback;
|
||||
private OnItemClickListener mOnItemClickListener;
|
||||
private int flag;
|
||||
|
||||
public MyUserIconAdapter(Context context, List<GetUserIconBean.DataBean> tables) {
|
||||
this.context = context;
|
||||
this.mTables = tables;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void setItemDragHelperCallback(ItemDragHelperCallback itemDragHelperCallback) {
|
||||
mItemDragHelperCallback = itemDragHelperCallback;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new ChannelViewHolder(inflater.inflate(R.layout.item_usericon_card, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ChannelViewHolder holder, int position) {
|
||||
GetUserIconBean.DataBean table = mTables.get(position);
|
||||
holder.mTextView.setText(table.getName());
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + table.getImg(),
|
||||
holder.mImageView, ImageOptions.getImageOptions()
|
||||
);
|
||||
if (flag==2){
|
||||
holder.iv_add.setImageResource(R.drawable.myicon_add);
|
||||
holder.iv_add.setVisibility(View.VISIBLE);
|
||||
}else if (flag==1){
|
||||
holder.iv_add.setImageResource(R.drawable.myicon_delete);
|
||||
holder.iv_add.setVisibility(View.VISIBLE);
|
||||
}else if (flag==3){
|
||||
holder.iv_add.setVisibility(View.GONE);
|
||||
}
|
||||
handleLongPress(holder, table);
|
||||
handleOnClick(holder, table);
|
||||
}
|
||||
|
||||
|
||||
public void showChoose(int flag){
|
||||
this.flag = flag;
|
||||
|
||||
}
|
||||
//处理点击事件
|
||||
private void handleOnClick(final ChannelViewHolder holder, final GetUserIconBean.DataBean table) {
|
||||
if (mOnItemClickListener != null) {
|
||||
holder.mLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
// if (!table.getNewsChannelFixed()) {
|
||||
//对项目点击后增删操作的监听
|
||||
mOnItemClickListener.onItemClick(view, holder.getLayoutPosition());
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//处理长按事件 开启ItemDragHelperCallBack拖拽
|
||||
private void handleLongPress(ChannelViewHolder holder, final GetUserIconBean.DataBean table) {
|
||||
if (mItemDragHelperCallback != null) {
|
||||
holder.mLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
// mItemDragHelperCallback.setLongPressEnabled(table.getNewsChannelIndex() == 0 ? false : true);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mTables.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||
if (isChannelFixed(fromPosition, toPosition)) {
|
||||
return false;
|
||||
}
|
||||
//在我的频道子频道的移动
|
||||
Collections.swap(getAdapterData(), fromPosition, toPosition);
|
||||
notifyItemMoved(fromPosition, toPosition);
|
||||
//通知顺序变换,存储,设置频道顺序,以及显示的顺序
|
||||
System.out.println("发送移动的消息");
|
||||
// EventBus.getDefault().post(new ChannelBean(getAdapterData()));
|
||||
return true;
|
||||
}
|
||||
|
||||
//不能移动头条
|
||||
private boolean isChannelFixed(int fromPosition, int toPosition) {
|
||||
return fromPosition == 0 || toPosition == 0;
|
||||
}
|
||||
|
||||
public class ChannelViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView iv_add;
|
||||
private TextView mTextView;
|
||||
private ImageView mImageView;
|
||||
private RelativeLayout mLayout;
|
||||
|
||||
public ChannelViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mImageView = (ImageView) itemView.findViewById(R.id.iv_my_library);
|
||||
mTextView = (TextView) itemView.findViewById(R.id.tv_tushuguan);
|
||||
mLayout = (RelativeLayout) itemView.findViewById(R.id.rl_my_library);
|
||||
iv_add = (ImageView) itemView.findViewById(R.id.iv_add);
|
||||
}
|
||||
}
|
||||
|
||||
public List<GetUserIconBean.DataBean> getAdapterData() {
|
||||
return mTables;
|
||||
}
|
||||
|
||||
//Item点击事件的监听接口
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.lidroid.xutils.exception.HttpException;
|
||||
import com.lidroid.xutils.http.RequestParams;
|
||||
import com.lidroid.xutils.http.ResponseInfo;
|
||||
import com.lidroid.xutils.http.callback.RequestCallBack;
|
||||
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientListBean.PatientData;
|
||||
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* 弃用
|
||||
*
|
||||
* 类名称:NewPatientAdapter
|
||||
* 类描述:TODO
|
||||
* 创建人:苏三元
|
||||
* 时间:2015-9-23 下午2:55:39
|
||||
* 版权:河南商宇科技有限公司--版权所有 (c) 2015
|
||||
*
|
||||
*/
|
||||
public class NewPatientAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<PatientData> PatientList;
|
||||
private String applyListOperate = Url.getapplyListOperate;
|
||||
private String uuid;
|
||||
private Holder mHolder = null;
|
||||
public NewPatientAdapter(Context context, ArrayList<PatientData> patientList) {
|
||||
this.context = context;
|
||||
this.PatientList = patientList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return PatientList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context, R.layout.item_new_patient_list,
|
||||
null);
|
||||
mHolder = new Holder();
|
||||
mHolder.ivImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_patient_image);
|
||||
mHolder.tvDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_patient_date);
|
||||
mHolder.tvInfo = (TextView) convertView
|
||||
.findViewById(R.id.tv_patient_info);
|
||||
mHolder.tvResult = (TextView) convertView
|
||||
.findViewById(R.id.tv_ok_cancle);
|
||||
mHolder.btOk = (Button) convertView
|
||||
.findViewById(R.id.bt_new_patient_ok);
|
||||
mHolder.btCancle = (Button) convertView
|
||||
.findViewById(R.id.bt_new_patient_cancle);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
PatientData p = PatientList.get(position);
|
||||
uuid = p.uuid;
|
||||
mHolder.tvInfo.setText("我是"+p.realName+","+p.content);
|
||||
mHolder.tvDate.setText(p.createDate);
|
||||
if (!TextUtils.isEmpty(p.photo)) {
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml+p.photo,mHolder.ivImage,
|
||||
ImageOptions.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
}else{
|
||||
mHolder.ivImage.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
|
||||
mHolder.btOk.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
LogUtil.i("ok-position=="+position);
|
||||
getNewPatientList(applyListOperate, "2");
|
||||
}
|
||||
});
|
||||
mHolder.btCancle.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
LogUtil.i("cancle-position=="+position);
|
||||
getNewPatientList(applyListOperate, "3");
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private void getNewPatientList(final String loadUrl, String status) {
|
||||
RequestParams params = new RequestParams();
|
||||
params.addBodyParameter("uuid", uuid);//申请记录uuid
|
||||
params.addBodyParameter("status", status);//状态(2.同意 3.拒绝)
|
||||
HttpHelper.loadData(HttpMethod.POST, loadUrl, params,
|
||||
new RequestCallBack<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<String> info) {
|
||||
mHolder.tvResult.setText("您已经同意了");
|
||||
mHolder.btOk.setVisibility(View.GONE);
|
||||
mHolder.btCancle.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException arg0, String arg1) {
|
||||
LogUtil.i("数据请求失败了: " + arg1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class Holder {
|
||||
|
||||
public TextView tvResult;
|
||||
public Button btCancle;
|
||||
public Button btOk;
|
||||
public ImageView ivImage;
|
||||
public TextView tvInfo;
|
||||
public TextView tvDate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import static com.netease.nim.uikit.common.util.sys.TimeUtil.isSameYear;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.NewListBean.NewsList;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* 新闻适配器
|
||||
*
|
||||
* 类名称:NewsAdapter 类描述:TODO 创建人:苏三元 时间:2015-9-24 下午3:12:40 版权:河南商宇科技有限公司--版权所有
|
||||
* (c) 2015
|
||||
*
|
||||
*/
|
||||
public class NewsAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<NewsList> newsList;
|
||||
|
||||
public NewsAdapter(Context context) {
|
||||
this.context = context;
|
||||
// this.newsList = newsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return newsList.size();
|
||||
}
|
||||
|
||||
public void getDatas(ArrayList<NewsList> newsList) {
|
||||
this.newsList = newsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
NewsViewHolder mHolder = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_news_big, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_news, null);
|
||||
}
|
||||
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.ivImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_news_image);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_title);
|
||||
mHolder.tvDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_date);
|
||||
mHolder.tv_Now = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_now);
|
||||
mHolder.tvSummary = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_summary);
|
||||
// 点赞阅读
|
||||
mHolder.tvdianzannum = (TextView) convertView
|
||||
.findViewById(R.id.tv_dianzan_count);
|
||||
mHolder.tvreadnum = (TextView) convertView
|
||||
.findViewById(R.id.tv_read_count);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
NewsList news = newsList.get(position);
|
||||
mHolder.tvTitle.setText(news.title);
|
||||
|
||||
if (!TextUtils.isEmpty(news.createDate)
|
||||
&& news.createDate.length() > 10) {
|
||||
if(inNow(news.createDate.substring(0, 10))){
|
||||
mHolder.tvDate.setVisibility(View.GONE);
|
||||
mHolder.tv_Now.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
mHolder.tv_Now.setVisibility(View.GONE);
|
||||
mHolder.tvDate.setVisibility(View.VISIBLE);
|
||||
if(isSameYear(news.createDate.substring(0, 4)))
|
||||
{
|
||||
mHolder.tvDate.setText(news.createDate.substring(5, 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.tvDate.setText(news.createDate.substring(0, 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (!TextUtils.isEmpty(news.createDate)) {
|
||||
mHolder.tvDate.setText(news.createDate);
|
||||
}
|
||||
if (!TextUtils.isEmpty(news.headImg)) {
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml + news.headImg,
|
||||
mHolder.ivImage,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
} else {
|
||||
mHolder.ivImage.setImageResource(R.drawable.default_news_iv);
|
||||
}
|
||||
if (!StringUtil.isEmpty(news.summary)) {
|
||||
mHolder.tvSummary.setText(news.summary);
|
||||
} else {
|
||||
mHolder.tvSummary.setText("");
|
||||
}
|
||||
|
||||
// 点赞和阅读量
|
||||
if (!TextUtils.isEmpty(news.agreenum)) {
|
||||
Double agree = Double.parseDouble(news.agreenum);
|
||||
if (agree > 10000) {
|
||||
double agreeNum = (double) (Math.round((double) agree / 1000) / 10.0);
|
||||
mHolder.tvdianzannum.setText(agreeNum + "万");
|
||||
} else {
|
||||
mHolder.tvdianzannum.setText(news.agreenum);
|
||||
}
|
||||
} else {
|
||||
mHolder.tvdianzannum.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(news.readnum)) {
|
||||
Double read = Double.parseDouble(news.readnum);
|
||||
if (read > 10000) {
|
||||
double readNum = (double) (Math.round((double) read / 1000) / 10.0);
|
||||
mHolder.tvreadnum.setText(readNum + "万");
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvreadnum.setText(readNum + "万人观看");
|
||||
}
|
||||
} else {
|
||||
mHolder.tvreadnum.setText(news.readnum);
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvreadnum.setText(news.readnum + "人观看");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mHolder.tvreadnum.setText("");
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvSummary.setVisibility(View.GONE);
|
||||
// mHolder.tv_Now.setVisibility(View.GONE);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
|
||||
public TextView tvreadnum;
|
||||
public TextView tvdianzannum;
|
||||
public TextView tvSummary;
|
||||
public ImageView ivImage;
|
||||
public TextView tvTitle;
|
||||
public TextView tvDate;
|
||||
public TextView tv_Now;
|
||||
}
|
||||
|
||||
public boolean inNow(String date) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String ds1 = formatter.format(new Date());
|
||||
if (date.equals(ds1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface OnRecyclerViewItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.MyOrderBean;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.common.utils.ClipboardUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
import static cn.shangyu.gdxzExpert.ecdemo.common.utils.CommomUtil.simpleDateFormat1;
|
||||
import static cn.shangyu.gdxzExpert.utils.StringUtil.fenGetYuanFormat;
|
||||
import static cn.shangyu.gdxzExpert.utils.UIUtils.getString;
|
||||
|
||||
public class OrderAdapter extends BaseAdapter {
|
||||
List<MyOrderBean.ODetailBean> data;
|
||||
private ViewHolder holder;
|
||||
Context context;
|
||||
public OrderAdapter(Context context,List<MyOrderBean.ODetailBean> data)
|
||||
{
|
||||
this.data=data;
|
||||
this.context=context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return data.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View view, ViewGroup parent) {
|
||||
holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view = UIUtils.inflate(R.layout.order_item);
|
||||
holder =new ViewHolder();
|
||||
|
||||
holder.tv_num = view.findViewById(R.id.tv_num);
|
||||
holder.tv_copy=view.findViewById(R.id.tv_copy);
|
||||
holder.tv_n=view.findViewById(R.id.tv_n);
|
||||
holder.tv_time=view.findViewById(R.id.tv_time);
|
||||
holder.tv_rpr=view.findViewById(R.id.tv_rpr);
|
||||
holder.tv_jifen=view.findViewById(R.id.tv_jifen);
|
||||
holder.tv_yue=view.findViewById(R.id.tv_yue);
|
||||
holder.tv_shifu=view.findViewById(R.id.tv_shifu);
|
||||
holder.tv_l=view.findViewById(R.id.tv_l);
|
||||
holder.tv_p=view.findViewById(R.id.tv_p);
|
||||
holder.tv_dtime=view.findViewById(R.id.tv_dtime);
|
||||
holder.r_y=view.findViewById(R.id.r_y);
|
||||
holder.r_j=view.findViewById(R.id.r_j);
|
||||
holder.r_t=view.findViewById(R.id.r_t);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else {
|
||||
holder = (ViewHolder) view.getTag();
|
||||
}
|
||||
holder.tv_num.setText(data.get(position).getUuid());
|
||||
holder.tv_n.setText(data.get(position).getExcellencourse_title());
|
||||
long t=Long.valueOf(data.get(position).getCreate_date()+"000");
|
||||
Date date = new Date(t);
|
||||
holder.tv_time.setText(simpleDateFormat1.format(date));
|
||||
holder.tv_rpr.setText(fenGetYuanFormat(data.get(position).getAccount()));
|
||||
holder.r_y.setVisibility(View.GONE);
|
||||
holder.r_j.setVisibility(View.GONE);
|
||||
holder.r_t.setVisibility(View.GONE);
|
||||
holder.tv_p.setVisibility(View.VISIBLE);
|
||||
if(data.get(position).getChildOrder()!=null&&data.get(position).getChildOrder().size()>0)
|
||||
{
|
||||
if("refund".equals(data.get(position).getOrder_status()))
|
||||
{
|
||||
for (MyOrderBean.ChilderBean childerBean:data.get(position).getChildOrder())
|
||||
{
|
||||
if("1".equals(childerBean.getOrder_pay_type()))
|
||||
{
|
||||
holder.r_y.setVisibility(View.VISIBLE);
|
||||
holder.tv_yue.setText
|
||||
("-"+fenGetYuanFormat(data.get(position).getChildOrder().get(0).getAccount())+"(已退还)");
|
||||
break;
|
||||
}
|
||||
else if("2".equals(childerBean.getOrder_pay_type()))
|
||||
{
|
||||
holder.r_j.setVisibility(View.VISIBLE);
|
||||
holder.tv_jifen.setText
|
||||
("-"+data.get(position).getChildOrder().get(0).getBonuspoints()+"积分"+"(已退还)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (MyOrderBean.ChilderBean childerBean:data.get(position).getChildOrder())
|
||||
{
|
||||
if("1".equals(childerBean.getOrder_pay_type()))
|
||||
{
|
||||
holder.r_y.setVisibility(View.VISIBLE);
|
||||
holder.tv_yue.setText
|
||||
("-"+fenGetYuanFormat(data.get(position).getChildOrder().get(0).getAccount()));
|
||||
break;
|
||||
}
|
||||
else if("2".equals(childerBean.getOrder_pay_type()))
|
||||
{
|
||||
holder.r_j.setVisibility(View.VISIBLE);
|
||||
holder.tv_jifen.setText
|
||||
("-"+data.get(position).getChildOrder().get(0).getBonuspoints()+"积分");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
switch (data.get(position).getOrder_status())
|
||||
{
|
||||
case "paid":
|
||||
holder.tv_l.setText("查看课程");
|
||||
holder.tv_p.setVisibility(View.GONE);
|
||||
break;
|
||||
case "created":
|
||||
holder.r_t.setVisibility(View.VISIBLE);
|
||||
|
||||
new CCountDownTimer(Long.valueOf(data.get(position).getExpire_time())*1000-System.currentTimeMillis(),1000,holder.tv_dtime).start();
|
||||
holder.tv_l.setText("继续支付");
|
||||
holder.tv_p.setText("取消订单");
|
||||
holder.r_t.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case "canceled":
|
||||
holder.tv_l.setText("查看课程");
|
||||
holder.tv_p.setText("已取消");
|
||||
break;
|
||||
case "overtime":
|
||||
holder.tv_l.setText("查看课程");
|
||||
holder.tv_p.setText("支付超时");
|
||||
case "refund":
|
||||
holder.tv_l.setText("查看课程");
|
||||
holder.tv_p.setText("支付失败");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
holder.tv_shifu.setText(fenGetYuanFormat(data.get(position).getPay_account()));
|
||||
holder.tv_copy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ClipboardUtils.copyFromEdit(context,
|
||||
getString(R.string.app_pic), holder.tv_num.getText().toString());
|
||||
ToastUtil.showMessage(cn.shangyu.gdxzExpert.R.string.app_copy_ok);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
|
||||
TextView tv_num;
|
||||
TextView tv_copy;
|
||||
TextView tv_n;
|
||||
|
||||
TextView tv_time,tv_rpr;
|
||||
TextView tv_jifen;
|
||||
TextView tv_yue,tv_shifu,tv_l,tv_p,tv_dtime;
|
||||
RelativeLayout r_y,r_j,r_t;
|
||||
}
|
||||
|
||||
public class CCountDownTimer extends CountDownTimer
|
||||
{
|
||||
|
||||
/**
|
||||
* @param millisInFuture The number of millis in the future from the call
|
||||
* to {@link #start()} until the countdown is done and {@link #onFinish()}
|
||||
* is called.
|
||||
* @param countDownInterval The interval along the way to receive
|
||||
* {@link #onTick(long)} callbacks.
|
||||
*/
|
||||
private TextView textView;
|
||||
public CCountDownTimer(long millisInFuture, long countDownInterval,TextView textView) {
|
||||
super(millisInFuture, countDownInterval);
|
||||
this.textView=textView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
textView.setText(formatTime(millisUntilFinished));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
textView.setText("00:00");
|
||||
}
|
||||
/**
|
||||
* 将毫秒转化为 分钟:秒 的格式
|
||||
*
|
||||
* @param millisecond 毫秒
|
||||
* @return
|
||||
*/
|
||||
public String formatTime(long millisecond) {
|
||||
int minute;//分钟
|
||||
int second;//秒数
|
||||
minute = (int) ((millisecond / 1000) / 60);
|
||||
second = (int) ((millisecond / 1000) % 60);
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return "0" + minute + ":" + "0" + second;
|
||||
} else {
|
||||
return "0" + minute + ":" + second;
|
||||
}
|
||||
}else {
|
||||
if (second < 10) {
|
||||
return minute + ":" + "0" + second;
|
||||
} else {
|
||||
return minute + ":" + second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 取消倒计时
|
||||
// */
|
||||
// public void timerCancel() {
|
||||
// timer.cancel();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 开始倒计时
|
||||
// */
|
||||
// public void timerStart() {
|
||||
// timer.start();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.IBinder;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PaperBean;
|
||||
|
||||
public class PaperAdapter extends BaseAdapter{
|
||||
Context context;
|
||||
List<PaperBean>list;
|
||||
// private int selectedEditTextPosition = -1;
|
||||
public PaperAdapter(Context context, List<PaperBean> list) {
|
||||
this.context = context;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return list.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View convertView, ViewGroup viewGroup) {
|
||||
final Holder mHolder ;
|
||||
if (convertView == null) {
|
||||
|
||||
convertView = View.inflate(context, R.layout.item_search,
|
||||
null);
|
||||
mHolder = new Holder();
|
||||
mHolder.tv1 = convertView
|
||||
.findViewById(R.id.tv1);
|
||||
mHolder.im_1 = convertView
|
||||
.findViewById(R.id.im_1);
|
||||
mHolder.literature_name1 = convertView
|
||||
.findViewById(R.id.literature_name1);
|
||||
mHolder.literature_name2 = convertView
|
||||
.findViewById(R.id.literature_name2);
|
||||
mHolder.literature_name3 = convertView
|
||||
.findViewById(R.id.literature_name3);
|
||||
mHolder.tv_add=convertView.findViewById(R.id.tv_add);
|
||||
mHolder.rr=convertView.findViewById(R.id.rr);
|
||||
mHolder.tv_sheng=convertView.findViewById(R.id.tv_sheng);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (Holder) convertView.getTag();
|
||||
}
|
||||
mHolder.position = i;
|
||||
mHolder.tv1.setText("文献"+(i+1));
|
||||
if(list.size()>1)
|
||||
{
|
||||
mHolder.im_1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.im_1.setVisibility(View.GONE);
|
||||
}
|
||||
if(list.size()<5&&(i== (list.size()-1)))
|
||||
{
|
||||
mHolder.rr.setVisibility(View.VISIBLE);
|
||||
mHolder.tv_sheng.setText("还可添加"+(4-i)+"篇");
|
||||
}
|
||||
else
|
||||
{
|
||||
mHolder.rr.setVisibility(View.GONE);
|
||||
mHolder.tv_sheng.setText("");
|
||||
}
|
||||
mHolder.literature_name1.setText(list.get(i).getTitle());
|
||||
mHolder.literature_name2.setText(list.get(i).getAuthor());
|
||||
mHolder.literature_name3.setText(list.get(i).getName());
|
||||
mHolder.im_1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
submitPaper("您是否确定删除该代查项?","确认删除",i);
|
||||
|
||||
}
|
||||
});
|
||||
mHolder.tv_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
hideSoftKeyboard();
|
||||
list.add(new PaperBean());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
mHolder.literature_name1.addTextChangedListener(new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
list.get(mHolder.position).setTitle(s.toString());
|
||||
}
|
||||
});
|
||||
|
||||
mHolder.literature_name2.addTextChangedListener(new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
list.get(mHolder.position).setAuthor(s.toString());
|
||||
}
|
||||
});
|
||||
mHolder.literature_name3.addTextChangedListener(new SimpleTextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
list.get(mHolder.position).setName(s.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
// private TextWatcher mTextWatcher = new MyTextWatcher() {
|
||||
// @Override
|
||||
// public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// if (selectedEditTextPosition != -1) {
|
||||
//// Log.w("MyEditAdapter", "onTextPosiotion " + selectedEditTextPosition);
|
||||
// PaperBean itemTest = (PaperBean) getItem(selectedEditTextPosition);
|
||||
// itemTest.setString1(s.toString());
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
private void submitPaper(String tishi,String infotitle,int i)
|
||||
{
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.dialog_new, null);
|
||||
AlertDialog dialog3 = new AlertDialog.Builder(
|
||||
context,AlertDialog.THEME_HOLO_LIGHT).create();
|
||||
|
||||
Button btn_sure = layout.findViewById(R.id.btn_sure);
|
||||
Button btn_cancel = layout.findViewById(R.id.btn_cancel);
|
||||
TextView tv_tishi=layout.findViewById(R.id.tv_tishi);
|
||||
TextView tv_infotitle=layout.findViewById(R.id.tv_infotitle);
|
||||
btn_sure.setText("确定");
|
||||
btn_sure.setTextColor(Color.parseColor("#333333"));
|
||||
btn_sure.setBackground(null);
|
||||
btn_cancel.setText("取消");
|
||||
btn_cancel.setBackground(null);
|
||||
tv_tishi.setText(tishi);
|
||||
tv_infotitle.setText(infotitle);
|
||||
tv_infotitle.setTextSize(19);
|
||||
dialog3.show();
|
||||
Window window =dialog3.getWindow();
|
||||
WindowManager.LayoutParams layoutParams = window.getAttributes();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(layoutParams);
|
||||
dialog3.getWindow().setContentView(layout);
|
||||
dialog3.setCanceledOnTouchOutside(false);
|
||||
btn_cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
dialog3.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
btn_sure.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
dialog3.dismiss();
|
||||
list.remove(i);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private class Holder {
|
||||
int position;
|
||||
public TextView tv1,tv_add,tv_sheng;
|
||||
RelativeLayout rr;
|
||||
public ImageView im_1;
|
||||
EditText literature_name1,literature_name2,literature_name3;
|
||||
}
|
||||
// public class MyTextWatcher implements TextWatcher {
|
||||
// @Override
|
||||
// public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void afterTextChanged(Editable editable) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
public void hideSoftKeyboard() {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager)context
|
||||
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (inputMethodManager != null) {
|
||||
View localView = ((Activity) context).getCurrentFocus();
|
||||
if (localView != null && localView.getWindowToken() != null) {
|
||||
IBinder windowToken = localView.getWindowToken();
|
||||
inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
public abstract class SimpleTextWatcher implements TextWatcher {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SectionIndexer;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.PatientEditActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientListBean.PatientData;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class PatientAdapter extends BaseAdapter implements SectionIndexer {
|
||||
|
||||
private Context context;
|
||||
private List<PatientData> PatientList;
|
||||
|
||||
public PatientAdapter(Context context, ArrayList<PatientData> patientList) {
|
||||
this.context = context;
|
||||
this.PatientList = patientList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return PatientList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder mHolder = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_patient_list_big,
|
||||
null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(context, R.layout.item_patient_list,
|
||||
null);
|
||||
}
|
||||
|
||||
mHolder = new Holder();
|
||||
mHolder.ivImage = convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_patient_name);
|
||||
mHolder.tvnickname = (TextView) convertView
|
||||
.findViewById(R.id.tv_nick_name);
|
||||
mHolder.tvLetter = (TextView) convertView
|
||||
.findViewById(R.id.catalog);
|
||||
mHolder.tv_dieasename = (TextView) convertView
|
||||
.findViewById(R.id.tv_dieasename);
|
||||
mHolder.tv_followtime = (TextView) convertView
|
||||
.findViewById(R.id.tv_followtime);
|
||||
mHolder.iv_editpatient = (ImageView) convertView
|
||||
.findViewById(R.id.iv_editpatient);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
final PatientData p = PatientList.get(position);
|
||||
// 1.随访关系 2.包月服务关系 (type==2即为VIP)3.既是随访又是vip
|
||||
// 根据position获取分类的首字母的Char ascii值
|
||||
int section = getSectionForPosition(position);
|
||||
|
||||
// 如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现
|
||||
if (position == getPositionForSection(section)) {
|
||||
mHolder.tvLetter.setVisibility(View.VISIBLE);
|
||||
mHolder.tvLetter.setText(p.getSortLetters());
|
||||
} else {
|
||||
mHolder.tvLetter.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
Drawable rightDrawable;
|
||||
if (2 == p.type || 3 == p.type) {
|
||||
rightDrawable = context.getResources().getDrawable(R.drawable.vip);
|
||||
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(),
|
||||
rightDrawable.getMinimumHeight());
|
||||
} else {
|
||||
rightDrawable = null;
|
||||
}
|
||||
mHolder.tvTitle.setCompoundDrawables(null, null, rightDrawable, null);
|
||||
// 姓名
|
||||
if (StringUtil.isEmpty(p.nickname)){
|
||||
mHolder.tvTitle.setText(p.realName);
|
||||
}else {
|
||||
mHolder.tvTitle.setText(p.nickname);
|
||||
}
|
||||
//患病类型
|
||||
String diagnosis = p.diagnosis;
|
||||
if (!StringUtil.isEmpty(diagnosis)){
|
||||
if (diagnosis.contains("甲、乙、丙、丁")){
|
||||
mHolder.tv_dieasename.setText("肝炎");
|
||||
}else {
|
||||
mHolder.tv_dieasename.setText(diagnosis);
|
||||
}
|
||||
mHolder.tv_dieasename.setVisibility(View.VISIBLE);
|
||||
|
||||
}else {
|
||||
mHolder.tv_dieasename.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
//随访时间
|
||||
mHolder.tv_followtime.setVisibility(View.VISIBLE);
|
||||
mHolder.iv_editpatient.setVisibility(View.VISIBLE);
|
||||
if (!StringUtil.isEmpty(p.join_date)){
|
||||
mHolder.tv_followtime.setText("随访于"+p.join_date.split(" ")[0]);
|
||||
}else {
|
||||
mHolder.tv_followtime.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mHolder.iv_editpatient.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, PatientEditActivity.class);
|
||||
intent.putExtra("patientUuid",p.uuid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tv_dieasename.setVisibility(View.GONE);
|
||||
mHolder.iv_editpatient.setVisibility(View.GONE);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class Holder {
|
||||
public TextView tvnickname;
|
||||
public ImageView ivImage;
|
||||
public TextView tvTitle;
|
||||
public TextView tvLetter;
|
||||
public TextView tv_dieasename;
|
||||
public TextView tv_followtime;
|
||||
public ImageView iv_editpatient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getSections() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPositionForSection(int sectionIndex) {
|
||||
// TODO Auto-generated method stub
|
||||
for (int i = 0; i < getCount(); i++) {
|
||||
String sortStr = PatientList.get(i).getSortLetters();
|
||||
char firstChar = sortStr.toUpperCase().charAt(0);
|
||||
if (firstChar == sectionIndex) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取英文的首字母,非英文字母用#代替。
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private String getAlpha(String str) {
|
||||
String sortStr = str.trim().substring(0, 1).toUpperCase();
|
||||
// 正则表达式,判断首字母是否是英文字母
|
||||
if (sortStr.matches("[A-Z]")) {
|
||||
return sortStr;
|
||||
} else {
|
||||
return "#";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSectionForPosition(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return PatientList.get(position).getSortLetters().charAt(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientListBean.PatientData;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class PatientAdapter2 extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<PatientData> PatientList;
|
||||
|
||||
public PatientAdapter2(Context context, ArrayList<PatientData> patientList) {
|
||||
this.context = context;
|
||||
this.PatientList = patientList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return PatientList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder mHolder = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(context,
|
||||
R.layout.item_patient_list_big1, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(context,
|
||||
R.layout.item_patient_list, null);
|
||||
}
|
||||
|
||||
mHolder = new Holder();
|
||||
mHolder.ivImage = convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_patient_name);
|
||||
mHolder.tvnickname = (TextView) convertView
|
||||
.findViewById(R.id.tv_nick_name);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (Holder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
PatientData p = PatientList.get(position);
|
||||
//1.随访关系 2.包月服务关系 (type==2即为VIP)3.既是随访又是vip
|
||||
Drawable rightDrawable;
|
||||
if (2 == p.type || 3 == p.type) {
|
||||
rightDrawable = context.getResources().getDrawable(R.drawable.vip);
|
||||
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight());
|
||||
}else{
|
||||
rightDrawable = null;
|
||||
}
|
||||
mHolder.tvTitle.setCompoundDrawables(null, null, rightDrawable, null);
|
||||
// 姓名
|
||||
if (StringUtil.isEmpty(p.nickname)){
|
||||
mHolder.tvTitle.setText(p.realName);
|
||||
}else {
|
||||
mHolder.tvTitle.setText(p.nickname);
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 头像
|
||||
if (!TextUtils.isEmpty(p.photo) && !"null".equals(p.photo)) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + p.photo,
|
||||
mHolder.ivImage,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
mHolder.ivImage
|
||||
.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
private class Holder {
|
||||
public TextView tvnickname;
|
||||
public ImageView ivImage;
|
||||
public TextView tvTitle;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientTeachBean.PatientTBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
public class PatientTeachAdapter extends BaseAdapter {
|
||||
private List<PatientTBean> data;
|
||||
|
||||
public PatientTeachAdapter(List<PatientTBean> data) {
|
||||
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (data == null) {
|
||||
return 0;
|
||||
}
|
||||
return data.size();
|
||||
}
|
||||
|
||||
public void getDatas(List<PatientTBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return data.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
NewsViewHolder mHolder = null;
|
||||
if (convertView == null) {
|
||||
// convertView = UIUtils.inflate(R.layout.item_news);
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_news_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_news);
|
||||
}
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.ivImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_news_image);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_title);
|
||||
mHolder.tvDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_date);
|
||||
mHolder.tv_Now = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_now);
|
||||
mHolder.tvSummary = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_summary);
|
||||
// 点赞阅读
|
||||
mHolder.tvdianzannum = (TextView) convertView
|
||||
.findViewById(R.id.tv_dianzan_count);
|
||||
mHolder.tvreadnum = (TextView) convertView
|
||||
.findViewById(R.id.tv_read_count);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
PatientTBean news = data.get(position);
|
||||
mHolder.tvTitle.setText(news.getTopic());
|
||||
|
||||
// mHolder.tvDate.setText(news.getModifyDate().substring(5, 10));
|
||||
if (!TextUtils.isEmpty(news.getModifyDate())
|
||||
&& news.getModifyDate().length() > 10) {
|
||||
if (inNow(news.getModifyDate().substring(0, 10))) {
|
||||
mHolder.tvDate.setVisibility(View.GONE);
|
||||
mHolder.tv_Now.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mHolder.tv_Now.setVisibility(View.GONE);
|
||||
mHolder.tvDate.setVisibility(View.VISIBLE);
|
||||
mHolder.tvDate.setText(news.getModifyDate().substring(5, 10));
|
||||
}
|
||||
|
||||
} else if (!TextUtils.isEmpty(news.getModifyDate())) {
|
||||
mHolder.tvDate.setText(news.getModifyDate());
|
||||
}
|
||||
if (!TextUtils.isEmpty(news.getImgPath())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + news.getImgPath(), mHolder.ivImage,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
} else {
|
||||
mHolder.ivImage.setImageResource(R.drawable.default_news_iv);
|
||||
}
|
||||
if (!StringUtil.isEmpty(news.getSummary())) {
|
||||
mHolder.tvSummary.setText(news.getSummary());
|
||||
} else {
|
||||
mHolder.tvSummary.setText("");
|
||||
}
|
||||
|
||||
// 点赞和阅读量
|
||||
if (!TextUtils.isEmpty(news.getAgreenum())) {
|
||||
Double agree = Double.parseDouble(news.getAgreenum());
|
||||
if (agree > 10000) {
|
||||
double agreeNum = (double) (Math.round((double) agree / 1000) / 10.0);
|
||||
mHolder.tvdianzannum.setText(agreeNum + "万");
|
||||
} else {
|
||||
mHolder.tvdianzannum.setText(news.getAgreenum());
|
||||
}
|
||||
} else {
|
||||
mHolder.tvdianzannum.setText("");
|
||||
}
|
||||
if (!TextUtils.isEmpty(news.getReadnum())) {
|
||||
Double read = Double.parseDouble(news.getReadnum());
|
||||
if (read > 10000) {
|
||||
double readNum = (double) (Math.round((double) read / 1000) / 10.0);
|
||||
mHolder.tvreadnum.setText(readNum + "万");
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvreadnum.setText(readNum + "万人观看");
|
||||
}
|
||||
} else {
|
||||
mHolder.tvreadnum.setText(news.getReadnum());
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvreadnum.setText(news.getReadnum()+"人观看");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mHolder.tvreadnum.setText("");
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
mHolder.tvSummary.setVisibility(View.GONE);
|
||||
mHolder.tv_Now.setVisibility(View.GONE);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
|
||||
public TextView tvreadnum;
|
||||
public TextView tvdianzannum;
|
||||
public TextView tvSummary;
|
||||
public ImageView ivImage;
|
||||
public TextView tvTitle;
|
||||
public TextView tvDate;
|
||||
public TextView tv_Now;
|
||||
}
|
||||
|
||||
public boolean inNow(String date) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String ds1 = formatter.format(new Date());
|
||||
if (date.equals(ds1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PhotoAibum;
|
||||
import cn.shangyu.gdxzExpert.bean.PhotoItem;
|
||||
|
||||
;
|
||||
|
||||
public class PhotoAdappter2 extends BaseAdapter {
|
||||
private Context context;
|
||||
private PhotoAibum aibum;
|
||||
private ArrayList<String> positions;
|
||||
private List<PhotoItem> bitList;
|
||||
|
||||
public PhotoAdappter2(Context context, PhotoAibum aibum) {
|
||||
this.context = context;
|
||||
this.aibum = aibum;
|
||||
List<PhotoItem> bitList1 = aibum.getBitList();
|
||||
Collections.reverse(bitList1);
|
||||
this.bitList = bitList1;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
|
||||
return bitList.size();
|
||||
|
||||
}
|
||||
|
||||
public void getPosition(ArrayList<String> positions) {
|
||||
|
||||
this.positions = positions;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = View.inflate(context,
|
||||
R.layout.photoalbum_gridview_item, null);
|
||||
vh = new ViewHolder();
|
||||
vh.iv_image = (ImageView) convertView
|
||||
.findViewById(R.id.photo_img_view);
|
||||
vh.iv_select = (ImageView) convertView
|
||||
.findViewById(R.id.photo_select);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(
|
||||
// context.getContentResolver(), aibum.getBitList().get(position)
|
||||
// .getPhotoID(), Thumbnails.MICRO_KIND, null);
|
||||
// vh.iv_image.setImageBitmap(bitmap);
|
||||
|
||||
Uri uri = Uri.fromFile(new File( bitList.get(position).getPath()));
|
||||
Glide.with(context).load(uri).into(vh.iv_image);
|
||||
|
||||
// List<PhotoItem> bitList = aibum.getBitList();
|
||||
// ImageLoader.getInstance().displayImage("file://" + bitList.get(position).getPath(),vh.iv_image);
|
||||
if (positions != null) {
|
||||
if (positions.contains(position + "")) {
|
||||
vh.iv_select.setImageDrawable(context.getResources()
|
||||
.getDrawable(R.drawable.cb_on));
|
||||
} else {
|
||||
vh.iv_select.setImageDrawable(context.getResources()
|
||||
.getDrawable(R.drawable.cb_normal));
|
||||
}
|
||||
} else {
|
||||
vh.iv_select.setImageDrawable(context.getResources().getDrawable(
|
||||
R.drawable.cb_normal));
|
||||
}
|
||||
vh.iv_select.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView iv_image, iv_select;
|
||||
}
|
||||
private ViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(ViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
public interface ViewItemClickListener {
|
||||
void onItemClick( int position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.RoundImageView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PhotoAdapter extends BaseAdapter {
|
||||
private List<String> photos;
|
||||
|
||||
public PhotoAdapter(List<String> photos) {
|
||||
this.photos = photos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (photos == null) {
|
||||
return 0;
|
||||
}
|
||||
return photos.size();
|
||||
}
|
||||
|
||||
public void getDatas(List<String> photos) {
|
||||
this.photos = photos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return photos.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
viewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_gv_photo_item);
|
||||
vh = new viewHolder();
|
||||
vh.mIv_photo = (RoundImageView) convertView
|
||||
.findViewById(R.id.item_iv_select);
|
||||
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (viewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml + photos.get(position), vh.mIv_photo,
|
||||
ImageOptions.getImageOptions(R.drawable.default_video));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class viewHolder {
|
||||
RoundImageView mIv_photo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PhotoAibum;
|
||||
import cn.shangyu.gdxzExpert.bean.PhotoItem;
|
||||
|
||||
public class PhotoAibumAdapter extends BaseAdapter {
|
||||
private List<PhotoAibum> aibumList;
|
||||
private Context context;
|
||||
private ViewHolder holder;
|
||||
// BitmapCache cache;
|
||||
ContentResolver cr;
|
||||
|
||||
public PhotoAibumAdapter(List<PhotoAibum> list, Context context) {
|
||||
// cache = new BitmapCache();
|
||||
this.aibumList = list;
|
||||
this.context = context;
|
||||
cr = context.getContentResolver();
|
||||
}
|
||||
|
||||
// ImageCallback callback = new ImageCallback() {
|
||||
// @Override
|
||||
// public void imageLoad(ImageView imageView, Bitmap bitmap,
|
||||
// Object... params) {
|
||||
// if (imageView != null && bitmap != null) {
|
||||
// String url = (String) params[0];
|
||||
// if (url != null && url.equals((String) imageView.getTag())) {
|
||||
// ((ImageView) imageView).setImageBitmap(bitmap);
|
||||
// } else {
|
||||
// Log.e("photo", "callback, bmp not match");
|
||||
// }
|
||||
// } else {
|
||||
// Log.e("photo", "callback, bmp null");
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return aibumList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return aibumList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = (LinearLayout) LayoutInflater.from(context).inflate(
|
||||
R.layout.photoalbum_item, null);
|
||||
holder = new ViewHolder();
|
||||
holder.iv = (ImageView) convertView
|
||||
.findViewById(R.id.photoalbum_item_image);
|
||||
holder.tv = (TextView) convertView
|
||||
.findViewById(R.id.photoalbum_item_name);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
/** 通过ID 获取缩略图 */
|
||||
// Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(context
|
||||
// .getContentResolver(), aibumList.get(position).getBitmap(),
|
||||
// Thumbnails.MICRO_KIND, null);
|
||||
// holder.iv.setImageBitmap(bitmap);
|
||||
List<PhotoItem> bitList = aibumList.get(position).getBitList();
|
||||
Uri uri = Uri.fromFile(new File(aibumList.get(position).getBitList().get(bitList.size()-1).getPath()));
|
||||
Glide.with(context).load(uri).into(holder.iv);
|
||||
// Log.e("info","BitmapPath = "+ aibumList.get(position).getBitmapPath());
|
||||
|
||||
// ImageLoader.getInstance().displayImage("file://" + aibumList.get(position).getBitList().get(bitList.size()-1).getPath(),holder.iv);
|
||||
holder.tv.setText(aibumList.get(position).getName() + " ( "+ aibumList.get(position).getCount() + " )");
|
||||
return convertView;
|
||||
}
|
||||
|
||||
static class ViewHolder {
|
||||
ImageView iv;
|
||||
TextView tv;
|
||||
}
|
||||
|
||||
// public static Bitmap getBitmap(ContentResolver cr, String fileName) {
|
||||
// Bitmap bitmap = null;
|
||||
// BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
// options.inDither = false;
|
||||
// options.inPreferredConfig = Bitmap.Config.ARGB_8888;
|
||||
// // select condition.
|
||||
// String whereClause = MediaStore.Images.Media.DATA + " = '" + fileName
|
||||
// + "'";
|
||||
//
|
||||
// // colection of results.
|
||||
// Cursor cursor = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
// new String[] { MediaStore.Images.Media._ID }, whereClause,
|
||||
// null, null);
|
||||
// if (cursor == null || cursor.getCount() == 0) {
|
||||
// if (cursor != null)
|
||||
// cursor.close();
|
||||
// return null;
|
||||
// }
|
||||
// cursor.moveToFirst();
|
||||
// // image id in image table.
|
||||
// String videoId = cursor.getString(cursor
|
||||
// .getColumnIndex(MediaStore.Images.Media._ID));
|
||||
// cursor.close();
|
||||
// if (videoId == null) {
|
||||
// return null;
|
||||
// }
|
||||
// long videoIdLong = Long.parseLong(videoId);
|
||||
// // via imageid get the bimap type thumbnail in thumbnail table.
|
||||
// bitmap = MediaStore.Images.Thumbnails.getThumbnail(cr, videoIdLong,
|
||||
// Images.Thumbnails.MINI_KIND, options);
|
||||
// return bitmap;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.BonusPointsListBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
/**
|
||||
* @author 作者 wcx
|
||||
* @version 创建时间:2018-7-13 上午10:12:13
|
||||
* 类说明
|
||||
*/
|
||||
public class PointListAdapter extends BaseAdapter{
|
||||
|
||||
private List<BonusPointsListBean.DataBean.ListBean> beans;
|
||||
private Context context;
|
||||
public PointListAdapter(List<BonusPointsListBean.DataBean.ListBean> beans, Context context) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.beans = beans;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beans.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beans.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_pointlist_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_pointlist);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.tv_score_type_name = (TextView) convertView.findViewById(R.id.tv_score_type_name);
|
||||
vh.create_date = (TextView) convertView.findViewById(R.id.create_date);
|
||||
vh.tv_score = (TextView) convertView.findViewById(R.id.tv_score);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.tv_score_type_name.setText(beans.get(position).getScore_type_name());
|
||||
vh.create_date.setText(beans.get(position).getCreate_date().subSequence(0, beans.get(position).getCreate_date().length()-3));
|
||||
String score = beans.get(position).getScore();
|
||||
// String score1 = score+"";
|
||||
if (score.contains("-")) {
|
||||
vh.tv_score.setText(score);
|
||||
}else {
|
||||
vh.tv_score.setText("+"+beans.get(position).getScore());
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
public static class ViewHolder {
|
||||
|
||||
public TextView tv_score_type_name, create_date, tv_score;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.SuggestBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class ProjectAdapter extends BaseAdapter {
|
||||
private List<SuggestBean.proBean> list;
|
||||
|
||||
public ProjectAdapter(List<SuggestBean.proBean> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view= UIUtils.inflate(R.layout.project_item);
|
||||
holder=new ViewHolder();
|
||||
holder.title=view.findViewById(R.id.title);
|
||||
holder.hosname=view.findViewById(R.id.hosname);
|
||||
holder.name=view.findViewById(R.id.name);
|
||||
holder.status=view.findViewById(R.id.status);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder= (ViewHolder) view.getTag();
|
||||
}
|
||||
holder.title.setText(list.get(i).getName());
|
||||
holder.hosname.setText(list.get(i).getExecutor());
|
||||
holder.name.setText(list.get(i).getLeader());
|
||||
if("1".equals(list.get(i).getStatus()))
|
||||
{
|
||||
holder.status.setTextColor(Color.parseColor("#ffe34d59"));
|
||||
holder.status.setText("进行中");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.status.setTextColor(Color.parseColor("#ff666666"));
|
||||
holder.status.setText("已结束");
|
||||
}
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
TextView title,hosname,name,status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.IntRange;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author cncoderx
|
||||
*/
|
||||
public class ProxyAdapter extends RecyclerView.Adapter {
|
||||
List<View> mHeaderViews = new ArrayList<>();
|
||||
List<View> mFooterViews = new ArrayList<>();
|
||||
|
||||
final RecyclerView.Adapter mAdapter;
|
||||
|
||||
public ProxyAdapter(RecyclerView.Adapter adapter) {
|
||||
if (adapter == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mAdapter = adapter;
|
||||
setHasStableIds(adapter.hasStableIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder viewHolder;
|
||||
final int type = ViewTypeSpec.getType(viewType);
|
||||
final int value = ViewTypeSpec.getValue(viewType);
|
||||
|
||||
if (type == ViewTypeSpec.HEADER) {
|
||||
viewHolder = new FixedViewHolder(mHeaderViews.get(value));
|
||||
} else if (type == ViewTypeSpec.FOOTER) {
|
||||
viewHolder = new FixedViewHolder(mFooterViews.get(value));
|
||||
} else {
|
||||
viewHolder = mAdapter.onCreateViewHolder(parent, viewType);
|
||||
}
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof FixedViewHolder) {
|
||||
((FixedViewHolder) holder).onBind();
|
||||
} else {
|
||||
int adjPosition = position - mHeaderViews.size();
|
||||
mAdapter.onBindViewHolder(holder, adjPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mHeaderViews.size() + mFooterViews.size() + mAdapter.getItemCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
final int numHeaderView = mHeaderViews.size();
|
||||
// final int numFooterView = mFooterViewInfos.size();
|
||||
|
||||
if (position < numHeaderView)
|
||||
return ViewTypeSpec.makeItemViewTypeSpec(position, ViewTypeSpec.HEADER);
|
||||
|
||||
final int adjPosition = position - numHeaderView;
|
||||
final int itemCount = mAdapter.getItemCount();
|
||||
if (adjPosition >= itemCount)
|
||||
return ViewTypeSpec.makeItemViewTypeSpec(adjPosition - itemCount, ViewTypeSpec.FOOTER);
|
||||
|
||||
int itemViewType = mAdapter.getItemViewType(adjPosition);
|
||||
if (itemViewType < 0 || itemViewType > (1 << ViewTypeSpec.TYPE_SHIFT) - 1) {
|
||||
throw new IllegalArgumentException("Invalid item view type: RecyclerView.Adapter.getItemViewType return " + itemViewType);
|
||||
}
|
||||
return itemViewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
|
||||
mAdapter.onDetachedFromRecyclerView(recyclerView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||
mAdapter.onAttachedToRecyclerView(recyclerView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
|
||||
mAdapter.unregisterAdapterDataObserver(observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAdapterDataObserver(RecyclerView.AdapterDataObserver observer) {
|
||||
mAdapter.registerAdapterDataObserver(observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
|
||||
if (holder instanceof FixedViewHolder) return;
|
||||
mAdapter.onViewDetachedFromWindow(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
|
||||
if (holder instanceof FixedViewHolder) return;
|
||||
mAdapter.onViewAttachedToWindow(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFailedToRecycleView(RecyclerView.ViewHolder holder) {
|
||||
if (holder instanceof FixedViewHolder) return false;
|
||||
return mAdapter.onFailedToRecycleView(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(RecyclerView.ViewHolder holder) {
|
||||
if (holder instanceof FixedViewHolder) return;
|
||||
mAdapter.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
int adjPosition = position - mHeaderViews.size();
|
||||
if (adjPosition >= 0 && adjPosition < mAdapter.getItemCount())
|
||||
return mAdapter.getItemId(adjPosition);
|
||||
|
||||
return RecyclerView.NO_ID;
|
||||
}
|
||||
|
||||
private boolean isFixedViewType(int viewType) {
|
||||
final int type = ViewTypeSpec.getType(viewType);
|
||||
return type == ViewTypeSpec.HEADER || type == ViewTypeSpec.FOOTER;
|
||||
}
|
||||
|
||||
public void addHeaderView(View view) {
|
||||
if (mHeaderViews.add(view)) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHeaderView(View view) {
|
||||
if (mHeaderViews.remove(view)) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void addFooterView(View view) {
|
||||
if (mFooterViews.add(view)) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFooterView(View view) {
|
||||
if (mFooterViews.remove(view)) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
static class ViewTypeSpec {
|
||||
static final int TYPE_SHIFT = 30;
|
||||
static final int TYPE_MASK = 0x3 << TYPE_SHIFT;
|
||||
|
||||
public static final int UNSPECIFIED = 0 << TYPE_SHIFT;
|
||||
public static final int HEADER = 1 << TYPE_SHIFT;
|
||||
public static final int FOOTER = 2 << TYPE_SHIFT;
|
||||
|
||||
@IntDef({UNSPECIFIED, HEADER, FOOTER})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ViewTypeSpecMode {}
|
||||
|
||||
public static int makeItemViewTypeSpec(@IntRange(from = 0, to = (1 << TYPE_SHIFT) - 1) int value,
|
||||
@ViewTypeSpecMode int type) {
|
||||
return (value & ~TYPE_MASK) | (type & TYPE_MASK);
|
||||
}
|
||||
|
||||
@ViewTypeSpecMode
|
||||
public static int getType(int viewType) {
|
||||
//noinspection ResourceType
|
||||
return (viewType & TYPE_MASK);
|
||||
}
|
||||
|
||||
public static int getValue(int viewType) {
|
||||
return (viewType & ~TYPE_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FixedViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public FixedViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
setIsRecyclable(false);
|
||||
}
|
||||
|
||||
public void onBind() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.ScienceListBean.ScienceData;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PublishingAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<ScienceData> mData;
|
||||
|
||||
public PublishingAdapter(Context context, List<ScienceData> mList) {
|
||||
this.mContext = context;
|
||||
this.mData = mList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_publishing);
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_title = (TextView) convertView
|
||||
.findViewById(R.id.tv_publishing_title);
|
||||
vh.mVline = convertView.findViewById(R.id.v_item_line);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTv_title.setText(mData.get(position).topic);
|
||||
if (position == (mData.size() - 1)) {
|
||||
vh.mVline.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
vh.mVline.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_title;
|
||||
View mVline;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.QuestionBean;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
// 显示时间的adapter类
|
||||
public class QuestionAdapter extends BaseAdapter {
|
||||
private List<QuestionBean.Qbean1> list;
|
||||
|
||||
|
||||
public QuestionAdapter(List<QuestionBean.Qbean1> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return list.get(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int arg0, View arg1, ViewGroup arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder viewHolder;
|
||||
if (arg1 == null) {
|
||||
viewHolder = new ViewHolder();
|
||||
arg1 = UIUtils.inflate(R.layout.question_item);
|
||||
viewHolder.tv_n = (TextView) arg1.findViewById(R.id.tv_n);
|
||||
arg1.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) arg1.getTag();
|
||||
}
|
||||
|
||||
viewHolder.tv_n.setText(list.get(arg0).getTitle());
|
||||
|
||||
|
||||
return arg1;
|
||||
}
|
||||
|
||||
class ViewHolder{
|
||||
TextView tv_n;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.zaaach.transformerslayout.holder.Holder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.IconBean;
|
||||
|
||||
public class RollAdapter extends Holder<IconBean> {
|
||||
private ImageView icon;
|
||||
private TextView text;
|
||||
private ImageView iv_red;
|
||||
public RollAdapter(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(View itemView) {
|
||||
icon = itemView.findViewById(R.id.iv_menu_icon);
|
||||
text = itemView.findViewById(R.id.tv_menu_text);
|
||||
iv_red=itemView.findViewById(R.id.iv_red);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBind(Context context, List<IconBean> list, @Nullable IconBean data, int position) {
|
||||
if (data == null) return;
|
||||
if(data.getRed()==null||!data.getRed())
|
||||
{
|
||||
iv_red.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
iv_red.setVisibility(View.VISIBLE);
|
||||
}
|
||||
text.setText(data.getName());
|
||||
// icon.setImageResource(data.getIcon());
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
// .placeholder(R.drawable.default_place_holder)
|
||||
.load(data.getImg())
|
||||
.into(icon);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.ScienceListBean.ScienceData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
|
||||
/**
|
||||
* ScienceListAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-6 上午9:48:06
|
||||
*
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:我讲科普列表的适配器
|
||||
*/
|
||||
public class ScienceListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<ScienceData> mData;
|
||||
|
||||
public ScienceListAdapter(Context context, List<ScienceData> mList) {
|
||||
this.mContext = context;
|
||||
this.mData = mList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
// convertView = View.inflate(mContext, R.layout.science_list_item,
|
||||
// null);
|
||||
convertView = View.inflate(mContext, R.layout.item_news, null);
|
||||
// holder.name = (TextView)
|
||||
// convertView.findViewById(R.id.item_name);
|
||||
// holder.title = (TextView)
|
||||
// convertView.findViewById(R.id.item_title);
|
||||
// holder.time = (TextView)
|
||||
// convertView.findViewById(R.id.item_time);
|
||||
|
||||
holder.ivImage = (ImageView) convertView
|
||||
.findViewById(R.id.iv_news_image);
|
||||
holder.title = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_title);
|
||||
holder.time = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_date);
|
||||
holder.tvreadnum = (TextView) convertView
|
||||
.findViewById(R.id.tv_read_count);
|
||||
holder.tvdianzannum = (TextView) convertView
|
||||
.findViewById(R.id.tv_dianzan_count);
|
||||
holder.tvSummary = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_summary);
|
||||
holder.tv_Now = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_now);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
ScienceData science = mData.get(position);
|
||||
// String name = science.expertName;
|
||||
// if (StringUtil.notEmpty(name)) {
|
||||
// holder.name.setText(name);
|
||||
// } else {
|
||||
// holder.name.setText("");
|
||||
// }
|
||||
holder.title.setText(science.topic);
|
||||
holder.tvSummary.setText(science.summary);
|
||||
if (!TextUtils.isEmpty(science.submitDate)) {
|
||||
if (science.submitDate.length() >= 10) {
|
||||
holder.time.setText(science.submitDate.substring(5, 10));
|
||||
if (inNow(science.submitDate.substring(0, 10))) {
|
||||
holder.time.setVisibility(View.GONE);
|
||||
holder.tv_Now.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.tv_Now.setVisibility(View.GONE);
|
||||
holder.time.setVisibility(View.VISIBLE);
|
||||
holder.time.setText(science.submitDate.substring(5, 10));
|
||||
}
|
||||
} else {
|
||||
holder.time.setText(science.submitDate);
|
||||
}
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(science.modifyDate)) {
|
||||
holder.time.setText(science.modifyDate);
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(science.imgPath)) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + science.imgPath, holder.ivImage,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
} else {
|
||||
holder.ivImage.setImageResource(R.drawable.default_news_iv);
|
||||
}
|
||||
// 点赞和阅读量
|
||||
Double agree = Double.parseDouble(science.agreenum);
|
||||
if (agree > 10000) {
|
||||
double agreeNum = (double) (Math.round((double) agree / 1000) / 10.0);
|
||||
holder.tvdianzannum.setText(agreeNum + "万赞");
|
||||
} else {
|
||||
holder.tvdianzannum.setText(science.agreenum);
|
||||
}
|
||||
Double read = Double.parseDouble(science.readnum);
|
||||
if (read > 10000) {
|
||||
double readNum = (double) (Math.round((double) read / 1000) / 10.0);
|
||||
holder.tvreadnum.setText(readNum + "万读");
|
||||
} else {
|
||||
holder.tvreadnum.setText(science.readnum);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class Holder {
|
||||
public TextView tvSummary;
|
||||
public ImageView ivImage;
|
||||
public TextView name, title, time, tvdianzannum, tvreadnum;
|
||||
public TextView tv_Now;
|
||||
}
|
||||
|
||||
public boolean inNow(String date) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String ds1 = formatter.format(new Date());
|
||||
if (date.equals(ds1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.BankCardBean.Card;
|
||||
import cn.shangyu.gdxzExpert.bean.MyBankCardBean.MyBankListData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* SelectBankCardAdapter.java
|
||||
*
|
||||
* @author liufang
|
||||
* @date 2015-11-10 15:03:06
|
||||
*
|
||||
* Copyright (C) 2015 河南商宇科技有限公司
|
||||
*
|
||||
* 功能说明:选择银行卡列表的适配器
|
||||
*/
|
||||
public class SelectBankCardAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
private List<Card> mData;
|
||||
private String CardUuid = null;
|
||||
|
||||
public SelectBankCardAdapter(Context context, List<Card> mList) {
|
||||
this.mContext = context;
|
||||
this.mData = mList;
|
||||
}
|
||||
|
||||
public void getChange(String CheckNum) {
|
||||
this.CardUuid = CheckNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
convertView = View.inflate(mContext,
|
||||
R.layout.item_select_bank_card, null);
|
||||
holder.img = (ImageView) convertView
|
||||
.findViewById(R.id.item_bank_img);
|
||||
holder.name = (TextView) convertView.findViewById(R.id.item_name);
|
||||
holder.card = (TextView) convertView.findViewById(R.id.item_card);
|
||||
holder.realName = (ImageView) convertView
|
||||
.findViewById(R.id.item_real_name);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (Holder) convertView.getTag();
|
||||
}
|
||||
Card data = (Card) getItem(position);
|
||||
|
||||
// String strImg = data.bankImg;
|
||||
// if (StringUtil.notEmpty(strImg)) {
|
||||
// ImageLoader
|
||||
// .getInstance()
|
||||
// .displayImage(
|
||||
// Url.urlHtml + strImg,
|
||||
// holder.img,
|
||||
// ImageOptions
|
||||
// .getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||||
// }
|
||||
String name = data.getOpen_bank();
|
||||
if (StringUtil.notEmpty(name)) {
|
||||
holder.name.setText(name);
|
||||
} else {
|
||||
holder.name.setText("为空");
|
||||
}
|
||||
String num = data.getCard_number();
|
||||
if (StringUtil.notEmpty(num)) {
|
||||
holder.card.setText("尾号为" + num + "储蓄卡");
|
||||
} else {
|
||||
holder.card.setText("");
|
||||
}
|
||||
if (mData.get(position).getUuid().equals(CardUuid)) {
|
||||
holder.realName.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.realName.setVisibility(View.GONE);
|
||||
}
|
||||
seletBankIcon(mData.get(position).getOpen_bank_code(), holder);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private void seletBankIcon(String name, Holder holder) {
|
||||
switch (name) {
|
||||
case "0102":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_gongshang);
|
||||
break;
|
||||
case "0105":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_jianseyinhang);
|
||||
break;
|
||||
case "0104":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_zhongguo);
|
||||
break;
|
||||
case "0103":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_nongyeyinhang);
|
||||
break;
|
||||
case "0308":
|
||||
holder.img
|
||||
.setImageResource(R.drawable.icon_bankcard_zhaoshangyinhang);
|
||||
break;
|
||||
case "0100":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_youzheng);
|
||||
break;
|
||||
case "0301":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_jiatong);
|
||||
break;
|
||||
case "0403":
|
||||
holder.img
|
||||
.setImageResource(R.drawable.icon_bankcard_beijingyinhang);
|
||||
break;
|
||||
case "0303":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_guangda);
|
||||
break;
|
||||
case "0318":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_pingan);
|
||||
break;
|
||||
case "0401":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_shanghai);
|
||||
break;
|
||||
case "0306":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_guangfa);
|
||||
break;
|
||||
case "0309":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_xingye);
|
||||
break;
|
||||
case "0304":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_huaxiayinhnag);
|
||||
break;
|
||||
case "0302":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_zhongxinshiye);
|
||||
break;
|
||||
case "0305":
|
||||
holder.img.setImageResource(R.drawable.icon_bankcard_minshneg);
|
||||
break;
|
||||
case "上海浦东发展银行":
|
||||
holder.img
|
||||
.setImageResource(R.drawable.icon_bankcard_shanghaipudongfazhanyinhang);
|
||||
break;
|
||||
|
||||
default:
|
||||
holder.img.setImageResource(R.drawable.bank_card_mr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
class Holder {
|
||||
ImageView img, realName;
|
||||
TextView name, card;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
// 显示时间的adapter类
|
||||
public class SelectCourseAdapter extends BaseAdapter {
|
||||
private List<String> list;
|
||||
private int position=-1;
|
||||
|
||||
public SelectCourseAdapter(List<String> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return list.get(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return arg0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int arg0, View arg1, ViewGroup arg2) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder viewHolder;
|
||||
if (arg1 == null) {
|
||||
viewHolder = new ViewHolder();
|
||||
arg1 = UIUtils.inflate(R.layout.select_item);
|
||||
viewHolder.tv_n = (TextView) arg1.findViewById(R.id.tv_n);
|
||||
viewHolder. v_line = (View) arg1.findViewById(R.id.v_line);
|
||||
|
||||
arg1.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) arg1.getTag();
|
||||
}
|
||||
|
||||
viewHolder.tv_n.setText(list.get(arg0).toString());
|
||||
if (position==arg0) {
|
||||
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.top_title));
|
||||
viewHolder.tv_n.setTextColor(UIUtils.getColor(R.color.top_title));
|
||||
}else{
|
||||
viewHolder.v_line.setBackgroundColor(UIUtils.getColor(R.color.devider_line));
|
||||
viewHolder.tv_n.setTextColor(UIUtils.getColor(R.color.tab_text_nor));
|
||||
|
||||
}
|
||||
return arg1;
|
||||
}
|
||||
|
||||
class ViewHolder{
|
||||
TextView tv_n;
|
||||
View v_line;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.ChildTree;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
|
||||
public class SuifangAdapter extends RecyclerView.Adapter<SuifangAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
List<ChildTree> list;
|
||||
public SuifangAdapter(Context context,List<? extends ChildTree> list) {
|
||||
this.context = context;
|
||||
this.list= (List<ChildTree>) list;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.sui_item,
|
||||
parent, false);
|
||||
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
viewHolder.name=view.findViewById(R.id.name);
|
||||
viewHolder.date=view.findViewById(R.id.date);
|
||||
viewHolder.status=view.findViewById(R.id.status);
|
||||
viewHolder.l_c=view.findViewById(R.id.l_c);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.name.setText(list.get(position).getTitle());
|
||||
if(!StringUtil.isEmpty(list.get(position).getDate()))
|
||||
{
|
||||
holder.date.setVisibility(View.VISIBLE);
|
||||
holder.date.setText(list.get(position).getDate());
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.date.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String datastatus="",sdvstatus="";
|
||||
if(StringUtil.isEmpty(list.get(position).getDataStatus()))
|
||||
{
|
||||
|
||||
}
|
||||
else if("0".equals(list.get(position).getDataStatus()))
|
||||
{
|
||||
datastatus="未录入";
|
||||
}
|
||||
else if("1".equals(list.get(position).getDataStatus()))
|
||||
{
|
||||
datastatus="部分录入";
|
||||
}
|
||||
else
|
||||
{
|
||||
datastatus="已录入";
|
||||
}
|
||||
if(StringUtil.isEmpty(list.get(position).getSdvStatus()))
|
||||
{
|
||||
|
||||
}
|
||||
else if("0".equals(list.get(position).getSdvStatus()))
|
||||
{
|
||||
sdvstatus="未SDV";
|
||||
}
|
||||
else if("1".equals(list.get(position).getSdvStatus()))
|
||||
{
|
||||
sdvstatus="部分SDV";
|
||||
}
|
||||
else
|
||||
{
|
||||
sdvstatus="已SDV";
|
||||
}
|
||||
if(StringUtil.isEmpty(datastatus)&&StringUtil.isEmpty(sdvstatus))
|
||||
{
|
||||
holder.status.setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.status.setText(datastatus+"/"+sdvstatus);
|
||||
}
|
||||
|
||||
holder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
TextView name,date,status;
|
||||
RelativeLayout l_c;
|
||||
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hjq.window.EasyWindow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.TerminationActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.endpoing;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class TermAdapter extends BaseAdapter {
|
||||
Context context;
|
||||
private List<endpoing> data;
|
||||
public TermAdapter(Context context, List<endpoing>data) {
|
||||
this.context = context;
|
||||
this.data=data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder holder=null;
|
||||
if(view==null)
|
||||
{
|
||||
view= UIUtils.inflate(R.layout.term_irem);
|
||||
holder=new ViewHolder();
|
||||
holder.title=view.findViewById(R.id.title);
|
||||
holder.time=view.findViewById(R.id.time);
|
||||
// holder.tv_edit=view.findViewById(R.id.tv_edit);
|
||||
holder.tv_delect=view.findViewById(R.id.tv_delect);
|
||||
holder.note_l=view.findViewById(R.id.note_l);
|
||||
holder.note=view.findViewById(R.id.note);
|
||||
view.setTag(holder);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder= (ViewHolder) view.getTag();
|
||||
}
|
||||
holder.title.setText(data.get(i).getEventType());
|
||||
if("其他恶性肿瘤".equals(data.get(i).getEventType()))
|
||||
{
|
||||
holder.note_l.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.note_l.setVisibility(View.GONE);
|
||||
}
|
||||
holder.note.setText(data.get(i).getEndpointId()+"");
|
||||
|
||||
|
||||
// holder.time.setText(data.get(i).getReportDate() +"("+ DateUtil.gettimeBydate(data.get(i).getReportDate())+"年"+")");
|
||||
// holder.tv_edit.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Intent intent=new Intent(context, TerminationDetailActivity.class);
|
||||
// if(i==0)
|
||||
// {
|
||||
// intent.putExtra("name","其他恶性肿瘤");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// intent.putExtra("name","表面抗原转阴");
|
||||
// }
|
||||
// context.startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
holder.tv_delect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showyiwen("温馨提示","确定要删除该终点事件吗?",data.get(i).getEndpointId());
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
public class ViewHolder
|
||||
{
|
||||
TextView title,time,tv_delect,note;
|
||||
LinearLayout note_l;
|
||||
}
|
||||
public void showyiwen(String title,String content,String id)
|
||||
{
|
||||
EasyWindow.with((Activity) context).setGravity(Gravity.CENTER)
|
||||
|
||||
.setContentView(R.layout.float_cent_dialogqs).setBackgroundDimAmount(0.5f)
|
||||
.setText(R.id.tv_infotitle, title)
|
||||
.setText(R.id.tv_tishi, content)
|
||||
.setVisibility(R.id.r_b,View.VISIBLE)
|
||||
.setText(android.R.id.message, "确定")
|
||||
.setOutsideTouchable(false)
|
||||
.setOnClickListener(android.R.id.message, new EasyWindow.OnClickListener<TextView>() {
|
||||
|
||||
@Override
|
||||
public void onClick(EasyWindow<?> window, TextView view) {
|
||||
window.cancel();
|
||||
((TerminationActivity)context).endpoingetdelete(id);
|
||||
}
|
||||
})
|
||||
.setOnClickListener(R.id.btn_cancel, new EasyWindow.OnClickListener<TextView>() {
|
||||
|
||||
@Override
|
||||
public void onClick(EasyWindow<?> window, TextView view) {
|
||||
window.cancel();
|
||||
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hjq.window.EasyWindow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.TerminationActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.endpoing;
|
||||
import cn.shangyu.gdxzExpert.utils.DateUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
|
||||
public class TermAdapterNew extends RecyclerView.Adapter<TermAdapterNew.ViewHolder> {
|
||||
Context context;
|
||||
private List<endpoing> data;
|
||||
public TermAdapterNew(Context context, List<endpoing>data) {
|
||||
this.context = context;
|
||||
this.data=data;
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.term_irem,
|
||||
parent, false);
|
||||
|
||||
ViewHolder holder = new ViewHolder(view);
|
||||
holder.title=view.findViewById(R.id.title);
|
||||
holder.time=view.findViewById(R.id.time);
|
||||
holder.notsname=view.findViewById(R.id.notsname);
|
||||
holder.tv_delect=view.findViewById(R.id.tv_delect);
|
||||
holder.note_l=view.findViewById(R.id.note_l);
|
||||
holder.note=view.findViewById(R.id.note);
|
||||
holder.l_c=view.findViewById(R.id.l_c);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.title.setText(data.get(position).getEventType());
|
||||
holder.time.setText(data.get(position).getReportDate() +"("+ DateUtil.gettimeBydate(data.get(position).getReportDate(), ((TerminationActivity)context).birthdayPost1)+"年"+")");
|
||||
if("其他恶性肿瘤".equals(data.get(position).getEventType())
|
||||
||"戒酒".equals(data.get(position).getEventType())||"戒酒后复饮".equals(data.get(position).getEventType()))
|
||||
{
|
||||
holder.note_l.setVisibility(View.VISIBLE);
|
||||
if("其他恶性肿瘤".equals(data.get(position).getEventType()))
|
||||
{
|
||||
holder.notsname.setText("肿瘤名称:");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.time.setText(data.get(position).getReportDate());
|
||||
if(StringUtil.isEmpty(data.get(position).getNotes()))
|
||||
{
|
||||
holder.note_l.setVisibility(View.GONE);
|
||||
}
|
||||
if("戒酒".equals(data.get(position).getEventType()))
|
||||
{
|
||||
holder.notsname.setText("已戒酒时间:");
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.notsname.setText("已复饮时间:");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.note_l.setVisibility(View.GONE);
|
||||
}
|
||||
holder.note.setText(data.get(position).getNotes()+"");
|
||||
|
||||
|
||||
|
||||
|
||||
holder.tv_delect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showyiwen("温馨提示","确定要删除该终点事件吗?",data.get(position).getEndpointId());
|
||||
}
|
||||
});
|
||||
holder.l_c.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(holder.itemView, holder.getAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
TextView title,time,tv_delect,note,notsname;
|
||||
LinearLayout note_l,l_c;
|
||||
|
||||
|
||||
}
|
||||
private OnRecyclerViewItemClickListener mOnItemClickListener = null;
|
||||
|
||||
public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) {
|
||||
this.mOnItemClickListener = listener;
|
||||
}
|
||||
public void showyiwen(String title,String content,String id)
|
||||
{
|
||||
EasyWindow.with((Activity) context).setGravity(Gravity.CENTER)
|
||||
|
||||
.setContentView(R.layout.float_cent_dialogqs).setBackgroundDimAmount(0.5f)
|
||||
.setText(R.id.tv_infotitle, title)
|
||||
.setText(R.id.tv_tishi, content)
|
||||
.setVisibility(R.id.r_b,View.VISIBLE)
|
||||
.setText(android.R.id.message, "确定")
|
||||
.setOutsideTouchable(false)
|
||||
.setOnClickListener(android.R.id.message, new EasyWindow.OnClickListener<TextView>() {
|
||||
|
||||
@Override
|
||||
public void onClick(EasyWindow<?> window, TextView view) {
|
||||
window.cancel();
|
||||
((TerminationActivity)context).endpoingetdelete(id);
|
||||
}
|
||||
})
|
||||
.setOnClickListener(R.id.btn_cancel, new EasyWindow.OnClickListener<TextView>() {
|
||||
|
||||
@Override
|
||||
public void onClick(EasyWindow<?> window, TextView view) {
|
||||
window.cancel();
|
||||
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.VideoActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.VideoDetilActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.VideoMoreActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.VideoBean.VideoData;
|
||||
import cn.shangyu.gdxzExpert.polyvplayer.VideoDetailPolyvPlayerActivity;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.view.MyGridView;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class VideoAdapter extends BaseAdapter {
|
||||
private VideoActivity mActivity;
|
||||
private List<VideoData> datas;
|
||||
|
||||
public VideoAdapter(VideoActivity mActivity, List<VideoData> datas) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mActivity = mActivity;
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
public void getDatas(List<VideoData> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.size();
|
||||
}
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder holder;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_video);
|
||||
holder = new ViewHolder();
|
||||
holder.mGv = (MyGridView) convertView.findViewById(R.id.mgv_video);
|
||||
holder.mTv_Title = (TextView) convertView.findViewById(R.id.tv_video_title);
|
||||
holder.mTv_more = (TextView) convertView.findViewById(R.id.tv_video_more);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.mTv_Title.setText(datas.get(position).getName());
|
||||
holder.mTv_more.setTag(position);
|
||||
holder.mTv_more.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity, VideoMoreActivity.class);
|
||||
intent.putExtra("uuid", datas.get((int) v.getTag()).getUuid());
|
||||
intent.putExtra("title", datas.get((int) v.getTag()).getName());
|
||||
intent.setType("video1");
|
||||
mActivity.startActivityForResult(intent,mActivity.GET_MORE_NUM_RESULT);
|
||||
}
|
||||
});
|
||||
// holder.mAdapter.getList(datas.get(position).video);
|
||||
if(holder.mGv!=null){
|
||||
VideoGVAdapter mAdapter = new VideoGVAdapter(mActivity,datas.get(position).video);
|
||||
holder.mGv.setAdapter(mAdapter);
|
||||
}
|
||||
holder.mGv.setTag(position);
|
||||
holder.mGv.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
// TODO Auto-generated method stub
|
||||
int Num = (int) parent.getTag();
|
||||
Intent intent = VideoDetailPolyvPlayerActivity.newIntent(mActivity, VideoDetailPolyvPlayerActivity.PlayMode.portrait,"");
|
||||
// 在线视频和下载的视频播放的时候只显示播放器窗口,用该参数来控制
|
||||
intent.putExtra("startNow", false);
|
||||
intent.putExtra("isVlmsOnline", false);
|
||||
intent.putExtra("url", datas.get(Num).video.get(position)
|
||||
.getPath());
|
||||
intent.putExtra("uuid", datas.get(Num).video.get(position)
|
||||
.getUuid());
|
||||
intent.putExtra("note", datas.get(Num).video.get(position)
|
||||
.getNote());
|
||||
intent.putExtra("title", datas.get(Num).video.get(position)
|
||||
.getName());
|
||||
intent.putExtra("readnum", datas.get(Num).video.get(position)
|
||||
.getReadnum());
|
||||
intent.putExtra("imgpath", datas.get(Num).video.get(position)
|
||||
.getImgpath());
|
||||
intent.putExtra("public_name",
|
||||
datas.get(Num).video.get(position).getPublic_name());
|
||||
// intent.putExtra("content",
|
||||
// datas.get(Num).video.get(position).getContent());
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_READ_NUM_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
// holder.mAdapter.notifyDataSetChanged();
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_Title, mTv_more;
|
||||
MyGridView mGv;
|
||||
VideoGVAdapter mAdapter;
|
||||
|
||||
// public ViewHolder(View view) {
|
||||
// // TODO Auto-generated constructor stub
|
||||
// mGv = (MyGridView) view.findViewById(R.id.mgv_video);
|
||||
// mTv_Title = (TextView) view.findViewById(R.id.tv_video_title);
|
||||
// mTv_more = (TextView) view.findViewById(R.id.tv_video_more);
|
||||
// mAdapter = new VideoGVAdapter(mActivity);
|
||||
// mGv.setAdapter(mAdapter);
|
||||
// view.setTag(this);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.SettingFeedbackActivity;
|
||||
import cn.shangyu.gdxzExpert.activity.VideoDetilActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CommentBean.CommentData;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.MyTextView;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
|
||||
public class VideoCommentAdapter extends BaseAdapter {
|
||||
List<CommentData> datas;
|
||||
VideoDetilActivity mActivity;
|
||||
String uuid;
|
||||
ForegroundColorSpan redSpan, greySpan;
|
||||
|
||||
public VideoCommentAdapter(VideoDetilActivity mActivity, String uuid) {
|
||||
this.uuid = uuid;
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
redSpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
greySpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
}
|
||||
|
||||
public void getDatas(List<CommentData> datas) {
|
||||
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (datas == null) {
|
||||
return 0;
|
||||
}
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_comment);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_delete = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_comment_delete);
|
||||
vh.mIv_tou = (ImageView) convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
vh.mTv_content = (MyTextView) convertView
|
||||
.findViewById(R.id.item_comment_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_time);
|
||||
vh.mTv_hf = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_hf);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getPhoto())
|
||||
&& !"null".equals(datas.get(position).getPhoto())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto(),
|
||||
vh.mIv_tou,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.mIv_tou.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
String content = datas.get(position).getComment().replaceAll(":", ":")
|
||||
.replaceAll(" ", "").replaceAll(" ", " ");
|
||||
if (content.contains("||")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
int i = content.indexOf("||");
|
||||
String sss = content.replaceAll("\\|\\|", "\n\n");
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(sss);
|
||||
builder.setSpan(greySpan, i, sss.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
// SpannableStringBuilder builder = new
|
||||
// SpannableStringBuilder(content);
|
||||
// builder.setSpan(greySpan, content.indexOf("||"),
|
||||
// content.length(),
|
||||
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//
|
||||
// vh.mTv_content.setSpecifiedTextsColor(content, "||",
|
||||
// Color.parseColor("#FF0000"), builder);
|
||||
} else if (content.contains("回复") && content.contains(":")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
if (content.indexOf(":") - content.indexOf("回复") > 0) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(
|
||||
content);
|
||||
builder.setSpan(redSpan, 3, content.indexOf(":"),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
|
||||
} else {
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
} else {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
if (datas.get(position).getCreate_date().length() > 16) {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date()
|
||||
.substring(5, 16));
|
||||
} else {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date());
|
||||
}
|
||||
|
||||
vh.mTv_name.setText(datas.get(position).getRealname());
|
||||
if (uuid.equals(datas.get(position).getExpert_uuid())) {
|
||||
vh.mIv_delete.setVisibility(View.VISIBLE);
|
||||
vh.mTv_hf.setVisibility(View.GONE);
|
||||
} else {
|
||||
vh.mIv_delete.setVisibility(View.GONE);
|
||||
vh.mTv_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
vh.mIv_delete.setTag(position);
|
||||
vh.mIv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
delVisit((Integer) v.getTag());
|
||||
|
||||
}
|
||||
});
|
||||
vh.mTv_hf.setTag(position);
|
||||
vh.mTv_hf.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity,
|
||||
SettingFeedbackActivity.class);
|
||||
intent.setType("comment");
|
||||
intent.putExtra("name", datas.get((Integer) v.getTag())
|
||||
.getRealname());
|
||||
intent.putExtra("content", datas.get((Integer) v.getTag())
|
||||
.getComment());
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_HF_COMMENT_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView mIv_tou, mIv_delete;
|
||||
TextView mTv_name, mTv_time, mTv_hf;
|
||||
MyTextView mTv_content;
|
||||
}
|
||||
|
||||
ECAlertDialog buildAlert;
|
||||
|
||||
public void delVisit(final int positions) {
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, "删除此评论?", "取消", "确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mActivity.getDeleteComment(positions);
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.SettingFeedbackActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.CommentBean.CommentData;
|
||||
import cn.shangyu.gdxzExpert.polyvplayer.VideoDetailPolyvPlayerActivity;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.MyTextView;
|
||||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||||
|
||||
public class VideoCommentPolyVplayerAdapter extends BaseAdapter {
|
||||
List<CommentData> datas;
|
||||
VideoDetailPolyvPlayerActivity mActivity;
|
||||
String uuid;
|
||||
ForegroundColorSpan redSpan, greySpan;
|
||||
|
||||
public VideoCommentPolyVplayerAdapter(VideoDetailPolyvPlayerActivity mActivity, String uuid, List<CommentData> datas) {
|
||||
this.uuid = uuid;
|
||||
this.datas = datas;
|
||||
this.mActivity = mActivity;
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
redSpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.c333333));
|
||||
}
|
||||
else
|
||||
{
|
||||
redSpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
}
|
||||
greySpan = new ForegroundColorSpan(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
}
|
||||
|
||||
public void getDatas(List<CommentData> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (datas == null) {
|
||||
return 0;
|
||||
}
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return datas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_comment_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_comment);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_delete = (ImageView) convertView
|
||||
.findViewById(R.id.iv_item_comment_delete);
|
||||
vh.mIv_tou = (ImageView) convertView
|
||||
.findViewById(R.id.iv_patient_touxiang);
|
||||
vh.mTv_content = (MyTextView) convertView
|
||||
.findViewById(R.id.item_comment_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_time);
|
||||
vh.mTv_hf = (TextView) convertView
|
||||
.findViewById(R.id.item_comment_hf);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
if (!TextUtils.isEmpty(datas.get(position).getPhoto())
|
||||
&& !"null".equals(datas.get(position).getPhoto())) {
|
||||
ImageLoader
|
||||
.getInstance()
|
||||
.displayImage(
|
||||
Url.urlHtml + datas.get(position).getPhoto(),
|
||||
vh.mIv_tou,
|
||||
ImageOptions
|
||||
.getImageOptions(R.drawable.icon_touxiang_persion_gray_big));
|
||||
} else {
|
||||
vh.mIv_tou.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
|
||||
}
|
||||
String content = datas.get(position).getComment().replaceAll(":", ":")
|
||||
.replaceAll(" ", "").replaceAll(" ", " ");
|
||||
if (content.contains("||")) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.c333333));
|
||||
int i = content.indexOf("||");
|
||||
String sss = content.replaceAll("\\|\\|", "\n");
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(sss);
|
||||
builder.setSpan(greySpan, i, sss.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
}
|
||||
else
|
||||
{
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
int i = content.indexOf("||");
|
||||
String sss = content.replaceAll("\\|\\|", "\n\n");
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(sss);
|
||||
builder.setSpan(greySpan, i, sss.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
}
|
||||
|
||||
|
||||
// SpannableStringBuilder builder = new
|
||||
// SpannableStringBuilder(content);
|
||||
// builder.setSpan(greySpan, content.indexOf("||"),
|
||||
// content.length(),
|
||||
// Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//
|
||||
// vh.mTv_content.setSpecifiedTextsColor(content, "||",
|
||||
// Color.parseColor("#FF0000"), builder);
|
||||
} else if (content.contains("回复") && content.contains(":")) {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
if (content.indexOf(":") - content.indexOf("回复") > 0) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(
|
||||
content);
|
||||
builder.setSpan(redSpan, 3, content.indexOf(":"),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
vh.mTv_content.setText(builder);
|
||||
|
||||
} else {
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
} else {
|
||||
vh.mTv_content.setTextColor(mActivity.getResources().getColor(
|
||||
R.color.darkGrey));
|
||||
vh.mTv_content.setText(content);
|
||||
}
|
||||
|
||||
if (datas.get(position).getCreate_date().length() > 16) {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date()
|
||||
.substring(5, 16));
|
||||
} else {
|
||||
vh.mTv_time.setText(datas.get(position).getCreate_date());
|
||||
}
|
||||
if("0".equals(datas.get(position).getUser_status()))
|
||||
{
|
||||
vh.mTv_name.setText(mActivity.getResources().getString(com.netease.nim.uikit.R.string.cancellation));
|
||||
}
|
||||
else
|
||||
{
|
||||
vh.mTv_name.setText(datas.get(position).getRealname());
|
||||
}
|
||||
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.mTv_name.setGravity(Gravity.CENTER_VERTICAL);
|
||||
}
|
||||
if (uuid.equals(datas.get(position).getExpert_uuid())) {
|
||||
vh.mIv_delete.setVisibility(View.VISIBLE);
|
||||
vh.mTv_hf.setVisibility(View.GONE);
|
||||
} else {
|
||||
vh.mIv_delete.setVisibility(View.GONE);
|
||||
vh.mTv_hf.setVisibility(View.VISIBLE);
|
||||
}
|
||||
vh.mIv_delete.setTag(position);
|
||||
vh.mIv_delete.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
delVisit((Integer) v.getTag());
|
||||
|
||||
}
|
||||
});
|
||||
vh.mTv_hf.setTag(position);
|
||||
vh.mTv_hf.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if("0".equals(datas.get((Integer) v.getTag()).getUser_status()))
|
||||
{
|
||||
ToastUtil.showMessage("该评论无法回复");
|
||||
return;
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
Intent intent = new Intent(mActivity,
|
||||
SettingFeedbackActivity.class);
|
||||
intent.setType("comment");
|
||||
intent.putExtra("name", datas.get((Integer) v.getTag())
|
||||
.getRealname());
|
||||
intent.putExtra("content", datas.get((Integer) v.getTag())
|
||||
.getComment());
|
||||
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_HF_COMMENT_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
ImageView mIv_tou, mIv_delete;
|
||||
TextView mTv_name, mTv_time, mTv_hf;
|
||||
MyTextView mTv_content;
|
||||
}
|
||||
|
||||
ECAlertDialog buildAlert;
|
||||
|
||||
public void delVisit(final int positions) {
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, "删除此评论?", "取消", "确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
// mActivity.getDeleteComment(positions);
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.VideoBean.VideoB;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.RoundImageView;
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class VideoGVAdapter extends BaseAdapter {
|
||||
Activity mContext;
|
||||
private List< VideoB> video;
|
||||
public VideoGVAdapter(Activity mContext,List< VideoB> video) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mContext = mContext;
|
||||
this.video=video;
|
||||
}
|
||||
public void getList(List< VideoB> video){
|
||||
this.video=video;
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if(video!=null){
|
||||
return video.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return video.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_video_gv);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_Video = (RoundImageView) convertView
|
||||
.findViewById(R.id.iv_video_gv);
|
||||
vh.mTv_title = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name);
|
||||
vh.mTv_lookNum = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_num);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(Url.urlHtml+video.get(position).getImgpath(),
|
||||
vh.mIv_Video,
|
||||
ImageOptions.getImageOptions(R.drawable.default_video));
|
||||
vh.mTv_title.setText(video.get(position).getName());
|
||||
vh.mTv_name.setText(video.get(position).getPublic_name());
|
||||
vh.mTv_lookNum.setText(video.get(position).getReadnum());
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
RoundImageView mIv_Video;
|
||||
TextView mTv_title, mTv_name, mTv_lookNum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.adapter.VideoGVAdapter.ViewHolder;
|
||||
import cn.shangyu.gdxzExpert.bean.VideoMoreBean.VideoMore;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.RoundImageView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class VideoMoreAdapter extends BaseAdapter {
|
||||
List<VideoMore> lists;
|
||||
Activity mActivity;
|
||||
|
||||
public VideoMoreAdapter(List<VideoMore> lists, Activity mActivity) {
|
||||
this.lists = lists;
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
public void getData(List<VideoMore> lists) {
|
||||
this.lists = lists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return lists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return lists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_video_gv);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_Video = (RoundImageView) convertView
|
||||
.findViewById(R.id.iv_video_gv);
|
||||
vh.mTv_title = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_content);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name);
|
||||
vh.mTv_lookNum = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_num);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + lists.get(position).getImgpath(), vh.mIv_Video,
|
||||
ImageOptions.getImageOptions(R.drawable.default_video));
|
||||
vh.mTv_title.setText(lists.get(position).getName());
|
||||
vh.mTv_name.setText(lists.get(position).getPublic_name());
|
||||
vh.mTv_lookNum.setText(lists.get(position).getReadnum());
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
RoundImageView mIv_Video;
|
||||
TextView mTv_title, mTv_name, mTv_lookNum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.activity.VideoActivity;
|
||||
import cn.shangyu.gdxzExpert.bean.VideoMoreBean.VideoMore;
|
||||
import cn.shangyu.gdxzExpert.polyvplayer.VideoDetailPolyvPlayerActivity;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.RoundImageView;
|
||||
|
||||
public class VideoSAdapter extends BaseAdapter {
|
||||
private List<VideoMore> lists;
|
||||
private VideoActivity mActivity;
|
||||
|
||||
public VideoSAdapter(List<VideoMore> lists, VideoActivity mActivity) {
|
||||
this.lists = lists;
|
||||
this.mActivity = mActivity;
|
||||
}
|
||||
|
||||
public void getDatas(List<VideoMore> lists) {
|
||||
this.lists = lists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (lists.size() % 2 == 1) {
|
||||
return lists.size() / 2 + 1;
|
||||
}
|
||||
return lists.size() / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_video_list);
|
||||
vh = new ViewHolder();
|
||||
vh.mIv_Video1 = (RoundImageView) convertView
|
||||
.findViewById(R.id.iv_video_gv1);
|
||||
vh.mTv_title1 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_content1);
|
||||
vh.mTv_name1 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name1);
|
||||
vh.mTv_lookNum1 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_num1);
|
||||
vh.mIv_Video2 = (RoundImageView) convertView
|
||||
.findViewById(R.id.iv_video_gv2);
|
||||
vh.mTv_title2 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_content2);
|
||||
vh.mTv_name2 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_name2);
|
||||
vh.mTv_lookNum2 = (TextView) convertView
|
||||
.findViewById(R.id.tv_video_num2);
|
||||
vh.mRl_second = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_second_view);
|
||||
vh.mRl_first = (RelativeLayout) convertView
|
||||
.findViewById(R.id.rl_first_view);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + lists.get(position * 2).getImgpath(),
|
||||
vh.mIv_Video1,
|
||||
ImageOptions.getImageOptions(R.drawable.default_video));
|
||||
vh.mTv_title1.setText(lists.get(position * 2).getName());
|
||||
vh.mTv_name1.setText(lists.get(position * 2).getPublic_name());
|
||||
vh.mTv_lookNum1.setText(lists.get(position * 2).getReadnum());
|
||||
if (lists.size() / 2 == position && lists.size() % 2 == 1) {
|
||||
vh.mRl_second.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
vh.mRl_second.setVisibility(View.VISIBLE);
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + lists.get(position * 2 + 1).getImgpath(),
|
||||
vh.mIv_Video2,
|
||||
ImageOptions.getImageOptions(R.drawable.default_video));
|
||||
vh.mTv_title2.setText(lists.get(position * 2 + 1).getName());
|
||||
vh.mTv_name2.setText(lists.get(position * 2 + 1).getPublic_name());
|
||||
vh.mTv_lookNum2.setText(lists.get(position * 2 + 1).getReadnum());
|
||||
}
|
||||
vh.mRl_first.setTag(position);
|
||||
vh.mRl_first.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
int Num = (int) v.getTag();
|
||||
Intent intent = VideoDetailPolyvPlayerActivity.newIntent(mActivity, VideoDetailPolyvPlayerActivity.PlayMode.portrait,"");
|
||||
// 在线视频和下载的视频播放的时候只显示播放器窗口,用该参数来控制
|
||||
intent.putExtra("startNow", false);
|
||||
intent.putExtra("isVlmsOnline", false);
|
||||
intent.putExtra("url", lists.get(Num * 2).getPath());
|
||||
intent.putExtra("uuid", lists.get(Num * 2).getUuid());
|
||||
intent.putExtra("note", lists.get(Num * 2).getNote());
|
||||
intent.putExtra("title", lists.get(Num * 2).getName());
|
||||
intent.putExtra("readnum", lists.get(Num * 2).getReadnum());
|
||||
intent.putExtra("imgpath", lists.get(Num * 2).getImgpath());
|
||||
intent.putExtra("getTags", lists.get(Num * 2 ).getTags());
|
||||
intent.putExtra("public_name", lists.get(Num * 2)
|
||||
.getPublic_name());
|
||||
intent.putExtra("pagetype","肝胆视频");
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_READ_NUM_RESULT2);
|
||||
// mActivity.needreportDetail("肝胆视频",lists.get(Num * 2).getTags(),lists.get(Num * 2).getName());
|
||||
}
|
||||
});
|
||||
vh.mRl_second.setTag(position);
|
||||
vh.mRl_second.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
int Num = (int) v.getTag();
|
||||
Intent intent = VideoDetailPolyvPlayerActivity.newIntent(mActivity, VideoDetailPolyvPlayerActivity.PlayMode.portrait,"");
|
||||
// 在线视频和下载的视频播放的时候只显示播放器窗口,用该参数来控制
|
||||
intent.putExtra("startNow", false);
|
||||
intent.putExtra("isVlmsOnline", false);
|
||||
intent.putExtra("url", lists.get(Num * 2 + 1).getPath());
|
||||
intent.putExtra("uuid", lists.get(Num * 2 + 1).getUuid());
|
||||
intent.putExtra("note", lists.get(Num * 2 + 1).getNote());
|
||||
intent.putExtra("title", lists.get(Num * 2 + 1).getName());
|
||||
intent.putExtra("readnum", lists.get(Num * 2 + 1).getReadnum());
|
||||
intent.putExtra("imgpath", lists.get(Num * 2 + 1).getImgpath());
|
||||
intent.putExtra("public_name", lists.get(Num * 2 + 1)
|
||||
.getPublic_name());
|
||||
intent.putExtra("getTags", lists.get(Num * 2 + 1).getTags());
|
||||
intent.putExtra("pagetype","肝胆视频");
|
||||
mActivity.startActivityForResult(intent,
|
||||
mActivity.GET_READ_NUM_RESULT2);
|
||||
// mActivity.needreportDetail("肝胆视频",lists.get(Num * 2+1).getTags(),lists.get(Num * 2 + 1).getName());
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
RoundImageView mIv_Video1, mIv_Video2;
|
||||
RelativeLayout mRl_second, mRl_first;
|
||||
TextView mTv_title1, mTv_name1, mTv_lookNum1, mTv_title2, mTv_name2,
|
||||
mTv_lookNum2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.PatientTeachBean;
|
||||
import cn.shangyu.gdxzExpert.bean.VideoMoreBean;
|
||||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
import cn.shangyu.gdxzExpert.utils.Url;
|
||||
import cn.shangyu.gdxzExpert.view.RoundImageView;
|
||||
|
||||
/**
|
||||
* Created by WANGChengXin on 2019/10/25.
|
||||
*/
|
||||
|
||||
public class VideoTeachAdapter extends BaseAdapter {
|
||||
private List<VideoMoreBean.VideoMore> data;
|
||||
|
||||
|
||||
public VideoTeachAdapter(List<VideoMoreBean.VideoMore> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
if (data == null) {
|
||||
return 0;
|
||||
}
|
||||
return data.size();
|
||||
}
|
||||
|
||||
public void getDatas(List<VideoMoreBean.VideoMore> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return data.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
NewsViewHolder mHolder = null;
|
||||
if (convertView == null) {
|
||||
convertView = UIUtils.inflate(R.layout.item_videoteach);
|
||||
mHolder = new NewsViewHolder();
|
||||
mHolder.ivImage = (RoundImageView) convertView
|
||||
.findViewById(R.id.iv_news_image);
|
||||
mHolder.im_read_count = (ImageView) convertView
|
||||
.findViewById(R.id.im_read_count);
|
||||
mHolder.im_argee = (ImageView) convertView
|
||||
.findViewById(R.id.im_argee);
|
||||
mHolder.tvTitle = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_title);
|
||||
mHolder.tvDate = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_date);
|
||||
mHolder.tv_Now = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_now);
|
||||
mHolder.tvSummary = (TextView) convertView
|
||||
.findViewById(R.id.tv_news_summary);
|
||||
// 点赞阅读
|
||||
mHolder.tvdianzannum = (TextView) convertView
|
||||
.findViewById(R.id.tv_dianzan_count);
|
||||
mHolder.tvreadnum = (TextView) convertView
|
||||
.findViewById(R.id.tv_read_count);
|
||||
mHolder.im_argee2 = (ImageView) convertView
|
||||
.findViewById(R.id.im_argee2);
|
||||
convertView.setTag(mHolder);
|
||||
mHolder.tv_dianzan_count2 = (TextView) convertView
|
||||
.findViewById(R.id.tv_dianzan_count2);
|
||||
convertView.setTag(mHolder);
|
||||
} else {
|
||||
mHolder = (NewsViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// 给控件赋值.
|
||||
VideoMoreBean.VideoMore videoMore = data.get(position);
|
||||
mHolder.tvTitle.setText(videoMore.getName());
|
||||
mHolder.im_read_count.setVisibility(View.INVISIBLE);
|
||||
mHolder.tvreadnum.setVisibility(View.INVISIBLE);
|
||||
mHolder.tvSummary.setVisibility(View.VISIBLE);
|
||||
mHolder.im_argee.setVisibility(View.GONE);
|
||||
mHolder.tvdianzannum.setVisibility(View.GONE);
|
||||
mHolder.im_argee2.setVisibility(View.VISIBLE);
|
||||
mHolder.tv_dianzan_count2.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(data.get(position).getImgpath())) {
|
||||
ImageLoader.getInstance().displayImage(
|
||||
Url.urlHtml + data.get(position).getImgpath(), mHolder.ivImage,
|
||||
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
||||
} else {
|
||||
mHolder.ivImage.setImageResource(R.drawable.default_news_iv);
|
||||
}
|
||||
mHolder.tvSummary.setText(data.get(position).getPublic_name());
|
||||
mHolder.tvDate.setText(data.get(position).getCreate_date().split(" ")[0]);
|
||||
mHolder.tv_dianzan_count2.setText(""+data.get(position).getReadnum());
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
private class NewsViewHolder {
|
||||
|
||||
public TextView tvreadnum;
|
||||
public TextView tvdianzannum;
|
||||
public TextView tvSummary;
|
||||
public RoundImageView ivImage;
|
||||
public ImageView im_read_count;
|
||||
public TextView tvTitle;
|
||||
public TextView tvDate;
|
||||
public TextView tv_Now;
|
||||
public ImageView im_argee2;
|
||||
public ImageView im_argee;
|
||||
public TextView tv_dianzan_count2;
|
||||
}
|
||||
|
||||
public boolean inNow(String date) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
String ds1 = formatter.format(new Date());
|
||||
if (date.equals(ds1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.VisitPlanListBean.Datas;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
|
||||
public class VisitPlanAdapter extends BaseAdapter {
|
||||
private Activity mActivity;
|
||||
private ArrayList<Datas> mList;
|
||||
public List<String> DatasList;
|
||||
public List<String> Positions;
|
||||
|
||||
public VisitPlanAdapter(Activity mActivity, ArrayList<Datas> mList) {
|
||||
DatasList = new ArrayList<String>();
|
||||
|
||||
this.mActivity = mActivity;
|
||||
this.mList = mList;
|
||||
getPosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
public void getPosition() {
|
||||
Positions = new ArrayList<String>();
|
||||
for (int i = 0; i < mList.size(); i++) {
|
||||
if (!DatasList.contains(mList.get(i).getDatetime().substring(0, 7))) {
|
||||
DatasList.add(mList.get(i).getDatetime().substring(0, 7));
|
||||
Positions.add(i + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return mList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
viewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = View.inflate(mActivity, R.layout.item_visit_plan_big,
|
||||
null);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = View.inflate(mActivity, R.layout.item_visit_plan,
|
||||
null);
|
||||
}
|
||||
|
||||
vh = new viewHolder();
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.r_date=convertView.findViewById(R.id.r_date);
|
||||
vh.im_v1=convertView.findViewById(R.id.im_v1);
|
||||
}
|
||||
vh.mTv_context = (TextView) convertView
|
||||
.findViewById(R.id.item_visit_content);
|
||||
vh.mTv_date = (TextView) convertView
|
||||
.findViewById(R.id.item_visit_date);
|
||||
vh.mTv_name = (TextView) convertView
|
||||
.findViewById(R.id.item_visit_name);
|
||||
vh.mTv_time = (TextView) convertView
|
||||
.findViewById(R.id.item_visit_time);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (viewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
vh.mTv_context.setText(mList.get(position).getNote());
|
||||
vh.mTv_time.setText(mList.get(position).getDatetime().substring(8)
|
||||
+ "日");
|
||||
if (Positions.contains(position + "")) {
|
||||
vh.mTv_date.setVisibility(View.VISIBLE);
|
||||
vh.mTv_date.setText(mList.get(position).getDatetime()
|
||||
.substring(0, 4)
|
||||
+ "年"
|
||||
+ mList.get(position).getDatetime().substring(5, 7)
|
||||
+ "月");
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.r_date.setVisibility(View.VISIBLE);
|
||||
vh.im_v1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
vh.mTv_date.setVisibility(View.GONE);
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.r_date.setVisibility(View.GONE);
|
||||
vh.im_v1.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
if(position==0)
|
||||
{
|
||||
vh.im_v1.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
vh.im_v1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
vh.mTv_name.setText(mList.get(position).getPatientname());
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class viewHolder {
|
||||
TextView mTv_date, mTv_time, mTv_context, mTv_name;
|
||||
RelativeLayout r_date;
|
||||
ImageView im_v1;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.WFYKArticleListBean.WFYKBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
|
||||
public class WFArticleAdapter extends BaseAdapter {
|
||||
private Activity mActivity;
|
||||
private List<WFYKBean> beanlists;
|
||||
private String title;
|
||||
|
||||
public WFArticleAdapter(Activity mActivity, List<WFYKBean> beanlists,
|
||||
String title) {
|
||||
this.mActivity = mActivity;
|
||||
this.beanlists = beanlists;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article);
|
||||
}
|
||||
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_context = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_context);
|
||||
vh.mTv_title_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_title_time);
|
||||
vh.mTv_Creator = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_creator);
|
||||
vh.mTv_KeyWords = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_keywords);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTv_context.setText(beanlists.get(position).getTitle());
|
||||
StringBuffer author = new StringBuffer();
|
||||
if (beanlists.get(position).getAuthorList()!=null&&beanlists.get(position).getAuthorList().length > 0) {
|
||||
for (int i = 0; i < beanlists.get(position).getAuthorList().length; i++) {
|
||||
if (i == beanlists.get(position).getAuthorList().length - 1) {
|
||||
author.append(beanlists.get(position).getAuthorList()[i]);
|
||||
} else {
|
||||
author.append(beanlists.get(position).getAuthorList()[i]
|
||||
+ ",");
|
||||
}
|
||||
|
||||
}
|
||||
vh.mTv_Creator.setText("作者:" + author.toString());
|
||||
} else {
|
||||
vh.mTv_Creator.setText("作者:");
|
||||
}
|
||||
StringBuffer Keyword = new StringBuffer();
|
||||
if (beanlists.get(position).getKeywordList()!=null&&beanlists.get(position).getKeywordList().length > 0) {
|
||||
for (int i = 0; i < beanlists.get(position).getKeywordList().length; i++) {
|
||||
if (i == beanlists.get(position).getKeywordList().length - 1) {
|
||||
Keyword.append(beanlists.get(position).getKeywordList()[i]);
|
||||
} else {
|
||||
Keyword.append(beanlists.get(position).getKeywordList()[i]
|
||||
+ ",");
|
||||
}
|
||||
|
||||
}
|
||||
vh.mTv_KeyWords.setText("关键词:" + Keyword.toString());
|
||||
} else {
|
||||
vh.mTv_KeyWords.setText("关键词:");
|
||||
}
|
||||
if(StringUtil.isEmpty(beanlists.get(position).getIssue())){
|
||||
vh.mTv_title_time.setText(beanlists.get(position).getJournal() + "."
|
||||
+ getStrTime(beanlists.get(position).getPubDate()));
|
||||
}else{
|
||||
vh.mTv_title_time.setText(beanlists.get(position).getJournal() + "."
|
||||
+ getStrTime(beanlists.get(position).getPubDate()) + ".第"
|
||||
+ beanlists.get(position).getIssue() + "期");
|
||||
}
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_title_time, mTv_context, mTv_Creator, mTv_KeyWords;
|
||||
}
|
||||
|
||||
public static String getStrTime(long cc_time) {
|
||||
String re_StrTime = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
||||
re_StrTime = sdf.format(new Date(cc_time));
|
||||
return re_StrTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.bean.WFSearchListBean.RecordsBean;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class WFArticleAdapter1 extends BaseAdapter{
|
||||
private Context mActivity;
|
||||
private List<RecordsBean> beanlists;
|
||||
public WFArticleAdapter1(Context context, List<RecordsBean> beanlists1) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.mActivity = context;
|
||||
this.beanlists = beanlists1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article);
|
||||
}
|
||||
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_context = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_context);
|
||||
vh.mTv_title_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_title_time);
|
||||
vh.mTv_Creator = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_creator);
|
||||
vh.mTv_KeyWords = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_keywords);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
/**
|
||||
* ArticleID : zgzl201201001
|
||||
* Title : 中国肿瘤登记地区2008年恶性肿瘤发病和死亡分析
|
||||
* Creator : |$郑荣寿;|$张思维;A002963611|$吴良有;A000451886|$李光琳;|$赵平;|$赫捷;|$陈万青
|
||||
* Source : 中国肿瘤
|
||||
* Year : 2012
|
||||
* KeyWords : 肿瘤登记;发病率;死亡率;流行病学;中国
|
||||
* DBID : WF_QK
|
||||
* HasOriginalDoc : 0
|
||||
*/
|
||||
vh.mTv_context.setText(beanlists.get(position).getTitle());
|
||||
if (!StringUtil.isEmpty(beanlists.get(position).getCreator())) {
|
||||
vh.mTv_Creator.setText("作者:" + beanlists.get(position).getCreator().toString());
|
||||
} else {
|
||||
vh.mTv_Creator.setText("作者:");
|
||||
}
|
||||
if (!StringUtil.isEmpty(beanlists.get(position).getKeyWords())) {
|
||||
vh.mTv_KeyWords.setText("关键词:" + beanlists.get(position).getKeyWords().toString());
|
||||
} else {
|
||||
vh.mTv_KeyWords.setText("关键词:");
|
||||
}
|
||||
|
||||
vh.mTv_title_time.setText(beanlists.get(position).getSource() + "|"
|
||||
+ beanlists.get(position).getYear());
|
||||
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_title_time, mTv_context, mTv_Creator, mTv_KeyWords;
|
||||
}
|
||||
|
||||
public static String getStrTime(long cc_time) {
|
||||
String re_StrTime = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
||||
re_StrTime = sdf.format(new Date(cc_time));
|
||||
return re_StrTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.shangyu.gdxzExpert.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.shangyu.gdxzExpert.R;
|
||||
import cn.shangyu.gdxzExpert.ecdemo.ui.chatting.model.DownloadModel;
|
||||
import cn.shangyu.gdxzExpert.utils.CommonUtil;
|
||||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||||
|
||||
public class WFArticleDownloadAdapter extends BaseAdapter {
|
||||
private Activity mActivity;
|
||||
private List<DownloadModel> beanlists;
|
||||
|
||||
public WFArticleDownloadAdapter(List<DownloadModel> beanlists) {
|
||||
|
||||
this.beanlists = beanlists;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return beanlists.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
// TODO Auto-generated method stub
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// TODO Auto-generated method stub
|
||||
ViewHolder vh = null;
|
||||
if (convertView == null) {
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article_big);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertView = UIUtils.inflate(R.layout.item_wf_article);
|
||||
}
|
||||
vh = new ViewHolder();
|
||||
vh.mTv_context = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_context);
|
||||
vh.mTv_title_time = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_title_time);
|
||||
vh.mTv_Creator = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_creator);
|
||||
vh.mTv_KeyWords = (TextView) convertView
|
||||
.findViewById(R.id.tv_itemwf_keywords);
|
||||
convertView.setTag(vh);
|
||||
} else {
|
||||
vh = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
vh.mTv_context.setText(beanlists.get(position).getTitle());
|
||||
String ssss = beanlists.get(position).getCurrentProgress();
|
||||
if (beanlists.get(position).getCurrentProgress().contains("0.0")) {
|
||||
vh.mTv_Creator.setText("作者:"+ ssss.substring(0, ssss.indexOf("0.0")));
|
||||
vh.mTv_KeyWords.setText("关键词:"+ ssss.substring(ssss.indexOf("0.0") + 3));
|
||||
} else {
|
||||
vh.mTv_Creator.setText("作者:");
|
||||
|
||||
vh.mTv_KeyWords.setText("关键词:");
|
||||
}
|
||||
|
||||
vh.mTv_title_time.setText(beanlists.get(position).getPath() + "."
|
||||
+ beanlists.get(position).getTime());
|
||||
if(CommonUtil.BigModule())
|
||||
{
|
||||
vh.mTv_title_time.setText(beanlists.get(position).getPath() + "|"
|
||||
+ beanlists.get(position).getTime());
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView mTv_title_time, mTv_context, mTv_Creator, mTv_KeyWords;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user