|
@@ -2,22 +2,18 @@ package com.uas.appworks.OA.platform.adapter;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Bitmap;
|
|
|
-import android.graphics.Color;
|
|
|
|
|
-import android.support.v7.widget.RecyclerView;
|
|
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.BaseAdapter;
|
|
import android.widget.BaseAdapter;
|
|
|
-import android.widget.Button;
|
|
|
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
+import android.widget.SeekBar;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
-import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
import com.common.LogUtil;
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.ListUtils;
|
|
import com.common.data.ListUtils;
|
|
|
import com.common.data.StringUtil;
|
|
import com.common.data.StringUtil;
|
|
|
import com.common.data.TextUtil;
|
|
import com.common.data.TextUtil;
|
|
|
-import com.core.app.MyApplication;
|
|
|
|
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
|
|
import com.nostra13.universalimageloader.core.assist.FailReason;
|
|
import com.nostra13.universalimageloader.core.assist.FailReason;
|
|
|
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
|
|
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
|
|
@@ -25,6 +21,7 @@ import com.uas.appworks.OA.platform.config.ImageConfig;
|
|
|
import com.uas.appworks.OA.platform.model.CharitModel;
|
|
import com.uas.appworks.OA.platform.model.CharitModel;
|
|
|
import com.uas.appworks.R;
|
|
import com.uas.appworks.R;
|
|
|
|
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -32,7 +29,7 @@ import java.util.List;
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
public class CharitableAdapter extends BaseAdapter {
|
|
public class CharitableAdapter extends BaseAdapter {
|
|
|
-
|
|
|
|
|
|
|
+ private DecimalFormat df = new DecimalFormat(".##");
|
|
|
private Context ct;
|
|
private Context ct;
|
|
|
private List<CharitModel> models;
|
|
private List<CharitModel> models;
|
|
|
private MyClickListener onClickListener;
|
|
private MyClickListener onClickListener;
|
|
@@ -83,13 +80,19 @@ public class CharitableAdapter extends BaseAdapter {
|
|
|
CharitModel model = models.get(i);
|
|
CharitModel model = models.get(i);
|
|
|
if (view == null) {
|
|
if (view == null) {
|
|
|
holder = new ViewHolder();
|
|
holder = new ViewHolder();
|
|
|
- view = getLayoutInflater().inflate(R.layout.item_charitable_list, null);
|
|
|
|
|
|
|
+ view = getLayoutInflater().inflate(R.layout.item_charitable_project, null);
|
|
|
holder.contantImg = (ImageView) view.findViewById(R.id.contantImg);
|
|
holder.contantImg = (ImageView) view.findViewById(R.id.contantImg);
|
|
|
holder.titleTv = (TextView) view.findViewById(R.id.titleTv);
|
|
holder.titleTv = (TextView) view.findViewById(R.id.titleTv);
|
|
|
holder.subTv = (TextView) view.findViewById(R.id.subTv);
|
|
holder.subTv = (TextView) view.findViewById(R.id.subTv);
|
|
|
holder.targetTv = (TextView) view.findViewById(R.id.targetTv);
|
|
holder.targetTv = (TextView) view.findViewById(R.id.targetTv);
|
|
|
holder.typeTv = (TextView) view.findViewById(R.id.typeTv);
|
|
holder.typeTv = (TextView) view.findViewById(R.id.typeTv);
|
|
|
holder.giftBtn = (TextView) view.findViewById(R.id.giftBtn);
|
|
holder.giftBtn = (TextView) view.findViewById(R.id.giftBtn);
|
|
|
|
|
+ holder.progressSb = view.findViewById(R.id.progressSb);
|
|
|
|
|
+ holder.defTv = view.findViewById(R.id.defTv);
|
|
|
|
|
+ holder.progressSb.setClickable(false);
|
|
|
|
|
+ holder.progressSb.setEnabled(false);
|
|
|
|
|
+ holder.progressSb.setFocusable(false);
|
|
|
|
|
+ holder.progressSb.setPadding(0,0,0,0);
|
|
|
view.setTag(holder);
|
|
view.setTag(holder);
|
|
|
} else {
|
|
} else {
|
|
|
holder = (ViewHolder) view.getTag();
|
|
holder = (ViewHolder) view.getTag();
|
|
@@ -117,6 +120,28 @@ public class CharitableAdapter extends BaseAdapter {
|
|
|
.showIn(holder.subTv);
|
|
.showIn(holder.subTv);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ float mTarget = Float.valueOf(model.getTarget());
|
|
|
|
|
+ float mTotalAmount = Float.valueOf(model.getTotalAmount());
|
|
|
|
|
+ holder.progressSb.setMax((int) mTarget);
|
|
|
|
|
+ holder.progressSb.setProgress((int) mTotalAmount);
|
|
|
|
|
+ String defStr = "";
|
|
|
|
|
+ if (mTotalAmount >= mTarget) {
|
|
|
|
|
+ defStr = "筹款已完成";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ float defAmount = mTarget - mTotalAmount;
|
|
|
|
|
+
|
|
|
|
|
+ if (defAmount > 10000) {
|
|
|
|
|
+ float defRMB = defAmount / 10000;
|
|
|
|
|
+ defStr = "还差" + df.format(defRMB) + "万元";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ defStr = "还差" + df.format(defAmount) + "元";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ holder.defTv.setText(defStr);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
final ViewHolder finalHoder = holder;
|
|
final ViewHolder finalHoder = holder;
|
|
@@ -167,6 +192,8 @@ public class CharitableAdapter extends BaseAdapter {
|
|
|
TextView targetTv;
|
|
TextView targetTv;
|
|
|
TextView typeTv;
|
|
TextView typeTv;
|
|
|
TextView giftBtn;
|
|
TextView giftBtn;
|
|
|
|
|
+ TextView defTv;
|
|
|
|
|
+ SeekBar progressSb;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -175,7 +202,7 @@ public class CharitableAdapter extends BaseAdapter {
|
|
|
* 用于回调的抽象类
|
|
* 用于回调的抽象类
|
|
|
*
|
|
*
|
|
|
* @author Ivan Xu
|
|
* @author Ivan Xu
|
|
|
- * 2014-11-26
|
|
|
|
|
|
|
+ * 2014-11-26
|
|
|
*/
|
|
*/
|
|
|
public static abstract class MyClickListener implements View.OnClickListener {
|
|
public static abstract class MyClickListener implements View.OnClickListener {
|
|
|
|
|
|