Explorar el Código

修改底部导航栏引用

zhanghongrui hace 1 semana
padre
commit
379810a987
Se han modificado 45 ficheros con 1469 adiciones y 159 borrados
  1. 3 0
      app/build.gradle
  2. 77 104
      app/src/main/java/com/sjkj/appthreefloor_tsgz/activity/MainActivity.java
  3. 78 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/bean/VersionBean.java
  4. 16 6
      app/src/main/java/com/sjkj/appthreefloor_tsgz/fragment/EventFragment.java
  5. 5 1
      app/src/main/java/com/sjkj/appthreefloor_tsgz/fragment/MainFragment.java
  6. 51 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/net/CheckVersionNet.java
  7. 5 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/net/RetrofitService.java
  8. 38 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/NavigationDateUtils.java
  9. 145 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/UpdateDialog.java
  10. 309 0
      app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/VersionUtils.java
  11. BIN
      app/src/main/res/drawable-xxhdpi/icon_enent_select.png
  12. BIN
      app/src/main/res/drawable-xxhdpi/icon_envent_bg.png
  13. BIN
      app/src/main/res/drawable-xxhdpi/icon_event.png
  14. BIN
      app/src/main/res/drawable-xxhdpi/icon_home.png
  15. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_select.png
  16. BIN
      app/src/main/res/drawable-xxhdpi/icon_me.png
  17. BIN
      app/src/main/res/drawable-xxhdpi/icon_me_select.png
  18. 6 0
      app/src/main/res/drawable/bg_update.xml
  19. 5 0
      app/src/main/res/drawable/selector_background_transparent.xml
  20. 2 2
      app/src/main/res/drawable/selector_navigation_tab_color.xml
  21. 15 20
      app/src/main/res/layout/activity_main.xml
  22. 90 0
      app/src/main/res/layout/dialog_update.xml
  23. 19 8
      app/src/main/res/layout/fragment_event.xml
  24. 5 4
      app/src/main/res/layout/fragment_main.xml
  25. 3 0
      app/src/main/res/values-v19/dimens.xml
  26. 1 0
      app/src/main/res/values/colors.xml
  27. 4 1
      app/src/main/res/values/dimens.xml
  28. 23 9
      app/src/main/res/values/styles.xml
  29. 1 1
      base-lib/src/main/java/com/sjkj/base_lib/view/BaseActivity.java
  30. 2 2
      config.gradle
  31. 1 0
      meantest/.gitignore
  32. 39 0
      meantest/build.gradle
  33. 21 0
      meantest/proguard-rules.pro
  34. 26 0
      meantest/src/androidTest/java/com/bit/meantest/ExampleInstrumentedTest.java
  35. 2 0
      meantest/src/main/AndroidManifest.xml
  36. 182 0
      meantest/src/main/java/com/bit/meantest/BottomBarAdapter.java
  37. 138 0
      meantest/src/main/java/com/bit/meantest/BottomBarView.java
  38. 63 0
      meantest/src/main/java/com/bit/meantest/BottomBean.java
  39. 9 0
      meantest/src/main/res/drawable/circle_red_unread_8dp.xml
  40. 45 0
      meantest/src/main/res/layout/bottom_bar_item.xml
  41. 8 0
      meantest/src/main/res/layout/view_bottombar.xml
  42. 10 0
      meantest/src/main/res/values/colors.xml
  43. 3 0
      meantest/src/main/res/values/strings.xml
  44. 17 0
      meantest/src/test/java/com/bit/meantest/ExampleUnitTest.java
  45. 2 1
      settings.gradle

+ 3 - 0
app/build.gradle

@@ -60,6 +60,7 @@ dependencies {
     implementation rootProject.ext.dependencies["appcompat"]
     implementation rootProject.ext.dependencies["design"]
     implementation project(':base-lib')
+    implementation project(':meantest')
     implementation(fileTree("libs"))
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     implementation 'androidx.navigation:navigation-fragment:2.3.5'
@@ -71,6 +72,8 @@ dependencies {
     implementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1'
     implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
     implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
+    // 基础依赖包,必须要依赖
+    implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
 //    implementation 'com.github.AnJiaoDe:StatusNavigationTransparent:V1.2.4'
 //    implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
 

+ 77 - 104
app/src/main/java/com/sjkj/appthreefloor_tsgz/activity/MainActivity.java

@@ -1,17 +1,19 @@
 package com.sjkj.appthreefloor_tsgz.activity;
 
 import android.content.Intent;
-import android.graphics.Color;
-import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.util.SparseIntArray;
+import android.util.TypedValue;
+import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.MenuItem;
 import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import androidx.annotation.NonNull;
@@ -20,6 +22,8 @@ import androidx.lifecycle.ViewModelProvider;
 import androidx.viewpager.widget.ViewPager;
 
 import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.scwang.smartrefresh.layout.util.DensityUtil;
+import com.sjkj.appthreefloor_tsgz.BuildConfig;
 import com.sjkj.appthreefloor_tsgz.R;
 import com.sjkj.appthreefloor_tsgz.activity.viewModel.MainViewModel;
 import com.sjkj.appthreefloor_tsgz.adapter.ViewPagerAdapter;
@@ -27,8 +31,13 @@ import com.sjkj.appthreefloor_tsgz.databinding.ActivityMainBinding;
 import com.sjkj.appthreefloor_tsgz.fragment.EventFragment;
 import com.sjkj.appthreefloor_tsgz.fragment.MainFragment;
 import com.sjkj.appthreefloor_tsgz.fragment.MineFragment;
+import com.sjkj.appthreefloor_tsgz.utils.NavigationDateUtils;
+import com.sjkj.appthreefloor_tsgz.utils.VersionUtils;
+import com.sjkj.base_lib.app.AppManager;
+import com.sjkj.base_lib.utils.ToastUtils;
 import com.sjkj.base_lib.view.BaseActivity;
 
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -63,76 +72,22 @@ public class MainActivity extends BaseActivity {
         binding.setViewModel(viewModel);
         binding.setLifecycleOwner(this);
     }
-    public void setStatusBarTransparent() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            Window window = getWindow();
-            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
-            int currentApiVersion = Build.VERSION.SDK_INT;
-            if (currentApiVersion >= Build.VERSION_CODES.M) {
-                // 如果你想要设置状态栏文字颜色为深色,使用以下代码
-                window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
-            } else {
-                // 对于Android 6.0以下版本,你可以这样设置状态栏为透明
-                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
-                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
-                window.setStatusBarColor(Color.TRANSPARENT);
-            }
-            // 对于导航栏也可以这样设置
-            // window.setNavigationBarColor(Color.TRANSPARENT);
-        }
-    }
     @Override
     public void initView() {
         super.initView();
-
-       // setStatusBarTransparent(); // 调用沉浸式状态栏方法
-//        ImmersionBar.with(this)
-//                .transparentStatusBar()  //透明状态栏,不写默认透明色
-//                .transparentNavigationBar()  //透明导航栏,不写默认黑色(设置此方法,fullScreen()方法自动为true)
-//                .transparentBar()             //透明状态栏和导航栏,不写默认状态栏为透明色,导航栏为黑色(设置此方法,fullScreen()方法自动为true)
-//                .statusBarColor(R.color.colorPrimary)     //状态栏颜色,不写默认透明色
-//                .navigationBarColor(R.color.colorPrimary) //导航栏颜色,不写默认黑色
-//                .barColor(R.color.colorPrimary)  //同时自定义状态栏和导航栏颜色,不写默认状态栏为透明色,导航栏为黑色
-//                .statusBarAlpha(0.3f)  //状态栏透明度,不写默认0.0f
-//                .navigationBarAlpha(0.4f)  //导航栏透明度,不写默认0.0F
-//                .barAlpha(0.3f)  //状态栏和导航栏透明度,不写默认0.0f
-//                .statusBarDarkFont(true)   //状态栏字体是深色,不写默认为亮色
-//                .navigationBarDarkIcon(true) //导航栏图标是深色,不写默认为亮色
-//                .autoDarkModeEnable(true) //自动状态栏字体和导航栏图标变色,必须指定状态栏颜色和导航栏颜色才可以自动变色哦
-//                .autoStatusBarDarkModeEnable(true,0.2f) //自动状态栏字体变色,必须指定状态栏颜色才可以自动变色哦
-//                .autoNavigationBarDarkModeEnable(true,0.2f) //自动导航栏图标变色,必须指定导航栏颜色才可以自动变色哦
-//                .fullScreen(true)      //有导航栏的情况下,activity全屏显示,也就是activity最下面被导航栏覆盖,不写默认非全屏
-//                .hideBar(BarHide.FLAG_HIDE_BAR)  //隐藏状态栏或导航栏或两者,不写默认不隐藏
-//                .fitsSystemWindows(true)    //解决状态栏和布局重叠问题,任选其一,默认为false,当为true时一定要指定statusBarColor(),不然状态栏为透明色,还有一些重载方法
-//                .supportActionBar(true) //支持ActionBar使用
-//                .removeSupportAllView() //移除全部view支持
-//                .navigationBarEnable(true)   //是否可以修改导航栏颜色,默认为true
-//                .navigationBarWithKitkatEnable(true)  //是否可以修改安卓4.4和emui3.x手机导航栏颜色,默认为true
-//                .navigationBarWithEMUI3Enable(true) //是否可以修改emui3.x手机导航栏颜色,默认为true
-//                .keyboardEnable(true)  //解决软键盘与底部输入框冲突问题,默认为false,还有一个重载方法,可以指定软键盘mode
-//                .keyboardMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)  //单独指定软键盘模式
-//                .setOnKeyboardListener(new OnKeyboardListener() {    //软键盘监听回调,keyboardEnable为true才会回调此方法
-//                    @Override
-//                    public void onKeyboardChange(boolean isPopup, int keyboardHeight) {
-//                    }
-//                })
-//                .addTag("tag")  //给以上设置的参数打标记
-//                .getTag("tag")  //根据tag获得沉浸式参数
-//                .reset()  //重置所以沉浸式参数
-//                .init();  //必须调用方可应用以上所配置的参数
-
         fragmentArrayList.add(eventFragment);
         fragmentArrayList.add(mainFragment);
         fragmentArrayList.add(mineFragment);
         pagerAdapter = new ViewPagerAdapter(MainActivity.this.getSupportFragmentManager(), fragmentArrayList);
         binding.viewPager.setAdapter(pagerAdapter);
-
         binding.viewPager.setCurrentItem(1);
-        binding.mNavigation.setCurrentItem(1);
-        binding.mNavigation.enableAnimation(false);
-        binding.mNavigation.enableShiftingMode(false);
-        binding.mNavigation.enableItemShiftingMode(false);
-        binding.mNavigation.setTextVisibility(false);
+
+//        binding.mNavigation.enableAnimation(false);
+//        binding.mNavigation.enableShiftingMode(false);
+//        binding.mNavigation.enableItemShiftingMode(false);
+//        binding.mNavigation.setTextVisibility(true);
+        binding.mNavigation.setData(NavigationDateUtils.createDefaultData());
+        binding.mNavigation.setSelectPosition(1);
         binding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
             @Override
             public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
@@ -141,8 +96,9 @@ public class MainActivity extends BaseActivity {
 
             @Override
             public void onPageSelected(int position) {
-                binding.mNavigation.setCurrentItem(position);
-                binding.mNavigation.getMenu().getItem(position).setChecked(true);
+                //binding.mNavigation.setCurrentItem(position);
+                //binding.mNavigation.getMenu().getItem(position).setChecked(true);
+                binding.mNavigation.setSelectPosition(position);
             }
 
             @Override
@@ -150,30 +106,47 @@ public class MainActivity extends BaseActivity {
 
             }
         });
