Просмотр исходного кода

重构首页导航栏,页面承载,切换效果,添加适配器,修改Fragment加载方式

zhoujuncai лет назад: 7
Родитель
Сommit
498d3065ba
23 измененных файлов с 444 добавлено и 108 удалено
  1. 7 1
      app/build.gradle
  2. 3 1
      app/src/main/AndroidManifest.xml
  3. 6 5
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  4. 4 4
      app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java
  5. 43 36
      app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java
  6. 123 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/HomeActivity.java
  7. 44 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/ui/adapter/HomeAdapter.java
  8. 1 2
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/GlideApp.java
  9. 28 9
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/TitleBarUtils.java
  10. 3 4
      app/src/main/res/drawable/drawable_selector_askgetmoney.xml
  11. 3 4
      app/src/main/res/drawable/drawable_selector_find.xml
  12. 3 4
      app/src/main/res/drawable/drawable_selector_game_center.xml
  13. 3 4
      app/src/main/res/drawable/drawable_selector_personalcenter.xml
  14. 3 4
      app/src/main/res/drawable/drawable_selector_task.xml
  15. 83 4
      app/src/main/res/layout/activity_home.xml
  16. 17 0
      app/src/main/res/layout/view_item_index_for_user.xml
  17. 17 0
      app/src/main/res/layout/view_item_index_game.xml
  18. 17 0
      app/src/main/res/layout/view_item_index_look.xml
  19. 17 0
      app/src/main/res/layout/view_item_index_make_money.xml
  20. 17 0
      app/src/main/res/layout/view_item_index_user_center.xml
  21. 0 24
      app/src/main/res/menu/home_bottom_navigation.xml
  22. 1 1
      app/src/main/res/values/dd_colors.xml
  23. 1 1
      common/build.gradle

+ 7 - 1
app/build.gradle

@@ -121,9 +121,15 @@ android {
             jni.srcDirs = [] //屏蔽掉默认的jni编译生成过程
         }
     }
-
+    packagingOptions {
+        pickFirst 'lib/armeabi-v7a/libgojni.so'
+        pickFirst 'lib/arm64-v8a/libgojni.so'
+        pickFirst 'lib/x86/libgojni.so'
+        pickFirst 'lib/x86_64/libgojni.so'
+    }
 }
 
