Parcourir la source

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

zengjiebin il y a 7 ans
Parent
commit
4026732fde

+ 96 - 64
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGameCenter.java

@@ -2,29 +2,50 @@ package com.sheep.gamegroup.view.fragment;
 
 import android.app.Activity;
 import android.content.Intent;
+import android.provider.MediaStore;
+import android.support.design.widget.TabLayout;
 import android.support.v4.view.ViewPager;
 import android.view.View;
+import android.widget.Button;
 import android.widget.ImageButton;
-
+import android.widget.ImageView;
+
+import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.model.entity.ArticleTag;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
+import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActDownloadMgr;
-import com.sheep.gamegroup.view.activity.ActGameCenter;
+import com.sheep.gamegroup.view.activity.ActMain;
+import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import org.afinal.simplecache.ApiKey;
+
+import java.util.List;
 
 import butterknife.BindView;
+import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+import rx.functions.Action1;
+
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_TAG;
 
 /**
- * Created by realicing on 2018/8/29.
+ * Created by realicing on 2018/6/27.
  * realicing@sina.com
+ * 主页--发现模块
  */
 public class FgtGameCenter extends BaseFragment {
-    @BindView(R.id.act_game_center_vp)
-    ViewPager act_game_center_vp;
-    @BindView(R.id.fgt_game_center_top)
-    View fgt_game_center_top;
 
     @Override
     public int getLayoutId() {
@@ -33,73 +54,84 @@ public class FgtGameCenter extends BaseFragment {
 
     @Override
     public void onViewCreated() {
-        activity = getActivity();
-        TitleBarUtils.getInstance().setTitleListen(activity, -2, null);
-        if (activity instanceof ActGameCenter) {
-            fgt_game_center_top.setVisibility(View.GONE);
-        }
+        initView();
     }
 
+    @BindView(R.id.indicator)
+    TabLayout indicator;
+    @BindView(R.id.pager)
+    ViewPager pager;
+    @BindView(R.id.back_btn)
+    ImageButton backBtn;
+    @BindView(R.id.download_btn)
+    ImageButton downloadBtn;
+    @BindView(R.id.search_btn)
+    ImageButton searchBtn;
+    @BindView(R.id.my_walfare_btn)
+    Button myWalfareBtn;
+
+    private TitleFragmentListAdapter mAdapter;
+
+    private void initView() {
+        backBtn.setVisibility((getActivity() instanceof ActMain) ? View.GONE : View.VISIBLE);
+        mAdapter = new TitleFragmentListAdapter(getChildFragmentManager());
+        mAdapter.add(new FgtPlayGame(), "玩转游戏");
+        mAdapter.add(new FgtWelfareCenter(), "福利中心");
+        pager.setAdapter(mAdapter);
+        indicator.setupWithViewPager(pager);
+        pager.setOffscreenPageLimit(3);
+        pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int i, float v, int i1) {
+
+            }
+
+            @Override
+            public void onPageSelected(int i) {
+                downloadBtn.setVisibility(i == 0 ? View.VISIBLE : View.GONE);
+                searchBtn.setVisibility(i == 0 ? View.VISIBLE : View.GONE);
+                myWalfareBtn.setVisibility(i == 0 ? View.GONE : View.VISIBLE);
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int i) {
+
+            }
+        });
+    }
 
-    private Activity activity;
+    private void initData() {
+    }
 
     @Override
-    protected void initViewOnVisibleToUser() {
-        final TitleBarUtils titleBarUtils = TitleBarUtils.getInstance();
-        titleBarUtils.addTabs(this, act_game_center_vp, "玩转游戏", new FgtPlayGame(), "福利中心", new FgtWelfareCenter(),
-                new ViewPager.OnPageChangeListener() {
-                    @Override
-                    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
-
-                    }
+    public void initDataOnVisibleToUser() {
 
-                    @Override
-                    public void onPageSelected(int position) {
-                        FgtGameCenter.this.onPageSelected(titleBarUtils, position);
+    }
 
-                    }
+    @Override
+    public void onResume() {
+        super.onResume();
+    }
 
-                    @Override
-                    public void onPageScrollStateChanged(int state) {
+    @OnClick(R.id.back_btn)
+    public void doBack(View v) {
+        getActivity().finish();
+    }
 
-                    }
-                });
-        onPageSelected(titleBarUtils, 0);
+    @OnClick(R.id.download_btn)
+    public void doDownload(View v) {
+        startActivity(new Intent(getContext(), ActDownloadMgr.class));
+        UMConfigUtils.onEvent(UMConfigUtils.Event.GAME_DOWNLOAD_MANAGER);
+    }
 
+    @OnClick(R.id.search_btn)
+    public void doSearch(View v) {
+        Jump2View.getInstance().goAppSearch(getActivity(), null);
     }
 
