소스 검색

Merge remote-tracking branch 'origin/sheep_develop' into sheep_develop

liujiangyao 7 년 전
부모
커밋
f853354227

+ 1 - 11
app/src/main/java/com/kfzs/duanduan/fragment/FgtFindChild.java

@@ -106,16 +106,8 @@ public class FgtFindChild extends BaseCompatFragment {
     View check_net_ll;
     @BindView(R.id.view_list)
     XRecyclerView view_list;
-    View bottomLine;
     private void initView(){
         title.setVisibility(View.GONE);
-//        refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-//            @Override
-//            public void onRefresh() {
-//                refreshData();
-//                refresh.setRefreshing(false);
-//            }
-//        });
         view_list.setLoadingListener(new XRecyclerView.LoadingListener() {
             @Override
             public void onRefresh() {
@@ -132,7 +124,7 @@ public class FgtFindChild extends BaseCompatFragment {
                 }
             }
         });
-        bottomLine = ViewUtil.setBottomLine(view_list);
+        ViewUtil.setBottomLine(view_list);
         view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
         view_list.setAdapter(new AdbCommonRecycler<FindItem>(SheepApp.getInstance(), list){
 
@@ -346,8 +338,6 @@ public class FgtFindChild extends BaseCompatFragment {
 
     private void notifyDataSetChanged(){
         CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
-        bottomLine.setVisibility(list.isEmpty() ? View.INVISIBLE : View.VISIBLE);
-//        refresh.setRefreshing(false);
         if(page == 1){
             view_list.refreshComplete();
         } else {

+ 8 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/DownloadWelfare.java

@@ -128,9 +128,14 @@ public class DownloadWelfare {
     }
 
 
-
-
-
+    @Override
+    public boolean equals(Object obj) {
+        try {
+            return obj instanceof DownloadWelfare && ((DownloadWelfare) obj).getLog().getId() == getLog().getId();
+        } catch (Exception e) {
+            return true;
+        }
+    }
 
     /**
      * 福利内容

+ 11 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GiftBagApp.java

@@ -40,4 +40,15 @@ public class GiftBagApp {
     public String getCode(){
         return this.code;
     }
+
+
+
+    @Override
+    public boolean equals(Object obj) {
+        try {
+            return obj instanceof GiftBagApp && ((GiftBagApp) obj).getGift_bag().getId() == getGift_bag().getId();
+        } catch (Exception e) {
+            return true;
+        }
+    }
 }

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/TaskReleaseEty.java

@@ -353,4 +353,8 @@ public class TaskReleaseEty implements Serializable{
     public boolean isTaskFinished() {
         return user_task_status == 3;
     }
+
+    public String getH5BonusText() {
+        return String.format(Locale.CHINA, "<font color='#ff2d4b' size='1'>¥</font><font color='#ff2d4b'>%s</font>", getBonusText());
+    }
 }

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/VoucherUseLog.java

@@ -100,6 +100,16 @@ public class VoucherUseLog {
 
 
 
+    @Override
+    public boolean equals(Object obj) {
+        try {
+            return obj instanceof VoucherUseLog && ((VoucherUseLog) obj).getLog().getId() == getLog().getId();
+        } catch (Exception e) {
+            return true;
+        }
+    }
+
+
 
 
 

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

@@ -493,13 +493,22 @@ public class ViewUtil {
             @Override
             public void onLoadMoreComplete(View yourFooterView) {
                 TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
-                bottom_line_text.setText("羊羊努力加载中...");
+                bottom_line_text.setText("加载完成");
             }
 
             @Override
             public void onSetNoMore(View yourFooterView, boolean noMore) {
                 TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
-                bottom_line_text.setText("我是有底线的");
+                bottom_line_text.setText(canScrollToTop() ? "我是有底线的,点击我回到顶部" : "我是有底线的");
+                yourFooterView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        view_list.scrollToPosition(0);
+                    }
+                });
+            }
+            private boolean canScrollToTop(){
+                return view_list.getAdapter().getItemCount() > 10;
             }
         });
         return view;

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

@@ -110,7 +110,7 @@ public class GiftCenterAdapter extends AdbCommonRecycler<GiftBagApp> {
                     public void onClick(View view) {
                         ViewUtil.showMsgDialog(context, new DialogConfig().setTitle("礼包使用说明").setBtnLeftText("我知道了")
                                 .setMsgGravity(Gravity.START)
-                                .setMsg(String.format(Locale.CHINA, "礼包内容:\n%s\n\n使用方式:\n启动游戏---设置---激活兑换", itemGiftBag.getGiftContent())));
+                                .setMsg(String.format(Locale.CHINA, "礼包内容:\n%s\n\n使用方式:\n%s", itemGiftBag.getGiftContent(), itemGiftBag.getUseMethod())));
                     }
                 });
 

+ 5 - 2
app/src/main/java/com/sheep/gamegroup/view/adapter/WelfareAdapter.java

@@ -76,15 +76,15 @@ public class WelfareAdapter extends AdbCommonRecycler<TaskReleaseEty>{
             }
             GlideImageLoader.setGameImage(item_download_welfare_iv, itemTask.getIcon());
             ViewUtil.setText(item_download_welfare_name_tv, item.getName());
-            item_download_welfare_money.setText(Html.fromHtml(String.format(Locale.CHINA, "<font size='1'>¥</font>%s", item.getBonusText())));
+            ViewUtil.setH5Text(item_download_welfare_money, item.getH5BonusText());
             ViewUtil.setText(item_download_welfare_num_tv, item.getGiftRatioText());
-            ViewUtil.setText(item_download_welfare_num_tv1, item.getLastNumText());
             ViewUtil.setText(item_download_welfare_date_tv, item.getDateText());
             item_download_welfare_iv2.setVisibility(item.isTaskFinished()? View.VISIBLE : View.INVISIBLE);
 
             item_download_welfare_btn_bottom.setTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + itemTask.getDownload_link());
             switch (item.getUser_task_status()){//1,已接受任务 2,正在进行中,3完成任务,4放弃任务,5任务失败,6审核失败,7提交审核,8任务已下线,9至少完成了一个任务了
                 case 0:
+                    ViewUtil.setText(item_download_welfare_num_tv1, item.getLastNumText());
                     item_download_welfare_money.setVisibility(View.VISIBLE);
                     item_download_welfare_btn_top.setVisibility(View.INVISIBLE);
                     item_download_welfare_btn_bottom.setEnabled(true);
@@ -98,6 +98,7 @@ public class WelfareAdapter extends AdbCommonRecycler<TaskReleaseEty>{
                     break;
                 case 1:
                 case 2:
+                    ViewUtil.setText(item_download_welfare_num_tv1, item.getLastNumText());
                     item_download_welfare_money.setVisibility(View.VISIBLE);
                     item_download_welfare_btn_top.setVisibility(View.INVISIBLE);
                     item_download_welfare_btn_bottom.setEnabled(true);
@@ -123,6 +124,7 @@ public class WelfareAdapter extends AdbCommonRecycler<TaskReleaseEty>{
                     }
                     break;
                 case 3:
+                    ViewUtil.setH5Text(item_download_welfare_num_tv1, item.getH5BonusText());
                     item_download_welfare_money.setVisibility(View.INVISIBLE);
                     item_download_welfare_btn_top.setVisibility(View.VISIBLE);
                     item.getDownloadHelper().updateDownloadTaskView((Activity) context, itemTask, item_download_welfare_btn_bottom);
@@ -141,6 +143,7 @@ public class WelfareAdapter extends AdbCommonRecycler<TaskReleaseEty>{
                     });
                     break;
                 default:
+                    ViewUtil.setText(item_download_welfare_num_tv1, item.getLastNumText());
                     item_download_welfare_money.setVisibility(View.VISIBLE);
                     item_download_welfare_btn_top.setVisibility(View.INVISIBLE);
                     item_download_welfare_btn_bottom.setText("已经下线");

+ 1 - 15
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment.java

@@ -65,7 +65,6 @@ public abstract class BaseListFragment<T> extends BaseFragment {
     public void initView() {
         title.setVisibility(View.GONE);
     }
-    private View bottomLine;
     public void initListener() {
         view_list.setLoadingListener(new XRecyclerView.LoadingListener() {
             @Override
@@ -83,7 +82,7 @@ public abstract class BaseListFragment<T> extends BaseFragment {
                 }
             }
         });
-        bottomLine = ViewUtil.setBottomLine(view_list);
+        ViewUtil.setBottomLine(view_list);
         view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
         view_list.setAdapter(getAdapter());
 
@@ -141,19 +140,6 @@ public abstract class BaseListFragment<T> extends BaseFragment {
     }
     protected void notifyDataSetChanged(){
         CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
-        if(bottomLine != null) {
-            bottomLine.setVisibility(list.isEmpty() ? View.INVISIBLE : View.VISIBLE);
-            final boolean isCanScrollToPosition = page > 1 ;//页数大于一页才显示点击回到顶部
-            TextView bottom_line_text = bottomLine.findViewById(R.id.bottom_line_text);
-            bottom_line_text.setText(isCanScrollToPosition ? "我是有底线的,点击我回到顶部" : "我是有底线的");
-            bottomLine.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    if(isCanScrollToPosition)
-                        view_list.scrollToPosition(0);
-                }
-            });
-        }
         if(page == 1){
             view_list.refreshComplete();
         } else {

+ 6 - 1
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGiftCenter.java

@@ -35,7 +35,12 @@ public class FgtGiftCenter extends BaseListFragment<GiftBagApp> implements Actio
     public void call(Integer integer) {
         switch (integer){
             case WelfareAdapter.TO_REFRESH:
-                refreshData();
+                view_list.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        refreshData();
+                    }
+                }, 500L);//延迟500毫秒刷新界面,防止服务器数据没有反应过来
                 break;
         }
     }

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtWelfareCenter.java

@@ -61,6 +61,10 @@ public class FgtWelfareCenter extends BaseFragment{
     RecyclerView wcDownloadWelfareList;
     @BindView(R.id.wc_all_gift)
     TextView wcAllGift;
+    @BindView(R.id.wc_gift_center_title_line)
+    View wc_gift_center_title_line;
+    @BindView(R.id.wc_gift_center_title_container)
+    View wc_gift_center_title_container;
     @BindView(R.id.wc_gift_center_list)
     RecyclerView wcGiftCenterList;
     @BindView(R.id.bottom_line_text)
@@ -157,6 +161,10 @@ public class FgtWelfareCenter extends BaseFragment{
     @Override
     public void onResume() {
         super.onResume();
+        //每次强制刷新
+        refreshHotWelfare = true;
+        refreshDownloadWelfare = true;
+        refreshGiftCenter = true;
         refreshData();
     }
     private boolean refreshHotWelfare = true;
@@ -248,6 +256,8 @@ public class FgtWelfareCenter extends BaseFragment{
     private void notifyDataSetChanged() {
         if(!refreshHotWelfare && !refreshDownloadWelfare && !refreshGiftCenter)
             refresh.setRefreshing(false);
+        wc_gift_center_title_container.setVisibility(giftCenterList.isEmpty() ? View.GONE : View.VISIBLE);
+        wc_gift_center_title_line.setVisibility(giftCenterList.isEmpty() ? View.GONE : View.VISIBLE);
     }
 
     @Override

+ 4 - 1
app/src/main/res/layout/fgt_welfare_center.xml

@@ -51,11 +51,14 @@
                 android:layout_height="wrap_content" />
 
             <View
+                android:id="@+id/wc_gift_center_title_line"
                 android:layout_width="match_parent"
                 android:layout_height="10dp"
                 android:background="#fff5f5f5" />
 
-            <RelativeLayout style="@style/style_wc_rl">
+            <RelativeLayout
+                android:id="@+id/wc_gift_center_title_container"
+                style="@style/style_wc_rl">
 
                 <TextView
                     style="@style/style_wc_line_title"