Przeglądaj źródła

提现列表修改

liujiangyao 8 lat temu
rodzic
commit
c4729819ba

+ 3 - 0
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -120,6 +120,9 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
 
     private void refalsh() {
 
+        if(myPrice == null || userEntity ==null){
+            return;
+        }
         myPrice.setText(userEntity.getBalance() + " 元");
         myAllPrice.setText("累计资产 " + userEntity.getTotal_asset() + " 元");
         nameTv.setText(userEntity.getNickname() + "");//绵羊号:123456789

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -19,7 +19,7 @@ public class CommonUtil {
 
     /**
      * 返回提现审核结果
-     * 审核状态 0未审核 1系统审核通过 2系统审核通过等待人工审核 3人工审核不通过 4人工审核通过
+     * 审核状态 1系统审核通过等待人工审核 2系统审核通过 3人工审核不通过 4人工审核通过
      */
     public String returnAuditResult(WithdrawalEty ety){
         String result = "未审核";
@@ -28,10 +28,10 @@ public class CommonUtil {
                 result = "未审核";
                 break;
             case 1:
-                result = returnPayState(ety);
+                result = "等待人工审核";
                 break;
             case 2:
-                result = "等待人工审核";
+                result = returnPayState(ety);
                 break;
             case 3:
                 result = "人工审核不通过";

+ 119 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/DialogActivity.java

@@ -9,6 +9,7 @@ import android.preference.DialogPreference;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.RequiresApi;
+import android.util.Log;
 import android.view.View;
 import android.webkit.WebChromeClient;
 import android.webkit.WebResourceRequest;
@@ -32,7 +33,6 @@ import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskState;
 import com.sheep.gamegroup.presenter.TaskDialogContract;
 import com.sheep.gamegroup.presenter.TaskDialogPresenter;
-import com.sheep.gamegroup.util.DeviceUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.MyListview;
@@ -50,6 +50,11 @@ import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 
 
 import org.greenrobot.eventbus.EventBus;
+import org.wlf.filedownloader.DownloadFileInfo;
+import org.wlf.filedownloader.FileDownloader;
+import org.wlf.filedownloader.listener.OnDetectBigUrlFileListener;
+import org.wlf.filedownloader.listener.OnDownloadFileChangeListener;
+import org.wlf.filedownloader.listener.OnFileDownloadStatusListener;
 import org.xutils.ex.DbException;
 import org.xutils.x;
 
@@ -95,6 +100,7 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
     private DownloadManager downloadManager;
     DownloadInfo downloadInfo;
     private int type;//0,开始任务 1,开始试玩 2,开始下载
+    private boolean isStartPause = false;//false:开始,true:暂停
     private boolean isDownLoad = false;//是否下载
     private String buttonStr = "开始任务";//是否下载
     private Activity activity;
@@ -137,6 +143,7 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
         activity = this;
         initViews();
         initDatas();
+        doFiler();
     }
 
     private void initDatas() {
@@ -151,7 +158,11 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
         dialogItemSizeTv.setText( task_entity.getPackage_size() + "M");
         isDownLoad = PackageUtil.isAppInstalled(SheepApp.mContext, task_entity.getPackage_names());
 
-        isHaveLoad();
+//        isHaveLoad();
+//        downLoadApk();
+        /**
+         * 下载
+         */
         loadTvAdp = new DownLoadTvAdp(activity, infoList);
         listview_down.setAdapter(loadTvAdp);
 
@@ -237,7 +248,7 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
             switch (type){
                 case 0://开始任务
                     JSONObject object = new JSONObject();
-                    object.put("device_id", DeviceUtil.getDeviceId(DialogActivity.this));
+                    object.put("device_id", new DeviceUtils(activity).getIMEI()+"");
                     object.put("release_task_id", Integer.valueOf(task_entity.getRelease_task_id()+""));
                     preference.acceptedTask(object);
                     break;
@@ -245,7 +256,14 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
                     toTestPlay();
                     break;
                 case 2://开始下载
-                    downLoadApk();
+//                    downLoadApk();
+                    if(!isStartPause){
+                        startFiler();
+                    }else {
+                        FileDownloader.pause(task_entity.getDownload_link());
+                    }
+                    isStartPause = !isStartPause;
+
                     break;
             }
         }catch (Exception e){
@@ -323,7 +341,6 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
 //                    start_task_tv.setText("继续下载");
                 }
                 infoList.clear();
-
                 infoList.add(downloadInfo);
             }
         }
@@ -354,6 +371,7 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
             }
         }
         start_task_tv.setText(buttonStr);
