Pārlūkot izejas kodu

2.8 界面调整

liujiangyao 7 gadi atpakaļ
vecāks
revīzija
22e0c0ae6b

+ 279 - 0
app/src/main/java/com/kfzs/duanduan/fragment/FgtGameAgencyRecharge.java

@@ -0,0 +1,279 @@
+package com.kfzs.duanduan.fragment;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.widget.SwipeRefreshLayout;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.text.Html;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSONArray;
+import com.arialyy.annotations.Download;
+import com.arialyy.aria.core.Aria;
+import com.arialyy.aria.core.download.DownloadTask;
+import com.kfzs.android.view.tag.FlowLayout;
+import com.kfzs.android.view.tag.TagAdapter;
+import com.kfzs.android.view.tag.TagFlowLayout;
+import com.kfzs.duanduan.BaseCompatFragment;
+import com.kfzs.duanduan.event.BigEvent;
+import com.kfzs.duanduan.services.DownloadTaskService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.FindApp;
+import com.sheep.gamegroup.model.entity.FindItem;
+import com.sheep.gamegroup.model.entity.FindTag;
+import com.sheep.gamegroup.model.entity.GameAgencyRechargePlatformEntity;
+import com.sheep.gamegroup.model.entity.GridViewEntity;
+import com.sheep.gamegroup.model.entity.HomeListEntity;
+import com.sheep.gamegroup.model.entity.RecyleObj;
+import com.sheep.gamegroup.model.entity.RecyleType;
+import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.ViewHolder;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
+import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.G;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
+
+import static android.content.Intent.ACTION_PACKAGE_ADDED;
+import static android.content.Intent.ACTION_PACKAGE_REMOVED;
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_ITEM;
+
+/**
+ * Created by ljy on 2018/7/16.
+ */
+
+public class FgtGameAgencyRecharge extends BaseCompatFragment {
+    public static FgtGameAgencyRecharge newInstance(String type){
+        FgtGameAgencyRecharge fgt = new FgtGameAgencyRecharge();
+        Bundle bundle = new Bundle();
+        bundle.putString("type", type);
+        fgt.setArguments(bundle);
+        return fgt;
+    }
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Bundle bundle = getArguments();
+        if(bundle != null){
+            task_type = bundle.getString("type", "1002"+",1003"+",1004");
+        }
+        EventBus.getDefault().register(this);
+        Aria.download(this).register();
+    }
+
+    private Activity activity;
+    @Override
+    protected void initView(Bundle savedInstanceState) {
+        setContentView(R.layout.net_empty_fresh_list);
+        activity = getActivity();
+        ButterKnife.bind(this, mContentView);
+        initView();
+        initData();
+    }
+
+    @BindView(R.id.title)
+    View title;
+    @BindView(R.id.refresh)
+    SwipeRefreshLayout refresh;
+    @BindView(R.id.empty_view)
+    View empty_view;
+    @BindView(R.id.check_net_ll)
+    View check_net_ll;
+    @BindView(R.id.view_list)
+    RecyclerView recyclerview;
+
+    private TryMakeMoneyAdp tryMakeMoneyAdp;
+    private List<GameAgencyRechargePlatformEntity> platformList = ListUtil.emptyList();//平台充值
+    private List<TaskReleaseEty> releaseEtyLists = new ArrayList<>();//游戏代充
+
+    private String task_type;
+
+    private void initView(){
+        title.setVisibility(View.GONE);
+        refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+            @Override
+            public void onRefresh() {
+                initData();
+                refresh.setRefreshing(false);
+            }
+        });
+
+
+        /**
+         * recycle view
+         */
+        recyclerview.setLayoutManager(new LinearLayoutManager(activity));
+        tryMakeMoneyAdp = new TryMakeMoneyAdp(activity);
+
+        for (int i = 0; i < 2; i++) {
+            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
+        }
+        recyclerview.setAdapter(tryMakeMoneyAdp);
+    }
+
+    private void initData(){
+        empty_view.setVisibility(View.INVISIBLE);
+        SysAppUtil.checkNet(new Action1<Integer>() {
+            @Override
+            public void call(Integer result) {
+                if(result != 0){//无网络
+                    if(check_net_ll != null)
+                        check_net_ll.setVisibility(View.VISIBLE);
+                } else {
+                    if(check_net_ll != null)
+                        check_net_ll.setVisibility(View.GONE);
+                }
+            }
+        });
+        {
+            refresh.setRefreshing(true);
+            tryMakeMoneyAdp.clear();
+            for (int i = 0; i < 2; i++) {
+                tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
+            }
+
+            //平台游戏
+            platformList.clear();
+            if(TextUtils.isEmpty(task_type)){
+                task_type = "1002"+",1003"+",1004";
+            }
+            switch (task_type){
+                case "1002":
+
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_platform_sheep_icon,
+                            "平台游戏代充",
+                            "充值有福利",
+                            1002));
+                    break;
+                case "1003":
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_platform_sheep_icon,
+                            "腾讯游戏代充",
+                            "充值有福利",
+                            1003));
+
+                    break;
+                case "1004":
+
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_xiaomi_icon,
+                            "小米游戏代充",
+                            "充值有福利",
+                            1004));
+                    break;
+                case "1002"+",1003"+",1004":
+                default:
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_platform_sheep_icon,
+                            "平台游戏代充",
+                            "充值有福利",
+                            1002));
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_xiaomi_icon,
+                            "小米游戏代充",
+                            "充值有福利",
+                            1004));
+                    platformList.add(new GameAgencyRechargePlatformEntity(
+                            R.mipmap.game_platform_sheep_icon,
+                            "腾讯游戏代充",
+                            "充值有福利",
+                            1003));
+                    break;
+
+            }
+
+            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.GAME_AGENCY_PAYMENT_PLATFORM, platformList),0);
+            notifyDataSetChanged();
+            if(TextUtils.isEmpty(task_type))
+                return;
+            CommonUtil.getInstance()
+                    .gameTask(activity, task_type, "", new Action1<BaseMessage>() {
+                        @Override
+                        public void call(BaseMessage baseMessage) {
+                            try {
+                                List<TaskReleaseEty> releaseEtyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), TaskReleaseEty.class);
+                                if(releaseEtyList != null){
+                                    releaseEtyLists.clear();
+                                    releaseEtyLists.addAll(releaseEtyList);
+                                    tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.GAME_AGENCY_PAYMENT, releaseEtyLists),1);
+                                    notifyDataSetChanged();
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+        }
+    }
+
+    private void notifyDataSetChanged(){
+        if(platformList.isEmpty() &&releaseEtyLists.isEmpty() )
+            empty_view.setVisibility(View.VISIBLE);
+        refresh.setRefreshing(false);
+        recyclerview.getAdapter().notifyDataSetChanged();
+    }
+
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        switch (event.getEventTypes()){
+            case GENERATION_ACCOUNT_REFRESH:
+                initData();
+                break;
+            case GENERATION_ACCOUNT_REFRESH_ADAPTER:
+                if(event.getData() instanceof DownloadTask){
+                    DownloadTask task = (DownloadTask) event.getData();
+                    try {
+                        int p = task.getPercent();    //任务进度百分比
+                        String speed = task.getConvertSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
+                        System.out.println("Aria "+task.getKey()+",p " + p + ", speed = " + speed);
+                        String url = task.getKey();
+                        TextView tvProgress = recyclerview.findViewWithTag(TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
+                        if (tvProgress == null) {
+                            return;
+                        }
+                        tvProgress.setText(String.format(Locale.CHINA, "%d%%",Math.abs(p)));
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                break;
+        }
+    }
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        EventBus.getDefault().unregister(this);
+    }
+}