+        //设置监听
+        binding.mNavigation.setOnMyItemClickListener((view, position) -> {
+            switch (position) {
+                case 0:
+                    binding.mNavigation.setSelectPosition(0);
+                    binding.viewPager.setCurrentItem(0);
+                    break;
+                case 1:
+                    binding.mNavigation.setSelectPosition(1);
+                    binding.viewPager.setCurrentItem(1);
+                    break;
+                case 2:
+                    binding.mNavigation.setSelectPosition(2);
+                    binding.viewPager.setCurrentItem(2);
+                    break;
 
-        binding.mNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
-
-            @Override
-            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
-                switch (item.getItemId()) {
-                    //通榆/四平
-                    case R.id.action_event:
-                        binding.viewPager.setCurrentItem(0);
-                        break;
-                    case R.id.action_main:
-                        binding.viewPager.setCurrentItem(1);
-                        break;
-
-                    case R.id.action_mine:
-                        binding.viewPager.setCurrentItem(2);
-                        break;
-                    default:
-                        break;
-                }
-
-                return false;
             }
         });
+//        binding.mNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
+//
+//            @Override
+//            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+//                switch (item.getItemId()) {
+//                    //通榆/四平
+//                    case R.id.action_event:
+//                        binding.viewPager.setCurrentItem(0);
+//                        break;
+//                    case R.id.action_main:
+//                        binding.viewPager.setCurrentItem(1);
+//                        break;
+//
+//                    case R.id.action_mine:
+//                        binding.viewPager.setCurrentItem(2);
+//                        break;
+//                    default:
+//                        break;
+//                }
+//
+//                return false;
+//            }
+//        });
 
 
 //        AppTools.initLink(this);
@@ -182,22 +155,22 @@ public class MainActivity extends BaseActivity {
     @Override
     public void loadData() {
 //        //版本信息校验
-//        VersionUtils versionUtils = new VersionUtils(AppManager.getAppManager().currentActivity());
-//        versionUtils.checkVersion(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, new VersionUtils.CallBack() {
-//            @Override
-//            public void onError(String msg) {
-//                ToastUtils.show(msg + "");
-//            }
-//
-//            @Override
-//            public void onSuccess() {
-//            }
-//
-//            @Override
-//            public void onNewest() {
-//                ToastUtils.show("当前版本为最新版本");
-//            }
-//        });
+        VersionUtils versionUtils = new VersionUtils(AppManager.getAppManager().currentActivity());
+        versionUtils.checkVersion(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, new VersionUtils.CallBack() {
+            @Override
+            public void onError(String msg) {
+                ToastUtils.show(msg + "");
+            }
+
+            @Override
+            public void onSuccess() {
+            }
+
+            @Override
+            public void onNewest() {
+                ToastUtils.show("当前版本为最新版本");
+            }
+        });
 //        DhUtils.getInstance().initServiceInfo();
     }
 

+ 78 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/bean/VersionBean.java

@@ -0,0 +1,78 @@
+package com.sjkj.appthreefloor_tsgz.bean;
+
+public class VersionBean {
+
+    /**
+     * id : 446f75f9c61d4bf19c1586aa34e316a8
+     * packageName : 1.0
+     * versionCode : 1.0
+     * versionName : 初版
+     * path : group1/M00/00/01/wKgA3GKxYMaAcevCAAAAAAAAAAA907.txt
+     * context : 初版
+     * isForceupdate : 是
+     */
+
+    private String id;
+    private String packageName;
+    private int versionCode;
+    private String versionName;
+    private String path;
+    private String context;
+    private String isForceupdate;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public int getVersionCode() {
+        return versionCode;
+    }
+
+    public void setVersionCode(int versionCode) {
+        this.versionCode = versionCode;
+    }
+
+    public String getVersionName() {
+        return versionName;
+    }
+
+    public void setVersionName(String versionName) {
+        this.versionName = versionName;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public String getContext() {
+        return context;
+    }
+
+    public void setContext(String context) {
+        this.context = context;
+    }
+
+    public String getIsForceupdate() {
+        return isForceupdate;
+    }
+
+    public void setIsForceupdate(String isForceupdate) {
+        this.isForceupdate = isForceupdate;
+    }
+}

+ 16 - 6
app/src/main/java/com/sjkj/appthreefloor_tsgz/fragment/EventFragment.java

@@ -1,21 +1,28 @@
 package com.sjkj.appthreefloor_tsgz.fragment;
 
 import android.content.Context;
+import android.os.Build;
 import android.os.Bundle;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.util.Log;
+import android.util.TypedValue;
 import android.view.LayoutInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Toast;
 
 import androidx.annotation.NonNull;
+import androidx.appcompat.widget.Toolbar;
 import androidx.lifecycle.ViewModelProvider;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.google.android.material.tabs.TabLayout;
+import com.gyf.immersionbar.ImmersionBar;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
 import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
@@ -54,6 +61,7 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
     private EventCenterAdapter adapter;
     public EventListRequest eventListRequest = new EventListRequest(App.getInstance());
     private List<EventBean> eventItemList = new ArrayList<>();
+
     static {
         SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
             @NonNull
@@ -77,6 +85,7 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
         return R.layout.fragment_event;
     }
 
+
     @Override
     public View initBinding(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
         binding = (FragmentEventBinding) getViewDataBing(inflater, container);
@@ -88,9 +97,12 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
 
     @Override
     public void initView() {
-      //  fitsLayoutOverlap();
-        //StatusBarUtil.transparencyBar(getActivity());
+        ImmersionBar.with(this).titleBar(binding.toolbar)
+                .init();
 
+        ViewGroup.LayoutParams params = binding.toolbar.getLayoutParams();
+        params.height = ImmersionBar.getStatusBarHeight(this);
+        binding.toolbar.setLayoutParams(params);
         initTab();
         LinearLayoutManager manager = new LinearLayoutManager(getActivity());
         manager.setOrientation(RecyclerView.VERTICAL);
@@ -120,10 +132,11 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
                 requestListLoadMore();
             }
         });
-       // binding.recyclerView.addItemDecoration(new DividerItem(getActivity()));
+        // binding.recyclerView.addItemDecoration(new DividerItem(getActivity()));
 
     }
 