-    private void onPageSelected(TitleBarUtils titleBarUtils, int position) {
-        switch (position) {
-            case 0:
-                titleBarUtils
-                        .setRightSecondBtn(getView(), R.mipmap.search_black_img, new View.OnClickListener() {
-                            @Override
-                            public void onClick(View view) {
-                                Jump2View.getInstance().goAppSearch(activity, null);
-                            }
-                        })
-                        .setRightImgBotton(getView(), R.drawable.index_download, new View.OnClickListener() {
-                            @Override
-                            public void onClick(View view) {
-                                TitleBarUtils.getInstance()
-                                        .setRightRedPoint(activity, View.GONE);
-                                startActivity(new Intent(activity, ActDownloadMgr.class));
-                                UMConfigUtils.onEvent(UMConfigUtils.Event.GAME_DOWNLOAD_MANAGER);
-                            }
-                        });
-                break;
-            case 1:
-                ImageButton secondImageButton = findViewById(R.id.ibtn_two_right);
-
-                secondImageButton.setVisibility(View.GONE);
-                titleBarUtils.setRightBtn(getView(), "我的福利", 0, new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        // 进入我的福利界面
-                        Jump2View.getInstance().goMyWelfare(activity);
-                    }
-                });
-                break;
-        }
+    @OnClick(R.id.my_walfare_btn)
+    public void doGoMyWalfare(View v) {
+        Jump2View.getInstance().goMyWelfare(getActivity());
     }
+
 }

+ 0 - 1
app/src/main/res/layout/check_net_view.xml

@@ -4,7 +4,6 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="#33ff0000"
-    android:visibility="gone"
     android:orientation="horizontal">
     <TextView
         android:layout_width="24dp"

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

@@ -2,12 +2,12 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:fitsSystemWindows="true"
     android:background="@color/white">
 
     <android.support.design.widget.TabLayout
         android:id="@+id/indicator"
-        style="@style/style_tab"
-        android:layout_marginTop="20dp" />
+        style="@style/style_tab" />
 
     <android.support.v4.view.ViewPager
         android:id="@+id/pager"

+ 68 - 11
app/src/main/res/layout/fgt_game_center.xml

@@ -1,19 +1,76 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    tools:context="com.sheep.gamegroup.view.activity.ActGameCenter">
+    android:background="@color/white"
+    android:paddingTop="20dp"
+    android:fitsSystemWindows="true">
 
-    <View
-        android:id="@+id/fgt_game_center_top"
+    <RelativeLayout
+        android:id="@+id/top_bar"
         android:layout_width="match_parent"
-        android:layout_height="20dp" />
-    <include layout="@layout/title" />
+        android:layout_height="wrap_content">
+
+        <ImageButton
+            android:id="@+id/back_btn"
+            android:layout_width="@dimen/content_padding_36"
+            android:layout_height="@dimen/content_padding_36"
+            android:background="@android:color/transparent"
+            android:scaleType="centerInside"
+            android:src="@drawable/narrow_back_black"
+            android:visibility="gone" />
+
+        <android.support.design.widget.TabLayout
+            android:id="@+id/indicator"
+            style="@style/style_tab"
+            android:layout_width="wrap_content"
+            android:layout_centerInParent="true" />
+
+        <ImageButton
+            android:id="@+id/download_btn"
+            android:layout_width="@dimen/content_padding_36"
+            android:layout_height="@dimen/content_padding_36"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:background="@android:color/transparent"
+            android:gravity="center"
+            android:minWidth="?attr/actionBarSize"
+            android:src="@drawable/index_download" />
+
+        <ImageButton
+            android:id="@+id/search_btn"
+            android:layout_width="@dimen/content_padding_36"
+            android:layout_height="@dimen/content_padding_36"
+            android:layout_alignParentEnd="true"
+            android:layout_centerVertical="true"
+            android:layout_marginEnd="@dimen/content_padding_36"
+            android:background="@android:color/transparent"
+            android:gravity="center"
+            android:minWidth="?attr/actionBarSize"
+            android:src="@mipmap/search_black_img" />
+
+        <Button
+            android:id="@+id/my_walfare_btn"
+            style="?android:attr/borderlessButtonStyle"
+            android:layout_width="wrap_content"
+            android:layout_height="@dimen/content_padding_36"
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentTop="true"
+            android:background="@color/translate"
+            android:gravity="center_vertical|end"
+            android:lines="1"
+            android:paddingEnd="17dp"
+            android:paddingStart="17dp"
+            android:text="我的福利"
+            android:textColor="@color/black_text_deep"
+            android:textSize="12sp"
+            android:visibility="gone" />
+    </RelativeLayout>
+
     <android.support.v4.view.ViewPager
-        android:id="@+id/act_game_center_vp"
+        android:id="@+id/pager"
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:layout_height="match_parent"
+        android:layout_below="@+id/top_bar" />
 
-</LinearLayout>
+</RelativeLayout>

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

@@ -8,9 +8,9 @@
     <include
         android:id="@+id/check_net_ll"
         layout="@layout/check_net_view"
+        android:visibility="gone"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/title" />
+        android:layout_height="wrap_content" />
 
     <include
         android:id="@+id/empty_view"