+ 96 - 203
app/src/main/java/com/sheep/gamegroup/view/activity/ActGameAgencyRecharge.java

@@ -2,6 +2,8 @@ package com.sheep.gamegroup.view.activity;
 
 import android.app.Activity;
 import android.os.Bundle;
+import android.support.design.widget.TabLayout;
+import android.support.v4.view.ViewPager;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -16,9 +18,13 @@ import com.alibaba.fastjson.JSONArray;
 import com.arialyy.aria.core.download.DownloadTask;
 import com.bumptech.glide.Glide;
 import com.kfzs.duanduan.event.BigEvent;
+import com.kfzs.duanduan.fragment.FgtFindChild;
+import com.kfzs.duanduan.fragment.FgtGameAgencyRecharge;
+import com.kfzs.duanduan.mine.GiftpackListAdapter;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.model.entity.FindTag;
 import com.sheep.gamegroup.model.entity.GameAgencyRechargePlatformEntity;
 import com.sheep.gamegroup.model.entity.GridViewEntity;
 import com.sheep.gamegroup.model.entity.OrienteeringDetail;
@@ -44,6 +50,7 @@ import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -54,6 +61,7 @@ import rx.android.schedulers.AndroidSchedulers;
 import rx.functions.Action1;
 import rx.schedulers.Schedulers;
 
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_TAG;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.GAME_INSTEAD_OF_RECHARGE_HELP;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.GAME_INSTEAD_OF_RECHARGE_TAB;
 
