|
|
@@ -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());
|
|
|
}
|
|
|
+
|
|
|
}
|