Explorar o código

小程序开发、邀请赚钱、个人中心修改、一些bug修改

liujiangyao %!s(int64=7) %!d(string=hai) anos
pai
achega
2590c4b8b6

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -860,7 +860,7 @@ public interface ApiService {
      * 获取邀请用户排名
      */
     @GET("app/user/invitation_top")
-    Observable<BaseMessage> getInvitationTop(@Query("top") int top);//top默认为5,可以不传
+    Observable<BaseMessage> getInvitationTop(@Query("top") int top,@Query("start_time") long start_time,@Query("end_time") long end_time);//top默认为5,可以不传
 
     /**
      * 获取邀请用户进两月礼物发放记录

+ 17 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java

@@ -28,7 +28,7 @@ public class TaskEty implements Serializable, IDownload {
     private String remarks;//private String string",
     private String task_name;//private String string",
     private String screenshots;//private String string",
-    private int task_type = 1;// 1时间试玩任务 2 信用卡任务 3应用下载 4h5业务 1001畅思 1000连续任务, 1002 1003游戏任务 1002平台游戏,1003 腾讯游戏,1004 小米游戏
+    private int task_type = 1;// 1时间试玩任务 2 信用卡任务 3应用下载 4h5业务 1001畅思 1000连续任务, 1002 1003游戏任务 1002平台游戏,1003 腾讯游戏,1004 小米游戏,1006 小程序(关联字段-qr_code)
     private int open_mode;//连续任务的打开方式 1:打开应用 2:H5内部 3:H5外部
     private String update_time;// 0
     private String icon;
@@ -42,6 +42,15 @@ public class TaskEty implements Serializable, IDownload {
     private List<TaskChild> child;
     private boolean can_download;//是否可以下载
     private int appointment_time;//预约时间
+    private String qr_code;//二维码地址
+
+    public String getQr_code() {
+        return qr_code;
+    }
+
+    public void setQr_code(String qr_code) {
+        this.qr_code = qr_code;
+    }
 
     public int getOpen_mode() {
         return open_mode;
@@ -635,4 +644,11 @@ public class TaskEty implements Serializable, IDownload {
                 return true;
         }
     }
+
+    /**
+     * 是否是小程序 1006
+     */
+    public boolean isApplet(){
+        return task_type == 1006;
+    }
 }

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

@@ -84,8 +84,10 @@ import java.lang.reflect.Field;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -2259,4 +2261,27 @@ public class CommonUtil {
                     }
                 });
     }