@@ -71,6 +79,12 @@ public class ActGameAgencyRecharge extends BaseActivity {
     SheepmSwipeRefreshLayout refresh;
     @BindView(R.id.empty_view)
     View empty_view;
+    @BindView(R.id.indicator)
+    TabLayout indicator;
+    @BindView(R.id.pager)
+    ViewPager pager;
+    private GiftpackListAdapter mAdapter;
+
     private Activity activity;
     private AdpGameAgencyRecharge adpGameAgencyRecharge;
     private ArrayList<Object> gridviewList = new ArrayList<>();
@@ -88,8 +102,6 @@ public class ActGameAgencyRecharge extends BaseActivity {
 
     @Override
     public void initView() {
-
-        EventBus.getDefault().register(this);
         activity = this;
         TitleBarUtils.getInstance()
                 .setTitleFinish(activity)
@@ -110,21 +122,8 @@ public class ActGameAgencyRecharge extends BaseActivity {
                                 Jump2View.getInstance().goGameSearch(activity, null);
                             }
                         });
-        adpGameAgencyRecharge = new AdpGameAgencyRecharge(activity, gridviewList);
-        gridviewGame.setAdapter(adpGameAgencyRecharge);
-        changeGridview();
-        empty_view.setVisibility(View.GONE);
-        /**
-         * recycle view
-         */
-        recyclerview.setLayoutManager(new LinearLayoutManager(activity));
-        tryMakeMoneyAdp = new TryMakeMoneyAdp(activity);
-
-        for (int i = 0; i < 2; i++) {
-            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
-        }
-        recyclerview.setAdapter(tryMakeMoneyAdp);
         setValue();//gridview data
+        gridviewV();
     }
 
     @Override
@@ -136,166 +135,107 @@ public class ActGameAgencyRecharge extends BaseActivity {
     @Override
     public void initListener() {
 
-        refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                initData();
-            }
-        });
-        recyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
-            @Override
-            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
-                super.onScrollStateChanged(recyclerView, newState);
-            }
+    }
+
+    @Override
+    public void initData() {}
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        // TODO: add setContentView(...) invocation
+        ButterKnife.bind(this);
+    }
 
+    /**
+     *
+     */
+    private void gridviewV(){
+
+        mAdapter = new GiftpackListAdapter(getSupportFragmentManager(), activity);
+        for(int i=0;i<gridviewList.size();i++){
+            mAdapter.add(FgtGameAgencyRecharge.newInstance(((GridViewEntity)gridviewList.get(i)).getTask_type()), ((GridViewEntity)gridviewList.get(i)).getName());
+        }
+        pager.setAdapter(mAdapter);
+        indicator.setupWithViewPager(pager);
+        pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
             @Override
-            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+            public void onPageScrolled(int i, float v, int i1) {
 
-                int topRowVerticalPosition =
-                        (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop();
+            }
 
-                refresh.setEnabled(topRowVerticalPosition >= 0);
+            @Override
+            public void onPageSelected(int i) {
+                position = i;
+//                FIND_TAG.onEvent("find_tag_name", ListUtil.hasIndex(list, i - 1) ? list.get(i - 1).getName() : "全部");
             }
-        });
-        gridviewGame.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+
             @Override