+
         loadTvAdp.setTaskState(type);
         loadTvAdp.addTaskPreference(preference);
         loadTvAdp.addTaskEty(task_entity);
@@ -409,11 +427,107 @@ public class DialogActivity extends Activity implements TaskDialogContract.View
     @Override
     public void getStatefail(Object o) {
 
+
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
+        unFiler();
+    }
+
+    /*----------------------------*/
+    OnFileDownloadStatusListener onFileDownloadStatusListener = new OnFileDownloadStatusListener() {
+        @Override
+        public void onFileDownloadStatusWaiting(DownloadFileInfo downloadFileInfo) {
+
+        }
+
+        @Override
+        public void onFileDownloadStatusPreparing(DownloadFileInfo downloadFileInfo) {
+
+        }
+
+        @Override
+        public void onFileDownloadStatusPrepared(DownloadFileInfo downloadFileInfo) {
+
+        }
+
+        @Override
+        public void onFileDownloadStatusDownloading(DownloadFileInfo downloadFileInfo, float downloadSpeed, long
+                remainingTime) {
+            // 正在下载,downloadSpeed为当前下载速度,单位KB/s,remainingTime为预估的剩余时间,单位秒
+            Log.e("tDownloadedSizeLong---",downloadFileInfo.getDownloadedSizeLong()+"");
+            Log.e("getFileSizeLong---",downloadFileInfo.getFileSizeLong()+"");
+            Log.e("getFileSizeLong---",(int)(downloadFileInfo.getDownloadedSizeLong()*100 /downloadFileInfo.getFileSizeLong()) + "%"+"");
+            start_task_tv.setText((int)(downloadFileInfo.getDownloadedSizeLong() * 100 /downloadFileInfo.getFileSizeLong() )+ "%");
+        }
+
+        @Override
+        public void onFileDownloadStatusPaused(DownloadFileInfo downloadFileInfo) {
+            start_task_tv.setText("继续下载");
+            Log.e("DownloadStatusPaused---",downloadFileInfo.getDownloadedSizeLong()+","+downloadFileInfo.getFileSizeLong());
+        }
+
+        @Override
+        public void onFileDownloadStatusCompleted(DownloadFileInfo downloadFileInfo) {
+
+            Log.e("Completed---",downloadFileInfo.getDownloadedSizeLong()+","+downloadFileInfo.getFileSizeLong());
+            if(PackageUtil.isAppInstalled(activity, task_entity.getPackage_names())){
+//                PackageUtil.startApp(SheepApp.mContext, task_entity.getPackage_names());
+                start_task_tv.setText("开始试玩");
+                type = 1;
+            }else{
+                PackageUtil.installApk(activity, task_entity.getPackage_names());
+            }
+        }
+
+        @Override
+        public void onFileDownloadStatusFailed(String s, DownloadFileInfo downloadFileInfo, FileDownloadStatusFailReason fileDownloadStatusFailReason) {
+
+        }
+    };
+    private OnDownloadFileChangeListener mOnDownloadFileChangeListener = new OnDownloadFileChangeListener() {
+        @Override
+        public void onDownloadFileCreated(DownloadFileInfo downloadFileInfo) {
+            // 一个新下载文件被创建,也许你需要同步你自己的数据存储,比如在你的业务数据库中增加一条记录
+        }
+        @Override
+        public void onDownloadFileUpdated(DownloadFileInfo downloadFileInfo, Type type) {
+            // 一个下载文件被更新,也许你需要同步你自己的数据存储,比如在你的业务数据库中更新一条记录
+        }
+        @Override
+        public void onDownloadFileDeleted(DownloadFileInfo downloadFileInfo) {
+            // 一个下载文件被删除,也许你需要同步你自己的数据存储,比如在你的业务数据库中删除一条记录
+        }
+    };
+    private void doFiler(){
+        FileDownloader.registerDownloadStatusListener(onFileDownloadStatusListener);
+        FileDownloader.registerDownloadFileChangeListener(mOnDownloadFileChangeListener);
+    }
+    private void unFiler(){
+        FileDownloader.unregisterDownloadStatusListener(onFileDownloadStatusListener);
+        FileDownloader.unregisterDownloadFileChangeListener(mOnDownloadFileChangeListener);
+    }
+    private void startFiler(){
+        ClassFileHelper.getInstance().createSDDirection();
+//        File mApkPath = new File(ClassFileHelper.DIR, task_entity.getTask_name() + ClassFileHelper.FILE_SUFFIX);
+        FileDownloader.detect(task_entity.getDownload_link(), new OnDetectBigUrlFileListener() {
+            @Override
+            public void onDetectNewDownloadFile(String url, String fileName, String saveDir, long fileSize) {
+                // 如果有必要,可以改变文件名称fileName和下载保存的目录saveDir
+                FileDownloader.createAndStart(url, ClassFileHelper.DIR, task_entity.getTask_name() + ClassFileHelper.FILE_SUFFIX);
+            }
+            @Override
+            public void onDetectUrlFileExist(String url) {
+                // 继续下载,自动会断点续传(如果服务器无法支持断点续传将从头开始下载)
+                FileDownloader.start(url);
+            }
+            @Override
+            public void onDetectUrlFileFailed(String url, DetectBigUrlFileFailReason failReason) {
+                // 探测一个网络文件失败了,具体查看failReason
+            }
+        });
     }
 
 }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/PhoneAct.java