+
     private void initTab() {
         for (int i = 0; i < eventStatusNames.length; i++) {
             binding.tabLayout.addTab(binding.tabLayout.newTab().setText(eventStatusNames[i]).setTag(eventStatusValues[i]));
@@ -156,12 +169,10 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
             @Override
             public void onNext(List<EventCenterListBean> bean) {
                 super.onNext(bean);
-                Log.d("ZHR111", bean.size() + "");
                 finishRefreshOrLoadMore(binding.smartRefreshLayout);
 
                 eventItemList.clear();
 
-                Log.d("ZHR111", bean.size() + "" + "===");
                 if (bean != null && bean.size() > 0) {
                     for (int i = 0; i < bean.size(); i++) {
                         String id = bean.get(i).getId();
@@ -180,7 +191,6 @@ public class EventFragment extends BaseFragment /*implements View.OnClickListene
 
 
                         EventBean eventBean = new EventBean(id, title, content, time, type, "", isUrged, "", "", eventCode, eventSource);
-                        Log.d("ZHR11111", title);
                         eventItemList.add(eventBean);
                     }
 

+ 5 - 1
app/src/main/java/com/sjkj/appthreefloor_tsgz/fragment/MainFragment.java

@@ -1,6 +1,7 @@
 package com.sjkj.appthreefloor_tsgz.fragment;
 
 import android.content.Intent;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Log;
@@ -8,11 +9,14 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.core.content.ContextCompat;
+import androidx.core.graphics.ColorUtils;
 import androidx.lifecycle.ViewModelProvider;
 
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
 import com.bumptech.glide.request.RequestOptions;
+import com.gyf.immersionbar.ImmersionBar;
 import com.sjkj.appthreefloor_tsgz.R;
 import com.sjkj.appthreefloor_tsgz.activity.ExoPlayerActivity;
 import com.sjkj.appthreefloor_tsgz.activity.MonitoringCenterActivity;
@@ -22,6 +26,7 @@ import com.sjkj.appthreefloor_tsgz.app.App;
 import com.sjkj.appthreefloor_tsgz.bean.BannerDataBean;
 import com.sjkj.appthreefloor_tsgz.databinding.FragmentMainBinding;
 import com.sjkj.appthreefloor_tsgz.net.BannerRequest;
+import com.sjkj.appthreefloor_tsgz.utils.StatusBarUtil;
 import com.sjkj.base_lib.entity.Params;
 import com.sjkj.base_lib.net.domain.interactor.ProcessErrorSubscriber;
 import com.sjkj.base_lib.utils.CommonUtils;
@@ -57,7 +62,6 @@ public class MainFragment extends BaseFragment {
 
     @Override
     public void initView() {
-
     }
 
     @Override

+ 51 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/net/CheckVersionNet.java

@@ -0,0 +1,51 @@
+package com.sjkj.appthreefloor_tsgz.net;
+
+import android.content.Context;
+
+import com.sjkj.appthreefloor_tsgz.bean.VersionBean;
+import com.sjkj.base_lib.entity.Params;
+import com.sjkj.base_lib.entity.ResponseBean;
+import com.sjkj.base_lib.net.RetrofitFactory;
+import com.sjkj.base_lib.net.data.exception.BusinessException;
+import com.sjkj.base_lib.net.domain.interactor.UseCase;
+import com.sjkj.base_lib.utils.AppTools;
+
+import rx.Observable;
+import rx.functions.Func1;
+
+/**
+ * 校验版本信息
+ */
+public class CheckVersionNet extends UseCase {
+    private Context context;
+    private RetrofitService service;
+
+    private Params params;
+
+    public Params getParams() {
+        return params;
+    }
+
+    public void setParams(Params params) {
+        this.params = params;
+    }
+
+    public CheckVersionNet(Context context) {
+        this.context = context;
+
+        service = RetrofitFactory.getRetrofit(AppTools.getBaseUrl(), true, 10L, false).create(RetrofitService.class);
+    }
+
+    @Override
+    protected Observable buildUseCaseObservable() {
+        return service.checkVersion(params).flatMap(new Func1<ResponseBean<VersionBean>, Observable<ResponseBean<VersionBean>>>() {
+            @Override
+            public Observable<ResponseBean<VersionBean>> call(ResponseBean<VersionBean> responseBean) {
+                if (!ResponseBean.CODE_SUCCESS.equals(responseBean.getCode())) {
+                    return Observable.error(new BusinessException(responseBean.getMsg()));
+                }
+                return Observable.just(responseBean);
+            }
+        });
+    }
+}

+ 5 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/net/RetrofitService.java

@@ -9,6 +9,7 @@ import com.sjkj.appthreefloor_tsgz.bean.FileBean;
 import com.sjkj.appthreefloor_tsgz.bean.LogInRsaBean;
 import com.sjkj.appthreefloor_tsgz.bean.LoginBean;
 import com.sjkj.appthreefloor_tsgz.bean.ResourceVisualizationBean;
+import com.sjkj.appthreefloor_tsgz.bean.VersionBean;
 import com.sjkj.base_lib.camera.dh.bean.CameraBean;
 import com.sjkj.base_lib.entity.Params;
 import com.sjkj.base_lib.entity.ResponseBean;
@@ -68,4 +69,8 @@ public interface RetrofitService {
     @Multipart
     @POST("AppFileController/appUpload")
     Observable<ResponseBean<FileBean>> upload(@Part MultipartBody.Part file);
+
+    //校验版本信息
+    @POST("AppVersionController/getVersionInfo")
+    Observable<ResponseBean<VersionBean>> checkVersion(@QueryMap Params params);
 }

+ 38 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/NavigationDateUtils.java

@@ -0,0 +1,38 @@
+package com.sjkj.appthreefloor_tsgz.utils;
+
+import com.bit.meantest.BottomBean;
+import com.sjkj.appthreefloor_tsgz.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class NavigationDateUtils {
+    public static List<BottomBean> createDefaultData() {
+        List<BottomBean> listBean = new ArrayList<>();
+        BottomBean bottomBean1 = new BottomBean();
+        bottomBean1.setIvSelectID(R.drawable.icon_enent_select);
+        bottomBean1.setIvUnSelectID(R.drawable.icon_event);
+        bottomBean1.setTvUnSelectID(R.color.color_notice);
+        bottomBean1.setTvSelectID(R.color.event_color);
+        bottomBean1.setBottomText("事件");
+        listBean.add(bottomBean1);
+
+        BottomBean bottomBean2 = new BottomBean();
+        bottomBean2.setIvSelectID(R.drawable.icon_home_select);
+        bottomBean2.setIvUnSelectID(R.drawable.icon_home);
+        bottomBean2.setTvUnSelectID(R.color.color_notice);
+        bottomBean2.setTvSelectID(R.color.event_color);
+        bottomBean2.setBottomText("驾驶舱");
+        listBean.add(bottomBean2);
+
+        BottomBean bottomBean3 = new BottomBean();
+        bottomBean3.setIvSelectID(R.drawable.icon_me_select);
+        bottomBean3.setIvUnSelectID(R.drawable.icon_me);
+        bottomBean3.setTvUnSelectID(R.color.color_notice);
+        bottomBean3.setTvSelectID(R.color.event_color);
+        bottomBean3.setBottomText("我的");
+        listBean.add(bottomBean3);
+
+        return listBean;
+    }
+}

+ 145 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/UpdateDialog.java

@@ -0,0 +1,145 @@
+package com.sjkj.appthreefloor_tsgz.utils;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.TextView;
+
+import com.sjkj.appthreefloor_tsgz.R;
+import com.sjkj.base_lib.utils.CommonUtils;
+
+/**
+ * Author       menc
+ * Desc	        ${更新Dialog}
+ */
+public class UpdateDialog extends Dialog {
+    public static final int LOADING_SUCCESS = 0;
+    public static final int LOADING_FAILED = -1;
+
+    private Context mContext;
+    private TextView localVersionTv;
+    private TextView newVersionTv;
+    private TextView msgTv;
+    private boolean isCancel = true;
+    private TextView cancelTv;
+
+    public UpdateDialog(Context context) {
+        super(context, R.style.LoadingDialogStyle);
+        this.mContext = context;
+        initDialog();
+    }
+
+    /**
+     * 初始化Dialog
+     */
+    public void initDialog() {
+        Window win = getWindow();
+        win.getDecorView().setPadding(0, 0, 0, 0);
+        win.setGravity(Gravity.RELATIVE_LAYOUT_DIRECTION | Gravity.CENTER);
+        WindowManager.LayoutParams lp = win.getAttributes();
+        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
+        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
+        win.setAttributes(lp);
+        setCancelable(isCancel);
+        setCanceledOnTouchOutside(isCancel);
+    }
+
+    public void showDialog() {
+        show();
+    }
+
+    /**
+     * 隐藏Dialog
+     */
+    public void hideDialog() {
+        try {
+            cancel();
+            dismiss();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.setContentView(R.layout.dialog_update);
+        initView();
+    }
+
+    private void initView() {
+        localVersionTv = findViewById(R.id.local_version_tv);
+        newVersionTv = findViewById(R.id.new_version_tv);
+        msgTv = findViewById(R.id.msg_tv);
+        TextView updateTv = findViewById(R.id.update_tv);
+        cancelTv = findViewById(R.id.cancel_tv);
+        updateTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                hideDialog();
+                if (mListener != null) mListener.onItemClick(1);
+            }
+        });
+        cancelTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                hideDialog();
+                if (mListener != null) mListener.onItemClick(0);
+            }
+        });
+    }
+
+    public void setParams(String localVersion, String newVersion, String msg, boolean isCancel) {
+        if (localVersionTv != null)
+            this.localVersionTv.setText(CommonUtils.stringNotEmpty(localVersion));
+        if (newVersionTv != null)
+            this.newVersionTv.setText(CommonUtils.stringNotEmpty(newVersion));
+        if (msgTv != null)
+            this.msgTv.setText(CommonUtils.stringNotEmpty(msg));
+        if (cancelTv != null){
+            this.cancelTv.setClickable(isCancel);
+            this.cancelTv.setVisibility(isCancel ? View.VISIBLE : View.INVISIBLE);
+            setCancelable(isCancel);
+            setCanceledOnTouchOutside(isCancel);
+        }
+    }
+
+    /**
+     * 判断当前用户触摸是否超出了Dialog的显示区域
+     *
+     * @param context
+     * @param event
+     * @return
+     */
+    private boolean isOutOfBounds(Context context, MotionEvent event) {
+        final int x = (int) event.getX();
+        final int y = (int) event.getY();
+        final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop();
+        final View decorView = getWindow().getDecorView();
+        return (x < -slop) || (y < -slop) || (x > (decorView.getWidth() + slop))
+                || (y > (decorView.getHeight() + slop));
+    }
+
+    private OnItemClickListener mListener;
+
+    public interface OnItemClickListener {
+        /**
+         * 点击条目
+         *
+         * @param type 0取消,1 first,2 second
+         */
+        void onItemClick(int type);
+    }
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        this.mListener = listener;
+    }
+
+
+}

