Просмотр исходного кода

兼容百度更新 andorid 8.0系统

Arison 7 лет назад
Родитель
Сommit
3e5762ddf8

+ 94 - 21
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/SplashActivity.java

@@ -6,12 +6,14 @@ import android.content.Intent;
 import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.Message;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.widget.RelativeLayout;
+import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -55,6 +57,8 @@ import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
 
 import pl.droidsonroids.gif.AnimationListener;
 import pl.droidsonroids.gif.GifDrawable;
@@ -67,16 +71,58 @@ import pl.droidsonroids.gif.GifImageView;
  * @version 1.0
  */
 public class SplashActivity extends BaseActivity {
+    private final int TIMER_SPLASH_COUNDOWN = 0x11;
+
     private RelativeLayout mSelectLv;
     private GifImageView mGifImageView;
+    private TextView mSkipTextView;
+
     private final String IS_FIRST = "IS_FIRST";
-    boolean isJumpable = false;
+    boolean isJumpable = false, isCountDown = false;
 
     private boolean mConfigReady = false;// 配置获取成功
     private GifDrawable mGifDrawable;
     private boolean mAnimationCompleted = false;
     private String mSplshUrl;
     private long mStartTime;
+    private int mCountDown = 5;
+    private Timer mTimer;
+    private Handler mHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            if (msg.what == TIMER_SPLASH_COUNDOWN) {
+                if (mCountDown > 1) {
+                    isCountDown = false;
+                    mCountDown--;
+                    mSkipTextView.setText("点击跳过\t" + mCountDown);
+                } else {
+                    isCountDown = true;
+                    if (mTimer != null) {
+                        mTimer.cancel();
+                    }
+                    jumpImmediately();
+                }
+            }
+        }
+    };
+
+    private void jumpImmediately() {
+        int userStatus = LoginHelper.prepareUser(mContext);
+        switch (userStatus) {
+            case LoginHelper.STATUS_USER_FULL://5
+            case LoginHelper.STATUS_USER_NO_UPDATE://3
+                trun2NextPage(1);
+                break;
+            case LoginHelper.STATUS_USER_TOKEN_OVERDUE://2
+            case LoginHelper.STATUS_USER_SIMPLE_TELPHONE:
+                trun2NextPage(0);
+                break;
+            case LoginHelper.STATUS_NO_USER://0
+            default:
+                stay();
+                return;// must return
+        }
+    }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -84,14 +130,16 @@ public class SplashActivity extends BaseActivity {
         setContentView(R.layout.activity_splash);
         getSupportActionBar().hide();
         StatusBarUtil.immersive(this, 0x00000000, 0.0f);
+        mSkipTextView = findViewById(R.id.splash_skip_tv);
 
         mStartTime = System.currentTimeMillis();
-        new Handler().postDelayed(new Runnable() {
+
+        /*new Handler().postDelayed(new Runnable() {
             @Override
             public void run() {
                 jump();
             }
-        }, 2000);
+        }, 2000);*/
         mGifImageView = findViewById(R.id.splash_gif_view);
         showSplash();
         mSelectLv = (RelativeLayout) findViewById(R.id.select_lv);
@@ -99,12 +147,35 @@ public class SplashActivity extends BaseActivity {
         initConfig();// 初始化配置
         updateAccountToken();//更新账户中心token
         requestSplash();
+
+        mSkipTextView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (mTimer != null) {
+                    mTimer.cancel();
+                }
+                isCountDown = true;
+                jumpImmediately();
+            }
+        });
     }
 
     private void showSplash() {
         try {
             List<String> pictures = FileUtils.getPictures(Constants.SPLASH_FILE_PATH);
             if (pictures != null && pictures.size() > 0) {
+                isCountDown = false;
+                mSkipTextView.setVisibility(View.VISIBLE);
+                mTimer = new Timer();
+                mTimer.schedule(new TimerTask() {
+                    @Override
+                    public void run() {
+                        Message message = Message.obtain();
+                        message.what = TIMER_SPLASH_COUNDOWN;
+                        mHandler.sendMessage(message);
+                    }
+                }, 1000, 1000);
+
                 String localSplash = pictures.get(0);
                 int dotIndex = localSplash.lastIndexOf(".");
                 if (dotIndex >= 0) {
@@ -118,13 +189,19 @@ public class SplashActivity extends BaseActivity {
                         return;
                     }
                 } else {
+                    isCountDown = true;
+                    mSkipTextView.setVisibility(View.GONE);
                     mGifDrawable = new GifDrawable(getAssets(), "gif_splash_welcome.gif");
                 }
             } else {
+                isCountDown = true;
+                mSkipTextView.setVisibility(View.GONE);
                 mGifDrawable = new GifDrawable(getAssets(), "gif_splash_welcome.gif");
             }
         } catch (Exception e) {
             try {
+                isCountDown = true;
+                mSkipTextView.setVisibility(View.GONE);
                 mGifDrawable = new GifDrawable(getAssets(), "gif_splash_welcome.gif");
             } catch (IOException e1) {
             }
@@ -291,11 +368,14 @@ public class SplashActivity extends BaseActivity {
         if (isDestroyed()) {
             return;
         }
-        Log.d("gifdrawablejump", "animation->" + mAnimationCompleted);
         if (!mAnimationCompleted) {
             return;
         }
 
+        if (!isCountDown) {
+            return;
+        }
+
         long currentTime = System.currentTimeMillis();
         long duration = currentTime - mStartTime;
         if (duration < 2000) {
@@ -308,21 +388,7 @@ public class SplashActivity extends BaseActivity {
             return;
         }
 
-        int userStatus = LoginHelper.prepareUser(mContext);
-        switch (userStatus) {
-            case LoginHelper.STATUS_USER_FULL://5
-            case LoginHelper.STATUS_USER_NO_UPDATE://3
-                trun2NextPage(1);
-                break;
-            case LoginHelper.STATUS_USER_TOKEN_OVERDUE://2
-            case LoginHelper.STATUS_USER_SIMPLE_TELPHONE:
-                trun2NextPage(0);
-                break;
-            case LoginHelper.STATUS_NO_USER://0
-            default:
-                stay();
-                return;// must return
-        }
+        jumpImmediately();
     }
 
     private void isNeedLogin() {
@@ -411,11 +477,15 @@ public class SplashActivity extends BaseActivity {
                             new Handler().postDelayed(new Runnable() {
                                 @Override
                                 public void run() {
-                                    trun2NextPage(1);
+                                    if (isCountDown) {
+                                        trun2NextPage(1);
+                                    }
                                 }
                             }, 2000 - duration);
                         } else {
-                            trun2NextPage(1);
+                            if (isCountDown) {
+                                trun2NextPage(1);
+                            }
                         }
                     }
                 } else {// 登录失败
@@ -432,6 +502,9 @@ public class SplashActivity extends BaseActivity {
         Runnable runnable = new Runnable() {
             @Override
             public void run() {
+                if (mTimer != null) {
+                    mTimer.cancel();
+                }
                 UasLocationHelper.getInstance().requestLocation();
                 trun2NextPage2(type);
             }

+ 66 - 53
WeiChat/src/main/java/com/xzjmyk/pm/activity/wxapi/WXPayEntryActivity.java

@@ -31,6 +31,7 @@ import com.me.network.app.http.rx.ResultSubscriber;
 import com.modular.apputils.listener.OnPlayListener;
 import com.modular.apputils.utils.playsdk.AliPlay;
 import com.modular.apputils.utils.playsdk.WxPlay;
+import com.modular.apputils.widget.VeriftyDialog;
 import com.tencent.mm.opensdk.constants.ConstantsAPI;
 import com.tencent.mm.opensdk.modelbase.BaseReq;
 import com.tencent.mm.opensdk.modelbase.BaseResp;
@@ -47,12 +48,12 @@ import java.util.List;
  * @desc:微信支付回调,支付测试类
  * @author:Arison on 2018/5/2
  */
-public class WXPayEntryActivity extends AppCompatActivity implements View.OnClickListener, OnPlayListener,IWXAPIEventHandler {
+public class WXPayEntryActivity extends AppCompatActivity implements View.OnClickListener, OnPlayListener, IWXAPIEventHandler {
     private IWXAPI api;
     private static final String TAG = "PayTestActivity";
-   // String baseUrl = "http://nf20718343.iask.in:15161/";
+    // String baseUrl = "http://nf20718343.iask.in:15161/";
     String baseUrl = "http://qq784602719.imwork.net:43580/";
- 
+
     private ListView lvWxPay;
     private ListView lvAliPay;
 
@@ -79,46 +80,46 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
 //        lvWxPay.setAdapter(wxAdapter);
 //        lvAliPay.setAdapter(aliAdapter);
 //        initEvent();
-//        initData();
+        initData();
     }
 
     private void initEvent() {
         lvWxPay.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
-                final PayTestAdapter.ViewHolder holder= (PayTestAdapter.ViewHolder) view.getTag();
-                LogUtil.d(TAG,"list action:"+holder.btnAction.getText().toString());
+                final PayTestAdapter.ViewHolder holder = (PayTestAdapter.ViewHolder) view.getTag();
+                LogUtil.d(TAG, "list action:" + holder.btnAction.getText().toString());
                 holder.btnAction.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        LogUtil.d(TAG,"action:"+holder.btnAction.getText().toString());
-                        if ("支付".equals(holder.btnAction.getText().toString())){
-                            ToastUtil.showToast(WXPayEntryActivity.this,"支付");
+                        LogUtil.d(TAG, "action:" + holder.btnAction.getText().toString());
+                        if ("支付".equals(holder.btnAction.getText().toString())) {
+                            ToastUtil.showToast(WXPayEntryActivity.this, "支付");
                             wxPay(holder.orderID.getText().toString());
-                        }else if("退款".equals(holder.btnAction.getText().toString())){
-                            ToastUtil.showToast(WXPayEntryActivity.this,"退款");
+                        } else if ("退款".equals(holder.btnAction.getText().toString())) {
+                            ToastUtil.showToast(WXPayEntryActivity.this, "退款");
                             wxRefund(holder.orderID.getText().toString());
                         }
                     }
                 });
-              
+
             }
         });
-        
+
         lvAliPay.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
-                final PayTestAdapter.ViewHolder holder= (PayTestAdapter.ViewHolder) view.getTag();
-                LogUtil.d(TAG,"list action:"+holder.btnAction.getText().toString());
+                final PayTestAdapter.ViewHolder holder = (PayTestAdapter.ViewHolder) view.getTag();
+                LogUtil.d(TAG, "list action:" + holder.btnAction.getText().toString());
                 holder.btnAction.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        LogUtil.d(TAG,"action:"+holder.btnAction.getText().toString());
-                        if ("支付".equals(holder.btnAction.getText().toString())){
-                            ToastUtil.showToast(WXPayEntryActivity.this,"支付");
+                        LogUtil.d(TAG, "action:" + holder.btnAction.getText().toString());
+                        if ("支付".equals(holder.btnAction.getText().toString())) {
+                            ToastUtil.showToast(WXPayEntryActivity.this, "支付");
                             aliPay(holder.orderID.getText().toString());
-                        }else if("退款".equals(holder.btnAction.getText().toString())){
-                            ToastUtil.showToast(WXPayEntryActivity.this,"退款");
+                        } else if ("退款".equals(holder.btnAction.getText().toString())) {
+                            ToastUtil.showToast(WXPayEntryActivity.this, "退款");
                             aliRefund(holder.orderID.getText().toString());
                         }
                     }
@@ -141,7 +142,7 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
         api = WXAPIFactory.createWXAPI(this, Constants.WXPAY_APPID, false);
         api.handleIntent(intent, this);
     }
-    
+
     private void getAliPayOrders() {
         new HttpClient.Builder(baseUrl)
                 .isDebug(BaseConfig.isDebug())
@@ -149,13 +150,13 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
                 .Api()
                 .send(new HttpClient.Builder()
                         .url("alipay/orderquery")
-                        .add("userId",MyApplication.getInstance().mLoginUser.getTelephone())
+                        .add("userId", MyApplication.getInstance().mLoginUser.getTelephone())
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
                     @Override
                     public void onResponse(Object o) {
-                        if (!ListUtils.isEmpty(aliDatas)){
+                        if (!ListUtils.isEmpty(aliDatas)) {
                             aliDatas.clear();
                         }
                         LogUtil.i(TAG, "支付宝list:" + o.toString());
@@ -189,7 +190,7 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
                 .Api()
                 .send(new HttpClient.Builder()
                         .url("wxpay/wxAppQuery")
-                        .add("userid",MyApplication.getInstance().mLoginUser.getTelephone())
+                        .add("userid", MyApplication.getInstance().mLoginUser.getTelephone())
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
@@ -213,7 +214,7 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
                         if (!ListUtils.isEmpty(wxDatas)) {
                             wxAdapter.notifyDataSetChanged();
                         }
-                        ToastUtil.showToast(WXPayEntryActivity.this,"微信订单列表数据已刷新!");
+                        ToastUtil.showToast(WXPayEntryActivity.this, "微信订单列表数据已刷新!");
                     }
 
                     @Override
@@ -229,34 +230,34 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
         if (i == R.id.btn_wxPay) {
             wxPay(null);
         } else if (i == R.id.btn_wxRefund) {
-           // wxRefund();
+            // wxRefund();
         } else if (i == R.id.btn_aliPay) {
             aliPay(null);
         } else if (i == R.id.btn_aliRefund) {
-           // aliRefund();
+            // aliRefund();
         }
     }
 
     private void aliRefund(String outTradeNo) {
-        LogUtil.d(TAG,"outTradeNo:"+outTradeNo);
+        LogUtil.d(TAG, "outTradeNo:" + outTradeNo);
         new HttpClient.Builder(baseUrl)
                 .isDebug(BaseConfig.isDebug())
                 .build()
                 .Api()
                 .send(new HttpClient.Builder()
                         .url("alipay/tradeRefund")
-                        .add("outTradeNo",outTradeNo)
-                        .add("refundAmount","0.01")
-                        .add("fee","0.01")
+                        .add("outTradeNo", outTradeNo)
+                        .add("refundAmount", "0.01")
+                        .add("fee", "0.01")
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
                     @Override
                     public void onResponse(Object o) {
                         LogUtil.i(TAG, "Success:" + o.toString());
-                      
+
                         getAliPayOrders();
-                        
+
                     }
 
                     @Override
@@ -267,16 +268,16 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
     }
 
     private void aliPay(String orderId) {
-        LogUtil.d(TAG,"orderId:"+orderId);
+        LogUtil.d(TAG, "orderId:" + orderId);
         new HttpClient.Builder(baseUrl)
                 .isDebug(BaseConfig.isDebug())
                 .build()
                 .Api()
                 .send(new HttpClient.Builder()
                         .url("alipay/appPay")
-                        .add("userId",MyApplication.getInstance().mLoginUser.getTelephone())
-                        .add("totalAmount","0.01")
-                        .add("out_trade_no",orderId)
+                        .add("userId", MyApplication.getInstance().mLoginUser.getTelephone())
+                        .add("totalAmount", "0.01")
+                        .add("out_trade_no", orderId)
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
@@ -296,7 +297,7 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
     }
 
     private void wxRefund(String outTradeNo) {
-        LogUtil.d(TAG,"退款操作---商户订单号:"+outTradeNo);
+        LogUtil.d(TAG, "退款操作---商户订单号:" + outTradeNo);
         new HttpClient.Builder(baseUrl)
                 .isDebug(BaseConfig.isDebug())
                 .build()
@@ -304,15 +305,15 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
                 .send(new HttpClient.Builder()
                         .url("wxpay/appRefund")
                         .add("outTradeNo", outTradeNo)
-                        .add("refund_fee","0.01")
-                        .add("fee","0.01")
+                        .add("refund_fee", "0.01")
+                        .add("fee", "0.01")
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
                     @Override
                     public void onResponse(Object o) {
                         Log.i(TAG, "Success:" + o.toString());
-                         getWxOrders();
+                        getWxOrders();
                     }
 
                     @Override
@@ -323,7 +324,7 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
     }
 
     private void wxPay(String orderId) {
-        LogUtil.d(TAG,"userid:"+MyApplication.getInstance().mLoginUser.getTelephone()+" orderId:"+orderId);
+        LogUtil.d(TAG, "userid:" + MyApplication.getInstance().mLoginUser.getTelephone() + " orderId:" + orderId);
         new HttpClient.Builder(baseUrl)
                 .isDebug(BaseConfig.isDebug())
                 .build()
@@ -331,8 +332,8 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
                 .send(new HttpClient.Builder()
                         .url("wxpay/appPay")
                         .add("userid", MyApplication.getInstance().mLoginUser.getTelephone())
-                        .add("fee","0.01")
-                        .add("out_trade_no",orderId)
+                        .add("fee", "0.01")
+                        .add("out_trade_no", orderId)
                         .method(Method.POST)
                         .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
 
@@ -355,8 +356,8 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
 
     @Override
     public void onSuccess(String resultStatus, String resultInfo) {
-        LogUtil.d(TAG,"支付宝支付成功!");
-      // getAliPayOrders();
+        LogUtil.d(TAG, "支付宝支付成功!");
+        // getAliPayOrders();
 
     }
 
@@ -365,24 +366,36 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
         //getAliPayOrders();
     }
 
-    
+
     //
     @Override
     public void onReq(BaseReq baseReq) {
-        
+
     }
 
     @Override
     public void onResp(BaseResp baseResp) {
         LogUtil.d(TAG, "onPayFinish, errCode = " + baseResp.errCode);
-       // getWxOrders();
+        // getWxOrders();
         if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
             if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) {
                 Toast.makeText(this, R.string.str_error_wechat_pay_success, Toast.LENGTH_LONG).show();
+                new VeriftyDialog.Builder(this)
+                        .setCanceledOnTouchOutside(false)
+                        .setContent("感谢您的爱心!")
+                        .setShowCancel(false)
+                        .build(new VeriftyDialog.OnDialogClickListener() {
+                            @Override
+                            public void result(boolean clickSure) {
+                                finish();
+                            }
+                        });
             } else if (baseResp.errCode == BaseResp.ErrCode.ERR_COMM) {
                 Toast.makeText(this, R.string.str_error_wechat_pay_fail, Toast.LENGTH_LONG).show();
+                finish();
             } else if (baseResp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
                 Toast.makeText(this, R.string.str_error_wechat_pay_cancel, Toast.LENGTH_LONG).show();
+                finish();
             }
         }
     }
@@ -550,11 +563,11 @@ public class WXPayEntryActivity extends AppCompatActivity implements View.OnClic
             private TextView btnAction;
 
             public ViewHolder(View view) {
-                orderID =  view.findViewById(R.id.orderID);
-                orderState =  view.findViewById(R.id.orderState);
+                orderID = view.findViewById(R.id.orderID);
+                orderState = view.findViewById(R.id.orderState);
                 orderNum = view.findViewById(R.id.orderNum);
-                orderTime =  view.findViewById(R.id.orderTime);
-                orderNo =  view.findViewById(R.id.orderNo);
+                orderTime = view.findViewById(R.id.orderTime);
+                orderNo = view.findViewById(R.id.orderNo);
                 btnAction = view.findViewById(R.id.btn_action);
             }
         }

+ 6 - 0
WeiChat/src/main/res/drawable/shape_splash_count.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <corners android:radius="20dp" />
+    <solid android:color="#88cccccc" />
+</shape>

+ 27 - 4
WeiChat/src/main/res/layout/activity_splash.xml

@@ -1,14 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <pl.droidsonroids.gif.GifImageView
-        android:id="@+id/splash_gif_view"
+    <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:scaleType="fitXY" />
+        android:layout_height="match_parent">
+
+        <pl.droidsonroids.gif.GifImageView
+            android:id="@+id/splash_gif_view"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scaleType="fitXY" />
+
+        <TextView
+            android:id="@+id/splash_skip_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_marginRight="20dp"
+            android:layout_marginTop="36dp"
+            android:background="@drawable/shape_splash_count"
+            android:paddingBottom="6dp"
+            android:paddingLeft="14dp"
+            android:paddingRight="14dp"
+            android:paddingTop="6dp"
+            android:text="点击跳过\t5"
+            android:textColor="@color/black"
+            android:visibility="gone" />
+
+    </RelativeLayout>
 
     <RelativeLayout
         android:id="@+id/select_lv"

+ 2 - 2
app_modular/apputils/src/main/java/com/modular/apputils/utils/playsdk/WxPlay.java

@@ -47,9 +47,9 @@ public class WxPlay {
             request.sign = JSONUtil.getText(orderObject, "sign");
 
            boolean result= wxApi.sendReq(request);
-           if (result){
+           /*if (result){
                onPlayListener.onSuccess("200","订单支付成功");
-           }
+           }*/
         } else {
             onPlayListener.onFailure("500", "订单信息获取异常");
         }

+ 13 - 1
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/JoinCharitActivity.java

@@ -20,6 +20,7 @@ import com.core.base.BaseActivity;
 import com.core.net.utils.NetUtils;
 import com.core.utils.IntentUtils;
 import com.core.utils.ToastUtil;
+import com.core.widget.EmptyLayout;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
@@ -38,6 +39,7 @@ public class JoinCharitActivity extends BaseActivity {
     private PullToRefreshListView refreshListView;
     private TextView numTv;
     private TextView charitTv;
+    private EmptyLayout emptyLayout;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -65,6 +67,11 @@ public class JoinCharitActivity extends BaseActivity {
             }
         }
         refreshListView = (PullToRefreshListView) findViewById(R.id.refreshListView);
+        emptyLayout = new EmptyLayout(ct, refreshListView.getRefreshableView());
+        emptyLayout.setShowLoadingButton(false);
+        emptyLayout.setShowEmptyButton(false);
+        emptyLayout.setShowErrorButton(false);
+        emptyLayout.setEmptyViewRes(com.core.app.R.layout.view_empty);
         if (type == 2) {
             refreshListView.getRefreshableView().addHeaderView(getActivityHeadler(num));
         } else {
@@ -120,7 +127,7 @@ public class JoinCharitActivity extends BaseActivity {
         progressDialog.show();
         HttpClient httpClient = new HttpClient.Builder(Constants.charitBaseUrl()).isDebug(true).build();
         HttpClient builder = new HttpClient.Builder()
-                .url( (type == 2 ? "joinActivity" : "donateDetail") + "/" + MyApplication.getInstance().getLoginUserId())
+                .url((type == 2 ? "joinActivity" : "donateDetail") + "/" + MyApplication.getInstance().getLoginUserId())
                 .method(Method.GET)
                 .build();
         httpClient.Api().send(builder, new ResultSubscriber<>(new ResultListener<Object>() {
@@ -176,6 +183,8 @@ public class JoinCharitActivity extends BaseActivity {
                 models.add(model);
             }
             setAdapter(models);
+        } else {
+            emptyLayout.showEmpty();
         }
     }
 
@@ -201,5 +210,8 @@ public class JoinCharitActivity extends BaseActivity {
             mAdapter.setModels(models);
             mAdapter.notifyDataSetChanged();
         }
+        if (ListUtils.isEmpty(models)) {
+            emptyLayout.showEmpty();
+        }
     }
 }

+ 35 - 8
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/CharitableAdapter.java

@@ -2,22 +2,18 @@ package com.uas.appworks.OA.platform.adapter;
 
 import android.content.Context;
 import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
-import android.widget.Button;
 import android.widget.ImageView;
+import android.widget.SeekBar;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import com.common.LogUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.data.TextUtil;
-import com.core.app.MyApplication;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.nostra13.universalimageloader.core.assist.FailReason;
 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.R;
 
+import java.text.DecimalFormat;
 import java.util.List;
 
 /**
@@ -32,7 +29,7 @@ import java.util.List;
  */
 
 public class CharitableAdapter extends BaseAdapter {
-
+    private DecimalFormat df = new DecimalFormat(".##");
     private Context ct;
     private List<CharitModel> models;
     private MyClickListener onClickListener;
@@ -83,13 +80,19 @@ public class CharitableAdapter extends BaseAdapter {
         CharitModel model = models.get(i);
         if (view == null) {
             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.titleTv = (TextView) view.findViewById(R.id.titleTv);
             holder.subTv = (TextView) view.findViewById(R.id.subTv);
             holder.targetTv = (TextView) view.findViewById(R.id.targetTv);
             holder.typeTv = (TextView) view.findViewById(R.id.typeTv);
             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);
         } else {
             holder = (ViewHolder) view.getTag();
@@ -117,6 +120,28 @@ public class CharitableAdapter extends BaseAdapter {
                     .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;
@@ -167,6 +192,8 @@ public class CharitableAdapter extends BaseAdapter {
         TextView targetTv;
         TextView typeTv;
         TextView giftBtn;
+        TextView defTv;
+        SeekBar progressSb;
 
     }
 
@@ -175,7 +202,7 @@ public class CharitableAdapter extends BaseAdapter {
      * 用于回调的抽象类
      *
      * @author Ivan Xu
-     *         2014-11-26
+     * 2014-11-26
      */
     public static abstract class MyClickListener implements View.OnClickListener {
 

+ 35 - 4
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/fragment/CharitableListFragment.java

@@ -46,6 +46,7 @@ import com.modular.apputils.listener.OnPlayListener;
 import com.modular.apputils.utils.playsdk.AliPlay;
 import com.modular.apputils.utils.playsdk.WxPlay;
 import com.modular.apputils.widget.CustomerBanner;
+import com.modular.apputils.widget.VeriftyDialog;
 import com.uas.appworks.OA.platform.activity.CharitSearchActivity;
 import com.uas.appworks.OA.platform.adapter.AutoPlayPagerAdapter;
 import com.uas.appworks.OA.platform.adapter.CharitableAdapter;
@@ -78,6 +79,8 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
     private boolean playing = false;
     private LinearLayout moneyAmountLL;
 
+    private VeriftyDialog mVeriftyDialog;
+
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
@@ -86,12 +89,39 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
         }
     }
 
+    @Override
+    public void onPause() {
+        if (mVeriftyDialog != null) {
+            mVeriftyDialog.dismiss();
+            mVeriftyDialog = null;
+        }
+        super.onPause();
+
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+    }
+
+    private void showPlyEnd() {
+        mVeriftyDialog = new VeriftyDialog.Builder(getActivity())
+                .setCanceledOnTouchOutside(false)
+                .setContent("感谢您的爱心!")
+                .setShowCancel(false)
+                .build(new VeriftyDialog.OnDialogClickListener() {
+                    @Override
+                    public void result(boolean clickSure) {
+                    }
+                });
+    }
 
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         inflater.inflate(R.menu.search, menu);
         MenuItem item = menu.getItem(0);
-        if (item!=null){
+        if (item != null) {
             LogUtil.i("item!=null");
             item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                 @Override
@@ -284,7 +314,7 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
     }
 
     private void handlerProjects(String area, String message) throws Exception {
-
+        LogUtil.prinlnLongMsg("gong", "message=" + message);
         JSONObject object = JSON.parseObject(message);
         JSONArray projectList = JSONUtil.getJSONArray(object, "projectList");
         String projectJSON = projectList.toJSONString();
@@ -371,6 +401,7 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
     }
 
     private CharitableAdapter charitableAdapter;
+
     private void setContantData(List<CharitModel> models) {
 //        if (charitableAdapter == null) {
         charitableAdapter = new CharitableAdapter(ct, models, new CharitableAdapter.MyClickListener() {
@@ -425,7 +456,7 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
 
     @Override
     public void onSuccess(String resultStatus, String resultInfo) {
-        ToastUtil.showToast(ct, "支付成功");
+//        ToastUtil.showToast(ct, "支付成功");
         playing = false;
     }
 
@@ -466,7 +497,7 @@ public class CharitableListFragment extends EasyFragment implements OnPlayListen
 
         String json = JSON.toJSONString(map);
         LogUtil.i("json=" + json);
-        String url="http://lj.ubtob.com/";
+        String url = "http://lj.ubtob.com/";
         new HttpClient.Builder(url)
                 .isDebug(BaseConfig.isDebug())
                 .build()

+ 1 - 1
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/CharitModel.java

@@ -11,7 +11,7 @@ public class CharitModel {
     private String area;
     private String proSummary;
     private String target;
-    private String totalAmount;
+    private String totalAmount;//捐款总额
     private String name;
     private String logo;
     private String mobileImg;

+ 27 - 0
app_modular/appworks/src/main/res/drawable/bg_seek_bar_progree.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape>
+            <corners android:radius="5dp"/>
+            <solid android:color="#D8D8D8"/>
+        </shape>
+    </item>
+
+    <item android:id="@android:id/secondaryProgress">
+        <clip>
+            <shape>
+                <corners android:radius="5dp"/>
+                <solid android:color="#D8D8D8"/>
+            </shape>
+        </clip>
+    </item>
+
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape>
+                <corners android:radius="5dp"/>
+                <solid android:color="#EF613B" />
+            </shape>
+        </clip>
+    </item>
+</layer-list>

+ 25 - 2
app_modular/appworks/src/main/res/layout/item_charitable_list.xml

@@ -50,7 +50,7 @@
         android:layout_toRightOf="@id/contantImg"
         android:text="目标筹款 :"
         android:textColor="@color/hintColor"
-        android:textSize="@dimen/text_hine" />
+        android:textSize="@dimen/text_min" />
 
     <TextView
         android:id="@+id/targetTv"
@@ -65,8 +65,9 @@
         android:textSize="@dimen/text_hine" />
 
 
+
     <TextView
-        android:id="@+id/giftBtn"
+        android:id="@+id/defProgress"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
@@ -74,6 +75,28 @@
         android:layout_marginBottom="@dimen/padding"
         android:layout_marginRight="@dimen/padding"
         android:layout_marginTop="@dimen/padding"
+        android:padding="4dp"
+        android:text="我要捐款"
+        android:textColor="@color/white"
+        android:textSize="@dimen/text_hine" />
+    <SeekBar
+        android:id="@+id/progressSb"
+        android:layout_below="@id/targetTag"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_toRightOf="@id/contantImg"/>
+
+
+
+    <TextView
+        android:id="@+id/giftBtn"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:layout_below="@id/progressSb"
+        android:layout_marginBottom="@dimen/padding"
+        android:layout_marginRight="@dimen/padding"
+        android:layout_marginTop="@dimen/padding"
         android:background="@color/indianred"
         android:padding="4dp"
         android:text="我要捐款"

+ 134 - 0
app_modular/appworks/src/main/res/layout/item_charitable_project.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white">
+
+    <ImageView
+        android:id="@+id/contantImg"
+        android:layout_width="100dp"
+        android:layout_height="80dp"
+        android:layout_marginLeft="20dp"
+        android:layout_marginRight="@dimen/padding"
+        android:layout_marginTop="10dp"
+        android:scaleType="centerCrop"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+
+    <TextView
+        android:id="@+id/titleTv"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="@dimen/padding"
+        android:ellipsize="end"
+        android:maxLines="2"
+        android:layout_marginRight="@dimen/padding"
+        android:text="titleTv"
+        app:layout_constraintRight_toRightOf="parent"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main"
+        app:layout_constraintLeft_toRightOf="@id/contantImg"
+        app:layout_constraintTop_toTopOf="@id/contantImg" />
+
+    <TextView
+        android:id="@+id/subTv"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/padding"
+        android:ellipsize="end"
+        android:maxLines="2"
+        android:text="subTv"
+        android:layout_marginRight="@dimen/padding"
+        app:layout_constraintRight_toRightOf="parent"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_hine"
+        app:layout_constraintLeft_toLeftOf="@id/titleTv"
+        app:layout_constraintTop_toBottomOf="@id/titleTv" />
+
+    <TextView
+        android:id="@+id/targetTag"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/padding"
+        android:text="目标筹款 :"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_min"
+        app:layout_constraintLeft_toLeftOf="@id/titleTv"
+        app:layout_constraintTop_toBottomOf="@id/subTv" />
+
+    <TextView
+        android:id="@+id/targetTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:maxLines="1"
+        android:text="targetTv"
+        android:textColor="@color/indianred"
+        android:textSize="@dimen/text_hine"
+        app:layout_constraintBottom_toBottomOf="@id/targetTag"
+        app:layout_constraintLeft_toRightOf="@id/targetTag"
+        app:layout_constraintTop_toTopOf="@id/targetTag" />
+
+
+    <TextView
+        android:id="@+id/defTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="@dimen/padding"
+        android:layout_marginTop="@dimen/padding"
+        android:text="还差13.3万元"
+        android:textColor="#FF414141"
+        android:textSize="9sp"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/targetTag" />
+
+    <SeekBar
+        android:id="@+id/progressSb"
+        android:layout_width="0dp"
+        android:layout_height="3dp"
+        android:layout_marginRight="@dimen/paddingMin"
+        android:thumb="@null"
+        android:progressDrawable="@drawable/bg_seek_bar_progree"
+        app:layout_constraintBottom_toBottomOf="@id/defTv"
+        app:layout_constraintLeft_toLeftOf="@id/titleTv"
+        app:layout_constraintRight_toLeftOf="@id/defTv"
+        app:layout_constraintTop_toTopOf="@id/defTv" />
+
+
+
+
+    <TextView
+        android:id="@+id/giftBtn"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintRight_toRightOf="@id/defTv"
+        app:layout_constraintTop_toBottomOf="@id/defTv"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_marginBottom="@dimen/padding"
+        android:layout_marginTop="@dimen/padding"
+        android:background="@color/indianred"
+        android:padding="4dp"
+        android:text="我要捐款"
+        android:textColor="@color/white"
+        android:textSize="@dimen/text_hine" />
+
+    <TextView
+        android:id="@+id/typeTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toTopOf="@id/giftBtn"
+        app:layout_constraintBottom_toBottomOf="@id/giftBtn"
+        app:layout_constraintLeft_toLeftOf="@id/titleTv"
+        android:background="@drawable/text_frame_bg"
+        android:ellipsize="end"
+        android:maxLines="1"
+        android:paddingBottom="2dp"
+        android:paddingLeft="5dp"
+        android:paddingRight="5dp"
+        android:paddingTop="2dp"
+        android:text="疾病救助"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_hine" />
+</android.support.constraint.ConstraintLayout>