-            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                GridViewEntity newItem = (GridViewEntity) ListUtil.getIndex(gridviewList, position);
-                if(newItem == null){
-                    return;
-                }
-                GAME_INSTEAD_OF_RECHARGE_TAB.onEvent("task_type", newItem.getTask_type(), "name", newItem.getName());
-                if(gridViewEntity == newItem){//无需切换
-                    return;
-                }
-                gridViewEntity = (GridViewEntity) gridviewList.get(position);
-                task_type = gridViewEntity.getTask_type();
-                for(int i=0;i<gridviewList.size();i++){
-                    if(position == i){
-                        ((GridViewEntity) gridviewList.get(i)).setSelectState(true);
-                    }else {
-                        ((GridViewEntity) gridviewList.get(i)).setSelectState(false);
+            public void onPageScrollStateChanged(int i) {
 
-                    }
-                }
-                adpGameAgencyRecharge.notifyDataSetChanged();
-                try{
-                    //刷新界面
-                    initData();
-                }catch (Exception e){
-                    e.printStackTrace();
-                }
             }
         });
+        pager.setCurrentItem(position);
+        reflex(indicator);
     }
+    private int position = 0;//默认选中第一个
 
-    @Override
-    public void initData() {
-        refresh.setRefreshing(true);
-        tryMakeMoneyAdp.clear();
-        for (int i = 0; i < 2; i++) {
-            tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.NONE, null));
-        }
+    /**
+     * 通过反射调整tabLayout中下划线的宽度
+     * @param tabLayout
+     */
+    public void reflex(final TabLayout tabLayout){
+        //了解源码得知 线的宽度是根据 tabView的宽度来设置的
+        tabLayout.post(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    //拿到tabLayout的mTabStrip属性
+                    LinearLayout mTabStrip = (LinearLayout) tabLayout.getChildAt(0);
 
-        //平台游戏
-        platformList.clear();
-        if(TextUtils.isEmpty(task_type)){
-            task_type = "1002"+",1003"+",1004";
-        }
-        switch (task_type){
-            case "1002":
-
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_platform_sheep_icon,
-                        "平台游戏代充",
-                        "充值有福利",
-                        1002));
-                break;
-            case "1003":
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_platform_sheep_icon,
-                        "腾讯游戏代充",
-                        "充值有福利",
-                        1003));
-
-                break;
-            case "1004":
-
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_xiaomi_icon,
-                        "小米游戏代充",
-                        "充值有福利",
-                        1004));
-                break;
-            case "1002"+",1003"+",1004":
-            default:
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_platform_sheep_icon,
-                        "平台游戏代充",
-                        "充值有福利",
-                        1002));
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_xiaomi_icon,
-                        "小米游戏代充",
-                        "充值有福利",
-                        1004));
-                platformList.add(new GameAgencyRechargePlatformEntity(
-                        R.mipmap.game_platform_sheep_icon,
-                        "腾讯游戏代充",
-                        "充值有福利",
-                        1003));
-                break;
+//                    int dp10 = dip2px(tabLayout.getContext(), 10);
+                    int add = getResources().getDimensionPixelSize(R.dimen.content_padding_10);
+                    int count = mTabStrip.getChildCount();
+                    int fillCount = Math.min(5, count);//一屏的个数
 