+ 309 - 0
app/src/main/java/com/sjkj/appthreefloor_tsgz/utils/VersionUtils.java

@@ -0,0 +1,309 @@
+package com.sjkj.appthreefloor_tsgz.utils;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Environment;
+import android.os.Message;
+import android.text.TextUtils;
+
+import androidx.core.content.FileProvider;
+
+import com.hjq.permissions.OnPermissionCallback;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+import com.sjkj.appthreefloor_tsgz.BuildConfig;
+import com.sjkj.appthreefloor_tsgz.app.App;
+import com.sjkj.appthreefloor_tsgz.bean.VersionBean;
+import com.sjkj.appthreefloor_tsgz.net.CheckVersionNet;
+import com.sjkj.appthreefloor_tsgz.utils.UpdateDialog;
+import com.sjkj.base_lib.app.AppManager;
+import com.sjkj.base_lib.entity.Params;
+import com.sjkj.base_lib.entity.ResponseBean;
+import com.sjkj.base_lib.net.domain.interactor.ProcessErrorSubscriber;
+import com.sjkj.base_lib.utils.ToastUtils;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.List;
+
+public class VersionUtils {
+    private Activity activity;
+    private CheckVersionNet checkVersionNet = new CheckVersionNet(App.getInstance());
+    public static String apkPath = "";
+
+    public boolean isExistApk() {
+        if (TextUtils.isEmpty(apkPath)) {
+            return false;
+        }
+        return true;
+    }
+
+    public String getApkPath() {
+        return apkPath;
+    }
+
+    public VersionUtils(Activity activity) {
+        this.activity = activity;
+    }
+
+    public interface CallBack {
+        void onError(String msg);
+
+        void onSuccess();
+
+        void onNewest();
+    }
+
+    private android.os.Handler handler = new android.os.Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+            switch (msg.what) {
+                case 0:
+                    ToastUtils.show("安装包地址不存在");
+                    break;
+                case 1:
+                    ToastUtils.show(/*file.getPath()*/"下载成功,准备安装");
+                    break;
+                case 2:
+                    ToastUtils.show("文件下载出错,请重试");
+                    break;
+                case 3:
+                    ToastUtils.show("文件安装出错,请重试");
+                    break;
+            }
+        }
+    };
+
+    public void checkVersion(String versionName, int versionCode, CallBack callBack) {
+        if (isExistApk()) {
+            installApkFile(AppManager.getAppManager().currentActivity(), getApkPath());
+            return;
+        }
+        if (TextUtils.isEmpty(versionName)) {
+            if (callBack != null) {
+                callBack.onError("获取当前版本信息失败");
+                return;
+            }
+        }
+        checkVersionNet.setParams(new Params());
+        checkVersionNet.execute(new ProcessErrorSubscriber<ResponseBean<VersionBean>>() {
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+                if (callBack != null)
+                    callBack.onError("" + e.getMessage());
+            }
+
+            @Override
+            public void onNext(final ResponseBean<VersionBean> o) {
+                super.onNext(o);
+                final ResponseBean<VersionBean> responseBean = o;
+                if (responseBean != null && responseBean.getData() != null) {
+
+                    if (responseBean.getData().getVersionCode() <= versionCode) {
+                        if (callBack != null) {
+                            callBack.onNewest();
+                        }
+                        return;
+                    }
+                    UpdateDialog updateDialog = new UpdateDialog(activity);
+                    updateDialog.showDialog();
+                    updateDialog.setParams(versionName, responseBean.getData().getVersionName(), "版本更新",!"Y".equals(responseBean.getData().getIsForceupdate()));
+                    updateDialog.setOnItemClickListener(new UpdateDialog.OnItemClickListener() {
+                        @Override
+                        public void onItemClick(int type) {
+                            switch (type) {
+                                case 1:
+//                                    ToastUtils.show("更新中...");
+                                    String fileUrl = responseBean.getData().getPath();
+                                    if (TextUtils.isEmpty(fileUrl)) {
+                                        updateDialog.hideDialog();
+                                        if (callBack != null) {
+                                            callBack.onError("下载更新包失败");
+                                            return;
+                                        }
+                                    }
+                                    downLoadApk(fileUrl, activity, callBack);
+                                    break;
+                                default:
+                                    break;
+                            }
+                        }
+                    });
+                }
+            }
+        });
+    }
+
+    /* * 从服务器中下载APK */
+    private void downLoadApk(final String updateUrl, final Context context, final CallBack callBack) {
+        final ProgressDialog pd;
+        // 进度条对话框
+        pd = new ProgressDialog(context);
+        pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+        pd.setMessage("正在下载更新");
+        pd.show();
+        pd.setCancelable(false);
+        pd.setCanceledOnTouchOutside(false);
+        new Thread() {
+            @Override
+            public void run() {
+
+                File file = null;
+                try {
+                    file =getFileFromServer(updateUrl, pd);
+                    sleep(3000);
+                    pd.dismiss(); // 结束掉进度条对话框
+                    handler.sendEmptyMessage(1);
+                } catch (Exception e) {
+                    if (callBack != null) {
+                        callBack.onError("文件下载失败");
+                        pd.dismiss();
+                        return;
+                    }
+                    handler.sendEmptyMessage(2);
+                    pd.dismiss(); // 结束掉进度条对话框
+                }
+                try {
+                    if (file != null && file.exists()) {
+                        apkPath = file.getPath();
+                        //check version o
+                        if (Build.VERSION.SDK_INT >= 26) {
+                            boolean b = activity.getPackageManager().canRequestPackageInstalls();
+                            if (b) {
+                                installApkFile(activity, file.getPath());//安装应用的逻辑(写自己的就可以)
+                            } else {
+                                final File finalFile = file;
+                                XXPermissions.with(AppManager.getAppManager().currentActivity())
+                                        .permission(Permission.REQUEST_INSTALL_PACKAGES)
+                                        .request(new OnPermissionCallback() {
+                                            @Override
+                                            public void onGranted(List<String> permissions, boolean all) {
+                                                if (all) {
+                                                    installApkFile(activity, finalFile.getPath());
+                                                } else {
+                                                    ToastUtils.show("获取部分权限成功,但部分权限未正常授予");
+                                                }
+                                            }
+
+                                            @Override
+                                            public void onDenied(List<String> permissions, boolean never) {
+                                                if (never) {
+                                                    ToastUtils.show("被永久拒绝授权,请手动授予权限");
+                                                    // 如果是被永久拒绝就跳转到应用权限系统设置页面
+                                                    XXPermissions.startPermissionActivity(AppManager.getAppManager().currentActivity(), permissions);
+                                                } else {
+                                                    ToastUtils.show("获取权限失败");
+                                                }
+                                            }
+                                        });
+                            }
+                        } else {
+                            installApkFile(activity, file.getPath());
+                        }
+                    } else {
+                        apkPath = "";
+                    }
+                } catch (Exception e) {
+                    pd.dismiss(); // 结束掉进度条对话框
+                    apkPath = "";
+                    if (callBack != null) {
+                        callBack.onError("安装失败");
+                        return;
+                    }
+                    handler.sendEmptyMessage(3);
+
+                }
+                if (callBack != null) {
+                    callBack.onSuccess();
+                    return;
+                }
+            }
+        }.start();
+    }
+
+//    // 安装apk
+//    private void installApk(File file, Context context) {
+//        Intent intent = new Intent();
+//        // 执行动作
+//        intent.setAction(Intent.ACTION_VIEW);
+//        // 执行的数据类型
+//        intent.setDataAndType(Uri.fromFile(file),
+//                "application/vnd.android.package-archive");
+//        context.startActivity(intent);
+//    }
+
+    public void installApkFile(Context context, String filePath) {
+        Intent intent = new Intent(Intent.ACTION_VIEW);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+            intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+            Uri contentUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", new File(filePath));
+            intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
+        } else {
+            intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive");
+        }
+        context.startActivity(intent);
+    }
+
+    public File getFileFromServer(String path, ProgressDialog progressDialog)
+            throws Exception {
+        // 如果相等的话表示当前的sdcard挂载在手机上并且是可用的
+        if (Environment.getExternalStorageState().equals(
+                Environment.MEDIA_MOUNTED)) {
+            URL url = new URL(path);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            conn.setConnectTimeout(5000);
+//            conn.setRequestProperty("Accept-Encoding", "identity");
+//            conn.connect();
+            int length = conn.getContentLength();
+            if (length <= 0) {
+                // 获取到文件的大小
+                progressDialog.setMax(53684474);
+            } else {
+                // 获取到文件的大小
+                progressDialog.setMax(conn.getContentLength());
+            }
+
+//            Log.e("progress_tag", "DownLoadManager_setMax_" + conn.getContentLength());
+            InputStream is = conn.getInputStream();
+
+            File file = new File(Environment.getExternalStorageDirectory() + File.separator + "Android/data/" + App.getInstance().getPackageName() + "/Files/");
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+            File mF = new File(file.getPath(), "update.apk");
+            if (mF.exists()) {
+                mF.delete();
+            }
+            FileOutputStream fos = new FileOutputStream(mF);
+            BufferedInputStream bis = new BufferedInputStream(is);
+            byte[] buffer = new byte[1024];
+            int len;
+            int total = 0;
+            while ((len = bis.read(buffer)) != -1) {
+                fos.write(buffer, 0, len);
+                total += len;
+                // 获取当前下载量
+                progressDialog.setProgress(total);
+//                Log.e("progress_tag", "DownLoadManager_setProgress_" + total);
+            }
+            progressDialog.dismiss();
+            fos.close();
+            bis.close();
+            is.close();
+            return mF;
+        } else {
+            return null;
+        }
+    }
+}