+
 repositories {
     flatDir {
         dirs 'libs'

+ 3 - 1
app/src/main/AndroidManifest.xml

@@ -713,7 +713,9 @@
             </intent-filter>
         </receiver>
         <!-- end幂动科技 -->
-        <activity android:name=".ui.activity.HomeActivity"></activity>
+        <activity
+            android:name=".ui.activity.HomeActivity"
+            android:screenOrientation="portrait" />
     </application>
 
 </manifest>

+ 6 - 5
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -42,6 +42,7 @@ import com.sheep.gamegroup.view.activity.ActCreditCardTaskList;
 import com.sheep.gamegroup.view.activity.ActCreditCardWeb;
 import com.sheep.gamegroup.view.activity.ActDownloadWelfareList;
 import com.sheep.gamegroup.view.activity.ActEverydayPlayGame;
+import com.sheep.gamegroup.view.activity.ActExchangeCMCC;
 import com.sheep.gamegroup.view.activity.ActFindGame;
 import com.sheep.gamegroup.view.activity.ActFindInformation;
 import com.sheep.gamegroup.view.activity.ActGameAccount;
@@ -54,7 +55,6 @@ import com.sheep.gamegroup.view.activity.ActGuideDeblocked;
 import com.sheep.gamegroup.view.activity.ActGuideOnHook;
 import com.sheep.gamegroup.view.activity.ActInvitation;
 import com.sheep.gamegroup.view.activity.ActLoadH5;
-import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActMiDong;
 import com.sheep.gamegroup.view.activity.ActModifyThird;
 import com.sheep.gamegroup.view.activity.ActMyMoney;
@@ -75,7 +75,6 @@ import com.sheep.gamegroup.view.activity.ActUserLabelList;
 import com.sheep.gamegroup.view.activity.ActWeb;
 import com.sheep.gamegroup.view.activity.ActXiaomiGame;
 import com.sheep.gamegroup.view.activity.ActXinwanWeb;
-import com.sheep.gamegroup.view.activity.ActExchangeCMCC;
 import com.sheep.gamegroup.view.activity.AskGetMoneyAct;
 import com.sheep.gamegroup.view.activity.BindOrChangeWeixinAct;
 import com.sheep.gamegroup.view.activity.ChangeTelAct;
@@ -115,10 +114,10 @@ import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
 import com.sheep.jiuyan.samllsheep.service.ListenerShotNewService;
 import com.sheep.jiuyan.samllsheep.service.ListenerShotService;
+import com.sheep.jiuyan.samllsheep.ui.activity.HomeActivity;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 
-import org.afinal.simplecache.ApiKey;
 import org.xutils.ex.DbException;
 
 import java.io.File;
@@ -261,7 +260,8 @@ public class Jump2View {
      * @param o
      */
     public void goHomePageView(final Context context, Object o) {
-        final Intent intent = new Intent(context, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+//        final Intent intent = new Intent(context, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        final Intent intent = new Intent(context, HomeActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         if (o instanceof String) {
             //统计用户登录信息
             UMConfigUtils.onProfileSignIn();
@@ -299,7 +299,8 @@ public class Jump2View {
                     Jump2View.getInstance().goBindPhone(activity, 2);
                     return;
                 }
-                Intent intent = new Intent(activity, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+//                Intent intent = new Intent(activity, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                Intent intent = new Intent(activity, HomeActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 activity.startActivity(intent);
                 activity.finish();
             }

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

@@ -994,10 +994,10 @@ public class ViewUtil {
             }
         }
 
-        final WebView dialog_msg_wv = view.findViewById(R.id.dialog_msg_wv);
-        if (dialog_msg_wv != null) {
-            ViewUtil.loadDataWithBaseURL(dialog_msg_wv, msg);
-        }
+//        final WebView dialog_msg_wv = view.findViewById(R.id.dialog_msg_wv);
+//        if (dialog_msg_wv != null) {
+//            ViewUtil.loadDataWithBaseURL(dialog_msg_wv, msg);
+//        }
 
         TextView dialog_msg_more = view.findViewById(R.id.dialog_msg_more);
         if (dialog_msg_more != null) {

+ 43 - 36
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -23,7 +23,6 @@ import com.bumptech.glide.Glide;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.Advertising;
 import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.RouserArticlesEntity;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
@@ -33,6 +32,7 @@ import com.sheep.gamegroup.util.RxjavaCountDownTimer;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.ui.activity.HomeActivity;
 
 import org.afinal.simplecache.ApiKey;
 
@@ -63,7 +63,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     ImageView splash_bg;
     @BindView(R.id.splash_skip)
     TextView splash_skip;
-//    @BindView(R.id.splash_know_ad_tv)
+    //    @BindView(R.id.splash_know_ad_tv)
     TextView splash_know_ad_tv;
 
 
@@ -111,6 +111,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     }
 
     private boolean isRequestCodePermissions = true;//是否正在获取权限或者没有获取到权限
+
     @AfterPermissionGranted(PERMISSON_REQUESTCODE)
     private void requestCodePermissions() {
         if (!EasyPermissions.hasPermissions(this, needPermissions)) {
@@ -125,15 +126,15 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
         @Override
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
-            switch (msg.what){
+            switch (msg.what) {
                 case 0:
-                    if(!isRequestCodePermissions && !isLoadingData && timerIsFinish())
+                    if (!isRequestCodePermissions && !isLoadingData && timerIsFinish())
                         gotoNext();
                     else
                         sendHandlerMessages(100);
                     break;
                 case 1:
-                    if(SysAppUtil.isNewSmallSheep()){//新版本只显示引导页面,不展示弹窗和开屏广告
+                    if (SysAppUtil.isNewSmallSheep()) {//新版本只显示引导页面,不展示弹窗和开屏广告
                         isLoadingData = false;
                         sendHandlerMessages(200);
                     } else {
@@ -153,7 +154,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
                                     .subscribe(new SheepSubscriber<BaseMessage>(activity) {
                                         @Override
                                         public void onNext(BaseMessage baseMessage) {
-                                            DataUtil.getInstance().resetCacheTime(ApiKey.advertisements(1), 3600*5);//开屏广告最多缓存5个小时
+                                            DataUtil.getInstance().resetCacheTime(ApiKey.advertisements(1), 3600 * 5);//开屏广告最多缓存5个小时
                                             isLoadingData = false;
                                             advertising = baseMessage.getData(Advertising.class);
                                             try {
@@ -195,6 +196,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
 
     @BindView(R.id.login_bg_img)
     ImageView login_bg_img;
+
     @Override
     public void initView() {
         activity = this;
@@ -210,32 +212,34 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     public void initListener() {
 
     }
+
     private boolean isLoadingData = true;//是否正在获取开屏广告数据
     private Advertising advertising;
+
     @Override
     public void initData() {
         SheepApp.getInstance().getNetComponent().getApiService().checkUserFirst()
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                boolean isNewSmallSheep = baseMessage.getData(Boolean.class);
-                                DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
-                                mHandler.sendEmptyMessageDelayed(1, 300);
-                            }
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        boolean isNewSmallSheep = baseMessage.getData(Boolean.class);
+                        DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
+                        mHandler.sendEmptyMessageDelayed(1, 300);
+                    }
 
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                                //访问出错时,认为不是新设备
-                                DataUtil.getInstance().setIsNewSmallSheep(false);
-                                mHandler.sendEmptyMessageDelayed(1, 300);
-                            }
-                        });
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        //访问出错时,认为不是新设备
+                        DataUtil.getInstance().setIsNewSmallSheep(false);
+                        mHandler.sendEmptyMessageDelayed(1, 300);
+                    }
+                });
     }
 
     private void loadAdvertising() {
-        if(advertising.isImage()) {
+        if (advertising.isImage()) {
             Glide.with(activity).load(advertising.getDisplay_src()).into(splash_bg);
 //            btnJoin.setVisibility(View.GONE);
             splash_video_view.setVisibility(View.GONE);
@@ -246,10 +250,10 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
             videoView.setOnInfoListener(new MediaPlayer.OnInfoListener() {
                 @Override
                 public boolean onInfo(MediaPlayer mediaPlayer, int what, int extra) {
-                    if(!mediaPlayer.isLooping())
+                    if (!mediaPlayer.isLooping())
                         mediaPlayer.setLooping(true);
                     LogUtil.println("onInfo what = " + what + " extra = " + extra);
-                    if(MediaPlayer.MEDIA_INFO_BUFFERING_START == what){
+                    if (MediaPlayer.MEDIA_INFO_BUFFERING_START == what) {
                         splash_bg.setVisibility(View.GONE);
 //                        btnJoin.setVisibility(View.GONE);
                     }
@@ -261,10 +265,10 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
             videoView.requestFocus();
         }
 
-        if(splash_know_ad_tv != null)
+        if (splash_know_ad_tv != null)
             splash_know_ad_tv.setVisibility(View.VISIBLE);
         mHandler.removeMessages(0);
-        if(advertising.getShow_time() > 0) {
+        if (advertising.getShow_time() > 0) {
             splash_skip.setVisibility(View.VISIBLE);
             timer = RxjavaCountDownTimer.getInstance(/*BuildConfig.DEBUG ? 10 : */advertising.getShow_time())
                     .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
@@ -286,12 +290,14 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
             sendHandlerMessages(1000);
         }
     }
+
     private boolean isResume = false;
+
     @Override
     protected void onResume() {
         super.onResume();
         isResume = true;
-        if(videoView != null)
+        if (videoView != null)
             videoView.resume();
     }
 
@@ -299,7 +305,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     protected void onPause() {
         super.onPause();
         isResume = false;
-        if(videoView != null)
+        if (videoView != null)
             videoView.pause();
     }
 
@@ -351,7 +357,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     }
 
 
-    @OnClick({R.id.btn_join, R.id.splash_skip, R.id.splash_know_ad_tv, R.id.splash_bg, R.id.splash_video_view,R.id.splash_click_view})
+    @OnClick({R.id.btn_join, R.id.splash_skip, R.id.splash_know_ad_tv, R.id.splash_bg, R.id.splash_video_view, R.id.splash_click_view})
     public void onViewClicked(View view) {
         switch (view.getId()) {
             case R.id.btn_join:
@@ -362,10 +368,10 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
             case R.id.splash_video_view:
             case R.id.splash_know_ad_tv:
             case R.id.splash_click_view:
-                if(advertising != null) {
+                if (advertising != null) {
                     goAdLink(activity, advertising);
                     AD_SPLASH.onEvent("ad_id", advertising.getId());
-                }else {
+                } else {
                     gotoNext();
                 }
                 break;
@@ -373,8 +379,8 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     }
 
     public static void goAdLink(Activity activity, Advertising advertising) {
-        if(advertising != null){
-            switch(advertising.getLinkType()){//转跳类型1:H5外部 2:H5内部 3:试玩赚钱 4:单个任务 5:信用卡 6:微信二维码 7:连续任务 8:打卡赚钱
+        if (advertising != null) {
+            switch (advertising.getLinkType()) {//转跳类型1:H5外部 2:H5内部 3:试玩赚钱 4:单个任务 5:信用卡 6:微信二维码 7:连续任务 8:打卡赚钱
                 case 1:
                     Jump2View.getInstance().goWeb(activity, advertising.getLink());
                     break;
@@ -424,7 +430,8 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
         isRequestCodePermissions = false;
         sendHandlerMessages(10);
     }
-    private void sendHandlerMessages(int time){
+
+    private void sendHandlerMessages(int time) {
         try {
             mHandler.removeMessages(0);
             mHandler.sendEmptyMessageDelayed(0, /*BuildConfig.DEBUG ? 100 :*/ time);
@@ -436,7 +443,7 @@ public class SplashAct extends BaseActivity implements EasyPermissions.Permissio
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        if(timer != null)
+        if (timer != null)
             timer.clear();
         try {
             mHandler.removeMessages(0);

+ 123 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/activity/HomeActivity.java

@@ -1,8 +1,22 @@
 package com.sheep.jiuyan.samllsheep.ui.activity;
 
+import android.annotation.SuppressLint;
+import android.support.v4.view.ViewPager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.ui.adapter.HomeAdapter;
 import com.sheep.jiuyan.samllsheep.ui.base.BaseActivity;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+
 /**
  * Created by: zhoujuncai.
  * Created date: 2018/10/17.
@@ -10,18 +24,127 @@ import com.sheep.jiuyan.samllsheep.ui.base.BaseActivity;
  */
 public class HomeActivity extends BaseActivity {
 
+    @BindView(R.id.view_home_change)
+    ViewPager viewHomeChange;
+    @BindView(R.id.but_make_money)
+    TextView butMakeMoney;
+    @BindView(R.id.but_game)
+    TextView butGame;
+    @BindView(R.id.but_get_user)
+    TextView butGetUser;
+    @BindView(R.id.but_look)
+    TextView butLook;
+    @BindView(R.id.but_user_center)
+    TextView butUserCenter;
+    @BindView(R.id.linearLayout)
+    LinearLayout linearLayout;
+
     @Override
     protected int onLayout() {
         return R.layout.activity_home;
     }
 
+    @SuppressLint("InflateParams")
     @Override
     protected void onView() {
+        List<View> views = new ArrayList<>();
+        LayoutInflater inflater = LayoutInflater.from(this);
+        views.add(inflater.inflate(R.layout.view_item_index_make_money, null));
+        views.add(inflater.inflate(R.layout.view_item_index_game, null));
+        views.add(inflater.inflate(R.layout.view_item_index_for_user, null));
+        views.add(inflater.inflate(R.layout.view_item_index_look, null));
+        views.add(inflater.inflate(R.layout.view_item_index_user_center, null));
+        HomeAdapter adapter = new HomeAdapter(views);
+        viewHomeChange.setAdapter(adapter);
+        viewHomeChange.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int i, float v, int i1) {
+
+            }
+
+            @Override
+            public void onPageSelected(int i) {
+                setStyle(i);
+            }
 
+            @Override
+            public void onPageScrollStateChanged(int i) {
+
+            }
+        });
     }
 
     @Override
     protected void onObject() {
 
     }
+
+    private void cleanStyle() {
+        butMakeMoney.setCompoundDrawablesWithIntrinsicBounds(
+                null, getResources().getDrawable(R.drawable.homepage_zhuanqian), null, null);
+        butGame.setCompoundDrawablesWithIntrinsicBounds(
+                null, getResources().getDrawable(R.drawable.tab_game), null, null);
+        butGetUser.setCompoundDrawablesWithIntrinsicBounds(
+                null, getResources().getDrawable(R.drawable.tab_yaoqing), null, null);
+        butLook.setCompoundDrawablesWithIntrinsicBounds(
+                null, getResources().getDrawable(R.drawable.homepage_faxian), null, null);
+        butUserCenter.setCompoundDrawablesWithIntrinsicBounds(
+                null, getResources().getDrawable(R.drawable.homepage_wode), null, null);
+        for (int i = 0; i < linearLayout.getChildCount(); i++) {
+            ((TextView) linearLayout.getChildAt(i)).setTextColor(getResources().getColor(R.color.main_tab));
+        }
+    }
+
+    private void setStyle(int index) {
+        cleanStyle();
+        TextView textView = (TextView) linearLayout.getChildAt(index);
+        textView.setTextColor(getResources().getColor(R.color.main_tab_activated));
+        switch (index) {
+            case 0:
+                textView.setCompoundDrawablesWithIntrinsicBounds(
+                        null, getResources().getDrawable(R.drawable.homepage_zhuanqian_click), null, null);
+                break;
+            case 1:
+                textView.setCompoundDrawablesWithIntrinsicBounds(
+                        null, getResources().getDrawable(R.drawable.tab_game_blue), null, null);
+                break;
+            case 2:
+                textView.setCompoundDrawablesWithIntrinsicBounds(
+                        null, getResources().getDrawable(R.drawable.tab_click_yaoqing), null, null);
+                break;
+            case 3:
+                textView.setCompoundDrawablesWithIntrinsicBounds(
+                        null, getResources().getDrawable(R.drawable.homepage_faxian_click), null, null);
+                break;
+            case 4:
+                textView.setCompoundDrawablesWithIntrinsicBounds(
+                        null, getResources().getDrawable(R.drawable.homepage_wode_click), null, null);
+                break;
+        }
+    }
+
+    @OnClick(R.id.but_make_money)
+    public void onButMakeMoneyClicked() {
+        viewHomeChange.setCurrentItem(0);
+    }
+
+    @OnClick(R.id.but_game)
+    public void onButGameClicked() {
+        viewHomeChange.setCurrentItem(1);
+    }
+
+    @OnClick(R.id.but_get_user)
+    public void onButGetUserClicked() {
+        viewHomeChange.setCurrentItem(2);
+    }
+
+    @OnClick(R.id.but_look)
+    public void onButLookClicked() {
+        viewHomeChange.setCurrentItem(3);
+    }
+
+    @OnClick(R.id.but_user_center)
+    public void onButUserCenterClicked() {
+        viewHomeChange.setCurrentItem(4);
+    }
 }

+ 44 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/ui/adapter/HomeAdapter.java

@@ -0,0 +1,44 @@
+package com.sheep.jiuyan.samllsheep.ui.adapter;
+
+import android.support.annotation.NonNull;
+import android.support.v4.view.PagerAdapter;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+/**
+ * Created by: zhoujuncai.
+ * Created date: 2018/10/18.
+ * Description: 主页页面切换适配器
+ */
+public class HomeAdapter extends PagerAdapter {
+
+    private List<View> views;
+
+    public HomeAdapter(List<View> views) {
+        this.views = views;
+    }
+
+    @Override
+    public int getCount() {
+        return views.size();
+    }
+
+    @Override
+    public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
+        return view == o;
+    }
+
+    @Override
+    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
+        container.removeView(views.get(position));
+    }
+
+    @NonNull
+    @Override
+    public Object instantiateItem(@NonNull ViewGroup container, int position) {
+        container.addView(views.get(position));
+        return views.get(position);
+    }
+}

+ 1 - 2
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/GlideApp.java

@@ -5,7 +5,6 @@ import android.content.Context;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.GlideBuilder;
 import com.bumptech.glide.Registry;
-import com.bumptech.glide.load.DecodeFormat;
 import com.bumptech.glide.module.GlideModule;
 
 /**
@@ -17,7 +16,7 @@ public class GlideApp implements GlideModule {
 
     @Override
     public void applyOptions(Context context, GlideBuilder builder) {
-        builder.setDecodeFormat(DecodeFormat.PREFER_RGB_565);
+//        builder.setDecodeFormat(DecodeFormat.PREFER_RGB_565);
     }
 
     @Override

+ 28 - 9
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/TitleBarUtils.java

@@ -14,8 +14,8 @@ import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.TextView;
 
-import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
 import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 
@@ -54,6 +54,7 @@ public class TitleBarUtils {
         titleView.setText(title == null ? "" : title);
         return mTitleBarUtils;
     }
+
     /**
      * 设置标题
      *
@@ -80,11 +81,12 @@ public class TitleBarUtils {
         titleView.setTextColor(color);
         return mTitleBarUtils;
     }
+
     /**
      * 设置Title文本的颜色
      *
      * @param view
-     * @param color    颜色值
+     * @param color 颜色值
      * @return
      */
     public TitleBarUtils setTitleColor(View view, int color) {
@@ -110,6 +112,7 @@ public class TitleBarUtils {
                 });
         return mTitleBarUtils;
     }
+
     public TitleBarUtils setTitleFinish(final View view, final Activity activity) {
         view.findViewById(R.id.img_baseactivity_title)
                 .setOnClickListener(new View.OnClickListener() {
@@ -120,11 +123,13 @@ public class TitleBarUtils {
                 });
         return mTitleBarUtils;
     }
+
     public TitleBarUtils setTitleFinish(final Activity activity, View.OnClickListener listener) {
         activity.findViewById(R.id.img_baseactivity_title)
                 .setOnClickListener(listener);
         return mTitleBarUtils;
     }
+
     public TitleBarUtils setTitleFinish(final Activity activity, View view) {
         view.findViewById(R.id.img_baseactivity_title)
                 .setOnClickListener(new View.OnClickListener() {
@@ -138,6 +143,7 @@ public class TitleBarUtils {
 
     public static final int GONE = -2;
     public static final int INVISIBLE = 0;
+
     /**
      * 设置最左边的Title监听
      *
@@ -149,10 +155,14 @@ public class TitleBarUtils {
         ImageView imageView = activity.findViewById(R.id.img_baseactivity_title);
         switch (drawableID) {
             case INVISIBLE:
-                imageView.setVisibility(View.INVISIBLE);
+                if (imageView != null) {
+                    imageView.setVisibility(View.INVISIBLE);
+                }
                 break;
             case GONE:
-                imageView.setVisibility(View.GONE);
+                if (imageView != null) {
+                    imageView.setVisibility(View.GONE);
+                }
                 return this;
             default:
                 if (drawableID != -1) {
@@ -166,6 +176,7 @@ public class TitleBarUtils {
         }
         return mTitleBarUtils;
     }
+
     /**
      * 设置最左边的Title监听
      *
@@ -223,6 +234,7 @@ public class TitleBarUtils {
         }
         return this;
     }
+
     /**
      * 设置最右边的普通按钮状态
      *
@@ -267,7 +279,7 @@ public class TitleBarUtils {
     public TitleBarUtils setRightImgBotton(Activity activity, int backgroundImgResId, View.OnClickListener onClickListener) {
         Button button = activity.findViewById(R.id.btn_baseactivity_right);
         ImageButton imageButton = activity.findViewById(R.id.ibtn_baseactivity_right);
-        if(button != null)
+        if (button != null)
             button.setVisibility(View.GONE);
         imageButton.setVisibility(View.VISIBLE);
         if (backgroundImgResId == 0) {
@@ -283,6 +295,7 @@ public class TitleBarUtils {
         }
         return this;
     }
+
     /**
      * 设置最右边的普通按钮状态
      *
@@ -293,7 +306,7 @@ public class TitleBarUtils {
     public TitleBarUtils setRightImgBotton(View view, int backgroundImgResId, View.OnClickListener onClickListener) {
         Button button = view.findViewById(R.id.btn_baseactivity_right);
         ImageButton imageButton = view.findViewById(R.id.ibtn_baseactivity_right);
-        if(button != null)
+        if (button != null)
             button.setVisibility(View.GONE);
         imageButton.setVisibility(View.VISIBLE);
         if (backgroundImgResId == 0) {
@@ -312,10 +325,11 @@ public class TitleBarUtils {
 
     /**
      * 设置红点是否显示
+     *
      * @param activity
      * @param visibility
      */
-    public void setRightRedPoint(Activity activity, int visibility){
+    public void setRightRedPoint(Activity activity, int visibility) {
 
         activity.findViewById(R.id.img_download_manager_dots).setVisibility(visibility);
     }
@@ -377,6 +391,7 @@ public class TitleBarUtils {
                 .setVisibility(isShow ? View.VISIBLE : View.GONE);
         return mTitleBarUtils;
     }
+
     /**
      * 隐藏线,GONE或VISIBLE
      */
@@ -395,6 +410,7 @@ public class TitleBarUtils {
                 .setBackground(activity.getResources().getDrawable(backgroundImgResId));
         return mTitleBarUtils;
     }
+
     /**
      * 设置标题栏颜色
      */
@@ -407,7 +423,7 @@ public class TitleBarUtils {
     /**
      * 设置 从右边数,第两个按钮
      */
-    public TitleBarUtils setRightSecondBtn(Activity activity, @DrawableRes int secondRes, View.OnClickListener secondOnclick){
+    public TitleBarUtils setRightSecondBtn(Activity activity, @DrawableRes int secondRes, View.OnClickListener secondOnclick) {
         ImageButton secondImageButton = activity.findViewById(R.id.ibtn_two_right);
 
         secondImageButton.setVisibility(View.VISIBLE);
@@ -438,10 +454,11 @@ public class TitleBarUtils {
 //        CommonUtil.getInstance().reflex(tabLayout, activity);
         return this;
     }
+
     /**
      * 设置 从右边数,第两个按钮
      */
-    public TitleBarUtils setRightSecondBtn(View view, @DrawableRes int secondRes, View.OnClickListener secondOnclick){
+    public TitleBarUtils setRightSecondBtn(View view, @DrawableRes int secondRes, View.OnClickListener secondOnclick) {
         ImageButton secondImageButton = view.findViewById(R.id.ibtn_two_right);
 
         secondImageButton.setVisibility(View.VISIBLE);
@@ -450,6 +467,7 @@ public class TitleBarUtils {
         secondImageButton.setOnClickListener(secondOnclick);
         return this;
     }
+
     public TitleBarUtils addTabs(final BaseFragment baseFragment, ViewPager viewPager, String tab1, Fragment fragment1, String tab2, Fragment fragment2, ViewPager.OnPageChangeListener listener) {
         //设置标题不可见
         TextView titleView = baseFragment.findViewById(R.id.txt_baseactivity_title);
@@ -496,6 +514,7 @@ public class TitleBarUtils {
         });
         viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
             private int lastPosition = 0;
+
             @Override
             public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
 

+ 3 - 4
app/src/main/res/drawable/drawable_selector_askgetmoney.xml

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/tab_click_yaoqing" android:state_activated="true"/>
-    <item android:drawable="@drawable/tab_click_yaoqing" android:state_pressed="true"/>
-    <item android:drawable="@drawable/tab_yaoqing"/>
-
+    <item android:state_activated="true" android:drawable="@drawable/tab_click_yaoqing" />
+    <item android:state_pressed="true" android:drawable="@drawable/tab_click_yaoqing" />
+    <item android:drawable="@drawable/tab_yaoqing" />
 </selector>

+ 3 - 4
app/src/main/res/drawable/drawable_selector_find.xml

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/homepage_faxian_click" android:state_activated="true"/>
-    <item android:drawable="@drawable/homepage_faxian_click" android:state_pressed="true"/>
-    <item android:drawable="@drawable/homepage_faxian"/>
-
+    <item android:state_activated="true" android:drawable="@drawable/homepage_faxian_click" />
+    <item android:state_pressed="true" android:drawable="@drawable/homepage_faxian_click" />
+    <item android:drawable="@drawable/homepage_faxian" />
 </selector>

+ 3 - 4
app/src/main/res/drawable/drawable_selector_game_center.xml

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/tab_game_blue" android:state_activated="true"/>
-    <item android:drawable="@drawable/tab_game_blue" android:state_pressed="true"/>
-    <item android:drawable="@drawable/tab_game"/>
-
+    <item android:state_activated="true" android:drawable="@drawable/tab_game_blue" />
+    <item android:state_pressed="true" android:drawable="@drawable/tab_game_blue" />
+    <item android:drawable="@drawable/tab_game" />
 </selector>

+ 3 - 4
app/src/main/res/drawable/drawable_selector_personalcenter.xml

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/homepage_wode_click" android:state_activated="true"/>
-    <item android:drawable="@drawable/homepage_wode_click" android:state_pressed="true"/>
-    <item android:drawable="@drawable/homepage_wode"/>
-
+    <item android:state_activated="true" android:drawable="@drawable/homepage_wode_click" />
+    <item android:state_pressed="true" android:drawable="@drawable/homepage_wode_click" />
+    <item android:drawable="@drawable/homepage_wode" />
 </selector>

+ 3 - 4
app/src/main/res/drawable/drawable_selector_task.xml

@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/homepage_zhuanqian_click" android:state_activated="true"/>
-    <item android:drawable="@drawable/homepage_zhuanqian_click" android:state_pressed="true"/>
-    <item android:drawable="@drawable/homepage_zhuanqian"/>
-
+    <item android:state_activated="true" android:drawable="@drawable/homepage_zhuanqian_click" />
+    <item android:state_pressed="true" android:drawable="@drawable/homepage_zhuanqian_click" />
+    <item android:drawable="@drawable/homepage_zhuanqian" />
 </selector>

+ 83 - 4
app/src/main/res/layout/activity_home.xml

@@ -6,12 +6,91 @@
     android:layout_height="match_parent"
     tools:context=".ui.activity.HomeActivity">
 
-    <android.support.design.widget.BottomNavigationView
-        android:id="@+id/bottom_bar"
+    <android.support.v4.view.ViewPager
+        android:id="@+id/view_home_change"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toTopOf="@+id/linearLayout"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <LinearLayout
+        android:id="@+id/linearLayout"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
+        android:background="@color/bg_write"
+        android:orientation="horizontal"
+        android:paddingTop="2dp"
+        android:paddingBottom="2dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:menu="@menu/home_bottom_navigation" />
+        app:layout_constraintStart_toStartOf="parent">
+
+        <TextView
+            android:id="@+id/but_make_money"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:drawableTop="@drawable/homepage_zhuanqian_click"
+            android:focusable="true"
+            android:gravity="center"
+            android:text="@string/nav_txt_money"
+            android:textColor="@color/main_tab_activated"
+            android:textSize="10sp" />
+
+        <TextView
+            android:id="@+id/but_game"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:drawableTop="@drawable/tab_game"
+            android:focusable="true"
+            android:gravity="center"
+            android:text="@string/nav_txt_game"
+            android:textColor="@color/main_tab"
+            android:textSize="10sp" />
+
+        <TextView
+            android:id="@+id/but_get_user"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:drawableTop="@drawable/tab_yaoqing"
+            android:focusable="true"
+            android:gravity="center"
+            android:text="@string/nav_txt_for_user"
+            android:textColor="@color/main_tab"
+            android:textSize="10sp" />
+
+        <TextView
+            android:id="@+id/but_look"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:drawableTop="@drawable/homepage_faxian"
+            android:focusable="true"
+            android:gravity="center"
+            android:text="@string/nav_txt_look"
+            android:textColor="@color/main_tab"
+            android:textSize="10sp" />
+
+        <TextView
+            android:id="@+id/but_user_center"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:drawableTop="@drawable/homepage_wode"
+            android:focusable="true"
+            android:gravity="center"
+            android:text="@string/nav_txt_user_center"
+            android:textColor="@color/main_tab"
+            android:textSize="10sp" />
+    </LinearLayout>
+
 </android.support.constraint.ConstraintLayout>

+ 17 - 0
app/src/main/res/layout/view_item_index_for_user.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    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">
+
+    <fragment
+        android:id="@+id/fragment3"
+        android:name="com.sheep.gamegroup.view.fragment.FgtAskGetMoney"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 17 - 0
app/src/main/res/layout/view_item_index_game.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    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">
+
+    <fragment
+        android:id="@+id/fragment2"
+        android:name="com.sheep.gamegroup.view.fragment.FgtGameCenter"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 17 - 0
app/src/main/res/layout/view_item_index_look.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    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">
+
+    <fragment
+        android:id="@+id/fragment4"
+        android:name="com.sheep.gamegroup.view.fragment.FgtNull"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 17 - 0
app/src/main/res/layout/view_item_index_make_money.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    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">
+
+    <fragment
+        android:id="@+id/fragment"
+        android:name="com.sheep.gamegroup.view.fragment.FgtSmallSheep"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 17 - 0
app/src/main/res/layout/view_item_index_user_center.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+    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">
+
+    <fragment
+        android:id="@+id/fragment5"
+        android:name="com.sheep.gamegroup.view.fragment.FgtPersonalCenter"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 0 - 24
app/src/main/res/menu/home_bottom_navigation.xml

@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item
-        android:id="@+id/nav_make_money"
-        android:icon="@drawable/homepage_zhuanqian_click"
-        android:title="@string/nav_txt_money" />
-    <item
-        android:id="@+id/nav_game"
-        android:icon="@drawable/tab_game_blue"
-        android:title="@string/nav_txt_game" />
-    <item
-        android:id="@+id/nav_for_user"
-        android:icon="@drawable/tab_click_yaoqing"
-        android:title="@string/nav_txt_for_user" />
-    <item
-        android:id="@+id/nav_look"
-        android:icon="@drawable/homepage_faxian_click"
-        android:title="@string/nav_txt_look" />
-    <item
-        android:id="@+id/nav_user_center"
-        android:icon="@drawable/homepage_wode_click"
-        android:title="@string/nav_txt_user_center" />
-</menu>

+ 1 - 1
app/src/main/res/values/dd_colors.xml

@@ -9,6 +9,6 @@
     <!--app text view-->
     <color name="B">#000000</color>
     <color name="main_tab_activated">#32b2ed</color>
-    <color name="main_tab">#AFAFAF</color>
+    <color name="main_tab">#afafaf</color>
 
 </resources>

+ 1 - 1
common/build.gradle

@@ -23,7 +23,7 @@ android {
 }
 
 dependencies {
-    api project(':codec')
+    implementation project(':codec')
     api fileTree(include: ['*.jar'], dir: 'libs')
     /* RX全家桶 */
     api "io.reactivex.rxjava2:rxjava:2.2.2"