-        }
+                    for (int i = 0; i < count; i++) {
+                        View tabView = mTabStrip.getChildAt(i);
 
-        tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.GAME_AGENCY_PAYMENT_PLATFORM, platformList),0);
-        notifyDataSetChanged();
-        if(gridViewEntity == null)
-            return;
-        CommonUtil.getInstance()
-                .gameTask(activity, task_type, "", new Action1<BaseMessage>() {
-                    @Override
-                    public void call(BaseMessage baseMessage) {
-                        try {
-                            List<TaskReleaseEty> releaseEtyList = JSONArray.parseArray(JSONArray.toJSONString(baseMessage.getData()), TaskReleaseEty.class);
-                            if(releaseEtyList != null){
-                                releaseEtyLists.clear();
-                                releaseEtyLists.addAll(releaseEtyList);
-                                tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.GAME_AGENCY_PAYMENT, releaseEtyLists),1);
-                                notifyDataSetChanged();
-                            }
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
-                });
-    }
+                        //拿到tabView的mTextView属性  tab的字数不固定一定用反射取mTextView
+                        Field mTextViewField = tabView.getClass().getDeclaredField("mTextView");
+                        mTextViewField.setAccessible(true);
 
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        // TODO: add setContentView(...) invocation
-        ButterKnife.bind(this);
-    }
+                        TextView mTextView = (TextView) mTextViewField.get(tabView);
 