BIN
app/src/main/res/drawable-xxhdpi/icon_enent_select.png


BIN
app/src/main/res/drawable-xxhdpi/icon_envent_bg.png


BIN
app/src/main/res/drawable-xxhdpi/icon_event.png


BIN
app/src/main/res/drawable-xxhdpi/icon_home.png


BIN
app/src/main/res/drawable-xxhdpi/icon_home_select.png


BIN
app/src/main/res/drawable-xxhdpi/icon_me.png


BIN
app/src/main/res/drawable-xxhdpi/icon_me_select.png


+ 6 - 0
app/src/main/res/drawable/bg_update.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="10dp"/>
+    <solid android:color="@android:color/white"/>
+</shape>

+ 5 - 0
app/src/main/res/drawable/selector_background_transparent.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+  <item android:drawable="@color/transparent_click" android:state_pressed="true" />
+  <item android:drawable="@android:color/transparent" />
+</selector>

+ 2 - 2
app/src/main/res/drawable/selector_navigation_tab_color.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:color="@color/main_blue_color" android:state_checked="true" />
-    <item android:color="@color/color_gray_text" android:state_checked="false" />
+    <item android:color="#0F5FEE" android:state_checked="true" />
+    <item android:color="#334960" android:state_checked="false" />
 </selector>

+ 15 - 20
app/src/main/res/layout/activity_main.xml

@@ -14,13 +14,24 @@
         android:layout_height="match_parent"
         android:orientation="vertical">
 
-        <com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
+<!--        <com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx-->
+<!--            android:id="@+id/mNavigation"-->
+<!--            android:layout_width="match_parent"-->
+<!--            android:layout_height="wrap_content"-->
+<!--            app:itemIconSize="30dp"-->
+<!--            android:layout_alignParentBottom="true"-->
+<!--            android:background="@drawable/rounded_corners"-->
+<!--            app:itemRippleColor="@null"-->
+<!--            app:itemTextAppearanceActive="@style/bottom_tab_title_active"-->
+<!--            app:itemTextAppearanceInactive="@style/bottom_tab_title_inactive"-->
+<!--            app:itemTextColor="@drawable/selector_navigation_tab_color"-->
+<!--            app:menu="@menu/bottom_navigation_tab" />-->
+        <com.bit.meantest.BottomBarView
             android:id="@+id/mNavigation"
             android:layout_width="match_parent"
-            android:layout_height="60dp"
-            android:layout_alignParentBottom="true"
+            android:layout_height="70dp"
             android:background="@drawable/rounded_corners"
-            app:menu="@menu/bottom_navigation_tab" />
+            android:layout_alignParentBottom="true" />
 
         <androidx.viewpager.widget.ViewPager
             android:id="@+id/view_pager"
@@ -28,22 +39,6 @@
             android:layout_height="match_parent"
             android:layout_above="@id/mNavigation" />
 