@@ -279,7 +279,7 @@ public class PhoneAct extends BaseActivity implements PhoneContract.View {
 
     private void goMain() {
         // TODO: 2018/3/22  测试界面,过后删除s
-        SpUtils.login(getApplicationContext(), "12@fae4031a0a57e344b004009b5d77a6b6");
+        SpUtils.login(getApplicationContext(), "13626@395a75211751465f54789a7f459089bd");
 //        startActivity(new Intent(this, ActMain.class));
         Jump2View.getInstance().goHomePageView(this, null);
         ActivityManager.getInstance().endActivity(LoginAct.class);

+ 6 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -7,6 +7,7 @@ import android.app.Activity;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.support.annotation.NonNull;
@@ -70,7 +71,11 @@ public class SplashAct extends BaseActivity implements SplashContract.View, Easy
             EasyPermissions.requestPermissions(this, "应用需要这些权限", PERMISSON_REQUESTCODE, needPermissions);
         } else {
 //            setContentView(R.layout.splash_activity);
-            animWelcomeImage();
+            if(Build.VERSION.SDK_INT >= 19){
+                animWelcomeImage();
+
+            }else {
+            }
         }
     }
 

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/WithdrawalListAdp.java

@@ -65,7 +65,7 @@ public class WithdrawalListAdp extends BaseAdapter {
         }catch (Exception e){
             e.printStackTrace();
         }
-        holder.price_tv.setText("+" + ety.getAmount()+"元");
+        holder.price_tv.setText("-" + ety.getAmount()+"元");
         holder.state_tv.setText(CommonUtil.getInstance().returnAuditResult(ety));
 
         return convertView;

+ 35 - 7
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -3,6 +3,7 @@ package com.sheep.jiuyan.samllsheep;
 import android.app.Activity;
 import android.content.Context;
 import android.os.Bundle;
+import android.os.Environment;
 import android.support.multidex.MultiDex;
 import android.util.DisplayMetrics;
 