+
+    /**
+     * 获取时间
+     */
+    public long[] getLastMonth(){
+        Calendar c=Calendar.getInstance();
+        c.add(Calendar.MONTH, -1);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
+        int lastMonthMaxDay=c.getActualMaximum(Calendar.DAY_OF_MONTH);
+        c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), lastMonthMaxDay, 23, 59, 59);
+        //按格式输出
+        String endtime = sdf.format(c.getTime()); //上月最后一天
+        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-01  00:00:00");
+        String starttime = sdf2.format(c.getTime()); //上月第一天
+        try {
+            Date dateStart = sdf.parse(starttime);
+            Date datEnd = sdf.parse(endtime);
+            return new long[]{dateStart.getTime(), datEnd.getTime()};
+        }catch (Exception e){
+
+        }
+        return null;
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -128,7 +128,7 @@ public enum ConnectAddress {
                 String flavor = ConfigUtil.getInstance().getItem(0);//第一行填写connectAddress的名字
                 try {
                     return ConnectAddress.valueOf(flavor);
-                } catch (IllegalArgumentException e) {
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
@@ -136,7 +136,7 @@ public enum ConnectAddress {
         String flavor = TestUtil.isSheep() ? "sheep" : DataUtil.getAsString("flavor", BuildConfig.FLAVOR);
         try {
             return ConnectAddress.valueOf(flavor);
-        } catch (IllegalArgumentException e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return this;

+ 9 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -341,6 +341,7 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
                     break;
                 case 2:
                 case 1001://信用卡与畅思任务不考虑
+                case 1006://小程序
                     bottom_btn_layout.setVisibility(View.GONE);
                     break;
                 case 1000://连续任务
@@ -385,8 +386,14 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
             } else {//有任务记录
                 switch (taskEty.getTask_type()) {// 1时间试玩任务 2 信用卡任务 3应用下载 4h5业务 1001畅思 1000连续任务, 1002 1003游戏任务 1004 小米游戏任务
                     case 4://h5业务
-                        type = TASK_TYPE_H5;
-                        btnTaskItem.setText(START_TASK);
+                    case 1006://h5业务
+                        if(taskEty.getTask_type() == 1006){
+                            btnTaskItem.setVisibility(View.GONE);
+                        }else {
+                            type = TASK_TYPE_H5;
+                            btnTaskItem.setText(START_TASK);
+                        }
+
                         switch (gettaskAcceptedEty.getStatus()) {
                             case 1://"已接受任务";
                             case 2:// "正在进行中";

+ 65 - 2
app/src/main/java/com/sheep/gamegroup/view/adapter/TaskdetailSonListviewAdp.java

@@ -2,7 +2,10 @@ package com.sheep.gamegroup.view.adapter;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
 import android.support.annotation.NonNull;
+import android.support.constraint.ConstraintLayout;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
@@ -19,18 +22,26 @@ import com.bumptech.glide.request.RequestOptions;
 import com.sheep.gamegroup.model.entity.ScreenshotsEntity;
 import com.sheep.gamegroup.model.entity.TaskChild;
 import com.sheep.gamegroup.model.entity.TaskDescEntity;
+import com.sheep.gamegroup.model.entity.TaskEty;
+import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.GlideImageLoader;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.MyListview;
 import com.sheep.gamegroup.util.ViewHolder;
+import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
 import me.iwf.photopicker.PhotoPreview;
 
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.QR_SAVE;
+
 /**
  * Created by ljy on 2018/6/14.
  */
@@ -38,6 +49,7 @@ import me.iwf.photopicker.PhotoPreview;
 public class TaskdetailSonListviewAdp extends BaseAdapter {
     private List<TaskChild> descEntityArrayList;
     private Context context;
+    private TaskReleaseEty taskReleaseEty;
     int with;
 
     public TaskdetailSonListviewAdp(List<TaskChild> descEntityArrayList, Context context) {
@@ -46,6 +58,10 @@ public class TaskdetailSonListviewAdp extends BaseAdapter {
         with = G.WIDTH > G.HEIGHT ? G.HEIGHT / 3 - 50 :G.WIDTH / 3 - 50;
     }
 
+    public void addTaskEntity(TaskReleaseEty taskReleaseEty){
+        this.taskReleaseEty = taskReleaseEty;
+    }
+
     @Override
     public int getCount() {
         return descEntityArrayList== null? 0:descEntityArrayList.size();
@@ -82,6 +98,12 @@ public class TaskdetailSonListviewAdp extends BaseAdapter {
             holder.item_show_layout = convertView.findViewById(R.id.item_show_layout);
             holder.title_item_price_tv = convertView.findViewById(R.id.title_item_price_tv);
             holder.item_detail_show_layout = convertView.findViewById(R.id.item_detail_show_layout);
+
+            holder.ar_code_layout = convertView.findViewById(R.id.ar_code_layout);
+            holder.qr_code_iv = convertView.findViewById(R.id.qr_code_iv);
+            holder.qr_code_notice_tv = convertView.findViewById(R.id.qr_code_notice_tv);
+            holder.btn_task_item = convertView.findViewById(R.id.btn_task_item);
+
             convertView.setTag(holder);
         }
         final TaskChild descEntity = descEntityArrayList.get(position);
@@ -108,6 +130,8 @@ public class TaskdetailSonListviewAdp extends BaseAdapter {
             }
             holder.item_detail_show_layout.setBackgroundResource(R.drawable.sp_bg_white_solid_bottom);
         }
+        //task_type 1006
+        qrCodeView(holder.ar_code_layout,holder.btn_task_item,holder.qr_code_notice_tv,holder.qr_code_iv);
 
 
         if(descEntity.getScreenshotsList() != null && descEntity.getScreenshotsList().size() > 0){
@@ -237,10 +261,49 @@ public class TaskdetailSonListviewAdp extends BaseAdapter {
     }
 
     class ViewHolder{
-        TextView  title_item_tv, item_remaining_time_tv, title_item_price_tv, num_item_textview;
-        ImageView select_tab_iv;
+        TextView  title_item_tv, item_remaining_time_tv, title_item_price_tv, num_item_textview, btn_task_item, qr_code_notice_tv;
+        ImageView select_tab_iv, qr_code_iv;
         LinearLayout title_item_layout, taskdetail_screenshot_layout, item_show_layout, item_detail_show_layout;
         MyListview item_detail_listview;
         RecyclerView recycler_screenshot_view;
+        ConstraintLayout ar_code_layout;
+    }
+
+    /**
+     * 1006 小程序 item 显示
+     */
+    private void qrCodeView(View ar_code_layout, final View btn_task_item, View qr_code_notice_tv, View qr_code_iv){
+        //task_type 1006
+        if(taskReleaseEty == null || taskReleaseEty.getTask() == null || !taskReleaseEty.getTask().isApplet()){
+            ar_code_layout.setVisibility(View.GONE);
+        }else {
+
+            if(taskReleaseEty.isIs_running()){
+
+                GlideImageLoader.setGameImage((ImageView) qr_code_iv, taskReleaseEty.getTask().getQr_code());
+                btn_task_item.setVisibility(View.VISIBLE);
+                qr_code_notice_tv.setVisibility(View.GONE);
+                btn_task_item.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        QR_SAVE.onEvent();
+                        File file = ViewUtil.saveImage(btn_task_item, ClassFileHelper.DIR, System.currentTimeMillis() + ".jpg");
+                        if (file != null) {
+                            Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+                            Uri uri = Uri.fromFile(file);
+                            intent.setData(uri);
+                            context.sendBroadcast(intent); // 发送广播通知相册
+                        } else {
+                            ViewUtil.sysSaveImage(btn_task_item, "小绵羊", "二维码展示");
+                        }
+                        G.showToast("已保存");
+                    }
+                });
+            }else {
+                btn_task_item.setVisibility(View.GONE);
+                qr_code_notice_tv.setVisibility(View.VISIBLE);
+            }
+            ar_code_layout.setVisibility(View.VISIBLE);
+        }
     }
 }

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment2.java

@@ -266,6 +266,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
             click_tv = findViewById(R.id.click_tv);
         if(empty_view == null)
             empty_view = findViewById(R.id.empty_view);
+        if(view_list == null)
+            view_list = findViewById(R.id.empty_view);
         loadMore = false;
         if(list.isEmpty()){
             refreshLayout.setVisibility(View.GONE);

+ 22 - 4
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAskGetMoneyRank.java

@@ -64,6 +64,8 @@ public class FgtAskGetMoneyRank extends BaseFragment {
     RelativeLayout emptyView;
     @BindView(R.id.ask_top5_list)
     RecyclerView askTop5List;
+    @BindView(R.id.this_last_tv)
+    TextView this_last_tv;
 
     private Activity activity;
     private List<AskTop> list = ListUtil.emptyList();
@@ -89,7 +91,7 @@ public class FgtAskGetMoneyRank extends BaseFragment {
     public void initData() {
 //        showProgress();
 
-        initAskTop5();
+        initAskTop5(0, 0);
     }
 
     private void initAskTop5View() {
@@ -152,8 +154,9 @@ public class FgtAskGetMoneyRank extends BaseFragment {
         };
         askTop5List.setAdapter(adapter);
     }
-    private void initAskTop5() {
-        SheepApp.getInstance().getNetComponent().getApiService().getInvitationTop(5)
+    private long start_time, end_time;
+    private void initAskTop5(long start_time, long end_time) {
+        SheepApp.getInstance().getNetComponent().getApiService().getInvitationTop(5,start_time, end_time)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
@@ -163,6 +166,8 @@ public class FgtAskGetMoneyRank extends BaseFragment {
                         if (ListUtil.isEmpty(newList)) {
                             return;
                         }
+                        list.clear();
+                        list.add(null);
                         list.addAll(newList);
                         notifyDataSetChanged();
                         String userId = DataUtil.getInstance().getUserId();
@@ -207,13 +212,26 @@ public class FgtAskGetMoneyRank extends BaseFragment {
     }
 
 
-    @OnClick({R.id.ask_top3_tip
+    @OnClick({R.id.ask_top3_tip,R.id.this_last_tv
     })
     public void onViewClicked(View view) {
         switch (view.getId()) {
             case R.id.ask_top3_tip://提现
                 showAstTop5Tip();
                 break;
+            case R.id.this_last_tv://
+                if(this_last_tv.getText().equals(activity.getResources().getString(R.string.last_this_month_rank))){//查上月
+                    this_last_tv.setText(activity.getResources().getString(R.string.this_month_rank));
+                    long[] longs = CommonUtil.getInstance().getLastMonth();
+                    start_time = longs[0];
+                    end_time = longs[1];
+                }else {//查本月
+                    start_time = 0;
+                    end_time = 0;
+                    this_last_tv.setText(activity.getResources().getString(R.string.last_this_month_rank));
+                }
+                initAskTop5(start_time,end_time);
+                break;
         }
     }
 }

+ 5 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtRouser.java

@@ -281,13 +281,15 @@ public class FgtRouser extends BaseFragment {
                         boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.awakenApp());
                         if(isNewData) {
                             List<RouserArticlesEntity> newList = baseMessage.getDatas(RouserArticlesEntity.class);
+                            List<RouserArticlesEntity> newLists = new ArrayList<>();
+                            newLists.clear();
                             for(RouserArticlesEntity r: newList){
                                 boolean isInstalled = PackageUtil.isAppInstalled(SheepApp.getInstance(), r.getPackage_name());
-                                if(!isInstalled){
-                                    newList.remove(r);
+                                if(isInstalled){
+                                    newLists.add(r);
                                 }
                             }
-                            loadList(newList);
+                            loadList(newLists);
                         }
                     }
 

+ 13 - 1
app/src/main/res/layout/fgt_askgetmoney_rank.xml

@@ -9,8 +9,20 @@
     android:paddingStart="@dimen/content_padding_10">
 
     <TextView
-        android:id="@+id/ask_top5_title"
+        android:id="@+id/this_last_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/last_this_month_rank"
+        android:textColor="#FFD269"
         app:layout_constraintTop_toTopOf="parent"
+        android:paddingTop="@dimen/content_padding_10"
+        app:layout_constraintEnd_toEndOf="@+id/ask_top3_tip"
+        android:paddingEnd="3dp"
+        android:autoLink="all"/>
+
+    <TextView
+        android:id="@+id/ask_top5_title"
+        app:layout_constraintTop_toBottomOf="@+id/this_last_tv"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:paddingBottom="@dimen/content_padding_10"

+ 1 - 1
app/src/main/res/layout/fgt_personalcenter_item_center_one.xml

@@ -72,7 +72,7 @@
     <LinearLayout
         android:id="@+id/proxy_service_layout"
         style="@style/style_item_container"
-        android:visibility="visible">
+        android:visibility="gone">
 
         <ImageView
             style="@style/style_item_img"

+ 3 - 1
app/src/main/res/layout/item_hot_welfare.xml

@@ -19,12 +19,14 @@
     <TextView
         android:id="@+id/item_hot_welfare_tv"
         android:layout_width="wrap_content"
+        android:maxWidth="90dp"
         android:layout_height="wrap_content"
         android:layout_gravity="center_horizontal"
         android:layout_marginTop="12dp"
         android:ellipsize="end"
         android:textColor="#333333"
         android:textSize="12sp"
+        android:gravity="center"
         android:lines="1"
-        android:text="1234"/>
+        android:text=""/>
 </LinearLayout>

+ 67 - 0
app/src/main/res/layout/taskdetail_mylistview_item.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout 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="match_parent"
     android:orientation="vertical"
@@ -114,6 +115,72 @@
                 android:scrollbars="none" />
         </LinearLayout>
 
+        <android.support.constraint.ConstraintLayout
+            android:id="@+id/ar_code_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/content_padding_15"
+            android:visibility="gone">
+
+            <TextView
+                android:id="@+id/qr_code_blue_line"
+                android:layout_width="4dp"
+                android:layout_height="wrap_content"
+                android:background="@color/blue_FF53BBF2"
+                android:text="1"
+                android:textColor="@color/blue_FF53BBF2"
+                android:textSize="@dimen/text_size_2"
+                app:layout_constraintBottom_toBottomOf="@+id/qr_code_tv"
+                app:layout_constraintTop_toTopOf="@+id/qr_code_tv" />
+
+            <TextView
+                android:id="@+id/qr_code_tv"
+                style="@style/txt_style_15_323232"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/content_padding_15"
+                android:text="二维码"
+                app:layout_constraintStart_toEndOf="@+id/qr_code_blue_line" />
+
+            <ImageView
+                android:id="@+id/qr_code_iv"
+                android:layout_width="@dimen/view_size_80"
+                android:layout_height="@dimen/view_size_80"
+                android:layout_marginTop="@dimen/content_padding_18"
+                android:src="@mipmap/qr_code_taskdetail_zhanwei"
+                app:layout_constraintStart_toStartOf="@+id/qr_code_tv"
+                app:layout_constraintTop_toBottomOf="@+id/qr_code_tv" />
+
+            <TextView
+                android:id="@+id/btn_task_item"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/content_padding_15"
+                android:background="@drawable/selector_button_full_main"
+                android:gravity="center"
+                android:paddingBottom="@dimen/content_padding_3"
+                android:paddingLeft="@dimen/content_padding_15"
+                android:paddingRight="@dimen/content_padding_15"
+                android:paddingTop="@dimen/content_padding_3"
+                android:text="保存二维码"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_size_12"
+                app:layout_constraintBottom_toBottomOf="@+id/qr_code_iv"
+                app:layout_constraintStart_toEndOf="@+id/qr_code_iv" />
+
+            <TextView
+                android:id="@+id/qr_code_notice_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="@dimen/content_padding_15"
+                android:text="领取任务后可获得二维码"
+                android:textColor="@color/gray"
+                android:textSize="@dimen/text_size_12"
+                app:layout_constraintStart_toEndOf="@+id/qr_code_iv"
+                app:layout_constraintTop_toTopOf="@+id/qr_code_iv" />
+        </android.support.constraint.ConstraintLayout>
+
+
         <LinearLayout
             android:id="@+id/taskdetail_screenshot_layout"
             android:layout_width="match_parent"

BIN=BIN
app/src/main/res/mipmap-xhdpi/qr_code_taskdetail_zhanwei.png


+ 3 - 0
app/src/main/res/values/strings.xml

@@ -90,4 +90,7 @@
     <string name="homepage_award">你还有%s元的奖励未领取</string>
     <string name="homepage_cash">现金任务:%s元</string>
     <string name="homepage_welfare">游戏福利:%s元</string>
+
+    <string name="last_this_month_rank">上月排行</string>
+    <string name="this_month_rank">这月排行</string>
 </resources>