-        <!--        <FrameLayout-->
-        <!--            android:id="@+id/mFrameLayout"-->
-        <!--            android:layout_width="match_parent"-->
-        <!--            android:layout_height="0dp"-->
-        <!--            android:layout_weight="1" />-->
-
-        <!--        <com.google.android.material.bottomnavigation.BottomNavigationView-->
-        <!--            android:id="@+id/mNavigation"-->
-        <!--            android:layout_width="match_parent"-->
-        <!--            android:layout_height="wrap_content"-->
-        <!--            android:background="@color/color_white"-->
-        <!--            app:itemTextAppearanceActive="@style/bottom_tab_title_active"-->
-
-        <!--            app:itemTextAppearanceInactive="@style/bottom_tab_title_inactive"-->
-        <!--            app:labelVisibilityMode="labeled"-->
-        <!--            app:menu="@menu/bottom_navigation_tab" />-->
 
     </RelativeLayout>
 </layout>

+ 90 - 0
app/src/main/res/layout/dialog_update.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="20dp"
+        android:background="@drawable/bg_update"
+        android:orientation="vertical"
+        android:padding="16dp"
+        tools:background="@drawable/bg_update">
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="12dp"
+            android:layout_marginStart="12dp"
+            android:layout_marginTop="8dp"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/local_version_tv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textSize="16sp"
+                tools:text="0.1.1" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text=" -> "
+                android:textSize="16sp" />
+
+            <TextView
+                android:id="@+id/new_version_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="16sp"
+                tools:text="0.0.1" />
+
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/msg_tv"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="12dp"
+            android:layout_marginStart="12dp"
+            android:layout_marginTop="8dp"
+            android:textSize="16sp"
+            android:visibility="visible"
+            tools:text="更新说明:\n优化软件效率\n修复软件" />
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="end"
+            android:layout_marginTop="8dp"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/cancel_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@drawable/selector_background_transparent"
+                android:padding="8dp"
+                android:text="取消" />
+
+            <View
+                android:layout_width="32dp"
+                android:layout_height="16dp" />
+
+            <TextView
+                android:id="@+id/update_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:background="@drawable/selector_background_transparent"
+                android:padding="8dp"
+                android:text="更新"
+                android:textColor="@color/main_blue_color" />
+
+        </LinearLayout>
+
+
+    </LinearLayout>
+</LinearLayout>

+ 19 - 8
app/src/main/res/layout/fragment_event.xml

@@ -19,22 +19,27 @@
         android:fitsSystemWindows="true"
         android:orientation="vertical">
 
-        <FrameLayout
+        <androidx.appcompat.widget.Toolbar
+            android:id="@+id/toolbar"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="?actionBarSize"
+            android:fitsSystemWindows="true"
+            android:gravity="center_horizontal">
 
 
-            <ImageView
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"></ImageView>
+        </androidx.appcompat.widget.Toolbar>
+
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
 
             <RelativeLayout
                 android:layout_width="match_parent"
-                android:layout_height="40dp">
+                android:layout_height="wrap_content">
 
                 <TextView
                     android:layout_width="match_parent"
-                    android:layout_height="match_parent"
+                    android:layout_height="wrap_content"
                     android:gravity="center_horizontal|center_vertical"
                     android:text="事件列表"
                     android:textColor="@color/white"
@@ -54,6 +59,12 @@
                 </ImageView>
             </RelativeLayout>
 
+            <ImageView
+                android:layout_width="match_parent"
+
+                android:layout_height="wrap_content"></ImageView>
+
+
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -209,7 +220,7 @@
                     android:id="@+id/tabLayout"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="50dp"
+                    android:layout_marginTop="30dp"
                     app:tabGravity="fill"
                     app:tabIndicatorColor="@color/white"
                     app:tabIndicatorFullWidth="false"

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

@@ -29,17 +29,19 @@
             android:orientation="vertical">
 
 
+
             <FrameLayout
                 android:layout_width="match_parent"
-                android:layout_height="450dp">
+                android:layout_height="490dp">
 
                 <FrameLayout
                     android:layout_width="match_parent"
-                    android:layout_height="250dp">
+                    android:layout_height="320dp">
 
                     <ImageView
+                        android:id="@+id/iv_banner"
                         android:layout_width="match_parent"
-                        android:layout_height="match_parent"
+                        android:layout_height="320dp"
                         android:layout_marginBottom="10dp"
                         android:adjustViewBounds="true"
                         android:background="@drawable/icon_bg"
@@ -57,7 +59,6 @@
 
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginBottom="30dp"
                     android:layout_gravity="bottom"
                     android:layout_marginLeft="15dp"
                     android:layout_marginRight="15dp"

+ 3 - 0
app/src/main/res/values-v19/dimens.xml

@@ -0,0 +1,3 @@
+<resources>
+    <dimen name="toolbar_padding_top">25dp</dimen>
+</resources>

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

@@ -65,5 +65,6 @@
     <color name="color_orange">#FF9800</color>
     <color name="color_bg_gray_input">#F6F6F6</color>
     <color name="coler_evnet">#9E9E9E</color>
+    <color name="event_color">#0F5FEE</color>
 
 </resources>

+ 4 - 1
app/src/main/res/values/dimens.xml

@@ -1,3 +1,6 @@
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
     <dimen name="fab_margin">16dp</dimen>
+    <dimen name="shifting_height_top_padding_active" tools:override="true">70dp</dimen>
+
+    <dimen name="toolbar_padding_top">0dp</dimen>
 </resources>

+ 23 - 9
app/src/main/res/values/styles.xml

@@ -6,6 +6,7 @@
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
         <item name="colorAccent">@color/colorAccent</item>
+        <item name="android:actionBarSize">50dp</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
 
@@ -18,18 +19,18 @@
 
     <style name="SplashTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
         <!-- 将splash图片设置在这,这样这张图片取代白屏或黑屏 -->
-<!--        <item name="android:windowNoTitle">true</item>-->
-<!--        <item name="android:windowBackground">@mipmap/bg_splash_tsgz</item>-->
-<!--        <item name="android:windowFullscreen">true</item>-->
+        <!--        <item name="android:windowNoTitle">true</item>-->
+        <!--        <item name="android:windowBackground">@mipmap/bg_splash_tsgz</item>-->
+        <!--        <item name="android:windowFullscreen">true</item>-->
         <item name="android:windowBackground">@mipmap/bg_splash_tsgz</item>
 
     </style>
 
     <style name="FullTheme" parent="android:Theme.Black.NoTitleBar">
         <!-- 将splash图片设置在这,这样这张图片取代白屏或黑屏 -->
-<!--        <item name="android:windowNoTitle">true</item>-->
-<!--        <item name="android:windowBackground">@mipmap/bg_splash_tsgz</item>-->
-<!--        <item name="android:windowFullscreen">true</item>-->
+        <!--        <item name="android:windowNoTitle">true</item>-->
+        <!--        <item name="android:windowBackground">@mipmap/bg_splash_tsgz</item>-->
+        <!--        <item name="android:windowFullscreen">true</item>-->
     </style>
 
     <style name="gray_line">
@@ -70,6 +71,7 @@
         <item name="android:textColor">@color/color_black_3</item>
         <item name="android:textStyle">bold</item>
     </style>
+
     <style name="daily_text_big">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
@@ -94,6 +96,7 @@
         <item name="android:textSize">14dp</item>
         <item name="android:textColor">@color/color_black_3</item>
     </style>
+
     <style name="daily_text_1_big">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
@@ -131,6 +134,7 @@
         <item name="android:textSize">14dp</item>
         <item name="android:textColor">@color/color_blue</item>
     </style>
+
     <style name="TabLayoutStyle_big" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse">
         <item name="android:textSize">18dp</item>
         <item name="android:textStyle">bold</item>
@@ -138,7 +142,7 @@
     </style>
     <!--选中的样式,可以设置选择的字体颜色,这里只是为了改变选择时的字体大小-->
     <style name="bottom_tab_title_active">
-        <item name="android:textSize">14sp</item>
+        <item name="android:textSize">16sp</item>
     </style>
     <!--选中的样式,可以设置选择的字体颜色,这里只是为了改变选择时的字体大小-->
     <style name="bottom_tab_title_active_big">
@@ -147,32 +151,37 @@
 
     <!--没有选中的样式,导航默认的字体大小就是12sp-->
     <style name="bottom_tab_title_inactive">