@@ -13,12 +14,16 @@ import com.sheep.gamegroup.di.components.DaggerNetComponent;
 import com.sheep.gamegroup.di.components.NetComponent;
 import com.sheep.gamegroup.di.modules.NetModule;
 import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.tencent.bugly.Bugly;
 import com.tencent.mm.opensdk.openapi.IWXAPI;
 import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import com.umeng.commonsdk.UMConfigure;
 
+import org.wlf.filedownloader.FileDownloadConfiguration;
+
+import java.io.File;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -37,7 +42,7 @@ public class SheepApp extends BaseApplication {
 
     private NetComponent netComponent;
 
-    public static SheepApp get(Context context){
+    public static SheepApp get(Context context) {
         return (SheepApp) context.getApplicationContext();
     }
 
@@ -53,6 +58,30 @@ public class SheepApp extends BaseApplication {
         Bugly.init(getApplicationContext(), Config.BUGLY_APPID, true);
         initNet();
         initImagePicker();
+        createFileDownloader();//创建FileDownloader
+    }
+
+    private void createFileDownloader() {
+
+        ClassFileHelper.getInstance().createSDDirection();
+        // 1、创建Builder
+        FileDownloadConfiguration.Builder builder = new FileDownloadConfiguration.Builder(this);
+
+        // 2.配置Builder
+// 配置下载文件保存的文件夹
+        builder.configFileDownloadDir(ClassFileHelper.DIR);
+// 配置同时下载任务数量,如果不配置默认为2
+        builder.configDownloadTaskSize(3);
+// 配置失败时尝试重试的次数,如果不配置默认为0不尝试
+        builder.configRetryDownloadTimes(5);
+// 开启调试模式,方便查看日志等调试相关,如果不配置默认不开启
+        builder.configDebugMode(true);
+// 配置连接网络超时时间,如果不配置默认为15秒
+        builder.configConnectTimeout(25000);// 25秒
+
+// 3、使用配置文件初始化FileDownloader
+        FileDownloadConfiguration configuration = builder.build();
+        org.wlf.filedownloader.FileDownloader.init(configuration);
     }
 
     private void initImagePicker() {
@@ -70,19 +99,18 @@ public class SheepApp extends BaseApplication {
         imagePicker.setOutPutY(500);//保存文件的高度。单位像素
     }
 
-    public  static void  removeAllActivity(){
+    public static void removeAllActivity() {
 
         Iterator<Map.Entry<String, Activity>> it = mActivitys.entrySet().iterator();
-        while(it.hasNext()){
+        while (it.hasNext()) {
             Map.Entry<String, Activity> entry = it.next();
-            Activity a=entry.getValue();
+            Activity a = entry.getValue();
             a.finish();
             it.remove();
         }
     }
 
 
-
     private void initNet() {
         netComponent = DaggerNetComponent.builder()
                 .netModule(new NetModule())
@@ -139,11 +167,11 @@ public class SheepApp extends BaseApplication {
         }
     };
 
-    public NetComponent getNetComponent(){
+    public NetComponent getNetComponent() {
         return netComponent;
     }
 
-    public static SheepApp getInstance(){
+    public static SheepApp getInstance() {
         return mSheepApp;
     }
 

BIN
app/src/main/res/drawable-xhdpi/no_bind_img.png


BIN
app/src/main/res/drawable-xxhdpi/no_bind_img.png


+ 2 - 2
app/src/main/res/layout/download_item_dialog.xml

@@ -118,7 +118,7 @@
                     android:layout_centerHorizontal="true"
                     android:minWidth="151dp"
                     android:text="开始任务"
-                    android:visibility="gone"/>
+                    android:visibility="visible"/>
 
                 <com.sheep.gamegroup.util.MyListview
                     android:id="@+id/listview_down"
@@ -131,7 +131,7 @@
                     android:layout_marginLeft="@dimen/content_padding_40"
                     android:layout_marginRight="@dimen/content_padding_40"
                     android:layout_marginTop="@dimen/content_padding_15"
-                    android:visibility="visible"/>
+                    android:visibility="gone"/>
 
                 <TextView
                     android:id="@+id/doalog_item_get_rewards_tv"