-    /**
-     * gridview 改成单行横向布局
-     */
-    private void changeGridview(){
+                        tabView.setPadding(0, 0, 0, 0);
 
-        int itemWidth = (G.WIDTH >G.HEIGHT?G.HEIGHT:G.WIDTH) / 4 -30;
-        int itemPaddingh = AppUtil.dp2px(activity, 1);
+                        //因为我想要的效果是   字多宽线就多宽,所以测量mTextView的宽度
+                        int width = 0;
+                        width = mTextView.getWidth();
+                        if (width == 0) {
+                            mTextView.measure(0, 0);
+                            width = mTextView.getMeasuredWidth();
+                        }
 
-        int size = 4;
+                        //设置tab左右间距为10dp  注意这里不能使用Padding 因为源码中线的宽度是根据 tabView的宽度来设置的
+                        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tabView.getLayoutParams();
+                        params.width = width ;
+                        int margin = (G.WIDTH - fillCount*width - 2*add) / (fillCount*2);
+                        params.leftMargin = margin + (i == 0 ? add : 0);
+                        params.rightMargin = margin + (i + 1 == count ? add : 0);
+                        tabView.setLayoutParams(params);
 
-        int gridview = size * (itemWidth + itemPaddingh);
+                        tabView.invalidate();
+                    }
+
+                } catch (NoSuchFieldException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
 
-        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(gridview, LinearLayout.LayoutParams.WRAP_CONTENT);
-        gridviewGame.setLayoutParams(params);
-        gridviewGame.setColumnWidth(itemWidth);
-        gridviewGame.setHorizontalSpacing(itemPaddingh);
-        gridviewGame.setStretchMode(MyGridview.NO_STRETCH);
-        gridviewGame.setNumColumns(size);
     }
 
     /**
@@ -312,55 +252,8 @@ public class ActGameAgencyRecharge extends BaseActivity {
 
     }
 
-    private void checkAndInitView() {
-        if(refresh == null)
-            refresh = findViewById(R.id.refresh);
-        if(empty_view == null)
-            empty_view = findViewById(R.id.empty_view);
-    }
-    private void notifyDataSetChanged(){
-        checkAndInitView();
-        tryMakeMoneyAdp.refreshAdapter();
-        if(tryMakeMoneyAdp.isEmpty() && platformList.isEmpty() && releaseEtyLists.isEmpty()){
-
-            empty_view.setVisibility(View.VISIBLE);
-        }else {
-            empty_view.setVisibility(View.GONE);
-        }
-        refresh.setRefreshing(false);
-    }
-
     @Override
     protected void onDestroy() {
         super.onDestroy();
-
-        EventBus.getDefault().unregister(this);
-    }
-    @Subscribe
-    public void onEventMainThread(BigEvent event){
-        switch (event.getEventTypes()){
-            case GENERATION_ACCOUNT_REFRESH:
-                initData();
-                break;
-            case GENERATION_ACCOUNT_REFRESH_ADAPTER:
-                if(event.getData() instanceof DownloadTask){
-                    DownloadTask task = (DownloadTask) event.getData();
-                    try {
-                        int p = task.getPercent();    //任务进度百分比
-                        String speed = task.getConvertSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
-                        System.out.println("Aria "+task.getKey()+",p " + p + ", speed = " + speed);
-                        String url = task.getKey();
-                        TextView tvProgress = recyclerview.findViewWithTag(TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
-                        if (tvProgress == null) {
-                            return;
-                        }
-                        tvProgress.setText(String.format(Locale.CHINA, "%d%%",Math.abs(p)));
-
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-                break;
-        }
     }
 }

+ 12 - 0
app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameAgencyRecharge.java

@@ -1,10 +1,12 @@
 package com.sheep.gamegroup.view.adapter;
 
 import android.content.Context;
+import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.sheep.gamegroup.model.entity.GridViewEntity;
@@ -56,6 +58,16 @@ public class AdpGameAgencyRecharge extends BaseAdapter {
             convertView.setTag(holder);
         }
 
+        int with = 70;
+        if(getItem(position).getName().length() > 4){
+            with = 140;
+        }else {
+            with = 60;
+        }
+        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(with, 8);
+        params.gravity = Gravity.CENTER_HORIZONTAL;
+        params.setMargins(0, 20,0,0);
+        holder.line_view.setLayoutParams(params);
         if (getItem(position).isSelectState()){
             holder.name_tv.setTextColor(context.getResources().getColor(R.color.blue_end));
             holder.line_view.setVisibility(View.VISIBLE);

+ 5 - 14
app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java

@@ -3,6 +3,7 @@ package com.sheep.gamegroup.view.adapter;
 import android.app.Activity;
 import android.content.Context;
 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.Html;
@@ -368,8 +369,8 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
             @NonNull
             @Override
             public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
-                LinearLayout view = (LinearLayout) LayoutInflater.from(context)
-                        .inflate(R.layout.try_makemoney_item_recommend, viewGroup, false);
+                ConstraintLayout view = (ConstraintLayout) LayoutInflater.from(context)
+                        .inflate(R.layout.game_agency_recharge_plotform_item, viewGroup, false);
                 RecyclerView.ViewHolder viewHolder = new RecyclerView.ViewHolder(view) {
                     @Override
                     public String toString() {
@@ -385,31 +386,21 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 if(item == null){
                     return;
                 }
-                TextView detail_task_tv = viewHolder.itemView.findViewById(R.id.detail_task_tv);
-                detail_task_tv.setVisibility(View.GONE);
-                TextView detail_task_tv_center = viewHolder.itemView.findViewById(R.id.detail_task_tv_center);
+                TextView detail_task_tv_center = viewHolder.itemView.findViewById(R.id.detail_task_tv);
                 detail_task_tv_center.setVisibility(View.VISIBLE);
-                viewHolder.itemView.findViewById(R.id.item_title_tv).setVisibility(View.GONE);
-                viewHolder.itemView.findViewById(R.id.item_title_iv).setVisibility(View.GONE);
 
                 if(i == getItemCount()-1){
                     viewHolder.itemView.findViewById(R.id.line_tv).setVisibility(View.GONE);
                 }else {
-                    viewHolder.itemView.findViewById(R.id.line_tv).setVisibility(View.VISIBLE);
+                    viewHolder.itemView.findViewById(R.id.line_tv).setVisibility(View.GONE);
                 }
                 detail_task_tv_center.setText("充值");
-                ((TextView)viewHolder.itemView.findViewById(R.id.item_date_tv)).setVisibility(View.INVISIBLE);
-                viewHolder.itemView.findViewById(R.id.item_date_question_img).setVisibility(View.INVISIBLE);
-                viewHolder.itemView.findViewById(R.id.cancel_task_tv).setVisibility(View.GONE);
 
                 //name
                 ((TextView)viewHolder.itemView.findViewById(R.id.item_anem_tv)).setText(item.getName()+"");
 
                 final TextView item_num_tv = viewHolder.itemView.findViewById(R.id.item_num_tv);
                 item_num_tv.setText(item.getDesc()+"");
-                final TextView task_type_tv = viewHolder.itemView.findViewById(R.id.task_type_tv);
-                task_type_tv.setVisibility(View.GONE);
-                viewHolder.itemView.findViewById(R.id.item_money).setVisibility(View.GONE);
 
                 Glide.with(context)
                         .load(item.getIcon())

+ 30 - 2
app/src/main/res/layout/act_game_agency_recharge_layout.xml

@@ -2,6 +2,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:orientation="vertical"
     android:background="@color/gray_F5F5F5">
 
@@ -11,7 +12,8 @@
     <HorizontalScrollView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:scrollbars="none">
+        android:scrollbars="none"
+        android:visibility="gone">
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -24,9 +26,35 @@
         </LinearLayout>
     </HorizontalScrollView>
 
+
+    <android.support.design.widget.TabLayout
+        android:id="@+id/indicator"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:tabBackground="@android:color/transparent"
+        app:tabIndicatorHeight="4dp"
+        app:tabGravity="center"
+        app:tabIndicatorColor="#4bc1fe"
+        app:tabPadding="7dp"
+        app:tabMode="scrollable"
+        app:tabSelectedTextColor="#4bc1fe"
+        app:tabTextColor="#444444"
+        app:tabTextAppearance="@style/SheepTabLayoutTextAppearance"
+        />
+
+    <android.support.v4.view.ViewPager
+        android:id="@+id/pager"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1"
+        android:paddingRight="@dimen/content_padding_15"
+        android:paddingTop="@dimen/content_padding_15"
+        android:paddingLeft="@dimen/content_padding_15"/>
+
     <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:visibility="gone">
         <include
             android:id="@+id/empty_view"
             layout="@layout/empty_view"

+ 7 - 7
app/src/main/res/layout/adp_level_gridview_item.xml

@@ -9,15 +9,15 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="全 部"
-        android:gravity="center_horizontal"/>
+        android:gravity="center_horizontal"
+        style="@style/txt_style_15"/>
 
     <View
         android:id="@+id/line_view"
-        android:layout_width="match_parent"
-        android:layout_height="7dp"
-        android:layout_marginLeft="@dimen/content_padding_15"
-        android:layout_marginRight="@dimen/content_padding_15"
-        android:background="@color/blue_start"
-        android:layout_marginTop="@dimen/content_padding_15"/>
+        android:layout_width="40dp"
+        android:layout_height="3dp"
+        android:background="#4bc1fe"
+        android:layout_marginTop="@dimen/content_padding_15"
+        android:layout_gravity="center_horizontal"/>
 
 </LinearLayout>

+ 89 - 0
app/src/main/res/layout/game_agency_recharge_plotform_item.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:paddingRight="12dp"
+    android:paddingLeft="12dp"
+    android:paddingBottom="@dimen/content_padding_12">
+
+
+        <RelativeLayout
+            android:id="@+id/icon_layout"
+            android:layout_width="@dimen/view_size_100"
+            android:layout_height="@dimen/view_size_80"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            android:background="@drawable/sp_bg_transparent_radius_transparent">
+            <ImageView
+                android:id="@+id/item_icon_iv"
+                android:layout_width="@dimen/view_size_100"
+                android:layout_height="@dimen/view_size_80"
+                android:src="@drawable/icon_lj"/>
+            <TextView
+                android:id="@+id/end_of_time_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:background="#66FFFFFF"
+                android:gravity="center"
+                android:lines="1"
+                android:visibility="gone"/>
+        </RelativeLayout>
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            app:layout_constraintStart_toEndOf="@+id/icon_layout"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            android:layout_marginStart="15dp">
+            <TextView
+                android:id="@+id/item_anem_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text=""
+                android:singleLine="true"
+                android:gravity="start"
+                android:ellipsize="middle"
+                style="@style/txt_style_15"/>
+            <TextView
+                android:id="@+id/item_num_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text=""
+                app:layout_constraintTop_toBottomOf="@+id/item_anem_tv"
+                app:layout_constraintStart_toStartOf="@+id/item_anem_tv"
+                android:layout_marginBottom="@dimen/content_padding_2"
+                android:textSize="@dimen/text_size_2"
+                android:textColor="@color/txt_black_8e8e8e"/>
+        </LinearLayout>
+
+        <RelativeLayout
+            android:id="@+id/detail_task_layout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+            <TextView
+                android:id="@+id/detail_task_tv"
+                android:text="取消任务"
+                android:layout_marginTop="@dimen/content_padding_small"
+                style="@style/style_button_find"/>
+            <TextView
+                android:id="@+id/detail_task_tv_down"
+                android:text="取消任务"
+                android:layout_marginTop="@dimen/content_padding_small"
+                style="@style/style_button_find"
+                android:visibility="gone"/>
+
+        </RelativeLayout>
+    <TextView
+        android:id="@+id/line_tv"
+        android:layout_width="match_parent"
+        android:layout_height="0.5dp"
+        android:background="@color/white_bg_line"
+        android:layout_marginTop="@dimen/content_padding_20"
+        app:layout_constraintTop_toBottomOf="@id/icon_layout"/>
+</android.support.constraint.ConstraintLayout>

+ 5 - 4
app/src/main/res/layout/try_makemoney_item_recommend.xml

@@ -6,8 +6,9 @@
     android:orientation="vertical"
     android:paddingRight="12dp"
     android:paddingTop="12dp"
-    android:paddingLeft="20dp"
-    android:paddingBottom="@dimen/content_padding_small">
+    android:paddingLeft="12dp"
+    android:paddingBottom="@dimen/content_padding_small"
+    android:layout_marginBottom="@dimen/content_padding_12">
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -111,7 +112,7 @@
             app:layout_constraintTop_toBottomOf="@+id/item_anem_tv"
             app:layout_constraintStart_toStartOf="@+id/item_anem_tv"
             android:layout_marginBottom="@dimen/content_padding_2"
-            android:textSize="@dimen/text_size_12"
+            android:textSize="@dimen/text_size_2"
             android:textColor="@color/txt_black_8e8e8e"/>
         <LinearLayout
             android:id="@+id/item_date_layout"
@@ -133,7 +134,7 @@
                 android:text=""
                 android:lines="1"
                 android:textColor="@color/txt_black_8e8e8e"
-                android:textSize="@dimen/text_size_12" />
+                android:textSize="@dimen/text_size_2" />
 
             <ImageView
                 android:id="@+id/item_date_question_img"

+ 4 - 2
app/src/main/res/layout/try_mkmy_release_task_list.xml

@@ -4,7 +4,8 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
-    android:background="@color/bg_gray">
+    android:background="@color/bg_gray"
+    android:layout_marginBottom="12dp">
 
     <TextView
         android:id="@+id/item_title_tv"
@@ -19,7 +20,8 @@
         android:id="@+id/release_task_listview"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="4dp"
+        android:paddingBottom="@dimen/content_padding_4"
+        android:paddingTop="@dimen/content_padding_16"
         android:background="@drawable/x_shap_shadow_bg_rectgangle_white">
 
     </android.support.v7.widget.RecyclerView>

+ 1 - 0
app/src/main/res/values/common.xml

@@ -41,6 +41,7 @@
     <dimen name="content_padding_3">3dp</dimen>
     <dimen name="content_padding_1">1dp</dimen>
     <dimen name="content_padding_2">2dp</dimen>
+    <dimen name="content_padding_4">4dp</dimen>
     <dimen name="content_padding_5">5dp</dimen>
     <dimen name="content_padding_small">6dp</dimen>
     <dimen name="content_padding_8">8dp</dimen>

+ 1 - 0
app/src/main/res/values/gamegroup_color.xml

@@ -32,6 +32,7 @@
     <color name="blue_E2F4FE">#E2F4FE</color>
     <color name="blue_E9EFF2">#E9EFF2</color>
     <color name="blue_end">#1394e8</color>
+    <color name="blue_4bc1fe">#4bc1fe</color>
     <color name="blue_34a6e7">#34a6e7</color>
     <color name="blue_FF53BBF2">#FF53BBF2</color>
     <color name="blue_36A6E6">#36A6E6</color>