-        <item name="android:textSize">12sp</item>
+        <item name="android:textSize">14sp</item>
     </style>
     <!--没有选中的样式,导航默认的字体大小就是12sp-->
     <style name="bottom_tab_title_inactive_big">
         <item name="android:textSize">16sp</item>
     </style>
+
     <style name="MyRadioButton" parent="Theme.AppCompat.Light">
         <item name="colorControlNormal">#ffffff</item>
         <item name="colorControlActivated">#6D88E9</item>
     </style>
+
     <style name="mypopwindow_anim_style">
         <item name="android:windowEnterAnimation">@anim/popshow_anim</item>
         <!-- 指定显示的动画xml -->
         <item name="android:windowExitAnimation">@anim/pophidden_anim</item>
         <!-- 指定消失的动画xml -->
     </style>
-    <style name="AppStyleTextInputLayout"  parent="@android:style/TextAppearance">
+
+    <style name="AppStyleTextInputLayout" parent="@android:style/TextAppearance">
         <item name="android:textColor">@color/color_input_red</item>
         <item name="android:textSize">12sp</item>
     </style>
+
     <style name="change_radio_button">
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">40dp</item>
         <item name="android:gravity">center</item>
         <item name="android:textSize">14dp</item>
     </style>
+
     <style name="AnimBottom">
         <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
         <item name="android:windowExitAnimation">@anim/push_bottom_out</item>
@@ -185,9 +194,14 @@
         <item name="android:textSize">16dp</item>
         <item name="android:textStyle">bold</item>
     </style>
+
     <style name="switch_text_color_white" parent="@android:style/TextAppearance.Small">
         <item name="android:textColor">@color/main_blue_color</item>
     </style>
 
+    <style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
+        <item name="android:gravity">center</item>
+        <item name="android:textAlignment">gravity</item>
+    </style>
 
 </resources>

+ 1 - 1
base-lib/src/main/java/com/sjkj/base_lib/view/BaseActivity.java

@@ -55,7 +55,7 @@ public abstract class BaseActivity extends AppCompatActivity implements BaseCall
         appManager.addActivity(this);
         initBinding();
         initBindingView(savedInstanceState);
-        initActionBar();
+       // initActionBar();
         initView();
         initListener();
         loadData();

+ 2 - 2
config.gradle

@@ -5,8 +5,8 @@ ext {
             minSdkVersion    : 21,
             targetSdkVersion : 31,
             compileSdkVersion: 30,
-            versionCode      : 10403,
-            versionName      : "1.4.3",
+            versionCode      : 10404,
+            versionName      : "1.4.4",
     ]
 
     //Libraries

+ 1 - 0
meantest/.gitignore

@@ -0,0 +1 @@
+/build

+ 39 - 0
meantest/build.gradle

@@ -0,0 +1,39 @@
+apply plugin: 'com.android.library'
+group='com.github.kezhangzhao'
+
+android {
+    compileSdkVersion 30
+
+    defaultConfig {
+        minSdkVersion 19
+        targetSdkVersion 30
+        versionCode 1
+        versionName "1.0"
+
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility = '1.8'
+        targetCompatibility = '1.8'
+    }
+
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+    implementation 'androidx.appcompat:appcompat:1.3.1'
+    implementation 'com.google.android.material:material:1.2.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+    testImplementation 'junit:junit:4.12'
+    androidTestImplementation 'com.android.support.test:runner:1.0.2'
+    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+}

+ 21 - 0
meantest/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 26 - 0
meantest/src/androidTest/java/com/bit/meantest/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package com.bit.meantest;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getTargetContext();
+
+        assertEquals("com.bit.meantest.test", appContext.getPackageName());
+    }
+}

+ 2 - 0
meantest/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.bit.meantest" />

+ 182 - 0
meantest/src/main/java/com/bit/meantest/BottomBarAdapter.java

@@ -0,0 +1,182 @@
+package com.bit.meantest;
+
+import android.content.Context;
+
+import android.util.TypedValue;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * author : zhangzhao.ke
+ * time   : 2018/06/11
+ * desc   : 自定义底部菜单
+ */
+
+public class BottomBarAdapter extends RecyclerView.Adapter {
+
+    private Context mContext;
+    private LayoutInflater inflater ;
+    private List<BottomBean> listBean= new ArrayList<>();
+    private int selectPosition=0;
+    private OnMyItemClickListener listener;//item点击事件监听
+    private int selectTextColor = R.color.theme;
+    private int unSelectTextColor = R.color.black_33;
+    private int unReadNumTextColor = R.color.white;
+    private int unReadNumBackground= R.drawable.circle_red_unread_8dp;
+
+    BottomBarAdapter(Context context) {
+        this.mContext = context;
+        this.inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+    }
+
+
+
+    /**
+     * 设置底部菜单数据
+     * @param list 数据
+     */
+    public void setData(List<BottomBean> list){
+        listBean.clear();
+        listBean.addAll(list);
+        notifyDataSetChanged();
+    }
+
+    @NonNull
+    @Override
+    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+        return new MyViewHolder(inflater.inflate(R.layout.bottom_bar_item, parent, false));
+    }
+
+    @Override
+    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
+        MyViewHolder viewHolder = (MyViewHolder) holder;
+        BottomBean bottomBean = listBean.get(position);
+        if (position==selectPosition) {
+            viewHolder.ivPicture.setImageResource(bottomBean.getIvSelectID());
+            viewHolder.tvTextStr.setTextColor(bottomBean.getTvSelectID());
+
+        }else {
+            viewHolder.ivPicture.setImageResource(bottomBean.getIvUnSelectID());
+            viewHolder.tvTextStr.setTextColor(bottomBean.getTvUnSelectID());
+        }
+        if (bottomBean.getUnReadNum()!=0) {
+            if (bottomBean.getUnReadNum()<100) {
+                viewHolder.tvUnReadNum.setText(String.valueOf(bottomBean.getUnReadNum()));
+                viewHolder.tvUnReadNum.setTextSize(TypedValue.COMPLEX_UNIT_DIP,10);
+            }else {
+                viewHolder.tvUnReadNum.setText("···");
+                viewHolder.tvUnReadNum.setTextSize(TypedValue.COMPLEX_UNIT_DIP,13);
+            }
+            viewHolder.tvUnReadNum.setVisibility(View.VISIBLE);
+        }else {
+            viewHolder.tvUnReadNum.setVisibility(View.GONE);
+        }
+        viewHolder.tvTextStr.setText(bottomBean.getBottomText());
+        viewHolder.tvUnReadNum.setTextColor(mContext.getResources().getColor(unReadNumTextColor));
+        viewHolder.tvUnReadNum.setBackgroundResource(unReadNumBackground);
+        if (listener!=null){//设置监听
+            viewHolder.llItemView.setOnClickListener(view -> {
+                listener.itemClick(view,position);
+                setSelectPosition(position);
+            });
+        }
+    }
+
+    @Override
+    public int getItemCount() {
+        return listBean.size();
+    }
+
+    /**
+     * item点击事件监听
+     */
+    public interface OnMyItemClickListener{
+        void itemClick(View view, int position);
+    }
+
+    /**
+     * 设置item监听
+     * @param listener OnMyItemClickListener
+     */
+    public void setOnMyItemClickListener (OnMyItemClickListener listener){
+        this.listener = listener;
+    }
+
+
+    public void setSelectPosition(int position){
+        this.selectPosition = position;
+        notifyDataSetChanged();
+    }
+
+    /**
+     * 设置选中文字的颜色
+     * @param colorId 颜色id
+     */
+    public void setSelectTextColor(int colorId){
+        this.selectTextColor = colorId;
+    }
+
+
+    /**
+     * 设置未选中文字的颜色
+     * @param colorId 颜色id
+     */
+    public void setUnSelectTextColor(int colorId){
+        this.unSelectTextColor = colorId;
+    }
+
+    /**
+     * 设置未读消息数量
+     * @param position 底部菜单第几个
+     * @param num 未读消息数量
+     */
+    public void setUnReadNum(int position,int num){
+        listBean.get(position).setUnReadNum(num);
+        notifyDataSetChanged();
+    }
+
+    /**
+     * 设置未读消息字体颜色
+     * @param colorId 颜色id
+     */
+    public void setUnReadNumTextColor(int colorId){
+        this.unReadNumTextColor= colorId;
+    }
+
+    /**
+     * 设置未读消息背景颜色
+     * @param background 背景资源
+     */
+    public void setUnReadNumBackground(int background){
+        this.unReadNumBackground = background;
+    }
+
+    /**
+     * adapter的ViewHolder
+     */
+    class MyViewHolder extends RecyclerView.ViewHolder {
+
+        ImageView ivPicture;
+        TextView tvTextStr;
+        TextView tvUnReadNum;
+        LinearLayout llItemView;
+
+        private MyViewHolder(View itemView) {
+            super(itemView);
+            ivPicture = itemView.findViewById(R.id.iv_picture);
+            tvTextStr = itemView.findViewById(R.id.tv_text_str);
+            tvUnReadNum = itemView.findViewById(R.id.tv_unread_num);
+            llItemView = itemView.findViewById(R.id.ll_item_view);
+        }
+    }
+}

+ 138 - 0
meantest/src/main/java/com/bit/meantest/BottomBarView.java

@@ -0,0 +1,138 @@
+package com.bit.meantest;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.LinearLayout;
+
+import java.util.List;
+
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * author : zhangzhao.ke
+ * time   : 2018/06/11
+ * desc   : 底部菜单自定义view
+ */
+
+public class BottomBarView extends LinearLayout {
+
+    private Context mContext;
+    private RecyclerView rvBottombar;
+    private BottomBarAdapter bottombarAdapter;
+    private GridLayoutManager gridLayoutManager;
+
+    public BottomBarView(Context context) {
+        super(context);
+        mContext = context;
+        initView();
+    }
+
+    public BottomBarView(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+        mContext = context;
+        initView();
+    }
+
+    /**
+     * 初始化
+     */
+    private void initView() {
+        LayoutInflater.from(mContext).inflate(R.layout.view_bottombar, this);
+        rvBottombar = findViewById(R.id.rv_bottom_bar);
+        gridLayoutManager = new GridLayoutManager(mContext, 4);
+        rvBottombar.setLayoutManager(gridLayoutManager);
+        bottombarAdapter = new BottomBarAdapter(mContext);
+        rvBottombar.setAdapter(bottombarAdapter);
+        rvBottombar.setItemAnimator(new DefaultItemAnimator());
+    }
+
+
+    /**
+     * 设置底部菜单数据 (选中图片、非选中图片、文字、未读数量)
+     *
+     * @param list 数据
+     */
+    public void setData(List<BottomBean> list) {
+        if (list != null && list.size() > 0) {
+            gridLayoutManager.setSpanCount(list.size());
+            bottombarAdapter.setData(list);
+        }
+    }
+
+    /**
+     * 设置item点击事件
+     *
+     * @param listener OnMyItemClickListener
+     */
+    public void setOnMyItemClickListener(BottomBarAdapter.OnMyItemClickListener listener) {
+        bottombarAdapter.setOnMyItemClickListener(listener);
+    }
+
+    /**
+     * 设置选中
+     *
+     * @param position 第几个
+     */
+    public void setSelectPosition(int position) {
+        bottombarAdapter.setSelectPosition(position);
+    }
+
+    /**
+     * 设置选中文字的颜色
+     *
+     * @param colorId 颜色id
+     */
+    public void setSelectTextColor(int colorId) {
+        bottombarAdapter.setSelectTextColor(colorId);
+    }
+
+    /**
+     * 设置未选中文字的颜色
+     *
+     * @param colorId 颜色id
+     */
+    public void setUnSelectTextColor(int colorId) {
+        bottombarAdapter.setUnSelectTextColor(colorId);
+    }
+
+    /**
+     * 设置未读消息数量
+     *
+     * @param position 底部菜单第几个
+     * @param num      未读消息数量
+     */
+    public void setUnReadNum(int position, int num) {
+        bottombarAdapter.setUnReadNum(position, num);
+    }
+
+    /**
+     * 设置未读消息字体颜色
+     *
+     * @param colorId 颜色id
+     */
+    public void setUnReadNumTextColor(int colorId) {
+        bottombarAdapter.setUnReadNumTextColor(colorId);
+    }
+
+    /**
+     * 设置未读消息背景颜色
+     *
+     * @param background 背景资源
+     */
+    public void setUnReadNumBackground(int background) {
+        bottombarAdapter.setUnReadNumBackground(background);
+    }
+
+    /**
+     * 设置背景颜色
+     *
+     * @param background 背景资源
+     */
+    public void setViewBackgroundResource(int background) {
+        setBackgroundResource(background);
+    }
+}

+ 63 - 0
meantest/src/main/java/com/bit/meantest/BottomBean.java

@@ -0,0 +1,63 @@
+package com.bit.meantest;
+
+
+
+public class BottomBean {
+
+    private int ivSelectID;//选中图片id
+    private int ivUnSelectID;//非选中图片id
+    private String bottomText;//图片下面文字
+    private int unReadNum;//未读数量
+    private int tvSelectID;//选中文字id
+
+    public int getTvSelectID() {
+        return tvSelectID;
+    }
+
+    public void setTvSelectID(int tvSelectID) {
+        this.tvSelectID = tvSelectID;
+    }
+
+    public int getTvUnSelectID() {
+        return tvUnSelectID;
+    }
+
+    public void setTvUnSelectID(int tvUnSelectID) {
+        this.tvUnSelectID = tvUnSelectID;
+    }
+
+    private int tvUnSelectID;//非选中文字id
+
+
+    public int getIvSelectID() {
+        return ivSelectID;
+    }
+
+    public void setIvSelectID(int ivSelectID) {
+        this.ivSelectID = ivSelectID;
+    }
+
+    public int getIvUnSelectID() {
+        return ivUnSelectID;
+    }
+
+    public void setIvUnSelectID(int ivUnSelectID) {
+        this.ivUnSelectID = ivUnSelectID;
+    }
+
+    public String getBottomText() {
+        return bottomText;
+    }
+
+    public void setBottomText(String bottomText) {
+        this.bottomText = bottomText;
+    }
+
+    public int getUnReadNum() {
+        return unReadNum;
+    }
+
+    public void setUnReadNum(int unReadNum) {
+        this.unReadNum = unReadNum;
+    }
+}

+ 9 - 0
meantest/src/main/res/drawable/circle_red_unread_8dp.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval"
+    android:useLevel="false" >
+    <solid android:color="@color/red_unread_num" />
+    <size android:width="7.5dp"
+        android:height="7.5dp" />
+</shape>

+ 45 - 0
meantest/src/main/res/layout/bottom_bar_item.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/ll_item_view"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal">
+
+        <ImageView
+            android:id="@+id/iv_picture"
+            android:layout_width="wrap_content"
+            android:scaleType="fitXY"
+            android:layout_height="wrap_content"
+            android:contentDescription="@null"
+            />
+
+        <TextView
+            android:id="@+id/tv_unread_num"
+            android:layout_width="15dp"
+            android:layout_height="15dp"
+            android:layout_marginTop="2dp"
+            android:layout_alignEnd="@+id/iv_picture"
+            android:background="@drawable/circle_red_unread_8dp"
+            android:gravity="center"
+            android:includeFontPadding="false"
+            android:textColor="@color/white"
+            android:textSize="10sp"
+            tools:text="···" />
+    </RelativeLayout>
+
+    <TextView
+        android:id="@+id/tv_text_str"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="5dp"
+        android:textColor="@color/black_33"
+        android:textSize="13sp" />
+</LinearLayout>

+ 8 - 0
meantest/src/main/res/layout/view_bottombar.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.recyclerview.widget.RecyclerView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/rv_bottom_bar"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center"
+    android:overScrollMode="never"/>

+ 10 - 0
meantest/src/main/res/values/colors.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#008577</color>
+    <color name="colorPrimaryDark">#00574B</color>
+    <color name="colorAccent">#D81B60</color>
+    <color name="white">#FFFFFF</color>
+    <color name="theme">#ff9805</color>
+    <color name="black_33">#333333</color>
+    <color name="red_unread_num">#FC3D39</color>
+</resources>

+ 3 - 0
meantest/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">meantest</string>
+</resources>

+ 17 - 0
meantest/src/test/java/com/bit/meantest/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.bit.meantest;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 2 - 1
settings.gradle

@@ -27,4 +27,5 @@ dependencyResolutionManagement {
 }
 rootProject.name = "AppThreeFloor"
 include ':app'
-include ':base-lib'
+include ':base-lib'
+include ':meantest'