yanghuaxiong пре 3 година
комит
e0e8ba503a
100 измењених фајлова са 8590 додато и 0 уклоњено
  1. 15 0
      .gitignore
  2. 1 0
      app/.gitignore
  3. 66 0
      app/build.gradle
  4. 21 0
      app/proguard-rules.pro
  5. 26 0
      app/src/androidTest/java/com/yhx/union/ExampleInstrumentedTest.java
  6. 37 0
      app/src/main/AndroidManifest.xml
  7. 38 0
      app/src/main/java/com/yhx/union/GroupFragment.java
  8. 194 0
      app/src/main/java/com/yhx/union/HomeFragment.java
  9. 90 0
      app/src/main/java/com/yhx/union/MainActivity.java
  10. 37 0
      app/src/main/java/com/yhx/union/MyFragment.java
  11. 34 0
      app/src/main/java/com/yhx/union/UnionFragment.java
  12. 128 0
      app/src/main/java/com/yhx/union/activity/NewListActivity.java
  13. 93 0
      app/src/main/java/com/yhx/union/adapter/NewAdapter.java
  14. 99 0
      app/src/main/java/com/yhx/union/custom_view/CusItemDecoration.java
  15. 654 0
      app/src/main/java/com/yhx/union/custom_view/CustomDatePicker.java
  16. 342 0
      app/src/main/java/com/yhx/union/custom_view/DatePickerView.java
  17. 34 0
      app/src/main/java/com/yhx/union/custom_view/NeverScrollGridView.java
  18. 30 0
      app/src/main/java/com/yhx/union/custom_view/NeverScrollListView.java
  19. 120 0
      app/src/main/java/com/yhx/union/custom_view/RatingBarView.java
  20. 154 0
      app/src/main/java/com/yhx/union/custom_view/RoundImageView.java
  21. 65 0
      app/src/main/java/com/yhx/union/dialog/SessionPromptDialog.java
  22. 135 0
      app/src/main/java/com/yhx/union/entity/BannerEntity.java
  23. 59 0
      app/src/main/java/com/yhx/union/entity/BaseResponse.java
  24. 136 0
      app/src/main/java/com/yhx/union/entity/NewBean.java
  25. 92 0
      app/src/main/java/com/yhx/union/entity/request/BaseRequest.java
  26. 31 0
      app/src/main/java/com/yhx/union/entity/request/NewListRequest.java
  27. 23 0
      app/src/main/java/com/yhx/union/entity/request/Request.java
  28. 72 0
      app/src/main/java/com/yhx/union/public_store/AppDataFile.java
  29. 47 0
      app/src/main/java/com/yhx/union/public_store/AppInfoUitl.java
  30. 130 0
      app/src/main/java/com/yhx/union/public_store/BasePreferences.java
  31. 260 0
      app/src/main/java/com/yhx/union/public_store/CFileDownLoad.java
  32. 21 0
      app/src/main/java/com/yhx/union/public_store/CacheUtils.java
  33. 12 0
      app/src/main/java/com/yhx/union/public_store/ConstDefine.java
  34. 211 0
      app/src/main/java/com/yhx/union/public_store/CrashHandler.java
  35. 74 0
      app/src/main/java/com/yhx/union/public_store/Des3Util.java
  36. 108 0
      app/src/main/java/com/yhx/union/public_store/FNNetwork.java
  37. 37 0
      app/src/main/java/com/yhx/union/public_store/LogUtils.java
  38. 14 0
      app/src/main/java/com/yhx/union/public_store/MyAppGlideModule.java
  39. 57 0
      app/src/main/java/com/yhx/union/public_store/PhoneFormatCheckUtils.java
  40. 87 0
      app/src/main/java/com/yhx/union/public_store/PropertyTypeUtil.java
  41. 46 0
      app/src/main/java/com/yhx/union/public_store/RootUtil.java
  42. 173 0
      app/src/main/java/com/yhx/union/public_store/SPUtils.java
  43. 44 0
      app/src/main/java/com/yhx/union/public_store/ScreenUtils.java
  44. 751 0
      app/src/main/java/com/yhx/union/public_store/TimeUtil.java
  45. 124 0
      app/src/main/java/com/yhx/union/public_store/UtilSD.java
  46. 210 0
      app/src/main/java/com/yhx/union/public_store/fragment/FragmentPager.java
  47. 31 0
      app/src/main/java/com/yhx/union/public_store/fragment/FragmentPagerAdapter.java
  48. 99 0
      app/src/main/java/com/yhx/union/public_store/fragment/FragmentTab.java
  49. 280 0
      app/src/main/java/com/yhx/union/public_store/fragment/FragmentVisitor.java
  50. 95 0
      app/src/main/java/com/yhx/union/public_store/retrofit/RetrofitUtils.java
  51. 25 0
      app/src/main/java/com/yhx/union/public_store/retrofit/UnionServices.java
  52. 17 0
      app/src/main/java/com/yhx/union/public_store/rx/ApiThrowableExceptionFunc.java
  53. 83 0
      app/src/main/java/com/yhx/union/public_store/rx/DefaultSubscriber.java
  54. 166 0
      app/src/main/java/com/yhx/union/public_store/rx/ExceptionHandle.java
  55. 24 0
      app/src/main/java/com/yhx/union/public_store/rx/NetWorkErrorException.java
  56. 65 0
      app/src/main/java/com/yhx/union/public_store/rx/ProgressSubscriber.java
  57. 17 0
      app/src/main/java/com/yhx/union/public_store/rx/ResponseFunc.java
  58. 49 0
      app/src/main/java/com/yhx/union/public_store/rx/SchedulersCompat.java
  59. 125 0
      app/src/main/java/com/yhx/union/public_store/statusbarutil/OSUtils.java
  60. 167 0
      app/src/main/java/com/yhx/union/public_store/statusbarutil/StatusBarHelper.java
  61. 161 0
      app/src/main/java/com/yhx/union/public_store/statusbarutil/StatusBarUtil.java
  62. 106 0
      app/src/main/java/com/yhx/union/public_store/statusbarutil/SystemBarTintManager.java
  63. 177 0
      app/src/main/java/com/yhx/union/system/BaseActivity.java
  64. 122 0
      app/src/main/java/com/yhx/union/system/BaseFragment.java
  65. 70 0
      app/src/main/java/com/yhx/union/system/HodingView.java
  66. 67 0
      app/src/main/java/com/yhx/union/system/HodingViewDialog.java
  67. 145 0
      app/src/main/java/com/yhx/union/system/MyApplication.java
  68. 158 0
      app/src/main/java/com/yhx/union/system/WebviewActivity.java
  69. 30 0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  70. 5 0
      app/src/main/res/drawable/drawable_orang_radius_top_5.xml
  71. 7 0
      app/src/main/res/drawable/drawable_orange_oval.xml
  72. 6 0
      app/src/main/res/drawable/drawable_orange_stroke_radius.xml
  73. 6 0
      app/src/main/res/drawable/drawable_orange_stroke_radius5.xml
  74. 38 0
      app/src/main/res/drawable/drawable_raduis_dialogviewhandler.xml
  75. BIN
      app/src/main/res/drawable/empty_photo.png
  76. 170 0
      app/src/main/res/drawable/ic_launcher_background.xml
  77. 39 0
      app/src/main/res/drawable/progressbar_viewhandler.xml
  78. 5 0
      app/src/main/res/drawable/tagpage_group.xml
  79. 5 0
      app/src/main/res/drawable/tagpage_home.xml
  80. 5 0
      app/src/main/res/drawable/tagpage_personal.xml
  81. 5 0
      app/src/main/res/drawable/tagpage_union.xml
  82. 73 0
      app/src/main/res/layout/activity_main.xml
  83. 22 0
      app/src/main/res/layout/activity_new_list.xml
  84. 23 0
      app/src/main/res/layout/activity_webview.xml
  85. 146 0
      app/src/main/res/layout/custom_date_picker.xml
  86. 46 0
      app/src/main/res/layout/dialog_session_timeout_prompt.xml
  87. 10 0
      app/src/main/res/layout/fragment_group.xml
  88. 250 0
      app/src/main/res/layout/fragment_home.xml
  89. 11 0
      app/src/main/res/layout/fragment_my.xml
  90. 10 0
      app/src/main/res/layout/fragment_union.xml
  91. 59 0
      app/src/main/res/layout/include_title.xml
  92. 51 0
      app/src/main/res/layout/item_new.xml
  93. 39 0
      app/src/main/res/layout/layout_majortab.xml
  94. 38 0
      app/src/main/res/layout/layout_viewhandler.xml
  95. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  96. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  97. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  98. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  99. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  100. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png

+ 15 - 0
.gitignore

@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties

+ 1 - 0
app/.gitignore

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

+ 66 - 0
app/build.gradle

@@ -0,0 +1,66 @@
+plugins {
+    id 'com.android.application'
+}
+
+android {
+    compileSdkVersion 30
+    buildToolsVersion "30.0.3"
+    defaultConfig {
+        applicationId "com.yhx.union"
+        minSdkVersion 19
+        targetSdkVersion 30
+        versionCode 1
+        versionName "1.0"
+
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+}
+
+dependencies {
+
+    implementation 'androidx.appcompat:appcompat:1.1.0'
+    implementation 'com.google.android.material:material:1.1.0'
+    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+    testImplementation 'junit:junit:4.+'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+    //图片加载框架
+    implementation 'com.github.bumptech.glide:glide:4.12.0'
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
+    implementation 'com.github.bumptech.glide:okhttp3-integration:4.12.0'
+    //butterknife
+    implementation 'com.jakewharton:butterknife:10.0.0'
+    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
+    //rxjava2
+    implementation 'io.reactivex.rxjava2:rxjava:2.1.3'
+    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
+    //retrofit2
+    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
+    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
+    //okhttp3
+    implementation 'com.squareup.okhttp3:okhttp:4.2.2'
+    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
+    //控制Rxjava生命周期
+    implementation 'com.uber.autodispose:autodispose:0.8.0'
+    implementation 'com.uber.autodispose:autodispose-android-archcomponents:0.8.0'
+    //下拉刷新上拉加载更多
+    implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1'      //核心必须依赖
+    implementation 'com.scwang.smart:refresh-header-material:2.0.1'    //经典刷新头
+    implementation 'com.scwang.smart:refresh-footer-classics:2.0.1'    //经典加载
+    //轮播图
+    implementation 'cn.bingoogolapple:bga-banner:2.1.7@aar'
+    //gson
+    implementation 'com.google.code.gson:gson:2.8.0'
+}

+ 21 - 0
app/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
app/src/androidTest/java/com/yhx/union/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package com.yhx.union;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
+        assertEquals("com.yhx.union", appContext.getPackageName());
+    }
+}

+ 37 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.yhx.union">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
+    <uses-permission android:name="android.permission.CALL_PHONE" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.FLASHLIGHT" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <application
+        android:allowBackup="true"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:largeHeap="true"
+        android:requestLegacyExternalStorage="true"
+        android:roundIcon="@mipmap/ic_launcher"
+        android:supportsRtl="true"
+        android:usesCleartextTraffic="true"
+        android:name=".system.MyApplication"
+        android:theme="@style/AppTheme">
+        <activity android:name=".MainActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".system.WebviewActivity" />
+        <activity android:name=".activity.NewListActivity" />
+    </application>
+
+</manifest>

+ 38 - 0
app/src/main/java/com/yhx/union/GroupFragment.java

@@ -0,0 +1,38 @@
+package com.yhx.union;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.yhx.union.system.BaseFragment;
+import butterknife.ButterKnife;
+import io.reactivex.annotations.Nullable;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/1 11:44 AM
+ *
+ */
+
+public class GroupFragment extends BaseFragment {
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        setHasOptionsMenu(true);
+        View view = inflater.inflate(R.layout.fragment_group, container, false);
+        ButterKnife.bind(this, view);
+
+
+
+        return view;
+    }
+
+
+
+}

+ 194 - 0
app/src/main/java/com/yhx/union/HomeFragment.java

@@ -0,0 +1,194 @@
+package com.yhx.union;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.uber.autodispose.AutoDispose;
+import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider;
+import com.yhx.union.activity.NewListActivity;
+import com.yhx.union.adapter.NewAdapter;
+import com.yhx.union.entity.BannerEntity;
+import com.yhx.union.entity.BaseResponse;
+import com.yhx.union.entity.NewBean;
+import com.yhx.union.entity.request.NewListRequest;
+import com.yhx.union.public_store.ConstDefine;
+import com.yhx.union.public_store.retrofit.RetrofitUtils;
+import com.yhx.union.public_store.retrofit.UnionServices;
+import com.yhx.union.public_store.rx.DefaultSubscriber;
+import com.yhx.union.system.BaseFragment;
+import com.yhx.union.system.WebviewActivity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import cn.bingoogolapple.bgabanner.BGABanner;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.annotations.Nullable;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2021/9/1 11:44 AM
+ */
+
+public class HomeFragment extends BaseFragment {
+    @BindView(R.id.bga_banner)
+    BGABanner bgaBanner;
+    @BindView(R.id.recyclerView)
+    RecyclerView recyclerView;
+
+    private List<BannerEntity> bannerEntities = new ArrayList<>();
+    private List<NewBean> beans = new ArrayList<>();
+    private NewAdapter adapter;
+    private UnionServices services;
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        setHasOptionsMenu(true);
+        View view = inflater.inflate(R.layout.fragment_home, container, false);
+        ButterKnife.bind(this, view);
+        init();
+        return view;
+    }
+
+    private void init(){
+        services = RetrofitUtils.createApi(UnionServices.class, ConstDefine.HttpAdress);
+        bgaBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {
+            @Override
+            public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
+                Glide.with(getActivity())
+                        .load(model)
+                        .placeholder(R.mipmap.bg_placeholder)
+                        .error(R.mipmap.bg_placeholder)
+                        .diskCacheStrategy(DiskCacheStrategy.ALL)
+                        .centerCrop()
+                        .dontAnimate()
+                        .into(itemView);
+            }
+        });
+        bgaBanner.setDelegate(new BGABanner.Delegate() {
+            @Override
+            public void onBannerItemClick(BGABanner banner, View itemView, Object model, int position) {
+                if (bannerEntities != null && bannerEntities.size() > 0) {
+                    BannerEntity entity = bannerEntities.get(position);
+                    Intent intent = new Intent();
+                    intent.setClass(getActivity(), WebviewActivity.class);
+                    intent.putExtra("url", entity.getWxurl());
+                    intent.putExtra("title", "工会新闻");
+                    startActivity(intent);
+                }
+            }
+        });
+
+        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
+        adapter = new NewAdapter(getActivity(), beans);
+        adapter.setOnItemClickListener(new NewAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(View view, NewBean entity) {
+                Intent intent = new Intent();
+                intent.setClass(getActivity(), WebviewActivity.class);
+                intent.putExtra("url", entity.getWxurl());
+                intent.putExtra("title", "工会新闻");
+                startActivity(intent);
+            }
+        });
+        recyclerView.setAdapter(adapter);
+        getBanners();
+        querynewlist();
+    }
+    @OnClick({R.id.function01, R.id.function02, R.id.function03, R.id.function04, R.id.function05, R.id.function06, R.id.function07, R.id.function08})
+    public void onClick(View view) {
+        Intent intent = new Intent();
+        switch (view.getId()) {
+            case R.id.function01:
+                intent.setClass(getActivity(), NewListActivity.class);
+                startActivity(intent);
+                break;
+            case R.id.function02:
+                break;
+            case R.id.function03:
+                break;
+            case R.id.function04:
+                break;
+            case R.id.function05:
+                break;
+            case R.id.function06:
+                break;
+            case R.id.function07:
+                break;
+            case R.id.function08:
+                break;
+        }
+    }
+
+    /**
+     * 加载广告
+     */
+    private void getBanners() {
+        //4-主页广告 5-餐饮广告,6-医疗广告,7-出行广告,8-物业广告
+        services.querytitlelist()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .as(AutoDispose.<BaseResponse<List<BannerEntity>>>autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)))
+                .subscribe(new DefaultSubscriber<BaseResponse<List<BannerEntity>>>(getActivity()) {
+                    @Override
+                    public void success(BaseResponse<List<BannerEntity>> value) {
+                        bannerEntities = value.getResultData();
+                        List<String> urls = new ArrayList<>();
+                        List<String> titles = new ArrayList<>();
+                        if (value.getResultData() != null) {
+                            for (BannerEntity entity : value.getResultData()) {
+                                if (!TextUtils.isEmpty(entity.getPicurl())) {
+                                    urls.add(entity.getPicurl());
+                                    titles.add(entity.getWxtitle());
+                                }
+                            }
+                            bgaBanner.setData(urls, titles);
+                        }
+                    }
+
+                });
+    }
+
+    //加载新闻
+    private void querynewlist() {
+        NewListRequest request = new NewListRequest();
+        request.setPageNum(1);
+        request.setPageSize(5);
+        services.querynewlist(request)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .as(AutoDispose.<BaseResponse<List<NewBean>>>autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)))
+                .subscribe(new DefaultSubscriber<BaseResponse<List<NewBean>>>(getActivity()) {
+                    @Override
+                    public void success(BaseResponse<List<NewBean>> value) {
+                        beans.clear();
+                        beans.addAll(value.getResultData());
+                        adapter.notifyDataSetChanged();
+                    }
+
+                });
+    }
+}

+ 90 - 0
app/src/main/java/com/yhx/union/MainActivity.java

@@ -0,0 +1,90 @@
+package com.yhx.union;
+
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.widget.FrameLayout;
+
+import androidx.fragment.app.Fragment;
+
+import com.yhx.union.public_store.fragment.FragmentTab;
+import com.yhx.union.public_store.fragment.FragmentVisitor;
+import com.yhx.union.system.BaseActivity;
+
+import butterknife.BindView;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/1 11:43 AM
+ *
+ */
+public class MainActivity extends BaseActivity implements FragmentVisitor.FragmentVisitorListener {
+
+    @BindView(R.id.fragment_continer)
+    FrameLayout fragmentContiner;
+    @BindView(R.id.mt_home)
+    FragmentTab mtHome;
+    @BindView(R.id.mt_union)
+    FragmentTab mtUnion;
+    @BindView(R.id.mt_group)
+    FragmentTab mtGroup;
+    @BindView(R.id.mt_personal)
+    FragmentTab mtPersonal;
+    public FragmentVisitor fragmentVisitor;
+    public int currIndex = 0;
+    private FragmentTab[] majorTabs;
+    private Class<? extends Fragment>[] fragments;
+    private long exit_time;
+
+
+    @Override
+    public int getContentViewLayoutID() {
+        return R.layout.activity_main;
+    }
+
+    @Override
+    public void bindViewAndEvent(Bundle savedInstanceState) {
+        init();
+    }
+    private void init() {
+        fragmentContiner.removeAllViews();
+        fragmentVisitor = new FragmentVisitor();
+        majorTabs = new FragmentTab[]{mtHome, mtUnion, mtGroup, mtPersonal};
+        fragments = new Class[]{HomeFragment.class, UnionFragment.class, GroupFragment.class, MyFragment.class};
+        fragmentVisitor.init(getSupportFragmentManager(), this)
+                .setFragmentContiner(R.id.fragment_continer)
+                .setTabAndFragmentData(majorTabs, fragments);
+        fragmentVisitor.setCurrentItem(0);
+
+    }
+    @Override
+    public void onItemChanged(int oldItem, int newItem, String tabDiscription) {
+        currIndex = newItem;
+    }
+
+    @Override
+    public boolean boforeItemChangedItemEnable(int currentItem, int newItem) {
+
+        return true;
+    }
+
+    @Override
+    public void controlItemEnable(boolean enable) {
+
+    }
+
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_BACK) {// 是后退键
+            long temp = System.currentTimeMillis();
+            if (temp - exit_time <= 3000) {
+                finish(); // 主界面退出
+            } else {
+                exit_time = temp;
+                showSnackBar("再按一次退出程序");
+            }
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+}

+ 37 - 0
app/src/main/java/com/yhx/union/MyFragment.java

@@ -0,0 +1,37 @@
+package com.yhx.union;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.yhx.union.system.BaseFragment;
+
+import butterknife.ButterKnife;
+import io.reactivex.annotations.Nullable;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/1 11:44 AM
+ *
+ */
+
+public class MyFragment extends BaseFragment {
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        setHasOptionsMenu(true);
+        View view = inflater.inflate(R.layout.fragment_my, container, false);
+        ButterKnife.bind(this, view);
+
+
+
+        return view;
+    }
+
+}

+ 34 - 0
app/src/main/java/com/yhx/union/UnionFragment.java

@@ -0,0 +1,34 @@
+package com.yhx.union;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.yhx.union.system.BaseFragment;
+
+import butterknife.ButterKnife;
+import io.reactivex.annotations.Nullable;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/1 11:44 AM
+ *
+ */
+public class UnionFragment extends BaseFragment {
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Nullable
+    @Override
+    public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+        setHasOptionsMenu(true);
+        View view = inflater.inflate(R.layout.fragment_union, container, false);
+        ButterKnife.bind(this, view);
+        return view;
+    }
+
+
+}

+ 128 - 0
app/src/main/java/com/yhx/union/activity/NewListActivity.java

@@ -0,0 +1,128 @@
+package com.yhx.union.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+import com.uber.autodispose.AutoDispose;
+import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider;
+import com.yhx.union.R;
+import com.yhx.union.adapter.NewAdapter;
+import com.yhx.union.entity.BaseResponse;
+import com.yhx.union.entity.NewBean;
+import com.yhx.union.entity.request.NewListRequest;
+import com.yhx.union.public_store.ConstDefine;
+import com.yhx.union.public_store.retrofit.RetrofitUtils;
+import com.yhx.union.public_store.retrofit.UnionServices;
+import com.yhx.union.public_store.rx.DefaultSubscriber;
+import com.yhx.union.system.BaseActivity;
+import com.yhx.union.system.WebviewActivity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * 描述:
+ *
+ * @author yhx
+ * @create 2021/9/2  8:57 AM
+ */
+public class NewListActivity extends BaseActivity {
+    @BindView(R.id.recyclerView)
+    RecyclerView recyclerView;
+    @BindView(R.id.refreshLayout)
+    SmartRefreshLayout refreshLayout;
+    private NewAdapter mAdapter;
+    private List<NewBean> newBeans = new ArrayList<>();
+    private UnionServices services;
+    private int pageNo = 1, stepSize = 10;
+    private boolean isHasMore = false;
+
+    @Override
+    public int getContentViewLayoutID() {
+        return R.layout.activity_new_list;
+    }
+
+    @Override
+    public void bindViewAndEvent(Bundle savedInstanceState) {
+        initTitle("工会新闻");
+        services = RetrofitUtils.createApi(UnionServices.class, ConstDefine.HttpAdress);
+        recyclerView.setLayoutManager(new LinearLayoutManager(this));
+        mAdapter = new NewAdapter(this, newBeans);
+        mAdapter.setOnItemClickListener(new NewAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(View view, NewBean entity) {
+                Intent intent = new Intent();
+                intent.setClass(NewListActivity.this, WebviewActivity.class);
+                intent.putExtra("url", entity.getWxurl());
+                intent.putExtra("title", "工会新闻");
+                startActivity(intent);
+            }
+        });
+        recyclerView.setAdapter(mAdapter);
+        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(RefreshLayout refreshLayout) {
+                pageNo = 1;
+                loadDate();
+            }
+        });
+
+        refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
+            @Override
+            public void onLoadMore(RefreshLayout refreshLayout) {
+                loadDate();
+            }
+        });
+        refreshLayout.autoRefresh();
+    }
+    //加载新闻
+    private void loadDate() {
+        NewListRequest request = new NewListRequest();
+        request.setPageNum(1);
+        request.setPageSize(5);
+        services.querynewlist(request)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .as(AutoDispose.<BaseResponse<List<NewBean>>>autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)))
+                .subscribe(new DefaultSubscriber<BaseResponse<List<NewBean>>>(this) {
+                    @Override
+                    public void success(BaseResponse<List<NewBean>> value) {
+                        if (value.getResultData() != null) {
+                            List<NewBean> beanList = value.getResultData();
+                            if (beanList != null) {
+                                if (pageNo == 1) {
+                                    newBeans.clear();
+                                }
+                                if (beanList.size() == stepSize) {
+                                    isHasMore = true;
+                                    pageNo++;
+                                } else {
+                                    isHasMore = false;
+                                }
+                                newBeans.addAll(beanList);
+                            } else {
+                                isHasMore = false;
+                            }
+                        } else {
+                            showSnackBar("加载失败");
+                        }
+                        mAdapter.notifyDataSetChanged();
+                        refreshComplete(refreshLayout, isHasMore);
+                    }
+
+                });
+    }
+}

+ 93 - 0
app/src/main/java/com/yhx/union/adapter/NewAdapter.java

@@ -0,0 +1,93 @@
+package com.yhx.union.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+import com.yhx.union.R;
+import com.yhx.union.custom_view.RoundImageView;
+import com.yhx.union.entity.NewBean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/5/3 下午4:40
+ */
+public class NewAdapter extends RecyclerView.Adapter<NewAdapter.ViewHolder> {
+
+    Context mContext;
+    List<NewBean> mList;
+    OnItemClickListener mOnItemClickListener;
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        this.mOnItemClickListener = listener;
+    }
+
+    public NewAdapter(Context mContext, List<NewBean> list) {
+        this.mContext = mContext;
+        this.mList = (list == null ? new ArrayList<NewBean>() : list);
+    }
+
+    @Override
+    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_new, parent, false);
+        v.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (mOnItemClickListener != null)
+                    mOnItemClickListener.onItemClick(view, (NewBean) view.getTag());
+            }
+        });
+        return new ViewHolder(v);
+    }
+
+    @Override
+    public void onBindViewHolder(ViewHolder holder, int position) {
+        NewBean bean = mList.get(position);
+        holder.itemView.setTag(bean);
+        Glide.with(mContext)
+                .load(bean.getPicurl())
+                .placeholder(R.mipmap.bg_placeholder)
+                .error(R.mipmap.bg_placeholder)
+                .into(holder.image);
+        holder.title.setText(bean.getDisstr());
+        holder.time.setText(bean.getCreate_date());
+    }
+
+    @Override
+    public int getItemCount() {
+        return mList.size();
+    }
+
+    public static class ViewHolder extends RecyclerView.ViewHolder {
+        @BindView(R.id.image)
+        RoundImageView image;
+        @BindView(R.id.title)
+        TextView title;
+        @BindView(R.id.time)
+        TextView time;
+
+
+        public ViewHolder(View itemView) {
+            super(itemView);
+            ButterKnife.bind(this, itemView);
+        }
+    }
+
+    public interface OnItemClickListener {
+        void onItemClick(View view, NewBean entity);
+    }
+
+}

+ 99 - 0
app/src/main/java/com/yhx/union/custom_view/CusItemDecoration.java

@@ -0,0 +1,99 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * Created by lhk on 2017/1/24.
+ */
+
+public class CusItemDecoration extends RecyclerView.ItemDecoration {
+
+    private Context mContext;
+    private Drawable mDivider;
+    private int mOrientation;
+    public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
+    public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
+
+    //我们通过获取系统属性中的listDivider来添加,在系统中的AppTheme中设置
+    public static final int[] ATRRS  = new int[]{
+            android.R.attr.listDivider
+    };
+
+    public CusItemDecoration(Context context, int orientation) {
+        this.mContext = context;
+        final TypedArray ta = context.obtainStyledAttributes(ATRRS);
+        this.mDivider = ta.getDrawable(0);
+        ta.recycle();
+        setOrientation(orientation);
+    }
+
+    //设置屏幕的方向
+    public void setOrientation(int orientation){
+        if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST){
+            throw new IllegalArgumentException("invalid orientation");        }        mOrientation = orientation;
+    }
+
+    @Override
+    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+        if (mOrientation == HORIZONTAL_LIST){
+            drawVerticalLine(c, parent, state);
+        }else {
+            drawHorizontalLine(c, parent, state);
+        }
+    }
+
+    //画横线, 这里的parent其实是显示在屏幕显示的这部分
+    public void drawHorizontalLine(Canvas c, RecyclerView parent, RecyclerView.State state){
+        int left = parent.getPaddingLeft();
+        int right = parent.getWidth() - parent.getPaddingRight();
+        final int childCount = parent.getChildCount();
+        for (int i = 0; i < childCount-1; i++){
+            final View child = parent.getChildAt(i);
+
+            //获得child的布局信息
+            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)child.getLayoutParams();
+            final int top = child.getBottom() + params.bottomMargin;
+            final int bottom = top + mDivider.getIntrinsicHeight();
+            mDivider.setBounds(left, top, right, bottom);
+            mDivider.draw(c);
+            //Log.d("wnw", left + " " + top + " "+right+"   "+bottom+" "+i);
+        }
+    }
+
+    //画竖线
+    public void drawVerticalLine(Canvas c, RecyclerView parent, RecyclerView.State state){
+        int top = parent.getPaddingTop();
+        int bottom = parent.getHeight() - parent.getPaddingBottom();
+        final int childCount = parent.getChildCount();
+        for (int i = 0; i < childCount-1; i++){
+            final View child = parent.getChildAt(i);
+
+            //获得child的布局信息
+            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)child.getLayoutParams();
+            final int left = child.getRight() + params.rightMargin;
+            final int right = left + mDivider.getIntrinsicWidth();
+            mDivider.setBounds(left, top, right, bottom);
+            mDivider.draw(c);
+        }
+    }
+
+    //由于Divider也有长宽高,每一个Item需要向下或者向右偏移
+    @Override
+    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        if(mOrientation == HORIZONTAL_LIST){
+            //画横线,就是往下偏移一个分割线的高度
+            outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
+        }else {
+            //画竖线,就是往右偏移一个分割线的宽度
+            outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
+        }
+    }
+}

+ 654 - 0
app/src/main/java/com/yhx/union/custom_view/CustomDatePicker.java

@@ -0,0 +1,654 @@
+package com.yhx.union.custom_view;
+
+import android.animation.ObjectAnimator;
+import android.animation.PropertyValuesHolder;
+import android.app.Dialog;
+import android.content.Context;
+import android.util.DisplayMetrics;
+import android.view.Gravity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.TextView;
+
+import com.yhx.union.R;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Locale;
+
+/**
+ * 自定义时间选择对话框
+ */
+public class CustomDatePicker {
+
+    /**
+     * 定义结果回调接口
+     */
+    public interface ResultHandler {
+        void handle(String time);
+    }
+
+    public enum SCROLL_TYPE {
+        HOUR(1),
+        MINUTE(2);
+
+        SCROLL_TYPE(int value) {
+            this.value = value;
+        }
+
+        public int value;
+    }
+
+    private int scrollUnits = SCROLL_TYPE.HOUR.value + SCROLL_TYPE.MINUTE.value;
+    private ResultHandler handler;
+    private Context context;
+    private boolean canAccess = false;
+
+    private Dialog datePickerDialog;
+    private DatePickerView year_pv, month_pv, day_pv, hour_pv, minute_pv;
+
+    private static final int MAX_MINUTE = 59;
+    private static final int MAX_HOUR = 23;
+    private static final int MIN_MINUTE = 0;
+    private static final int MIN_HOUR = 0;
+    private static final int MAX_MONTH = 12;
+
+    private ArrayList<String> year, month, day, hour, minute;
+    private int startYear, startMonth, startDay, startHour, startMinute, endYear, endMonth, endDay, endHour, endMinute;
+    private boolean spanYear, spanMon, spanDay, spanHour, spanMin;
+    private Calendar selectedCalender, startCalendar, endCalendar;
+    private TextView tv_cancle, tv_select, hour_text, minute_text;
+
+    public CustomDatePicker(Context context, ResultHandler resultHandler, String startDate, String endDate) {
+        if (isValidDate(startDate, "yyyy-MM-dd HH:mm") && isValidDate(endDate, "yyyy-MM-dd HH:mm")) {
+            canAccess = true;
+            this.context = context;
+            this.handler = resultHandler;
+            selectedCalender = Calendar.getInstance();
+            startCalendar = Calendar.getInstance();
+            endCalendar = Calendar.getInstance();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
+            try {
+                startCalendar.setTime(sdf.parse(startDate));
+                endCalendar.setTime(sdf.parse(endDate));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            initDialog();
+            initView();
+        }
+    }
+
+    private void initDialog() {
+        if (datePickerDialog == null) {
+            datePickerDialog = new Dialog(context, R.style.time_dialog);
+            datePickerDialog.setCancelable(false);
+            datePickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+            datePickerDialog.setContentView(R.layout.custom_date_picker);
+            Window window = datePickerDialog.getWindow();
+            window.setGravity(Gravity.BOTTOM);
+            WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+            DisplayMetrics dm = new DisplayMetrics();
+            manager.getDefaultDisplay().getMetrics(dm);
+            WindowManager.LayoutParams lp = window.getAttributes();
+            lp.width = dm.widthPixels;
+            window.setAttributes(lp);
+        }
+    }
+
+    private void initView() {
+        year_pv = (DatePickerView) datePickerDialog.findViewById(R.id.year_pv);
+        month_pv = (DatePickerView) datePickerDialog.findViewById(R.id.month_pv);
+        day_pv = (DatePickerView) datePickerDialog.findViewById(R.id.day_pv);
+        hour_pv = (DatePickerView) datePickerDialog.findViewById(R.id.hour_pv);
+        minute_pv = (DatePickerView) datePickerDialog.findViewById(R.id.minute_pv);
+        tv_cancle = (TextView) datePickerDialog.findViewById(R.id.tv_cancle);
+        tv_select = (TextView) datePickerDialog.findViewById(R.id.tv_select);
+        hour_text = (TextView) datePickerDialog.findViewById(R.id.hour_text);
+        minute_text = (TextView) datePickerDialog.findViewById(R.id.minute_text);
+
+        tv_cancle.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                datePickerDialog.dismiss();
+            }
+        });
+
+        tv_select.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
+                handler.handle(sdf.format(selectedCalender.getTime()));
+                datePickerDialog.dismiss();
+            }
+        });
+    }
+
+    private void initParameter() {
+        startYear = startCalendar.get(Calendar.YEAR);
+        startMonth = startCalendar.get(Calendar.MONTH) + 1;
+        startDay = startCalendar.get(Calendar.DAY_OF_MONTH);
+        startHour = startCalendar.get(Calendar.HOUR_OF_DAY);
+        startMinute = startCalendar.get(Calendar.MINUTE);
+        endYear = endCalendar.get(Calendar.YEAR);
+        endMonth = endCalendar.get(Calendar.MONTH) + 1;
+        endDay = endCalendar.get(Calendar.DAY_OF_MONTH);
+        endHour = endCalendar.get(Calendar.HOUR_OF_DAY);
+        endMinute = endCalendar.get(Calendar.MINUTE);
+        spanYear = startYear != endYear;
+        spanMon = (!spanYear) && (startMonth != endMonth);
+        spanDay = (!spanMon) && (startDay != endDay);
+        spanHour = (!spanDay) && (startHour != endHour);
+        spanMin = (!spanHour) && (startMinute != endMinute);
+        selectedCalender.setTime(startCalendar.getTime());
+    }
+
+    private void initTimer() {
+        initArrayList();
+        if (spanYear) {
+            for (int i = startYear; i <= endYear; i++) {
+                year.add(String.valueOf(i));
+            }
+            for (int i = startMonth; i <= MAX_MONTH; i++) {
+                month.add(formatTimeUnit(i));
+            }
+            for (int i = startDay; i <= startCalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                day.add(formatTimeUnit(i));
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.HOUR.value) != SCROLL_TYPE.HOUR.value) {
+                hour.add(formatTimeUnit(startHour));
+            } else {
+                for (int i = startHour; i <= MAX_HOUR; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.MINUTE.value) != SCROLL_TYPE.MINUTE.value) {
+                minute.add(formatTimeUnit(startMinute));
+            } else {
+                for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+        } else if (spanMon) {
+            year.add(String.valueOf(startYear));
+            for (int i = startMonth; i <= endMonth; i++) {
+                month.add(formatTimeUnit(i));
+            }
+            for (int i = startDay; i <= startCalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                day.add(formatTimeUnit(i));
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.HOUR.value) != SCROLL_TYPE.HOUR.value) {
+                hour.add(formatTimeUnit(startHour));
+            } else {
+                for (int i = startHour; i <= MAX_HOUR; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.MINUTE.value) != SCROLL_TYPE.MINUTE.value) {
+                minute.add(formatTimeUnit(startMinute));
+            } else {
+                for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+        } else if (spanDay) {
+            year.add(String.valueOf(startYear));
+            month.add(formatTimeUnit(startMonth));
+            for (int i = startDay; i <= endDay; i++) {
+                day.add(formatTimeUnit(i));
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.HOUR.value) != SCROLL_TYPE.HOUR.value) {
+                hour.add(formatTimeUnit(startHour));
+            } else {
+                for (int i = startHour; i <= MAX_HOUR; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.MINUTE.value) != SCROLL_TYPE.MINUTE.value) {
+                minute.add(formatTimeUnit(startMinute));
+            } else {
+                for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+        } else if (spanHour) {
+            year.add(String.valueOf(startYear));
+            month.add(formatTimeUnit(startMonth));
+            day.add(formatTimeUnit(startDay));
+
+            if ((scrollUnits & SCROLL_TYPE.HOUR.value) != SCROLL_TYPE.HOUR.value) {
+                hour.add(formatTimeUnit(startHour));
+            } else {
+                for (int i = startHour; i <= endHour; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            }
+
+            if ((scrollUnits & SCROLL_TYPE.MINUTE.value) != SCROLL_TYPE.MINUTE.value) {
+                minute.add(formatTimeUnit(startMinute));
+            } else {
+                for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+        } else if (spanMin) {
+            year.add(String.valueOf(startYear));
+            month.add(formatTimeUnit(startMonth));
+            day.add(formatTimeUnit(startDay));
+            hour.add(formatTimeUnit(startHour));
+
+            if ((scrollUnits & SCROLL_TYPE.MINUTE.value) != SCROLL_TYPE.MINUTE.value) {
+                minute.add(formatTimeUnit(startMinute));
+            } else {
+                for (int i = startMinute; i <= endMinute; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+        }
+        loadComponent();
+    }
+
+    /**
+     * 将“0-9”转换为“00-09”
+     */
+    private String formatTimeUnit(int unit) {
+        return unit < 10 ? "0" + String.valueOf(unit) : String.valueOf(unit);
+    }
+
+    private void initArrayList() {
+        if (year == null) year = new ArrayList<>();
+        if (month == null) month = new ArrayList<>();
+        if (day == null) day = new ArrayList<>();
+        if (hour == null) hour = new ArrayList<>();
+        if (minute == null) minute = new ArrayList<>();
+        year.clear();
+        month.clear();
+        day.clear();
+        hour.clear();
+        minute.clear();
+    }
+
+    private void loadComponent() {
+        year_pv.setData(year);
+        month_pv.setData(month);
+        day_pv.setData(day);
+        hour_pv.setData(hour);
+        minute_pv.setData(minute);
+        year_pv.setSelected(0);
+        month_pv.setSelected(0);
+        day_pv.setSelected(0);
+        hour_pv.setSelected(0);
+        minute_pv.setSelected(0);
+        executeScroll();
+    }
+
+    private void addListener() {
+        year_pv.setOnSelectListener(new DatePickerView.onSelectListener() {
+            @Override
+            public void onSelect(String text) {
+                selectedCalender.set(Calendar.YEAR, Integer.parseInt(text));
+                monthChange();
+            }
+        });
+
+        month_pv.setOnSelectListener(new DatePickerView.onSelectListener() {
+            @Override
+            public void onSelect(String text) {
+                selectedCalender.set(Calendar.DAY_OF_MONTH, 1);
+                selectedCalender.set(Calendar.MONTH, Integer.parseInt(text) - 1);
+                dayChange();
+            }
+        });
+
+        day_pv.setOnSelectListener(new DatePickerView.onSelectListener() {
+            @Override
+            public void onSelect(String text) {
+                selectedCalender.set(Calendar.DAY_OF_MONTH, Integer.parseInt(text));
+                hourChange();
+            }
+        });
+
+        hour_pv.setOnSelectListener(new DatePickerView.onSelectListener() {
+            @Override
+            public void onSelect(String text) {
+                selectedCalender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(text));
+                minuteChange();
+            }
+        });
+
+        minute_pv.setOnSelectListener(new DatePickerView.onSelectListener() {
+            @Override
+            public void onSelect(String text) {
+                selectedCalender.set(Calendar.MINUTE, Integer.parseInt(text));
+            }
+        });
+    }
+
+    private void monthChange() {
+        month.clear();
+        int selectedYear = selectedCalender.get(Calendar.YEAR);
+        if (selectedYear == startYear) {
+            for (int i = startMonth; i <= MAX_MONTH; i++) {
+                month.add(formatTimeUnit(i));
+            }
+        } else if (selectedYear == endYear) {
+            for (int i = 1; i <= endMonth; i++) {
+                month.add(formatTimeUnit(i));
+            }
+        } else {
+            for (int i = 1; i <= MAX_MONTH; i++) {
+                month.add(formatTimeUnit(i));
+            }
+        }
+        selectedCalender.set(Calendar.MONTH, Integer.parseInt(month.get(0)) - 1);
+        month_pv.setData(month);
+        month_pv.setSelected(0);
+        executeAnimator(month_pv);
+
+        month_pv.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                dayChange();
+            }
+        }, 100);
+    }
+
+    private void dayChange() {
+        day.clear();
+        int selectedYear = selectedCalender.get(Calendar.YEAR);
+        int selectedMonth = selectedCalender.get(Calendar.MONTH) + 1;
+        if (selectedYear == startYear && selectedMonth == startMonth) {
+            for (int i = startDay; i <= selectedCalender.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                day.add(formatTimeUnit(i));
+            }
+        } else if (selectedYear == endYear && selectedMonth == endMonth) {
+            for (int i = 1; i <= endDay; i++) {
+                day.add(formatTimeUnit(i));
+            }
+        } else {
+            for (int i = 1; i <= selectedCalender.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                day.add(formatTimeUnit(i));
+            }
+        }
+        selectedCalender.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day.get(0)));
+        day_pv.setData(day);
+        day_pv.setSelected(0);
+        executeAnimator(day_pv);
+
+        day_pv.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                hourChange();
+            }
+        }, 100);
+    }
+
+    private void hourChange() {
+        if ((scrollUnits & SCROLL_TYPE.HOUR.value) == SCROLL_TYPE.HOUR.value) {
+            hour.clear();
+            int selectedYear = selectedCalender.get(Calendar.YEAR);
+            int selectedMonth = selectedCalender.get(Calendar.MONTH) + 1;
+            int selectedDay = selectedCalender.get(Calendar.DAY_OF_MONTH);
+            if (selectedYear == startYear && selectedMonth == startMonth && selectedDay == startDay) {
+                for (int i = startHour; i <= MAX_HOUR; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            } else if (selectedYear == endYear && selectedMonth == endMonth && selectedDay == endDay) {
+                for (int i = MIN_HOUR; i <= endHour; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            } else {
+                for (int i = MIN_HOUR; i <= MAX_HOUR; i++) {
+                    hour.add(formatTimeUnit(i));
+                }
+            }
+            selectedCalender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour.get(0)));
+            hour_pv.setData(hour);
+            hour_pv.setSelected(0);
+            executeAnimator(hour_pv);
+        }
+
+        hour_pv.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                minuteChange();
+            }
+        }, 100);
+    }
+
+    private void minuteChange() {
+        if ((scrollUnits & SCROLL_TYPE.MINUTE.value) == SCROLL_TYPE.MINUTE.value) {
+            minute.clear();
+            int selectedYear = selectedCalender.get(Calendar.YEAR);
+            int selectedMonth = selectedCalender.get(Calendar.MONTH) + 1;
+            int selectedDay = selectedCalender.get(Calendar.DAY_OF_MONTH);
+            int selectedHour = selectedCalender.get(Calendar.HOUR_OF_DAY);
+            if (selectedYear == startYear && selectedMonth == startMonth && selectedDay == startDay && selectedHour == startHour) {
+                for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            } else if (selectedYear == endYear && selectedMonth == endMonth && selectedDay == endDay && selectedHour == endHour) {
+                for (int i = MIN_MINUTE; i <= endMinute; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            } else {
+                for (int i = MIN_MINUTE; i <= MAX_MINUTE; i++) {
+                    minute.add(formatTimeUnit(i));
+                }
+            }
+            selectedCalender.set(Calendar.MINUTE, Integer.parseInt(minute.get(0)));
+            minute_pv.setData(minute);
+            minute_pv.setSelected(0);
+            executeAnimator(minute_pv);
+        }
+        executeScroll();
+    }
+
+    private void executeAnimator(View view) {
+        PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 0f, 1f);
+        PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 1.3f, 1f);
+        PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 1.3f, 1f);
+        ObjectAnimator.ofPropertyValuesHolder(view, pvhX, pvhY, pvhZ).setDuration(200).start();
+    }
+
+    private void executeScroll() {
+        year_pv.setCanScroll(year.size() > 1);
+        month_pv.setCanScroll(month.size() > 1);
+        day_pv.setCanScroll(day.size() > 1);
+        hour_pv.setCanScroll(hour.size() > 1 && (scrollUnits & SCROLL_TYPE.HOUR.value) == SCROLL_TYPE.HOUR.value);
+        minute_pv.setCanScroll(minute.size() > 1 && (scrollUnits & SCROLL_TYPE.MINUTE.value) == SCROLL_TYPE.MINUTE.value);
+    }
+
+    private int disScrollUnit(SCROLL_TYPE... scroll_types) {
+        if (scroll_types == null || scroll_types.length == 0) {
+            scrollUnits = SCROLL_TYPE.HOUR.value + SCROLL_TYPE.MINUTE.value;
+        } else {
+            for (SCROLL_TYPE scroll_type : scroll_types) {
+                scrollUnits ^= scroll_type.value;
+            }
+        }
+        return scrollUnits;
+    }
+
+    public void show(String time) {
+        if (canAccess) {
+            if (isValidDate(time, "yyyy-MM-dd")) {
+                if (startCalendar.getTime().getTime() < endCalendar.getTime().getTime()) {
+                    canAccess = true;
+                    initParameter();
+                    initTimer();
+                    addListener();
+                    setSelectedTime(time);
+                    datePickerDialog.show();
+                }
+            } else {
+                canAccess = false;
+            }
+        }
+    }
+
+    /**
+     * 设置日期控件是否显示时和分
+     */
+    public void showSpecificTime(boolean show) {
+        if (canAccess) {
+            if (show) {
+                disScrollUnit();
+                hour_pv.setVisibility(View.VISIBLE);
+                hour_text.setVisibility(View.VISIBLE);
+                minute_pv.setVisibility(View.VISIBLE);
+                minute_text.setVisibility(View.VISIBLE);
+            } else {
+                disScrollUnit(SCROLL_TYPE.HOUR, SCROLL_TYPE.MINUTE);
+                hour_pv.setVisibility(View.GONE);
+                hour_text.setVisibility(View.GONE);
+                minute_pv.setVisibility(View.GONE);
+                minute_text.setVisibility(View.GONE);
+            }
+        }
+    }
+
+    /**
+     * 设置日期控件是否可以循环滚动
+     */
+    public void setIsLoop(boolean isLoop) {
+        if (canAccess) {
+            this.year_pv.setIsLoop(isLoop);
+            this.month_pv.setIsLoop(isLoop);
+            this.day_pv.setIsLoop(isLoop);
+            this.hour_pv.setIsLoop(isLoop);
+            this.minute_pv.setIsLoop(isLoop);
+        }
+    }
+
+    /**
+     * 设置日期控件默认选中的时间
+     */
+    public void setSelectedTime(String time) {
+        if (canAccess) {
+            String[] str = time.split(" ");
+            String[] dateStr = str[0].split("-");
+
+            year_pv.setSelected(dateStr[0]);
+            selectedCalender.set(Calendar.YEAR, Integer.parseInt(dateStr[0]));
+
+            month.clear();
+            int selectedYear = selectedCalender.get(Calendar.YEAR);
+            if (selectedYear == startYear) {
+                for (int i = startMonth; i <= MAX_MONTH; i++) {
+                    month.add(formatTimeUnit(i));
+                }
+            } else if (selectedYear == endYear) {
+                for (int i = 1; i <= endMonth; i++) {
+                    month.add(formatTimeUnit(i));
+                }
+            } else {
+                for (int i = 1; i <= MAX_MONTH; i++) {
+                    month.add(formatTimeUnit(i));
+                }
+            }
+            month_pv.setData(month);
+            month_pv.setSelected(dateStr[1]);
+            selectedCalender.set(Calendar.MONTH, Integer.parseInt(dateStr[1]) - 1);
+            executeAnimator(month_pv);
+
+            day.clear();
+            int selectedMonth = selectedCalender.get(Calendar.MONTH) + 1;
+            if (selectedYear == startYear && selectedMonth == startMonth) {
+                for (int i = startDay; i <= selectedCalender.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                    day.add(formatTimeUnit(i));
+                }
+            } else if (selectedYear == endYear && selectedMonth == endMonth) {
+                for (int i = 1; i <= endDay; i++) {
+                    day.add(formatTimeUnit(i));
+                }
+            } else {
+                for (int i = 1; i <= selectedCalender.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
+                    day.add(formatTimeUnit(i));
+                }
+            }
+            day_pv.setData(day);
+            day_pv.setSelected(dateStr[2]);
+            selectedCalender.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStr[2]));
+            executeAnimator(day_pv);
+
+            if (str.length == 2) {
+                String[] timeStr = str[1].split(":");
+
+                if ((scrollUnits & SCROLL_TYPE.HOUR.value) == SCROLL_TYPE.HOUR.value) {
+                    hour.clear();
+                    int selectedDay = selectedCalender.get(Calendar.DAY_OF_MONTH);
+                    if (selectedYear == startYear && selectedMonth == startMonth && selectedDay == startDay) {
+                        for (int i = startHour; i <= MAX_HOUR; i++) {
+                            hour.add(formatTimeUnit(i));
+                        }
+                    } else if (selectedYear == endYear && selectedMonth == endMonth && selectedDay == endDay) {
+                        for (int i = MIN_HOUR; i <= endHour; i++) {
+                            hour.add(formatTimeUnit(i));
+                        }
+                    } else {
+                        for (int i = MIN_HOUR; i <= MAX_HOUR; i++) {
+                            hour.add(formatTimeUnit(i));
+                        }
+                    }
+                    hour_pv.setData(hour);
+                    hour_pv.setSelected(timeStr[0]);
+                    selectedCalender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeStr[0]));
+                    executeAnimator(hour_pv);
+                }
+
+                if ((scrollUnits & SCROLL_TYPE.MINUTE.value) == SCROLL_TYPE.MINUTE.value) {
+                    minute.clear();
+                    int selectedDay = selectedCalender.get(Calendar.DAY_OF_MONTH);
+                    int selectedHour = selectedCalender.get(Calendar.HOUR_OF_DAY);
+                    if (selectedYear == startYear && selectedMonth == startMonth && selectedDay == startDay && selectedHour == startHour) {
+                        for (int i = startMinute; i <= MAX_MINUTE; i++) {
+                            minute.add(formatTimeUnit(i));
+                        }
+                    } else if (selectedYear == endYear && selectedMonth == endMonth && selectedDay == endDay && selectedHour == endHour) {
+                        for (int i = MIN_MINUTE; i <= endMinute; i++) {
+                            minute.add(formatTimeUnit(i));
+                        }
+                    } else {
+                        for (int i = MIN_MINUTE; i <= MAX_MINUTE; i++) {
+                            minute.add(formatTimeUnit(i));
+                        }
+                    }
+                    minute_pv.setData(minute);
+                    minute_pv.setSelected(timeStr[1]);
+                    selectedCalender.set(Calendar.MINUTE, Integer.parseInt(timeStr[1]));
+                    executeAnimator(minute_pv);
+                }
+            }
+            executeScroll();
+        }
+    }
+
+    /**
+     * 验证字符串是否是一个合法的日期格式
+     */
+    private boolean isValidDate(String date, String template) {
+        boolean convertSuccess = true;
+        // 指定日期格式
+        SimpleDateFormat format = new SimpleDateFormat(template, Locale.CHINA);
+        try {
+            // 设置lenient为false. 否则SimpleDateFormat会比较宽松地验证日期,比如2015/02/29会被接受,并转换成2015/03/01
+            format.setLenient(false);
+            format.parse(date);
+        } catch (Exception e) {
+            // 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
+            convertSuccess = false;
+        }
+        return convertSuccess;
+    }
+
+}

+ 342 - 0
app/src/main/java/com/yhx/union/custom_view/DatePickerView.java

@@ -0,0 +1,342 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Paint.Align;
+import android.graphics.Paint.FontMetricsInt;
+import android.graphics.Paint.Style;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import androidx.core.content.ContextCompat;
+
+import com.yhx.union.R;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * 自定义时间选择对话框
+ */
+public class DatePickerView extends View {
+
+    private Context context;
+    /**
+     * 新增字段 控制是否首尾相接循环显示 默认为循环显示
+     */
+    private boolean loop = true;
+    /**
+     * text之间间距和minTextSize之比
+     */
+    public static final float MARGIN_ALPHA = 2.8f;
+    /**
+     * 自动回滚到中间的速度
+     */
+    public static final float SPEED = 10;
+    private List<String> mDataList;
+    /**
+     * 选中的位置,这个位置是mDataList的中心位置,一直不变
+     */
+    private int mCurrentSelected;
+    private Paint mPaint, nPaint;
+    private float mMaxTextSize = 80;
+    private float mMinTextSize = 40;
+    private float mMaxTextAlpha = 255;
+    private float mMinTextAlpha = 120;
+    private int mViewHeight;
+    private int mViewWidth;
+    private float mLastDownY;
+    /**
+     * 滑动的距离
+     */
+    private float mMoveLen = 0;
+    private boolean isInit = false;
+    private boolean canScroll = true;
+    private onSelectListener mSelectListener;
+    private Timer timer;
+    private MyTimerTask mTask;
+
+    private Handler updateHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            if (Math.abs(mMoveLen) < SPEED) {
+                mMoveLen = 0;
+                if (mTask != null) {
+                    mTask.cancel();
+                    mTask = null;
+                    performSelect();
+                }
+            } else {
+                // 这里mMoveLen / Math.abs(mMoveLen)是为了保有mMoveLen的正负号,以实现上滚或下滚
+                mMoveLen = mMoveLen - mMoveLen / Math.abs(mMoveLen) * SPEED;
+            }
+            invalidate();
+        }
+    };
+
+    public DatePickerView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        this.context = context;
+        init();
+    }
+
+    public void setOnSelectListener(onSelectListener listener) {
+        mSelectListener = listener;
+    }
+
+    private void performSelect() {
+        if (mSelectListener != null) {
+            mSelectListener.onSelect(mDataList.get(mCurrentSelected));
+        }
+    }
+
+    public void setData(List<String> datas) {
+        mDataList = datas;
+        mCurrentSelected = datas.size() / 4;
+        invalidate();
+    }
+
+    /**
+     * 选择选中的item的index
+     */
+    public void setSelected(int selected) {
+        mCurrentSelected = selected;
+        if (loop) {
+            int distance = mDataList.size() / 2 - mCurrentSelected;
+            if (distance < 0) {
+                for (int i = 0; i < -distance; i++) {
+                    moveHeadToTail();
+                    mCurrentSelected--;
+                }
+            } else if (distance > 0) {
+                for (int i = 0; i < distance; i++) {
+                    moveTailToHead();
+                    mCurrentSelected++;
+                }
+            }
+        }
+        invalidate();
+    }
+
+    /**
+     * 选择选中的内容
+     */
+    public void setSelected(String mSelectItem) {
+        for (int i = 0; i < mDataList.size(); i++) {
+            if (mDataList.get(i).equals(mSelectItem)) {
+                setSelected(i);
+                break;
+            }
+        }
+    }
+
+    private void moveHeadToTail() {
+        if (loop) {
+            String head = mDataList.get(0);
+            mDataList.remove(0);
+            mDataList.add(head);
+        }
+    }
+
+    private void moveTailToHead() {
+        if (loop) {
+            String tail = mDataList.get(mDataList.size() - 1);
+            mDataList.remove(mDataList.size() - 1);
+            mDataList.add(0, tail);
+        }
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        mViewHeight = getMeasuredHeight();
+        mViewWidth = getMeasuredWidth();
+        // 按照View的高度计算字体大小
+        mMaxTextSize = mViewHeight / 7f;
+        mMinTextSize = mMaxTextSize / 2.2f;
+        isInit = true;
+        invalidate();
+    }
+
+    private void init() {
+        timer = new Timer();
+        mDataList = new ArrayList<>();
+        //第一个paint
+        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+        mPaint.setStyle(Style.FILL);
+        mPaint.setTextAlign(Align.CENTER);
+        mPaint.setColor(ContextCompat.getColor(context, R.color.text_green));
+        //第二个paint
+        nPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+        nPaint.setStyle(Style.FILL);
+        nPaint.setTextAlign(Align.CENTER);
+        nPaint.setColor(ContextCompat.getColor(context, R.color.text_black));
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        // 根据index绘制view
+        if (isInit) {
+            drawData(canvas);
+        }
+    }
+
+    private void drawData(Canvas canvas) {
+        // 先绘制选中的text再往上往下绘制其余的text
+        float scale = parabola(mViewHeight / 4.0f, mMoveLen);
+        float size = (mMaxTextSize - mMinTextSize) * scale + mMinTextSize;
+        mPaint.setTextSize(size);
+        mPaint.setAlpha((int) ((mMaxTextAlpha - mMinTextAlpha) * scale + mMinTextAlpha));
+        // text居中绘制,注意baseline的计算才能达到居中,y值是text中心坐标
+        float x = (float) (mViewWidth / 2.0);
+        float y = (float) (mViewHeight / 2.0 + mMoveLen);
+        FontMetricsInt fmi = mPaint.getFontMetricsInt();
+        float baseline = (float) (y - (fmi.bottom / 2.0 + fmi.top / 2.0));
+
+        canvas.drawText(mDataList.get(mCurrentSelected), x, baseline, mPaint);
+        // 绘制上方data
+        for (int i = 1; (mCurrentSelected - i) >= 0; i++) {
+            drawOtherText(canvas, i, -1);
+        }
+        // 绘制下方data
+        for (int i = 1; (mCurrentSelected + i) < mDataList.size(); i++) {
+            drawOtherText(canvas, i, 1);
+        }
+    }
+
+    /**
+     * @param position 距离mCurrentSelected的差值
+     * @param type     1表示向下绘制,-1表示向上绘制
+     */
+    private void drawOtherText(Canvas canvas, int position, int type) {
+        float d = MARGIN_ALPHA * mMinTextSize * position + type * mMoveLen;
+        float scale = parabola(mViewHeight / 4.0f, d);
+        float size = (mMaxTextSize - mMinTextSize) * scale + mMinTextSize;
+        nPaint.setTextSize(size);
+        nPaint.setAlpha((int) ((mMaxTextAlpha - mMinTextAlpha) * scale + mMinTextAlpha));
+        float y = (float) (mViewHeight / 2.0 + type * d);
+        FontMetricsInt fmi = nPaint.getFontMetricsInt();
+        float baseline = (float) (y - (fmi.bottom / 2.0 + fmi.top / 2.0));
+        canvas.drawText(mDataList.get(mCurrentSelected + type * position),
+                (float) (mViewWidth / 2.0), baseline, nPaint);
+    }
+
+    /**
+     * 抛物线
+     *
+     * @param zero 零点坐标
+     * @param x    偏移量
+     */
+    private float parabola(float zero, float x) {
+        float f = (float) (1 - Math.pow(x / zero, 2));
+        return f < 0 ? 0 : f;
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getActionMasked()) {
+            case MotionEvent.ACTION_DOWN:
+                doDown(event);
+                break;
+
+            case MotionEvent.ACTION_MOVE:
+                mMoveLen += (event.getY() - mLastDownY);
+                if (mMoveLen > MARGIN_ALPHA * mMinTextSize / 2) {
+                    if (!loop && mCurrentSelected == 0) {
+                        mLastDownY = event.getY();
+                        invalidate();
+                        return true;
+                    }
+                    if (!loop) {
+                        mCurrentSelected--;
+                    }
+                    // 往下滑超过离开距离
+                    moveTailToHead();
+                    mMoveLen = mMoveLen - MARGIN_ALPHA * mMinTextSize;
+                } else if (mMoveLen < -MARGIN_ALPHA * mMinTextSize / 2) {
+                    if (mCurrentSelected == mDataList.size() - 1) {
+                        mLastDownY = event.getY();
+                        invalidate();
+                        return true;
+                    }
+                    if (!loop) {
+                        mCurrentSelected++;
+                    }
+                    // 往上滑超过离开距离
+                    moveHeadToTail();
+                    mMoveLen = mMoveLen + MARGIN_ALPHA * mMinTextSize;
+                }
+                mLastDownY = event.getY();
+                invalidate();
+                break;
+
+            case MotionEvent.ACTION_UP:
+                doUp();
+                break;
+        }
+        return true;
+    }
+
+    private void doDown(MotionEvent event) {
+        if (mTask != null) {
+            mTask.cancel();
+            mTask = null;
+        }
+        mLastDownY = event.getY();
+    }
+
+    private void doUp() {
+        // 抬起手后mCurrentSelected的位置由当前位置move到中间选中位置
+        if (Math.abs(mMoveLen) < 0.0001) {
+            mMoveLen = 0;
+            return;
+        }
+        if (mTask != null) {
+            mTask.cancel();
+            mTask = null;
+        }
+        mTask = new MyTimerTask(updateHandler);
+        timer.schedule(mTask, 0, 10);
+    }
+
+    class MyTimerTask extends TimerTask {
+        Handler handler;
+
+        public MyTimerTask(Handler handler) {
+            this.handler = handler;
+        }
+
+        @Override
+        public void run() {
+            handler.sendMessage(handler.obtainMessage());
+        }
+    }
+
+    public interface onSelectListener {
+        void onSelect(String text);
+    }
+
+    public void setCanScroll(boolean canScroll) {
+        this.canScroll = canScroll;
+    }
+
+    @Override
+    public boolean dispatchTouchEvent(MotionEvent event) {
+        return canScroll && super.dispatchTouchEvent(event);
+    }
+
+    /**
+     * 控制内容是否首尾相连
+     */
+    public void setIsLoop(boolean isLoop) {
+        loop = isLoop;
+    }
+
+}

+ 34 - 0
app/src/main/java/com/yhx/union/custom_view/NeverScrollGridView.java

@@ -0,0 +1,34 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.GridView;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/4/23 上午10:37
+ * 
+ */
+public class NeverScrollGridView extends GridView {
+
+    public NeverScrollGridView(Context context) {
+        super(context);
+    }
+
+    public NeverScrollGridView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public NeverScrollGridView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    //不出现滚动条
+    @Override
+    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+
+        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
+        super.onMeasure(widthMeasureSpec, expandSpec);
+    }
+}

+ 30 - 0
app/src/main/java/com/yhx/union/custom_view/NeverScrollListView.java

@@ -0,0 +1,30 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.ListView;
+
+/**
+ * Created by Administrator on 2015/12/1.
+ */
+public class NeverScrollListView extends ListView {
+    public NeverScrollListView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public NeverScrollListView(Context context) {
+        super(context);
+    }
+
+    public NeverScrollListView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+
+        int expandSpec = MeasureSpec.makeMeasureSpec(
+                Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
+        super.onMeasure(widthMeasureSpec, expandSpec);
+    }
+}

+ 120 - 0
app/src/main/java/com/yhx/union/custom_view/RatingBarView.java

@@ -0,0 +1,120 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.yhx.union.R;
+
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/5/23 下午2:16
+ *
+ */
+public class RatingBarView extends LinearLayout {
+    public interface OnRatingListener {
+        void onRating(Object bindObject, int RatingScore);
+    }
+
+    private boolean mClickable = true;
+    private OnRatingListener onRatingListener;
+    private Object bindObject;
+    private float starImageSize;
+    private int starCount;
+    private Drawable starEmptyDrawable;
+    private Drawable starFillDrawable;
+    private int mStarCount;
+
+    public void setClickable(boolean clickable) {
+        this.mClickable = clickable;
+    }
+
+    public RatingBarView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        setOrientation(LinearLayout.HORIZONTAL);
+        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RatingBarView);
+        starImageSize = ta.getDimension(R.styleable.RatingBarView_starImageSize, 20);
+        starCount = ta.getInteger(R.styleable.RatingBarView_starCount, 5);
+        starEmptyDrawable = ta.getDrawable(R.styleable.RatingBarView_starEmpty);
+        starFillDrawable = ta.getDrawable(R.styleable.RatingBarView_starFill);
+        ta.recycle();
+
+        for (int i = 0; i < starCount; ++i) {
+            ImageView imageView = getStarImageView(context, attrs);
+            imageView.setOnClickListener(new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if (mClickable) {
+                        mStarCount = indexOfChild(v) + 1;
+                        setStar(mStarCount, true);
+                        if (onRatingListener != null) {
+                            onRatingListener.onRating(bindObject, mStarCount);
+                        }
+                    }
+                }
+            });
+            addView(imageView);
+        }
+    }
+
+    private ImageView getStarImageView(Context context, AttributeSet attrs) {
+        ImageView imageView = new ImageView(context);
+        ViewGroup.LayoutParams para = new ViewGroup.LayoutParams(Math.round(starImageSize), Math.round(starImageSize));
+        imageView.setLayoutParams(para);
+        imageView.setPadding(0, 0, 10, 0);
+        imageView.setImageDrawable(starEmptyDrawable);
+        imageView.setMaxWidth(10);
+        imageView.setMaxHeight(10);
+        return imageView;
+    }
+
+    public void setStar(int starCount, boolean animation) {
+        starCount = starCount > this.starCount ? this.starCount : starCount;
+        starCount = starCount < 0 ? 0 : starCount;
+        for (int i = 0; i < starCount; ++i) {
+            ((ImageView) getChildAt(i)).setImageDrawable(starFillDrawable);
+            /*if (animation) {
+                ScaleAnimation sa = new ScaleAnimation(0, 0, 1, 1);
+                getChildAt(i).startAnimation(sa);
+            }*/
+        }
+        for (int i = this.starCount - 1; i >= starCount; --i) {
+            ((ImageView) getChildAt(i)).setImageDrawable(starEmptyDrawable);
+        }
+    }
+
+    public int getStarCount() {
+        return mStarCount;
+    }
+
+    public void setStarFillDrawable(Drawable starFillDrawable) {
+        this.starFillDrawable = starFillDrawable;
+    }
+
+    public void setStarEmptyDrawable(Drawable starEmptyDrawable) {
+        this.starEmptyDrawable = starEmptyDrawable;
+    }
+
+    public void setStarCount(int startCount) {
+        this.starCount = starCount;
+    }
+
+    public void setStarImageSize(float starImageSize) {
+        this.starImageSize = starImageSize;
+    }
+
+    public void setBindObject(Object bindObject) {
+        this.bindObject = bindObject;
+    }
+
+    public void setOnRatingListener(OnRatingListener onRatingListener) {
+        this.onRatingListener = onRatingListener;
+    }
+}

+ 154 - 0
app/src/main/java/com/yhx/union/custom_view/RoundImageView.java

@@ -0,0 +1,154 @@
+package com.yhx.union.custom_view;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.BitmapShader;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+
+import androidx.appcompat.widget.AppCompatImageView;
+
+import com.yhx.union.R;
+
+
+/**
+ * Created by leo on 17/3/14.
+ */
+
+public class RoundImageView extends AppCompatImageView {
+    /**
+     * 圆形模式
+     */
+    private static final int MODE_CIRCLE = 1;
+    /**
+     * 普通模式
+     */
+    private static final int MODE_NONE = 0;
+    /**
+     * 圆角模式
+     */
+    private static final int MODE_ROUND = 2;
+    private Paint mPaint;
+    private int currMode = 0;
+    /**
+     * 圆角半径
+     */
+    private int currRound = dp2px(10);
+
+    public RoundImageView(Context context) {
+        super(context);
+        initViews();
+    }
+
+    public RoundImageView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public RoundImageView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        obtainStyledAttrs(context, attrs, defStyleAttr);
+        initViews();
+    }
+
+    private void obtainStyledAttrs(Context context, AttributeSet attrs, int defStyleAttr) {
+        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView, defStyleAttr, 0);
+        currMode = a.hasValue(R.styleable.RoundImageView_type) ? a.getInt(R.styleable.RoundImageView_type, MODE_NONE) : MODE_NONE;
+        currRound = a.hasValue(R.styleable.RoundImageView_radius) ? a.getDimensionPixelSize(R.styleable.RoundImageView_radius, currRound) : currRound;
+        a.recycle();
+    }
+
+    private void initViews() {
+        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        /**
+         * 当模式为圆形模式的时候,我们强制让宽高一致
+         */
+        if (currMode == MODE_CIRCLE) {
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+            int result = Math.min(getMeasuredHeight(), getMeasuredWidth());
+            setMeasuredDimension(result, result);
+        } else {
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        }
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        Drawable mDrawable = getDrawable();
+        Matrix mDrawMatrix = getImageMatrix();
+        if (mDrawable == null) {
+            return; // couldn't resolve the URI
+        }
+
+        if (mDrawable.getIntrinsicWidth() == 0 || mDrawable.getIntrinsicHeight() == 0) {
+            return;     // nothing to draw (empty bounds)
+        }
+
+        if (mDrawMatrix == null && getPaddingTop() == 0 && getPaddingLeft() == 0) {
+            mDrawable.draw(canvas);
+        } else {
+            final int saveCount = canvas.getSaveCount();
+            canvas.save();
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+                if (getCropToPadding()) {
+                    final int scrollX = getScrollX();
+                    final int scrollY = getScrollY();
+                    canvas.clipRect(scrollX + getPaddingLeft(), scrollY + getPaddingTop(),
+                            scrollX + getRight() - getLeft() - getPaddingRight(),
+                            scrollY + getBottom() - getTop() - getPaddingBottom());
+                }
+            }
+            canvas.translate(getPaddingLeft(), getPaddingTop());
+            if (currMode == MODE_CIRCLE) {//当为圆形模式的时候
+                Bitmap bitmap = drawable2Bitmap(mDrawable);
+                mPaint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
+                canvas.drawCircle(getWidth() / 2, getHeight() / 2, getWidth() / 2, mPaint);
+            } else if (currMode == MODE_ROUND) {//当为圆角模式的时候
+                Bitmap bitmap = drawable2Bitmap(mDrawable);
+                mPaint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
+                canvas.drawRoundRect(new RectF(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), getHeight() - getPaddingBottom()),
+                        currRound, currRound, mPaint);
+            } else {
+                if (mDrawMatrix != null) {
+                    canvas.concat(mDrawMatrix);
+                }
+                mDrawable.draw(canvas);
+            }
+            canvas.restoreToCount(saveCount);
+        }
+    }
+
+    /**
+     * drawable转换成bitmap
+     */
+    private Bitmap drawable2Bitmap(Drawable drawable) {
+        if (drawable == null) {
+            return null;
+        }
+        Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(bitmap);
+        //根据传递的scaletype获取matrix对象,设置给bitmap
+        Matrix matrix = getImageMatrix();
+        if (matrix != null) {
+            canvas.concat(matrix);
+        }
+        drawable.draw(canvas);
+        return bitmap;
+    }
+
+    private int dp2px(float value) {
+        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMetrics());
+    }
+}

+ 65 - 0
app/src/main/java/com/yhx/union/dialog/SessionPromptDialog.java

@@ -0,0 +1,65 @@
+package com.yhx.union.dialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.annotation.NonNull;
+
+import com.yhx.union.R;
+import com.yhx.union.system.MyApplication;
+
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/6/8  下午4:29
+ */
+public class SessionPromptDialog extends Dialog {
+    private Context context;
+    public SessionPromptDialog(@NonNull final Context context) {
+        super(context, R.style.cp_dialogNoTitle);
+        this.context = context;
+        super.setContentView(R.layout.dialog_session_timeout_prompt);
+        findViewById(R.id.sure).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                MyApplication.getInstance().removeAllActivity();
+//                Intent intent = new Intent(context,LoginActivity.class);
+//                context.startActivity(intent);
+            }
+        });
+        setCancelAble(false);
+    }
+
+    public SessionPromptDialog setCancelAble(boolean cancelAble) {
+        setCancelable(cancelAble);
+        return this;
+    }
+
+
+
+    @SuppressWarnings("deprecation")
+    @Override
+    public void show() {
+        Window dialogWindow = this.getWindow();
+//        dialogWindow.setWindowAnimations(R.style.cp_dialogWindowAnim);
+        WindowManager windowManager = dialogWindow.getWindowManager();
+        Display display = windowManager.getDefaultDisplay();
+        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
+        dialogWindow.setGravity(Gravity.CENTER_HORIZONTAL
+                | Gravity.CENTER_VERTICAL);
+        lp.width = (display.getWidth() * 1);
+        int height = lp.height;
+        if (height > display.getWidth() * 0.9) {
+            lp.height = (int) (display.getWidth() * 0.9);
+        }
+        dialogWindow.setAttributes(lp);
+        super.show();
+    }
+}

+ 135 - 0
app/src/main/java/com/yhx/union/entity/BannerEntity.java

@@ -0,0 +1,135 @@
+package com.yhx.union.entity;
+
+import java.io.Serializable;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/1 12:21 PM
+ *
+ */
+public class BannerEntity implements Serializable {
+
+    /**
+     * id : 1
+     * section : 1
+     * disclass : null
+     * wxtitle : 区总工会党员干部职工参观天津市弘扬“三种精神”教育展和“红色记忆——天津革命文物展
+     * disstr : null
+     * picurl : https://app.tjzhxx.com/Uploads/webfile/titleimg/m1.png
+     * wxurl : https://app.tjzhxx.com/Uploads/webfile/titl1.html
+     * videourl : null
+     * create_date : 2021-08-21
+     * readcount : null
+     * sharecount : null
+     * isshow : 1
+     */
+
+    private String id;
+    private String section;
+    private String disclass;
+    private String wxtitle;
+    private String disstr;
+    private String picurl;
+    private String wxurl;
+    private String videourl;
+    private String create_date;
+    private String readcount;
+    private String sharecount;
+    private String isshow;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getSection() {
+        return section;
+    }
+
+    public void setSection(String section) {
+        this.section = section;
+    }
+
+    public String getDisclass() {
+        return disclass;
+    }
+
+    public void setDisclass(String disclass) {
+        this.disclass = disclass;
+    }
+
+    public String getWxtitle() {
+        return wxtitle;
+    }
+
+    public void setWxtitle(String wxtitle) {
+        this.wxtitle = wxtitle;
+    }
+
+    public String getDisstr() {
+        return disstr;
+    }
+
+    public void setDisstr(String disstr) {
+        this.disstr = disstr;
+    }
+
+    public String getPicurl() {
+        return picurl;
+    }
+
+    public void setPicurl(String picurl) {
+        this.picurl = picurl;
+    }
+
+    public String getWxurl() {
+        return wxurl;
+    }
+
+    public void setWxurl(String wxurl) {
+        this.wxurl = wxurl;
+    }
+
+    public String getVideourl() {
+        return videourl;
+    }
+
+    public void setVideourl(String videourl) {
+        this.videourl = videourl;
+    }
+
+    public String getCreate_date() {
+        return create_date;
+    }
+
+    public void setCreate_date(String create_date) {
+        this.create_date = create_date;
+    }
+
+    public String getReadcount() {
+        return readcount;
+    }
+
+    public void setReadcount(String readcount) {
+        this.readcount = readcount;
+    }
+
+    public String getSharecount() {
+        return sharecount;
+    }
+
+    public void setSharecount(String sharecount) {
+        this.sharecount = sharecount;
+    }
+
+    public String getIsshow() {
+        return isshow;
+    }
+
+    public void setIsshow(String isshow) {
+        this.isshow = isshow;
+    }
+}

+ 59 - 0
app/src/main/java/com/yhx/union/entity/BaseResponse.java

@@ -0,0 +1,59 @@
+package com.yhx.union.entity;
+
+import java.io.Serializable;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/4/10 下午2:41
+ * 
+ */
+public class BaseResponse<T> implements Serializable {
+    /**
+     * "code": 0,
+     * "succeed": true,
+     * "msg": "成功",
+     * "data":""
+     */
+    
+    private boolean succeed;
+    private int code;
+    private String msg;
+    private T resultData;
+
+    public boolean isSucceed() {
+        return succeed;
+    }
+
+    public void setSucceed(boolean succeed) {
+        this.succeed = succeed;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public T getResultData() {
+        return resultData;
+    }
+
+    public void setResultData(T data) {
+        this.resultData = resultData;
+    }
+    
+    public boolean isOK() {
+        return code == 0 && resultData != null;
+    }
+}

+ 136 - 0
app/src/main/java/com/yhx/union/entity/NewBean.java

@@ -0,0 +1,136 @@
+package com.yhx.union.entity;
+
+import java.io.Serializable;
+
+/**
+ * 描述:
+ *
+ * @author yhx
+ * @create 2021/9/2  8:11 AM
+ */
+public class NewBean implements Serializable {
+
+    /**
+     * id : 4
+     * section : 2
+     * disclass : null
+     * wxtitle : 高新区总工会为基层一线“夏送凉爽”
+     * disstr : 近日,高新区两委及工会组织对广大职工的关心爱护,进一步激发广大职工为国家自主创新示范区建设作贡献的积极性,高新区总工会开展2021年“夏送凉爽”活动。
+     * picurl : https://app.tjzhxx.com/Uploads/webfile/titleimg/title1.png
+     * wxurl : https://app.tjzhxx.com/Uploads/webfile/new3.html
+     * videourl : null
+     * create_date : 2021-08-21
+     * readcount : null
+     * sharecount : null
+     * isshow : 1
+     */
+
+    private String id;
+    private String section;
+    private String disclass;
+    private String wxtitle;
+    private String disstr;
+    private String picurl;
+    private String wxurl;
+    private String videourl;
+    private String create_date;
+    private String readcount;
+    private String sharecount;
+    private String isshow;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getSection() {
+        return section;
+    }
+
+    public void setSection(String section) {
+        this.section = section;
+    }
+
+    public String getDisclass() {
+        return disclass;
+    }
+
+    public void setDisclass(String disclass) {
+        this.disclass = disclass;
+    }
+
+    public String getWxtitle() {
+        return wxtitle;
+    }
+
+    public void setWxtitle(String wxtitle) {
+        this.wxtitle = wxtitle;
+    }
+
+    public String getDisstr() {
+        return disstr;
+    }
+
+    public void setDisstr(String disstr) {
+        this.disstr = disstr;
+    }
+
+    public String getPicurl() {
+        return picurl;
+    }
+
+    public void setPicurl(String picurl) {
+        this.picurl = picurl;
+    }
+
+    public String getWxurl() {
+        return wxurl;
+    }
+
+    public void setWxurl(String wxurl) {
+        this.wxurl = wxurl;
+    }
+
+    public String getVideourl() {
+        return videourl;
+    }
+
+    public void setVideourl(String videourl) {
+        this.videourl = videourl;
+    }
+
+    public String getCreate_date() {
+        return create_date;
+    }
+
+    public void setCreate_date(String create_date) {
+        this.create_date = create_date;
+    }
+
+    public String getReadcount() {
+        return readcount;
+    }
+
+    public void setReadcount(String readcount) {
+        this.readcount = readcount;
+    }
+
+    public String getSharecount() {
+        return sharecount;
+    }
+
+    public void setSharecount(String sharecount) {
+        this.sharecount = sharecount;
+    }
+
+    public String getIsshow() {
+        return isshow;
+    }
+
+    public void setIsshow(String isshow) {
+        this.isshow = isshow;
+    }
+}

+ 92 - 0
app/src/main/java/com/yhx/union/entity/request/BaseRequest.java

@@ -0,0 +1,92 @@
+package com.yhx.union.entity.request;
+
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/6/4 上午11:20
+ * 
+ */
+
+public class BaseRequest implements Serializable {
+    @SerializedName("user_code")
+    private String userCode;
+    @SerializedName("user_name")
+    private String userName;
+    @SerializedName("user_unit")
+    private String userUnit;
+    @SerializedName("user_unit_name")
+    private String userUnitName;
+    private String uid;
+    private String token;
+    private String deviceID;
+    private String deviceType;
+
+    public String getUserCode() {
+        return userCode;
+    }
+
+    public void setUserCode(String userCode) {
+        this.userCode = userCode;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getUserUnit() {
+        return userUnit;
+    }
+
+    public void setUserUnit(String userUnit) {
+        this.userUnit = userUnit;
+    }
+
+    public String getUserUnitName() {
+        return userUnitName;
+    }
+
+    public void setUserUnitName(String userUnitName) {
+        this.userUnitName = userUnitName;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+    public String getDeviceID() {
+        return deviceID;
+    }
+
+    public void setDeviceID(String deviceID) {
+        this.deviceID = deviceID;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+}

+ 31 - 0
app/src/main/java/com/yhx/union/entity/request/NewListRequest.java

@@ -0,0 +1,31 @@
+package com.yhx.union.entity.request;
+
+import java.io.Serializable;
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2021/9/2 8:07 AM
+ * 
+ */
+public class NewListRequest implements Serializable {
+    
+    private int pageNum;
+
+    private int pageSize;
+
+    public int getPageNum() {
+        return pageNum;
+    }
+
+    public void setPageNum(int pageNum) {
+        this.pageNum = pageNum;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+}

+ 23 - 0
app/src/main/java/com/yhx/union/entity/request/Request.java

@@ -0,0 +1,23 @@
+package com.yhx.union.entity.request;
+
+import java.io.Serializable;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/6/4 上午11:20
+ * 
+ */
+
+public class Request implements Serializable {
+    
+    private BaseRequest baseRequest;
+
+    public BaseRequest getBaseRequest() {
+        return baseRequest;
+    }
+
+    public void setBaseRequest(BaseRequest baseRequest) {
+        this.baseRequest = baseRequest;
+    }
+}

+ 72 - 0
app/src/main/java/com/yhx/union/public_store/AppDataFile.java

@@ -0,0 +1,72 @@
+package com.yhx.union.public_store;
+
+import android.os.Environment;
+
+import java.io.File;
+
+public class AppDataFile {
+
+    private File sdcard = Environment.getExternalStorageDirectory();
+    private File mAppFile;
+	private static AppDataFile mAppDataFile;
+	private static final String FILE_ROOT_PATH="logisticsmanage";
+
+	/**
+	 * 图片
+	 */
+	public static final String FILE_PICTURE="Picture";
+	
+	public static String rootFileName=null;
+	
+	public AppDataFile(String rootFileName) {
+        if(sdcard==null){
+            sdcard= Environment.getDataDirectory();
+        }
+        File rootFile=new File(sdcard,FILE_ROOT_PATH);
+        if(!rootFile.exists()){
+            rootFile.mkdirs();
+        }
+
+        mAppFile=new File(rootFile,rootFileName);
+        if(!mAppFile.exists()){
+            mAppFile.mkdirs();
+        }
+
+		makFile(mAppFile,rootFileName);
+	}
+	
+	public static void init(String rootFileName ){
+		if(mAppDataFile ==null){
+			mAppDataFile =new AppDataFile(rootFileName);
+		}
+	}
+	
+	private void makFile(File appFile, String rootFileName){
+		makChildFile(appFile,FILE_PICTURE);
+	}
+
+    private File makChildFile(File appFile, String filename){
+        File file=new File(appFile,filename);
+        if(!file.exists()){
+            file.mkdirs();
+        }
+        return file;
+    }
+
+    public static File getAppFile(){
+        return mAppDataFile.mAppFile;
+    }
+
+	/**
+	 * 获取图片目录
+	 * @return
+	 */
+	public static File getPictureFile(){
+		File file=new File(getAppFile(),FILE_PICTURE);
+		if(!file.exists()){
+			file.mkdirs();
+		}
+		return file;
+	}
+
+}

+ 47 - 0
app/src/main/java/com/yhx/union/public_store/AppInfoUitl.java

@@ -0,0 +1,47 @@
+package com.yhx.union.public_store;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+
+/**
+ * APP信息工具类
+ * @author root
+ *
+ */
+public class AppInfoUitl {
+
+	public static int getVersionCode(Context context) {
+		try {
+			PackageInfo packageInfo =getPackageInfo(context);
+			return packageInfo.versionCode;
+		} catch (NameNotFoundException e) {
+			e.printStackTrace();
+		}
+		return 0;
+	}
+	
+	public static String getVersionName(Context context) {
+		try {
+			PackageInfo packageInfo =getPackageInfo(context);
+			return packageInfo.versionName;
+		} catch (NameNotFoundException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	public static String getPackageName(Context context) {
+		return context.getApplicationInfo().packageName;		
+	}
+
+	public static PackageInfo getPackageInfo(Context context) throws NameNotFoundException {
+		PackageInfo packageInfo =context.getPackageManager()
+				.getPackageInfo(getPackageName(context),
+						PackageManager.GET_ACTIVITIES);
+		return packageInfo;
+	}
+
+
+}

+ 130 - 0
app/src/main/java/com/yhx/union/public_store/BasePreferences.java

@@ -0,0 +1,130 @@
+package com.yhx.union.public_store;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
+
+import java.util.Set;
+
+/**
+ * 使用方法:
+ * SharedPreferences preferences = getSharedPreferences("user", Context.MODE_PRIVATE);
+ * BasePreferences basePreferences = new BasePreferences(preferences);
+ */
+public class BasePreferences {
+
+    public final static String SP_FILE_NAME = "app_user";
+    public final static String APP_USER_OBJ = "app_user_obj";
+    public final static String APP_USER_PWD = "app_user_pwd";
+    public final static String APP_IS_REMEMBER = "app_remember";
+
+    public final static String SP_FILE_MANAGER = "app_managers";
+    public final static String KEY_FOOD_MANAGER = "FoodManagers";
+    public final static String KEY_PROPERTY_MANAGER = "PropertyManagers";
+
+    protected SharedPreferences mPreferences;
+
+    public static BasePreferences getAppUser(Context context){
+        SharedPreferences preferences = context.getSharedPreferences(SP_FILE_NAME, Context.MODE_PRIVATE);
+        BasePreferences basePreferences = new BasePreferences(preferences);
+        return basePreferences;
+    }
+
+    public static BasePreferences getAppManager(Context context){
+        SharedPreferences preferences = context.getSharedPreferences(SP_FILE_MANAGER, Context.MODE_PRIVATE);
+        BasePreferences basePreferences = new BasePreferences(preferences);
+        return basePreferences;
+    }
+
+    public BasePreferences(SharedPreferences sharedPreferences) {
+        mPreferences = sharedPreferences;
+    }
+
+    public boolean putInt(String key, int value) {
+        return mPreferences.edit().putInt(key, value).commit();
+    }
+
+    public void putApplyInt(String key, int value){
+        mPreferences.edit().putInt(key, value).apply();
+    }
+
+    public boolean putLong(String key, long value) {
+        return mPreferences.edit().putLong(key, value).commit();
+    }
+
+    public void putApplyLong(String key, long value) {
+        mPreferences.edit().putLong(key, value).apply();
+    }
+
+    public boolean putFloat(String key, float value) {
+        return mPreferences.edit().putFloat(key, value).commit();
+    }
+
+    public void putApplyFloat(String key, float value) {
+        mPreferences.edit().putFloat(key, value).apply();
+    }
+
+    public boolean putString(String key, String value) {
+        return mPreferences.edit().putString(key, value).commit();
+    }
+
+    public void putApplyString(String key, String value) {
+        mPreferences.edit().putString(key, value).apply();
+    }
+
+    public boolean putSetString(String key, Set<String> value) {
+        return mPreferences.edit().putStringSet(key, value).commit();
+    }
+
+    public void putApplySetString(String key, Set<String> value) {
+        mPreferences.edit().putStringSet(key, value).apply();
+    }
+
+    public boolean putBoolean(String key, boolean value) {
+        return mPreferences.edit().putBoolean(key, value).commit();
+    }
+
+    public void putApplyBoolean(String key, boolean value) {
+        mPreferences.edit().putBoolean(key, value).apply();
+    }
+
+    public String getString(String key, String defValue) {
+        return mPreferences.getString(key, defValue);
+    }
+
+    public boolean getBoolean(String key, boolean defValue) {
+        return mPreferences.getBoolean(key, defValue);
+    }
+
+    public int getInt(String key, int defValue) {
+        return mPreferences.getInt(key, defValue);
+    }
+
+    public long getLong(String key, long defValue) {
+        return mPreferences.getLong(key, defValue);
+    }
+
+    public float getFloat(String key, float defValue){
+        return mPreferences.getFloat(key, defValue);
+    }
+
+    public Set<String> getSetString(String key, Set<String> defValue){
+        return mPreferences.getStringSet(key, defValue);
+    }
+
+    public boolean contains(String key){
+        return mPreferences.contains(key);
+    }
+
+    public void registerOnChangeListener(OnSharedPreferenceChangeListener listener){
+        if (listener!=null)
+        mPreferences.registerOnSharedPreferenceChangeListener(listener);
+    }
+
+    public void unregisterOnChangeListener(OnSharedPreferenceChangeListener listener){
+        if (listener!=null)
+        mPreferences.unregisterOnSharedPreferenceChangeListener(listener);
+    }
+
+
+}

+ 260 - 0
app/src/main/java/com/yhx/union/public_store/CFileDownLoad.java

@@ -0,0 +1,260 @@
+package com.yhx.union.public_store;
+
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * Created by LHL on 2014/9/24.
+
+ 文件下载封装:
+
+ 使用方法:
+ 第一步:创建进度消息接收器
+ private Handler DownFileMsgDown=new Handler(){
+        @Override
+        public void handleMessage(Message msg) {
+                Bundle bd=msg.getData();
+                String SavePath= bd.getString("savepath");
+                boolean isComplete= bd.getBoolean("iscomplete");
+                int Percert= bd.getInt("percent");
+                int filesize=bd.getInt("filesize");
+                int postion= bd.getInt("postion");
+                boolean isSucc= bd.getBoolean("issucc");
+                String downurl= bd.getString("downurl");
+                String saveFilename=bd.getString("filename");
+
+                if (!isComplete)
+                {
+                    pb.setMax(100);
+                    pb.setProgress(Percert);
+                }else{
+                    pb.setMax(0);
+                    pb.setProgress(0);
+                if (isSucc)
+                {
+                    //成功
+                    Toast.makeText(MyActivity.this, "下载成功", Toast.LENGTH_SHORT).show();
+                }
+        }
+           super.handleMessage(msg);
+        }
+    };
+
+
+ 第二步:调用
+ //初始化进度条对象
+ pb=(ProgressBar)findViewById(R.id.down_pb);
+
+
+ String url="http://10.180.120.94/oafile/upload/fw/2014/019F7C87279600B2E0530A6F0ACC915D/fastRead/d6565cc48235dfbf4f5ed54da9fc9754.doc";
+ CFileDownLoad down=new CFileDownLoad();
+ down.DownLoadFile(url,
+ CFileDownLoad.GetSdkPath()+"test/",
+ CFileDownLoad.PickFileNameFromUrl(url),
+ DownFileMsgDown);
+
+ *
+ */
+
+public class CFileDownLoad {
+    private static int BuffLength = 1024;//缓存大小
+
+    public CFileDownLoad() {
+        super();
+    }
+
+    public static class DownloadData implements Serializable {
+
+        public String DownUrl = "";//下载URL
+        public String SavePath = "";//保存路径
+        public String SaveFileName = "";//保存文件名
+        public Handler Progresshwnd = null;//进度条回调句柄
+
+        //以下是运行期数据,上面是运行前数据。
+        public boolean Complete = false;//是否完成
+        public int FileSize = 0;//文件大小
+        public int CurrPostion = 0;//当已经传输的大小
+        public int Percent = 0;//完成百分比例
+        public Boolean isSucc = false;
+    }
+
+    public static class HttpRunnable implements Runnable {
+        private DownloadData data;
+
+        public HttpRunnable(DownloadData httpInfo) {
+            super();
+            data = httpInfo;
+        }
+
+        @Override
+        public void run() {
+            DoDown(data);
+
+        }
+    }
+
+    //从URL中得到文件名
+    public static String PickFileNameFromUrl(String AUrl) {
+        return AUrl.substring(AUrl.lastIndexOf("/") + 1);
+    }
+    //替换URL中的主机地址
+    public static String ReplaceHost(String ASrcUrl, String ANewHost){
+        String urlHead="http://";
+        String tmp=ASrcUrl.substring(urlHead.length(),ASrcUrl.length());
+        tmp= tmp.substring(tmp.indexOf("/"),tmp.length());
+        tmp=ANewHost+tmp;
+        return tmp;
+    }
+
+    //文件是否存在
+    //AFile= "/storage/sdcard0/Manual/test.pdf"
+    public static boolean fileIsExists(String AFile) {
+        boolean ret = false;
+        try {
+            File f = new File(AFile);
+            ret = f.exists();
+        } catch (Exception e) {
+            // TODO: handle exception
+            ret = false;
+        }
+        return ret;
+    }
+
+    private static void sendMsg(DownloadData Info) {
+        sendMsg(Info, "");
+    }
+
+    private static void sendMsg(DownloadData Info, String errorMsg) {
+        DownloadData objData = new DownloadData();
+        Message msg = new Message();
+        Bundle bd = new Bundle();
+        bd.putString("savepath", Info.SavePath);
+        bd.putBoolean("iscomplete", Info.Complete);
+        bd.putInt("percent", Info.Percent);
+        bd.putInt("filesize", Info.FileSize);
+        bd.putInt("postion", Info.CurrPostion);
+        bd.putBoolean("issucc", Info.isSucc);
+        bd.putString("downurl", Info.DownUrl);
+        bd.putString("filename", Info.SaveFileName);
+        bd.putString("errormessage", errorMsg);
+        msg.setData(bd);
+        Info.Progresshwnd.sendMessage(msg);
+    }
+
+    private static void DoDown(DownloadData DownInfo) {
+        System.out.println("Download File:"+DownInfo.DownUrl);
+        try {
+            URL myURL = new URL(DownInfo.DownUrl);
+            URLConnection conn = myURL.openConnection();
+            conn.connect();
+            InputStream is = conn.getInputStream();
+            DownInfo.FileSize = conn.getContentLength();//根据响应获取文件大小
+            if (DownInfo.FileSize <= 0) {
+                //throw new RuntimeException("无法获知文件大小");
+                DownInfo.isSucc = false;
+                sendMsg(DownInfo);//通知下载完成
+                return;
+            }
+            if (is == null) throw new RuntimeException("stream is null");
+            deleteFile(DownInfo.SavePath + DownInfo.SaveFileName);
+            System.out.println("Download success, save to :"+DownInfo.SavePath + DownInfo.SaveFileName);
+            FileOutputStream fos = new FileOutputStream(DownInfo.SavePath + DownInfo.SaveFileName);
+            //把数据存入路径+文件名
+            byte buf[] = new byte[BuffLength];
+            DownInfo.CurrPostion = 0;
+            DownInfo.Percent = 0;
+            sendMsg(DownInfo);
+
+            do {
+                //循环读取
+                int numread = is.read(buf);
+                if (numread == -1)
+                {
+                    break;
+                }
+                fos.write(buf, 0, numread);
+                DownInfo.CurrPostion += numread;
+                double tmp=DownInfo.CurrPostion;
+                double val=(tmp*100) /DownInfo.FileSize;
+                DownInfo.Percent =(int)val ;
+                sendMsg(DownInfo);//更新进度条
+            } while (true);
+            if (fileIsExists(DownInfo.SavePath + DownInfo.SaveFileName)) {
+                DownInfo.isSucc = true;
+            } else {
+                DownInfo.isSucc = false;
+            }
+            DownInfo.Complete=true;
+            sendMsg(DownInfo);//通知下载完成
+            try {
+                is.close();
+            } catch (Exception ex) {
+                LogUtils.e("tag", "下载异常: " + ex.getMessage());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            DownInfo.isSucc = false;
+            DownInfo.Complete = true;
+            sendMsg(DownInfo, e.getMessage());//通知下载完成
+        }
+    }
+
+
+    public void CreateFolder(String APath) {
+        File pt = new File(APath);
+        if (!pt.exists()) {
+            pt.mkdirs();
+        }
+    }
+
+    public void DownLoadFile(String ADownUrl, String ASavePath, String AFileName, Handler AProgressHwnd) {
+        DownloadData info = new DownloadData();
+        CreateFolder(ASavePath);
+        info.DownUrl = ADownUrl;
+        info.SavePath = ASavePath;
+        if (!info.SavePath.endsWith("/")) {
+            info.SavePath = info.SavePath + "/";
+        }
+        info.SaveFileName = AFileName;
+        info.Progresshwnd = AProgressHwnd;
+        HttpRunnable ra = new HttpRunnable(info);
+        new Thread(ra).start();
+    }
+
+
+    //删除文件
+    public static void deleteFile(String AName) {
+        File F = new File(AName);
+        if (F.exists()) { // 判断文件是否存在
+            if (F.isFile()) { // 判断是否是文件
+                F.delete(); // delete()方法 你应该知道 是删除的意思;
+            }
+        } else {
+
+        }
+    }
+
+    //删除文件夹
+    public static void deleteFolder(String AName) {
+        File F = new File(AName);
+        if (F.exists()) { // 判断文件是否存在
+            if (F.isDirectory()) { // 否则如果它是一个目录
+                File files[] = F.listFiles(); // 声明目录下所有的文件 files[];
+                for (int i = 0; i < files.length; i++) { // 遍历目录下所有的文件
+                    deleteFolder(files[i].getName()); // 把每个文件 用这个方法进行迭代
+                }
+            }
+            F.delete();
+        }
+    }
+}

+ 21 - 0
app/src/main/java/com/yhx/union/public_store/CacheUtils.java

@@ -0,0 +1,21 @@
+package com.yhx.union.public_store;
+
+
+import com.yhx.union.entity.request.BaseRequest;
+
+public class CacheUtils {
+    
+    public static BaseRequest getBaseRequest() {
+        BaseRequest baseRequest = new BaseRequest();
+//        baseRequest.setUid(ConstDefine.UID);
+//        baseRequest.setToken(ConstDefine.Token);
+//        baseRequest.setDeviceID(ConstDefine.DeviceID);
+//        baseRequest.setDeviceType(ConstDefine.DeviceType);
+//        //用户数据
+//        baseRequest.setUserCode(ConstDefine.CurrUserCode);
+//        baseRequest.setUserName(ConstDefine.CurrUserName);
+//        baseRequest.setUserUnit(ConstDefine.CurrUserUnit);
+//        baseRequest.setUserUnitName(ConstDefine.CurrUserUnitName);
+        return baseRequest;
+    }
+}

+ 12 - 0
app/src/main/java/com/yhx/union/public_store/ConstDefine.java

@@ -0,0 +1,12 @@
+package com.yhx.union.public_store;
+
+
+/**
+ * Created by ynyxmac on 16/2/4.
+ */
+public class ConstDefine {
+    public static String HttpAdress = "https://app.tjzhxx.com/labphp/";
+//    public static String HttpAdress = "https://app.tjzhxx.cn:1443/";//正式环境
+
+
+}

+ 211 - 0
app/src/main/java/com/yhx/union/public_store/CrashHandler.java

@@ -0,0 +1,211 @@
+package com.yhx.union.public_store;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Environment;
+import android.os.Looper;
+import android.os.Process;
+import android.widget.Toast;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 通用的异常记录、上报类,用于替换系统默认的异常捕获
+ * 在application中初始化即可,
+ * 其中,log的目录为应用安装的cache目录,会随着应用被卸载而删除
+ * //sdcard/Android/data/<application package>/cache 
+ * Created by Dong on 2015/12/17.
+ *
+ * 用法:
+ * MyApplication.java OnCreate 中加入
+ *  CrashHandler crashHandler = CrashHandler.getInstance();
+ *  crashHandler.init(this.getApplicationContext());
+ */
+public class CrashHandler implements Thread.UncaughtExceptionHandler {
+    
+    private static final String TAG = CrashHandler.class.getSimpleName();
+    private static final boolean DEBUG = true;
+
+    //放在缓存目录更好,卸载程序时,会一并删除
+//    private static final String PATH = 
+//            Environment.getExternalStorageDirectory().getPath() + "/EPIC/log/";
+    private static final String FILE_NAME = "crash";
+
+    //log文件的后缀名  
+    private static final String FILE_NAME_SUFFIX = ".trace";
+    
+    //系统默认的异常处理
+    private Thread.UncaughtExceptionHandler mUncaughtExceptionHandler;
+
+    private CrashHandler(){};
+
+    private static CrashHandler sInstance;
+
+    public static CrashHandler getInstance() {
+        if (sInstance == null) {
+            synchronized (CrashHandler.class) {
+                if (sInstance == null) {
+                    sInstance = new CrashHandler();
+                }
+            }
+        }
+        return sInstance;
+    }
+
+
+    private Context mContext;
+
+    /**
+     * 初始化
+     * @param context
+     */
+    public void init(Context context){
+        //获取系统默认的异常实例
+        mUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+        Thread.setDefaultUncaughtExceptionHandler(this);
+        mContext = context;
+        
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable ex) {
+        
+        dumpException2SDCard(ex);
+        //考虑异常上报的时机。弹出对话框,询问用户上报异常信息
+        dumpException2NetServers(ex);
+        
+        showToast(mContext,"程序遭遇异常,即将退出!");
+
+        try {
+            Thread.sleep(1000*2);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        //如下的退出方式只会结束TASK中的栈顶activity,可以考虑通过回调在application中finish所有的activity
+        if (mUncaughtExceptionHandler != null) {
+            mUncaughtExceptionHandler.uncaughtException(thread, ex);
+        } else {
+            Process.killProcess(Process.myPid());
+            System.exit(1);
+        }
+    }
+
+    private void showToast(final Context context, final String message) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                Looper.prepare();
+                Toast.makeText(context, message, Toast.LENGTH_LONG).show();
+                Looper.loop();
+            }
+        }).start();
+    }
+
+    /**
+     * save the exception to sd files
+     * @param ex
+     */
+    private void dumpException2SDCard(Throwable ex) {
+        //如果SD卡不存在或无法使用,则无法把异常信息写入SD卡  
+        if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+            if (DEBUG) {
+                LogUtils.w(TAG, "sdcard unmounted,skip dump exception");
+                return;
+            }
+        }
+        //获取 cache目录中的log目录
+        String filePath = getDiskCacheDir(mContext,"log");
+        File dir = new File(filePath);
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }
+        long current = System.currentTimeMillis();
+        String time = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date(current));
+        //以当前时间创建log文件  
+        File file = new File(filePath +"/"+ FILE_NAME + time + FILE_NAME_SUFFIX);
+        PrintWriter pw = null;
+        try {
+            pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
+            //导出发生异常的时间  
+            pw.println(time);
+
+            //导出手机信息  
+            dumpPhoneInfo(pw);
+
+            pw.println();
+            //导出异常的调用栈信息  
+            ex.printStackTrace(pw);
+           
+        } catch (Exception e) {
+            LogUtils.e(TAG, "dump crash info failed");
+            e.printStackTrace();
+        }finally {
+            if (pw!=null){
+                pw.close();
+            }
+           
+        }
+    }
+
+    /**
+     * 
+     * @param context
+     * @param fileName 文件夹的名字,将bitmap和log之类分开存放
+     * @return
+     */
+    private String getDiskCacheDir(Context context, String fileName){
+        String cachePath;
+        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
+                || !Environment.isExternalStorageRemovable()) {
+            ///sdcard/Android/data/<application package>/cache 
+            cachePath = context.getExternalCacheDir().getPath();
+        } else {
+            ///data/data/<application package>/cache
+            cachePath = context.getCacheDir().getPath();
+        }
+        return cachePath+"/"+fileName;
+    }
+    
+    private void dumpPhoneInfo(PrintWriter pw) throws PackageManager.NameNotFoundException {
+        //应用的版本名称和版本号  
+        PackageManager pm = mContext.getPackageManager();
+        PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
+        pw.print("App Version: ");
+        pw.print(pi.versionName);
+        pw.print('_');
+        pw.println(pi.versionCode);
+
+        //android版本号  
+        pw.print("OS Version: ");
+        pw.print(Build.VERSION.RELEASE);
+        pw.print("_");
+        pw.println(Build.VERSION.SDK_INT);
+
+        //手机制造商  
+        pw.print("Vendor: ");
+        pw.println(Build.MANUFACTURER);
+
+        //手机型号  
+        pw.print("Model: ");
+        pw.println(Build.MODEL);
+
+        //cpu架构  
+        pw.print("CPU ABI: ");
+        pw.println(Build.CPU_ABI);//consider os version
+    }
+
+    /**
+     * upload the ex to servers;
+     * @param ex
+     */
+    private void dumpException2NetServers(Throwable ex){
+        LogUtils.d("CrashHandler","dumpException2NetServers()");
+    }
+}

+ 74 - 0
app/src/main/java/com/yhx/union/public_store/Des3Util.java

@@ -0,0 +1,74 @@
+package com.yhx.union.public_store;
+
+import android.util.Base64;
+
+import java.security.Key;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESedeKeySpec;
+import javax.crypto.spec.IvParameterSpec;
+
+/**
+ * Created by MyPC on 2017/9/8.
+ */
+
+public class Des3Util {
+    // 密钥 长度不得小于24
+    private final static String secretKey = "123456789012345678901234" ;
+    // 向量 可有可无 终端后台也要约定
+    private final static String iv = "01234567" ;
+    // 加解密统一使用的编码方式
+    private final static String encoding = "utf-8" ;
+
+    /**
+     * 3DES加密
+     *
+     * @param plainText
+     *            普通文本
+     * @return
+     * @throws Exception
+     */
+    public static String encode(String plainText) throws Exception {
+        Key deskey = null ;
+        DESedeKeySpec spec = new DESedeKeySpec(secretKey .getBytes());
+        SecretKeyFactory keyfactory = SecretKeyFactory.getInstance( "desede");
+        deskey = keyfactory.generateSecret(spec);
+
+        Cipher cipher = Cipher.getInstance( "desede/CBC/PKCS5Padding");
+        IvParameterSpec ips = new IvParameterSpec( iv.getBytes());
+        cipher.init(Cipher. ENCRYPT_MODE , deskey, ips);
+        byte [] encryptData = cipher.doFinal(plainText.getBytes(encoding ));
+        return Base64.encodeToString(encryptData, Base64. DEFAULT );
+    }
+
+    /**
+     * 3DES解密
+     *
+     * @param encryptText
+     *            加密文本
+     * @return
+     * @throws Exception
+     */
+    public static String decode(String encryptText) throws Exception {
+        Key deskey = null ;
+        DESedeKeySpec spec = new DESedeKeySpec( secretKey.getBytes());
+        SecretKeyFactory keyfactory = SecretKeyFactory.getInstance( "desede" );
+        deskey = keyfactory. generateSecret(spec);
+        Cipher cipher = Cipher.getInstance( "desede/CBC/PKCS5Padding" );
+        IvParameterSpec ips = new IvParameterSpec( iv.getBytes());
+        cipher. init(Cipher. DECRYPT_MODE, deskey, ips);
+
+        byte [] decryptData = cipher.doFinal(Base64. decode(encryptText, Base64. DEFAULT));
+
+        return new String(decryptData, encoding);
+    }
+
+//    public static void main(String args[]) throws Exception{
+//        String str = "你好" ;
+//        System. out.println( "----加密前-----:" + str );
+//        String encodeStr = Des3Util. encode( str);
+//        System. out.println( "----加密后-----:" + encodeStr );
+//        System. out.println( "----解密后-----:" + Des3Util.decode( encodeStr));
+//    }
+}

+ 108 - 0
app/src/main/java/com/yhx/union/public_store/FNNetwork.java

@@ -0,0 +1,108 @@
+package com.yhx.union.public_store;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Build;
+import android.text.TextUtils;
+
+/**
+ * 跟网络相关的工具类
+ */
+public class FNNetwork {
+	
+	private FNNetwork() {
+		throw new UnsupportedOperationException("cannot be instantiated");
+	}
+	/**
+	 * 判断网络是否连接
+	 * 
+	 * @param context
+	 * @return
+	 */
+	public static boolean isConnected(Context context) {
+
+		ConnectivityManager connectivity = (ConnectivityManager) context
+				.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		if (null != connectivity) {
+
+			NetworkInfo info = connectivity.getActiveNetworkInfo();
+			if (null != info && info.isConnected()) {
+				if (info.getState() == NetworkInfo.State.CONNECTED) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * 判断是否是wifi连接
+	 */
+	public static boolean isWIFI(Context context) {
+		ConnectivityManager cm = (ConnectivityManager) context
+				.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		return (cm != null && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI);
+	}
+
+	public static boolean isMobile(Context context) {
+		ConnectivityManager cm = (ConnectivityManager) context
+				.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+		return (cm != null && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_MOBILE);
+	}
+	/**
+	 * 打开网络设置界面
+	 */
+	public static void openNetworkSetting(Activity activity) {
+		Intent intent = null;
+		// 判断手机系统的版本 即API大于10 就是3.0或以上版本
+		if (Build.VERSION.SDK_INT > 10) {
+			intent = new Intent(
+					android.provider.Settings.ACTION_WIRELESS_SETTINGS);
+		} else {
+			intent = new Intent();
+			ComponentName component = new ComponentName("com.android.settings",
+					"com.android.settings.WirelessSettings");
+			intent.setComponent(component);
+			intent.setAction("android.intent.action.VIEW");
+		}
+		activity.startActivityForResult(intent, 0);
+	}
+
+	/*
+	 * 判断设备 是否使用代理上网
+	 * */
+	public static boolean isWifiProxy(Context context) {
+
+		final boolean IS_ICS_OR_LATER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
+
+		String proxyAddress;
+
+		int proxyPort;
+
+		if (IS_ICS_OR_LATER) {
+
+			proxyAddress = System.getProperty("http.proxyHost");
+
+			String portStr = System.getProperty("http.proxyPort");
+
+			proxyPort = Integer.parseInt((portStr != null ? portStr : "-1"));
+
+		} else {
+
+			proxyAddress = android.net.Proxy.getHost(context);
+
+			proxyPort = android.net.Proxy.getPort(context);
+
+		}
+
+		return (!TextUtils.isEmpty(proxyAddress)) && (proxyPort != -1);
+
+	}
+}

+ 37 - 0
app/src/main/java/com/yhx/union/public_store/LogUtils.java

@@ -0,0 +1,37 @@
+package com.yhx.union.public_store;
+
+import android.util.Log;
+
+
+
+/**
+ * Created by MyPC on 2017/9/28.
+ */
+
+public class LogUtils {
+    public static boolean LogDEBUG = true;
+    public static void e(String tag, String msg) {
+        if (LogDEBUG)
+            Log.e(tag, msg);
+    }
+
+    public static void d(String tag, String msg) {
+        if (LogDEBUG)
+            Log.d(tag, msg);
+    }
+
+    public static void v(String tag, String msg) {
+        if (LogDEBUG)
+            Log.v(tag, msg);
+    }
+
+    public static void i(String tag, String msg) {
+        if (LogDEBUG)
+            Log.i(tag, msg);
+    }
+
+    public static void w(String tag, String msg) {
+        if (LogDEBUG)
+            Log.w(tag, msg);
+    }
+}

+ 14 - 0
app/src/main/java/com/yhx/union/public_store/MyAppGlideModule.java

@@ -0,0 +1,14 @@
+package com.yhx.union.public_store;
+
+import com.bumptech.glide.annotation.GlideModule;
+import com.bumptech.glide.module.AppGlideModule;
+
+/**
+ * Created
+ * by @author wuzhengtong
+ * on @date 2018/1/29
+ */
+
+@GlideModule
+public final class MyAppGlideModule extends AppGlideModule {
+}

+ 57 - 0
app/src/main/java/com/yhx/union/public_store/PhoneFormatCheckUtils.java

@@ -0,0 +1,57 @@
+package com.yhx.union.public_store;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * Created by Dong on 2017/3/13.
+ */
+
+public class PhoneFormatCheckUtils {
+    /**
+     * 大陆号码或香港号码均可 
+     */
+    public static boolean isPhoneLegal(String str)throws PatternSyntaxException {
+        return isChinaPhoneLegal(str) || isHKPhoneLegal(str);
+    }
+
+    /**
+     * 大陆手机号码11位数,匹配格式:前三位固定格式+后8位任意数 
+     * 此方法中前三位格式有: 
+     * 13+任意数 
+     * 15+除4的任意数 
+     * 18+除1和4的任意数 
+     * 17+除9的任意数 
+     * 147 
+     */
+    public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
+        String regExp = "^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
+
+    /**
+     * 香港手机号码8位数,5|6|8|9开头+7位任意数 
+     */
+    public static boolean isHKPhoneLegal(String str)throws PatternSyntaxException {
+        String regExp = "^(5|6|8|9)\\d{7}$";
+        Pattern p = Pattern.compile(regExp);
+        Matcher m = p.matcher(str);
+        return m.matches();
+    }
+
+    /**
+     * 利用正则表达式校验电话号码
+     * @param obj
+     * @param regexp
+     * @return
+     */
+    public final static String regexp = "(^(\\d{3,4}-)?\\d{7,8})$|(1[3|5|7|8]\\d{9})";
+    public static boolean validateObjRex(Object obj, String regexp) {
+        Pattern pattern = Pattern.compile(regexp);
+        Matcher matcher = pattern.matcher(obj.toString());
+        return matcher.matches();
+    }
+}

+ 87 - 0
app/src/main/java/com/yhx/union/public_store/PropertyTypeUtil.java

@@ -0,0 +1,87 @@
+package com.yhx.union.public_store;
+
+/**
+ * Created by lhk on 2017/1/19.
+ */
+
+public class PropertyTypeUtil {
+
+    /**
+     * 工单状态翻译
+     * @param code
+     * @return
+     */
+    public static String translateType(String code){
+        String value = "";
+        if (code==null){
+            return value;
+        }
+        switch (code){
+            case "0":
+                value = "已下单";
+                break;
+            case "1":
+                value = "进行中";
+                break;
+            case "2":
+                value = "已完成";
+                break;
+            case "3":
+                value = "已撤销";
+                break;
+            default:
+                value = "未知";
+                break;
+        }
+        return value;
+    }
+
+    public static String EvaluationStatus2String(String value){
+        String status = "";
+        if (value==null){
+            return status;
+        }
+        switch (value){
+            case "0":
+                status = "未评价";
+                break;
+            case "1":
+                status = "已评价";
+                break;
+        }
+        return status;
+    }
+
+    /**
+     * 投诉类型翻译
+     * @param value
+     * @return
+     */
+    public static String complainValue2Type(String value){
+        String type = "";
+        if (value==null){
+            return type;
+        }
+        switch (value){
+            case "0":
+                type = "物业工单";
+                break;
+            case "1":
+                type = "保安";
+                break;
+            case "2":
+                type = "礼仪";
+                break;
+            case "3":
+                type = "维修";
+                break;
+            case "4":
+                type = "保洁";
+                break;
+            case "5":
+                type = "绿化";
+                break;
+        }
+        return type;
+    }
+}

+ 46 - 0
app/src/main/java/com/yhx/union/public_store/RootUtil.java

@@ -0,0 +1,46 @@
+package com.yhx.union.public_store;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+
+/**
+ * 描述:
+ *
+ * @author yhx
+ * @create 2019/3/5  2:21 PM
+ */
+public class RootUtil {
+    public static boolean isDeviceRooted() {
+        return checkRootMethod1() || checkRootMethod2() || checkRootMethod3();
+    }
+
+    private static boolean checkRootMethod1() {
+        String buildTags = android.os.Build.TAGS;
+        return buildTags != null && buildTags.contains("test-keys");
+    }
+
+    private static boolean checkRootMethod2() {
+        String[] paths = { "/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su",
+                "/system/bin/failsafe/su", "/data/local/su", "/su/bin/su"};
+        for (String path : paths) {
+            if (new File(path).exists()) return true;
+        }
+        return false;
+    }
+
+    private static boolean checkRootMethod3() {
+        Process process = null;
+        try {
+            process = Runtime.getRuntime().exec(new String[] { "/system/xbin/which", "su" });
+            BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            if (in.readLine() != null) return true;
+            return false;
+        } catch (Throwable t) {
+            return false;
+        } finally {
+            if (process != null) process.destroy();
+        }
+    }
+}
+

+ 173 - 0
app/src/main/java/com/yhx/union/public_store/SPUtils.java

@@ -0,0 +1,173 @@
+package com.yhx.union.public_store;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/5/31  下午7:22
+ */
+public class SPUtils {
+    /**
+     * 保存在手机里面的文件名
+     */
+    public static final String FILE_NAME = "share_data";
+
+    /**
+     * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
+     *
+     * @param context
+     * @param key
+     * @param object
+     */
+    public static void put(Context context, String key, Object object) {
+
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+
+        if (object instanceof String) {
+            editor.putString(key, (String) object);
+        } else if (object instanceof Integer) {
+            editor.putInt(key, (Integer) object);
+        } else if (object instanceof Boolean) {
+            editor.putBoolean(key, (Boolean) object);
+        } else if (object instanceof Float) {
+            editor.putFloat(key, (Float) object);
+        } else if (object instanceof Long) {
+            editor.putLong(key, (Long) object);
+        } else {
+            editor.putString(key, object.toString());
+        }
+
+        SharedPreferencesCompat.apply(editor);
+    }
+
+    /**
+     * 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
+     *
+     * @param context
+     * @param key
+     * @param defaultObject
+     * @return
+     */
+    public static Object get(Context context, String key, Object defaultObject) {
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+
+        if (defaultObject instanceof String) {
+            return sp.getString(key, (String) defaultObject);
+        } else if (defaultObject instanceof Integer) {
+            return sp.getInt(key, (Integer) defaultObject);
+        } else if (defaultObject instanceof Boolean) {
+            return sp.getBoolean(key, (Boolean) defaultObject);
+        } else if (defaultObject instanceof Float) {
+            return sp.getFloat(key, (Float) defaultObject);
+        } else if (defaultObject instanceof Long) {
+            return sp.getLong(key, (Long) defaultObject);
+        }
+
+        return null;
+    }
+
+    /**
+     * 移除某个key值已经对应的值
+     *
+     * @param context
+     * @param key
+     */
+    public static void remove(Context context, String key) {
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+        editor.remove(key);
+        SharedPreferencesCompat.apply(editor);
+    }
+
+    /**
+     * 清除所有数据
+     *
+     * @param context
+     */
+    public static void clear(Context context) {
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+        editor.clear();
+        SharedPreferencesCompat.apply(editor);
+    }
+
+    /**
+     * 查询某个key是否已经存在
+     *
+     * @param context
+     * @param key
+     * @return
+     */
+    public static boolean contains(Context context, String key) {
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+        return sp.contains(key);
+    }
+
+    /**
+     * 返回所有的键值对
+     *
+     * @param context
+     * @return
+     */
+    public static Map<String, ?> getAll(Context context) {
+        SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
+                Context.MODE_PRIVATE);
+        return sp.getAll();
+    }
+
+    /**
+     * 创建一个解决SharedPreferencesCompat.apply方法的一个兼容类
+     *
+     * @author zhy
+     */
+    private static class SharedPreferencesCompat {
+        private static final Method sApplyMethod = findApplyMethod();
+
+        /**
+         * 反射查找apply的方法
+         *
+         * @return
+         */
+        @SuppressWarnings({"unchecked", "rawtypes"})
+        private static Method findApplyMethod() {
+            try {
+                Class clz = SharedPreferences.Editor.class;
+                return clz.getMethod("apply");
+            } catch (NoSuchMethodException e) {
+            }
+
+            return null;
+        }
+
+        /**
+         * 如果找到则使用apply执行,否则使用commit
+         *
+         * @param editor
+         */
+        public static void apply(SharedPreferences.Editor editor) {
+            try {
+                if (sApplyMethod != null) {
+                    sApplyMethod.invoke(editor);
+                    return;
+                }
+            } catch (IllegalArgumentException e) {
+            } catch (IllegalAccessException e) {
+            } catch (InvocationTargetException e) {
+            }
+            editor.commit();
+        }
+    }
+}

+ 44 - 0
app/src/main/java/com/yhx/union/public_store/ScreenUtils.java

@@ -0,0 +1,44 @@
+package com.yhx.union.public_store;
+
+import android.app.Activity;
+import android.util.DisplayMetrics;
+
+/**
+ * ScreenUtils
+ * Created by lhk on 17-03-08.
+ */
+public class ScreenUtils {
+    private static int screenW;
+    private static int screenH;
+    private static float screenDensity;
+
+    public static void initScreen(Activity mActivity){
+        DisplayMetrics metric = new DisplayMetrics();
+        mActivity.getWindowManager().getDefaultDisplay().getMetrics(metric);
+        screenW = metric.widthPixels;
+        screenH = metric.heightPixels;
+        screenDensity = metric.density;
+    }
+
+    public static int getScreenW(){
+        return screenW;
+    }
+
+    public static int getScreenH(){
+        return screenH;
+    }
+
+    public static float getScreenDensity(){
+        return screenDensity;
+    }
+
+    /** 根据手机的分辨率从 dp 的单位 转成为 px(像素) */
+    public static int dp2px(float dpValue) {
+        return (int) (dpValue * getScreenDensity() + 0.5f);
+    }
+
+    /** 根据手机的分辨率从 px(像素) 的单位 转成为 dp */
+    public static int px2dp(float pxValue) {
+        return (int) (pxValue / getScreenDensity() + 0.5f);
+    }
+}

+ 751 - 0
app/src/main/java/com/yhx/union/public_store/TimeUtil.java

@@ -0,0 +1,751 @@
+package com.yhx.union.public_store;
+
+import android.annotation.SuppressLint;
+import android.text.TextUtils;
+import android.widget.DatePicker;
+import android.widget.TimePicker;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Created by Dong on 2016/10/20.
+ */
+public class TimeUtil {
+
+    public static final String TIME_YYYY_MM_DD = "yyyy-MM-dd";
+    public static final String TIME_YYYY_MM_DD2 = "yyyy'/'MM'/'dd";
+    public static final String TIME_YYYY_MM_DD3 = "yyyy.MM.dd";
+    public static final String TIME_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
+    public static final String TIME_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
+    public static final String TIME_MM_DD_HH_MM = "MM-dd HH:mm";
+    public static final String TIME_MM_DD_HH_MM_SS = "MM-dd HH:mm:ss";
+    public static final String HH_MM = "HH:mm";
+    public static final String TIME_HH_MM_SS = "HH:mm:ss";
+    public static final String TIME_MM_DD = "MM-dd";
+    public static final String TIME_DD = "dd";
+    public static final String BEGIN_HH_MM_SS_ZAO = "00:01:00";
+    public static final String END_HH_MM_SS_ZAO = "10:00:00";
+    public static final String BEGIN_HH_MM_SS_ZHONG = "10:01:00";
+    public static final String END_HH_MM_SS_ZHONG = "14:00:00";
+    public static final String BEGIN_HH_MM_SS_WAN = "14:01:00";
+    public static final String END_HH_MM_SS_WAN = "24:00:00";
+    public static final String BEGIN_ORDER_HH_MM_SS = "00:00:00";
+    public static final String END_ORDER_HH_MM_SS = "19:00:00";
+    public static final String BEGIN_ORDER_HH_MM_SS_WAIMAI = "00:00:00";
+    public static final String END_ORDER_HH_MM_SS_WAIMAI = "12:00:00";
+    public static final String BEGIN_ORDER_HH_MM_SS_PROPERTY = "00:00:00";
+    public static final String END_ORDER_HH_MM_SS_PROPERTY = "18:00:00";
+
+    /**
+     * 时间字符串格式化
+     *
+     * @param date      需要被处理的日期字符串
+     * @param parseStr  需要被处理的日期的格式串
+     * @param formatStr 最终返回的日期字符串的格式串
+     * @return 已经格式化的日期字符串
+     */
+    public static String formatDate(String date, String parseStr,
+                                    String formatStr) {
+        if (TextUtils.isEmpty(date)) {
+            return "";
+        }
+
+        SimpleDateFormat sdf = new SimpleDateFormat(parseStr);
+        Date d = null;
+        try {
+            d = sdf.parse(date);
+            sdf.applyPattern(formatStr);
+            return sdf.format(d);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return "";
+        }
+    }
+
+    public static String formatDate(long date, String formatStr) {
+//		if (date <= 0) {
+//			return "";
+//		}
+        DateFormat sdf = new SimpleDateFormat(formatStr);
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTimeInMillis(date);
+            return sdf.format(calendar.getTime());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "";
+        }
+    }
+
+    public static String formatDate(String date, String format) {
+        if (TextUtils.isEmpty(date)) {
+            return "";
+        }
+        String str = date;
+        if (str.contains("T")) {
+            str = str.replace("T", " ");
+        }
+        if (str.contains("/")) {
+            str = str.replaceAll("/", "-");
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        Date d = null;
+        try {
+            d = sdf.parse(str);
+            return sdf.format(d);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return "";
+        }
+    }
+
+    public static String getWeak(long time) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(time);
+        String week = "星期日";
+        switch (calendar.get(Calendar.DAY_OF_WEEK)) {
+            case 1:
+                week = "星期日";
+                break;
+            case 2:
+                week = "星期一";
+                break;
+            case 3:
+                week = "星期二";
+                break;
+            case 4:
+                week = "星期三";
+                break;
+            case 5:
+                week = "星期四";
+                break;
+            case 6:
+                week = "星期五";
+                break;
+            case 7:
+                week = "星期六";
+                break;
+            default:
+                break;
+        }
+        return week;
+    }
+
+    /**
+     * 星期一 MON
+     * 星期二 TUE
+     * 星期三 WED
+     * 星期四 THU
+     * 星期五 FRI
+     * 星期六 SAT
+     * 星期天 SUN
+     *
+     * @param time
+     * @return
+     */
+    public static String getWeak2(long time) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(time);
+        String week = "SUN";//星期日
+        switch (calendar.get(Calendar.DAY_OF_WEEK)) {
+            case 1:
+                week = "SUN";
+                break;
+            case 2:
+                week = "MON";
+                break;
+            case 3:
+                week = "TUE";
+                break;
+            case 4:
+                week = "WED";
+                break;
+            case 5:
+                week = "THU";
+                break;
+            case 6:
+                week = "FRI";
+                break;
+            case 7:
+                week = "SAT";//六
+                break;
+            default:
+                break;
+        }
+        return week;
+    }
+
+    /**
+     * @param time
+     * @return
+     */
+    public static String getWeak3(long time) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(time);
+        String week = "日";//星期日
+        switch (calendar.get(Calendar.DAY_OF_WEEK)) {
+            case 1:
+                week = "日";
+                break;
+            case 2:
+                week = "一";
+                break;
+            case 3:
+                week = "二";
+                break;
+            case 4:
+                week = "三";
+                break;
+            case 5:
+                week = "四";
+                break;
+            case 6:
+                week = "五";
+                break;
+            case 7:
+                week = "六";//六
+                break;
+            default:
+                break;
+        }
+        return week;
+    }
+
+
+    /**
+     * 字符时间转换成Date
+     *
+     * @param value
+     * @param format 需要的Date格式
+     * @return
+     */
+    public static Date strToDate(String value, String format) {
+        if (TextUtils.isEmpty(value)) {
+            return new Date();
+        }
+        try {
+            SimpleDateFormat formatter = new SimpleDateFormat(format);
+            Date strtodate = formatter.parse(value);
+            return strtodate;
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static long strToMillis(String time) {
+        Date date = strToDate(time, "yyyy-MM-dd");
+        if (date != null) {
+            return date.getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    public static long strToMillis(String time, String format) {
+        Date date = strToDate(time, format);
+        if (date != null) {
+            return date.getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * 计算两个时间之间的相差天数,第二个参数减第一个参数
+     *
+     * @param first
+     * @param second
+     * @return
+     */
+    public static int compareDifference(long first, long second) {
+        try {
+            long time = second - first;
+            int diff = (int) (time / 60 / 60 / 1000 / 24);
+            return diff;
+        } catch (Exception e) {
+            return 0;
+        }
+    }
+
+    /**
+     * 比较两个日期大小,如果第一个小于第二个返回true
+     *
+     * @param first  yyyy-MM-dd
+     * @param second yyyy-MM-dd
+     * @param format yyyy-MM-dd
+     * @return
+     */
+    public static boolean compareDate(String first, String second, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
+        Date firstDate;
+        try {
+            firstDate = sdf.parse(first);
+            Date secondDate = sdf.parse(second);
+            return firstDate.before(secondDate);
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    /**
+     * 比较两个日期大小,如果第一个小于第二个返回true
+     *
+     * @param firstDate Date
+     * @param second
+     * @param format    yyyy-MM-dd hh:mm:ss
+     * @return
+     */
+    public static boolean compareDate(Date firstDate, String second, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
+        Date secondDate;
+        try {
+            secondDate = sdf.parse(second);
+            return firstDate.before(secondDate);
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    /**
+     * 根据传入date获取前后多少天的日期
+     *
+     * @param date
+     * @param day         正数就是后几天 负数就是前几天
+     * @param returnParse 返回时间的格式
+     * @return
+     */
+    public static String getDateByDay(String date, int day, String returnParse) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTimeInMillis(strToMillis(date));
+        calendar.add(Calendar.DAY_OF_MONTH, day);
+        return formatDate(calendar.getTimeInMillis(), returnParse);
+    }
+
+    /**
+     * 比较两个日期的大小(前者大 返回true,比较到分钟数)
+     *
+     * @param one
+     * @param two
+     * @return
+     */
+    public static boolean compareDate(Date one, Date two) {
+        if (one.getYear() > two.getYear()) {
+            return true;
+        } else if (one.getYear() == two.getYear()
+                && one.getMonth() > two.getMonth()) {
+            return true;
+        } else if (one.getYear() == two.getYear()
+                && one.getMonth() == two.getMonth()
+                && one.getDate() > two.getDate()) {
+            return true;
+        } else if (one.getYear() == two.getYear()
+                && one.getMonth() == two.getMonth()
+                && one.getDate() == two.getDate()
+                && one.getHours() > two.getHours()) {
+            return true;
+        } else if (one.getYear() == two.getYear()
+                && one.getMonth() == two.getMonth()
+                && one.getDate() == two.getDate()
+                && one.getHours() == two.getHours()
+                && one.getMinutes() > two.getMinutes()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static String getTimeStrFromDatePicker(DatePicker date,
+                                                  TimePicker time) {
+        String timeStr = date.getYear() + "-";
+        if (date.getMonth() + 1 < 10) {
+            timeStr += "0" + (date.getMonth() + 1);
+        } else {
+            timeStr += (date.getMonth() + 1);
+        }
+        timeStr += "-";
+        if (date.getDayOfMonth() < 10) {
+            timeStr += "0" + date.getDayOfMonth();
+        } else {
+            timeStr += date.getDayOfMonth();
+        }
+        if (time != null) {
+            if (time.getCurrentHour() < 10) {
+                timeStr += " 0" + time.getCurrentHour();
+            } else {
+                timeStr += " " + time.getCurrentHour();
+            }
+            if (time.getCurrentMinute() < 10) {
+                timeStr += ":0" + time.getCurrentMinute();
+            } else {
+                timeStr += ":" + time.getCurrentMinute();
+            }
+        }
+        return timeStr;
+    }
+
+    /**
+     * @param date
+     * @return 1天5小时20分
+     * @throws ParseException
+     */
+    @SuppressLint("SimpleDateFormat")
+    public static String distanceDay(String date) {
+        String reulst = "";
+
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        date = formatDate(date, "yyyy-MM-dd HH:mm:ss");
+        // 给定的时间
+        Date end = null;
+        try {
+            end = format.parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        // 当前时间
+        Date now = new Date();
+        // 得到时间差
+        long diff = (end.getTime() - now.getTime()) / 1000;
+        long mm = (diff / 60) % 60;
+        long hh = (diff / 60 / 60) % 24;
+        long dd = (diff / 60 / 60 / 24);
+
+        reulst = (dd + "天" + hh + "小时" + mm + "分");
+
+        return reulst;
+    }
+
+    /**
+     * @return 获取当前月第一天
+     */
+    @SuppressLint("SimpleDateFormat")
+    public static String getMonthForFirstDay() {
+        SimpleDateFormat format = new SimpleDateFormat(TIME_YYYY_MM_DD);
+        Calendar cal = Calendar.getInstance();
+        cal.add(Calendar.MONTH, 0);
+        cal.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * @return 获取当前月最后一天
+     */
+    @SuppressLint("SimpleDateFormat")
+    public static String getMonthForLastDay() {
+        SimpleDateFormat format = new SimpleDateFormat(TIME_YYYY_MM_DD);
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.DAY_OF_MONTH,
+                cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * 刚刚------2分钟及以内的
+     * <p>
+     * 今天 hh:mm------除了刚刚,且在当天24:00内的
+     * <p>
+     * yy-mm-dd hh:mm----除了以上的,就是它
+     *
+     * @param time
+     * @return
+     */
+    public static String getProductHistory(long time) {
+        String result = null;
+        if ((System.currentTimeMillis() - time) <= 2 * 1000 * 60) {
+            result = "刚刚";
+        } else if (isSameDay(time, System.currentTimeMillis())) {
+            result = "今天" + formatDate(time, HH_MM);
+        } else {
+            result = formatDate(time, TimeUtil.TIME_YYYY_MM_DD_HH_MM);
+        }
+
+        return result;
+    }
+
+    public static boolean isSameDay(long timeOne, long timeTwo) {
+        Date dateOne = new Date(timeOne);
+        Date dateTwo = new Date(timeTwo);
+        if (dateOne.getYear() == dateTwo.getYear()
+                && dateOne.getMonth() == dateTwo.getMonth()
+                && dateOne.getDay() == dateTwo.getDay()) {
+            return true;
+        }
+        return false;
+    }
+
+
+
+    public static boolean isYesterdayDay(long timeOne, long timeTwo) {
+        Date dateOne = new Date(timeOne);
+        Date dateTwo = new Date(timeTwo);
+        if (dateOne.getYear() == dateTwo.getYear()
+                && dateOne.getMonth() == dateTwo.getMonth()
+                && (dateOne.getDay() == dateTwo.getDay() - 1)) {
+            return true;
+        }
+        return false;
+    }
+
+    public static String getPostBoardHeaderTime(long time) {
+        String result = null;
+        if (isSameDay(time, System.currentTimeMillis())) {
+            result = "今天";
+        } else if (isYesterdayDay(time, System.currentTimeMillis())) {
+            result = "昨天";
+        } else {
+            result = formatDate(time, TimeUtil.TIME_YYYY_MM_DD);
+        }
+
+        return result;
+    }
+
+    public static String getPostBoardHeaderTime(String time) {
+        long localTime = strToMillis(
+                formatDate(time, TIME_YYYY_MM_DD_HH_MM_SS),
+                TIME_YYYY_MM_DD_HH_MM_SS);
+        return getPostBoardHeaderTime(localTime);
+    }
+
+    /**
+     * 截取格式 **年**月**日
+     *
+     * @param date
+     * @return
+     */
+    public static String formatDate(String date) {
+        if (TextUtils.isEmpty(date)) {
+            return "";
+        }
+        date = formatDate(date, TIME_YYYY_MM_DD);
+        String[] arr = date.split("-");
+        if (arr != null && arr.length == 3) {
+            String s = arr[0] + "年" + arr[1] + "月" + arr[2] + "日";
+            return s;
+        }
+        return "";
+    }
+
+    /**
+     * 当前时间推迟一年加一天
+     *
+     * @param format 返回数据的时间格式
+     * @return
+     */
+    public static String getTheDayNextYear(String format) {
+        String nextYear = "";
+        try {
+            Calendar calendar = Calendar.getInstance();
+            calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1);
+            calendar.set(Calendar.DAY_OF_YEAR,
+                    calendar.get(Calendar.DAY_OF_YEAR) + 1);
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
+            nextYear = sdf.format(calendar.getTime());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return nextYear;
+    }
+
+    /**
+     * 返回年
+     *
+     * @return
+     */
+    public static String getCurrentYear() {
+        String result = "";
+        try {
+            Calendar calendar = Calendar.getInstance();
+            int year = calendar.get(Calendar.YEAR);
+            result = year + "";
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+
+    /**
+     * 返回月
+     *
+     * @return
+     */
+    public static String getCurrentMoth() {
+        String result = "";
+        try {
+            Calendar calendar = Calendar.getInstance();
+            int moth = calendar.get(Calendar.MONTH);
+            moth++;
+            result = moth + "";
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+
+    /**
+     * 返回今天
+     *
+     * @return
+     */
+    public static String getCurrentDayofMoth() {
+        String result = "";
+        try {
+            Calendar calendar = Calendar.getInstance();
+            int day = calendar.get(Calendar.DAY_OF_MONTH);
+            result = day + "";
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+
+    /**
+     * 获取日期
+     *
+     * @param pattern
+     * @return
+     */
+    public static String getCurrentDayStr(String pattern) {
+        String result = "";
+        try {
+            Calendar calendar = Calendar.getInstance();
+            result = formatDate(calendar.getTimeInMillis(), pattern);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+
+    }
+
+    /**
+     * 判断时间是否在时间段内
+     *
+     * @param date         当前时间 new Date()
+     * @param strDateBegin 开始时间 00:00:00
+     * @param strDateEnd   结束时间 00:05:00
+     * @return
+     */
+    public static boolean isInDate(Date date, String strDateBegin, String strDateEnd) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String strDate = sdf.format(date);
+        // 截取当前时间时分秒
+        int strDateH = Integer.parseInt(strDate.substring(11, 13));
+        int strDateM = Integer.parseInt(strDate.substring(14, 16));
+        int strDateS = Integer.parseInt(strDate.substring(17, 19));
+        // 截取开始时间时分秒
+        int strDateBeginH = Integer.parseInt(strDateBegin.substring(0, 2));
+        int strDateBeginM = Integer.parseInt(strDateBegin.substring(3, 5));
+        int strDateBeginS = Integer.parseInt(strDateBegin.substring(6, 8));
+        // 截取结束时间时分秒
+        int strDateEndH = Integer.parseInt(strDateEnd.substring(0, 2));
+        int strDateEndM = Integer.parseInt(strDateEnd.substring(3, 5));
+        int strDateEndS = Integer.parseInt(strDateEnd.substring(6, 8));
+        if ((strDateH >= strDateBeginH && strDateH <= strDateEndH)) {
+            // 当前时间小时数在开始时间和结束时间小时数之间
+            if (strDateH > strDateBeginH && strDateH < strDateEndH) {
+                return true;
+                // 当前时间小时数等于开始时间小时数,分钟数在开始和结束之间
+            } else if (strDateH == strDateBeginH && strDateM >= strDateBeginM
+                    && strDateM <= strDateEndM) {
+                return true;
+                // 当前时间小时数等于开始时间小时数,分钟数等于开始时间分钟数,秒数在开始和结束之间
+            } else if (strDateH == strDateBeginH && strDateM == strDateBeginM
+                    && strDateS >= strDateBeginS && strDateS <= strDateEndS) {
+                return true;
+            }
+            // 当前时间小时数大等于开始时间小时数,等于结束时间小时数,分钟数小等于结束时间分钟数
+            else if (strDateH >= strDateBeginH && strDateH == strDateEndH
+                    && strDateM <= strDateEndM) {
+                return true;
+                // 当前时间小时数大等于开始时间小时数,等于结束时间小时数,分钟数等于结束时间分钟数,秒数小等于结束时间秒数
+            } else if (strDateH >= strDateBeginH && strDateH == strDateEndH
+                    && strDateM == strDateEndM && strDateS <= strDateEndS) {
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 判断时间是否在时间段内
+     *
+     * @param strDate      当前时间 yyyy-MM-dd HH:mm:ss
+     * @param strDateBegin 开始时间 00:00:00
+     * @param strDateEnd   结束时间 00:05:00
+     * @return
+     */
+    public static boolean isInDate(String strDate, String strDateBegin, String strDateEnd) {
+        // 截取当前时间时分秒
+        int strDateH = Integer.parseInt(strDate.substring(11, 13));
+        int strDateM = Integer.parseInt(strDate.substring(14, 16));
+        int strDateS = Integer.parseInt(strDate.substring(17, 19));
+        // 截取开始时间时分秒
+        int strDateBeginH = Integer.parseInt(strDateBegin.substring(0, 2));
+        int strDateBeginM = Integer.parseInt(strDateBegin.substring(3, 5));
+        int strDateBeginS = Integer.parseInt(strDateBegin.substring(6, 8));
+        // 截取结束时间时分秒
+        int strDateEndH = Integer.parseInt(strDateEnd.substring(0, 2));
+        int strDateEndM = Integer.parseInt(strDateEnd.substring(3, 5));
+        int strDateEndS = Integer.parseInt(strDateEnd.substring(6, 8));
+        if ((strDateH >= strDateBeginH && strDateH <= strDateEndH)) {
+            // 当前时间小时数在开始时间和结束时间小时数之间
+            if (strDateH > strDateBeginH && strDateH < strDateEndH) {
+                return true;
+                // 当前时间小时数等于开始时间小时数,分钟数在开始和结束之间
+            } else if (strDateH == strDateBeginH && strDateM >= strDateBeginM
+                    && strDateM <= strDateEndM) {
+                return true;
+                // 当前时间小时数等于开始时间小时数,分钟数等于开始时间分钟数,秒数在开始和结束之间
+            } else if (strDateH == strDateBeginH && strDateM == strDateBeginM
+                    && strDateS >= strDateBeginS && strDateS <= strDateEndS) {
+                return true;
+            }
+            // 当前时间小时数大等于开始时间小时数,等于结束时间小时数,分钟数小等于结束时间分钟数
+            else if (strDateH >= strDateBeginH && strDateH == strDateEndH
+                    && strDateM <= strDateEndM) {
+                return true;
+                // 当前时间小时数大等于开始时间小时数,等于结束时间小时数,分钟数等于结束时间分钟数,秒数小等于结束时间秒数
+            } else if (strDateH >= strDateBeginH && strDateH == strDateEndH
+                    && strDateM == strDateEndM && strDateS <= strDateEndS) {
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    public static String GetNowDate() {
+        String temp_str = "";
+        Date dt = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        temp_str = sdf.format(dt);
+        return temp_str;
+    }
+
+    public static Calendar getCalendar(String date, String pattern) {
+        Calendar calendar = Calendar.getInstance();
+        SimpleDateFormat df = new SimpleDateFormat(pattern);
+        Date daystart = null;
+        try {
+            daystart = df.parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
+        calendar.setTime(daystart);
+        return calendar;
+    }
+}

+ 124 - 0
app/src/main/java/com/yhx/union/public_store/UtilSD.java

@@ -0,0 +1,124 @@
+package com.yhx.union.public_store;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Environment;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class UtilSD {
+
+    /**
+     * 判断SD卡是否可用
+     */
+    public static boolean isSDcardOK() {
+        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
+    }
+
+    /**
+     * 获取SD卡跟路径。SD卡不可用时,返回null
+     */
+    public static String getSDcardRoot() {
+        if (isSDcardOK()) {
+            return Environment.getExternalStorageDirectory().getAbsolutePath();
+        }
+
+        return null;
+    }
+
+    public static void showToast(Context context, String msg) {
+        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+    }
+
+    public static void showToast(Context context, int msgId) {
+        Toast.makeText(context, msgId, Toast.LENGTH_SHORT).show();
+    }
+
+    /**获取字符串中某个字符串出现的次数。*/
+    public static int countMatches(String res, String findString) {
+        if (res == null) {
+            return 0;
+        }
+
+        if (findString == null || findString.length() == 0) {
+            throw new IllegalArgumentException("The param findString cannot be null or 0 length.");
+        }
+
+        return (res.length() - res.replace(findString, "").length()) / findString.length();
+    }
+
+    /**判断该文件是否是一个图片。*/
+    public static boolean isImage(String fileName) {
+        return fileName.endsWith(".jpg") || fileName.endsWith(".jpeg") || fileName.endsWith(".png");
+    }
+
+    /**
+     * 获取年月日时分秒作为文件名
+     * @return
+     */
+    public static String getStrDate() {
+        Date date = new Date();
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+        String strDate = format.format(date);
+        return strDate;
+    }
+
+
+
+    public static String forNewName(){
+        String fileName = UtilSD.getStrDate()+".jpg";
+        String newImgPath = AppDataFile.getPictureFile().getAbsoluteFile() + File.separator + fileName;
+        return newImgPath;
+    }
+
+    public static String reGetNewFile(String filepath, String uid){
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inJustDecodeBounds = true;
+        // 获取这个图片的宽和高
+        Bitmap bitmap = BitmapFactory.decodeFile(filepath, options); //此时返回bm为空
+        options.inJustDecodeBounds = false;
+        //计算缩放比
+        int be = (int)(options.outHeight / (float)200);
+        if (be <= 0)
+            be = 1;
+        options.inSampleSize = be;
+        //重新读入图片,注意这次要把options.inJustDecodeBounds 设为 false哦
+        bitmap= BitmapFactory.decodeFile(filepath,options);
+//        int w = bitmap.getWidth();
+//        int h = bitmap.getHeight();
+//        System.out.println(w + "   " + h);
+
+        String fileName = uid+UtilSD.getStrDate()+".jpg";
+        String newImgPath = AppDataFile.getPictureFile().getAbsoluteFile() + File.separator + fileName;
+        File newFile = new File(newImgPath);
+        try {
+            FileOutputStream out=new FileOutputStream(newFile);
+            if(bitmap.compress(Bitmap.CompressFormat.PNG, 100, out)){
+                out.flush();
+                out.close();
+            }
+        } catch (FileNotFoundException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return newImgPath;
+    }
+
+    public static boolean delete(File file) {
+        if (file == null || !file.exists() || file.isDirectory()){
+            return false;
+        }
+        file.delete();
+        return true;
+    }
+}

+ 210 - 0
app/src/main/java/com/yhx/union/public_store/fragment/FragmentPager.java

@@ -0,0 +1,210 @@
+package com.yhx.union.public_store.fragment;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.viewpager.widget.ViewPager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Created by Administrator on 2015/11/16.
+ */
+public class FragmentPager extends ViewPager {
+    private FragmentTab[] fragmentTabs;
+    private List<Fragment> fragmentList = new ArrayList<Fragment>();
+    private FragmentManager fragmentManager;
+    private FragmentPagerListener fragmentPagerListener;
+    private Class<? extends Fragment>[] fragments;
+
+    private boolean isCanScroll = false;
+
+    private int oldItem = 0;
+
+
+    public FragmentPager init(FragmentManager fragmentManager1, FragmentPagerListener fragmentPagerListener1) {
+        if (fragmentManager1 == null) {
+            throw new RuntimeException("FragmentManager can not been null");
+        }
+        this.fragmentManager = fragmentManager1;
+        this.fragmentPagerListener = fragmentPagerListener1;
+        return this;
+    }
+
+    public FragmentPager setTabAndFragmentData(FragmentTab[] fragmentTabs1, Class<? extends Fragment>[] fragments1) {
+        if (fragmentTabs1 == null || fragments1 == null) {
+            throw new RuntimeException("FragmentVisitor data init error:either can not been null");
+        }
+        if (fragmentTabs1.length != fragments1.length) {
+            throw new RuntimeException("FragmentVisitor data init error:is not equal size");
+        }
+
+        this.fragmentTabs = fragmentTabs1;
+        this.fragments = fragments1;
+        for (int i = 0; i < fragmentTabs.length; i++) {
+            final int finalI = i;
+            fragmentTabs[finalI].setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    setCurrentItem(finalI);
+                }
+            });
+        }
+        addFragments();
+        this.setOnPageChangeListener(new OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+                setCurrentItem(position);
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+
+            }
+        });
+        return this;
+    }
+
+    public FragmentPager(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        setOverScrollMode(OVER_SCROLL_NEVER);
+        setOffscreenPageLimit(1);
+    }
+
+    public FragmentPager(Context context) {
+        this(context, null);
+    }
+
+
+    @Override
+    public void scrollTo(int x, int y) {
+        super.scrollTo(x, y);
+    }
+
+    @Override
+    public boolean onTouchEvent(MotionEvent arg0) {
+        // TODO Auto-generated method stub
+        if (isCanScroll()) {
+            return super.onTouchEvent(arg0);
+        } else {
+            return false;
+        }
+
+    }
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent arg0) {
+        // TODO Auto-generated method stub
+        if (isCanScroll()) {
+            return super.onInterceptTouchEvent(arg0);
+        } else {
+            return false;
+        }
+
+    }
+
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        if (isCanScroll()) {
+            return super.dispatchKeyEvent(event);
+        } else {
+            return false;
+        }
+    }
+
+    //    @Override
+//    public void setCurrentItem(int item) {
+//        super.setCurrentItem(item);
+//        setTab(item);
+//    }
+    public void setCurrentItem(int item) {
+        if (item < 0) {
+            return;
+        }
+        boolean itemEnable = true;
+        if (fragmentPagerListener != null) {
+            itemEnable = fragmentPagerListener.boforeItemChangedItemEnable(item);
+        }
+        if (fragmentPagerListener != null) {
+            fragmentPagerListener.controlItemEnable(item, itemEnable);
+        }
+        if (!itemEnable) {
+            //调到原来的item
+            if (oldItem >= 0) {
+                super.setCurrentItem(oldItem);
+            }
+            return;
+        }
+        //item改变
+        super.setCurrentItem(item);
+        if (fragmentPagerListener != null && oldItem >= 0) {
+            fragmentPagerListener.onItemChanged(oldItem, item, fragmentTabs[item].getTabCaption());
+        }
+        oldItem = item;
+        setTabs();
+    }
+
+    private void setTabs() {
+        if ((fragmentTabs != null) && (fragmentTabs.length - 1 >= oldItem)) {
+            for (int i = 0; i < fragmentTabs.length; i++) {
+                fragmentTabs[i].setTabFoucus(i == oldItem);
+            }
+        }
+    }
+
+    public boolean isCanScroll() {
+        return isCanScroll;
+    }
+
+    public FragmentPager setCanScroll(boolean isCanScroll) {
+        this.isCanScroll = isCanScroll;
+        return this;
+    }
+
+    private void addFragments() {
+        if (fragments == null || fragments.length <= 0) {
+            return;
+        }
+        fragmentList.clear();
+        for (int i = 0; i < fragments.length; i++) {
+            try {
+                fragmentList.add(fragments[i].newInstance());
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        this.setAdapter(new FragmentPagerAdapter(fragmentManager, fragmentList));
+    }
+
+    public interface FragmentPagerListener {
+        void onItemChanged(int oldItem, int newItem, String tabDiscription);
+
+        boolean boforeItemChangedItemEnable(int currentItem);
+
+        void controlItemEnable(int item, boolean enable);
+    }
+
+    public void resetHeight(int height) {
+        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) getLayoutParams();
+        if (layoutParams == null) {
+            layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
+        } else {
+            layoutParams.height = height;
+        }
+        setLayoutParams(layoutParams);
+    }
+}

+ 31 - 0
app/src/main/java/com/yhx/union/public_store/fragment/FragmentPagerAdapter.java

@@ -0,0 +1,31 @@
+package com.yhx.union.public_store.fragment;
+
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+
+import java.util.List;
+
+/**
+ * Created by Administrator on 2015/11/16.
+ */
+public class FragmentPagerAdapter extends androidx.fragment.app.FragmentPagerAdapter {
+
+    List<Fragment> list;
+
+    public FragmentPagerAdapter(FragmentManager fm, List<Fragment> list) {
+        super(fm);
+        this.list = list;
+
+    }
+
+    @Override
+    public int getCount() {
+        return list.size();
+    }
+
+    @Override
+    public Fragment getItem(int arg0) {
+        return list.get(arg0);
+    }
+}

+ 99 - 0
app/src/main/java/com/yhx/union/public_store/fragment/FragmentTab.java

@@ -0,0 +1,99 @@
+package com.yhx.union.public_store.fragment;
+
+/**
+ * Created by Administrator on 2016/2/22.
+ */
+
+import android.content.Context;
+import android.content.res.ColorStateList;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.yhx.union.R;
+
+
+/**
+ * TAB页
+ * */
+public class FragmentTab extends LinearLayout {
+    private ImageView ivIcon;
+    private TextView tvText;
+    private TextView tvTips;
+
+    private ColorStateList colorFocus=null;
+    private ColorStateList colorBlur=null;
+
+    public FragmentTab(Context context) {
+        this(context, null);
+    }
+
+    public FragmentTab(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public FragmentTab(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        TypedArray a = context.obtainStyledAttributes(attrs,
+                R.styleable.FragmentTab);
+        LayoutInflater.from(context).inflate(R.layout.layout_majortab, this);
+        ivIcon=(ImageView)findViewById(R.id.iv_tabicon);
+        tvText=(TextView)findViewById(R.id.tv_tabtips);
+        tvTips =(TextView)findViewById(R.id.tv_tabtext);
+
+        Drawable icon=a.getDrawable(R.styleable.FragmentTab_tab_icon); //图标
+        CharSequence text=a.getText(R.styleable.FragmentTab_tab_text);//文字
+        colorFocus=a.getColorStateList(R.styleable.FragmentTab_tab_text_focuscolor);
+        colorBlur=a.getColorStateList(R.styleable.FragmentTab_tab_text_blurcolor);
+        ivIcon.setBackgroundDrawable(icon);
+        tvText.setText(text);
+        a.recycle();
+    }
+
+    /**
+     *
+     * 显示提示
+     * @param count 数目,count>0才显示
+     * */
+    public void setTips(int count){
+        if(tvTips!=null){
+            if (count > 0)
+            {
+                String res = count > 99 ? "99+" : String.valueOf(count);
+                tvTips.setText(res);
+            }
+            tvTips.setVisibility(count > 0 ? View.VISIBLE : View.GONE);
+        }
+    }
+
+    public String getTabCaption(){
+        if(tvText!=null){
+            return tvText.getText().toString();
+        }
+        return "";
+    }
+
+    /**
+     *
+     * 设置tab状态
+     * */
+    public void setTabFoucus(boolean focus){
+        if(tvText!=null){
+            if(focus){
+                tvText.setTextColor(colorFocus != null ? colorFocus : ColorStateList.valueOf(0xFF000000));
+            }
+            else{
+                tvText.setTextColor(colorBlur != null ? colorBlur : ColorStateList.valueOf(0xFFe8e8e8));
+            }
+        }
+        if(ivIcon!=null){
+            ivIcon.setSelected(focus);
+        }
+    }
+
+}

+ 280 - 0
app/src/main/java/com/yhx/union/public_store/fragment/FragmentVisitor.java

@@ -0,0 +1,280 @@
+package com.yhx.union.public_store.fragment;/**
+ * Created by Administrator on 2016/4/1.
+ */
+
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
+
+/**
+ * Created by Administrator on 2016/4/1.
+ * 描述: Fragment查看器
+ * 修改者:
+ *
+ * @author tianhongtao on 2016/4/1 09:56
+ * @version 1.0 2016/4/1 09:56
+ * @since 1.0
+ */
+public class FragmentVisitor {
+    //当前项
+    private int fragmentCurrentItem = -1;
+    private FragmentManager fragmentManager;
+    private FragmentVisitorListener fragmentVisitorListener;
+
+    private int resContinerId = -1;
+
+    private FragmentTab[] fragmentTabs;
+    private Class<? extends Fragment>[] fragments;
+    private Fragment preFragmen;
+
+    /**
+     * 初始化
+     */
+    public FragmentVisitor init(FragmentManager fragmentManager1, FragmentVisitorListener fragmentVisitorListener1) {
+        if (fragmentManager1 == null) {
+            throw new RuntimeException("FragmentManager can not been null");
+        }
+        this.fragmentManager = fragmentManager1;
+        this.fragmentVisitorListener = fragmentVisitorListener1;
+        return this;
+    }
+
+    /**
+     * 设置容器
+     */
+    public FragmentVisitor setFragmentContiner(int resId) {
+        this.resContinerId = resId;
+        return this;
+    }
+
+    /**
+     * 设置tab和数据
+     */
+    public FragmentVisitor setTabAndFragmentData(FragmentTab[] fragmentTabs1, Class<? extends Fragment>[] fragments1) {
+        if (fragmentTabs1 == null || fragments1 == null) {
+            throw new RuntimeException("FragmentVisitor data init error:either can not been null");
+        }
+        if (fragmentTabs1.length != fragments1.length) {
+            throw new RuntimeException("FragmentVisitor data init error:is not equal size");
+        }
+        if (fragmentManager == null || resContinerId < 0) {
+            throw new RuntimeException("Method must be set FragmentManager and ContinerId first");
+        }
+        this.fragmentTabs = fragmentTabs1;
+        this.fragments = fragments1;
+        for (int i = 0; i < fragmentTabs.length; i++) {
+            final int finalI = i;
+            fragmentTabs[finalI].setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    setCurrentItem(finalI);
+                }
+            });
+        }
+        return this;
+    }
+
+    public void setCurrentItem(int item) {
+        if (item < 0) {
+            return;
+        }
+        boolean itemEnable = true;
+        if (fragmentVisitorListener != null) {
+            itemEnable = fragmentVisitorListener.boforeItemChangedItemEnable(fragmentCurrentItem,item);
+        }
+        if (fragmentVisitorListener != null) {
+            fragmentVisitorListener.controlItemEnable(itemEnable);
+        }
+        if (!itemEnable) {
+            return;
+        }
+        //item改变
+        if (fragmentCurrentItem != item && fragmentTabs != null && (fragmentTabs.length - 1 >= item)) {
+            if (fragmentVisitorListener != null) {
+                fragmentVisitorListener.onItemChanged(fragmentCurrentItem, item, fragmentTabs[item].getTabCaption());
+            }
+            if (fragmentCurrentItem < 0) {
+                try {
+                    preFragmen = fragments[item].newInstance();
+                    this.fragmentCurrentItem = item;
+                    setTabs();
+                    FragmentUtils.replaceFragment(fragmentManager, resContinerId,fragments[fragmentCurrentItem], null, false);
+                } catch (InstantiationException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+            else {
+                this.fragmentCurrentItem = item;
+                //改变tab
+                setTabs();
+                //设置Fragment
+                replaceFragment(fragments[fragmentCurrentItem]);
+            }
+        }
+    }
+
+    private void setTabs() {
+        if ((fragmentTabs != null) && (fragmentTabs.length - 1 >= fragmentCurrentItem)) {
+            for (int i = 0; i < fragmentTabs.length; i++) {
+                fragmentTabs[i].setTabFoucus(i == fragmentCurrentItem);
+            }
+        }
+    }
+
+    private void replaceFragment(Class<? extends Fragment> newFragment) {
+
+        preFragmen = FragmentUtils.switchFragment(fragmentManager,
+                resContinerId, preFragmen,
+                newFragment, null, false);
+    }
+
+    public interface FragmentVisitorListener {
+        void onItemChanged(int oldItem, int newItem, String tabDiscription);
+
+        boolean boforeItemChangedItemEnable(int currentItem, int newItem);
+
+        void controlItemEnable(boolean enable);
+    }
+
+
+    private final static class FragmentUtils {
+
+
+        public static Fragment replaceFragment(FragmentManager fragmentManager, int container,
+                                               Class<? extends Fragment> newFragment, Bundle args) {
+            return replaceFragment(fragmentManager, container, newFragment, args, false);
+        }
+
+        public static Fragment replaceFragment(FragmentManager fragmentManager, int container,
+                                               Fragment newFragment) {
+            return replaceFragment(fragmentManager, container, newFragment, false);
+        }
+
+        public static Fragment replaceFragment(FragmentManager fragmentManager, int container,
+                                               Class<? extends Fragment> newFragment, Bundle args, boolean addToBackStack) {
+
+            Fragment fragment = null;
+
+            // 构造新的Fragment
+            try {
+                fragment = newFragment.newInstance();
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+
+            if (fragment != null) {
+                // 设置参数
+                if (args != null && !args.isEmpty()) {
+                    final Bundle bundle = fragment.getArguments();
+                    if (bundle != null) {
+                        bundle.putAll(args);
+                    } else {
+                        fragment.setArguments(args);
+                    }
+                }
+                // 替换
+                return replaceFragment(fragmentManager, container, fragment, addToBackStack);
+            } else {
+                return null;
+            }
+        }
+
+        public static Fragment replaceFragment(FragmentManager fragmentManager, int container,
+                                               Fragment newFragment, boolean addToBackStack) {
+            final FragmentTransaction transaction = fragmentManager.beginTransaction();
+            final String tag = newFragment.getClass().getSimpleName();
+
+            if (newFragment != null) {
+                transaction.replace(container, newFragment, tag);
+            }
+
+            if (addToBackStack) {
+                transaction.addToBackStack(null);
+            }
+            transaction.commitAllowingStateLoss();
+            return newFragment;
+        }
+
+        public static Fragment switchFragment(FragmentManager fragmentManager, int container,
+                                              Fragment currentFragment, Class<? extends Fragment> newFragment, Bundle args) {
+            return switchFragment(fragmentManager, container, currentFragment, newFragment, args, false);
+        }
+
+        /**
+         * @param fragmentManager
+         * @param container
+         * @param currentFragment
+         * @param newFragment
+         * @param args            新Fragment的参数
+         * @param addToBackStack  这个操作是否加入栈中,如果要实现类似返回效果,则需要。
+         * @return 新显示的Fragment
+         */
+        public static Fragment switchFragment(FragmentManager fragmentManager, int container,
+                                              Fragment currentFragment, Class<? extends Fragment> newFragment, Bundle args,
+                                              boolean addToBackStack) {
+
+            final FragmentTransaction transaction = fragmentManager.beginTransaction();
+            final String tag = newFragment.getSimpleName();
+            Fragment fragment = fragmentManager.findFragmentByTag(tag);
+
+            // 如果在栈中找到相应的Fragment,则显示,否则重新生成一个
+            if (fragment != null) {
+                if (fragment != currentFragment) {
+                    if (currentFragment != null) {
+                        transaction.hide(currentFragment);
+                    }
+                    transaction.show(fragment);
+                    if (addToBackStack) {
+                        transaction.addToBackStack(null);
+                    }
+                    transaction.commitAllowingStateLoss();
+                } else {
+                    fragment.getArguments().putAll(args);
+                }
+
+                return fragment;
+            } else {
+                try {
+                    fragment = newFragment.newInstance();
+                } catch (InstantiationException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            // 为新的Fragment添加参数
+            if (fragment != null) {
+                if (args != null && !args.isEmpty()) {
+                    final Bundle bundle = fragment.getArguments();
+                    if (bundle != null) {
+                        bundle.putAll(args);
+                    } else {
+                        fragment.setArguments(args);
+                    }
+                }
+            }
+
+            // 显示新的Fragment
+            if (currentFragment != null) {
+                transaction.hide(currentFragment);
+            }
+            transaction.add(container, fragment, tag);
+            if (addToBackStack) {
+                transaction.addToBackStack(null);
+            }
+            transaction.commitAllowingStateLoss();
+
+            return fragment;
+        }
+
+    }
+}

+ 95 - 0
app/src/main/java/com/yhx/union/public_store/retrofit/RetrofitUtils.java

@@ -0,0 +1,95 @@
+package com.yhx.union.public_store.retrofit;
+
+import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
+import com.yhx.union.public_store.LogUtils;
+import java.io.IOException;
+import java.net.CookieManager;
+import java.net.CookiePolicy;
+import java.util.concurrent.TimeUnit;
+
+import io.reactivex.functions.Consumer;
+import io.reactivex.plugins.RxJavaPlugins;
+import okhttp3.Interceptor;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/5/4 下午4:35
+ *
+ */
+public class RetrofitUtils {
+    private static Retrofit singleton;
+    private static CookieManager cookieManager;
+    private final static int CONNECT_TIMEOUT = 30;
+    private final static int READ_TIMEOUT = 30;
+    private final static int WRITE_TIMEOUT = 30;
+
+    /**
+     * @param clazz
+     * @param baseUrl
+     * @param <T>
+     * @return
+     */
+    public static <T> T createApi(Class<T> clazz, String baseUrl) {
+        if (singleton == null) {
+            synchronized (RetrofitUtils.class) {
+                if (singleton == null) {
+                    Retrofit.Builder builder = new Retrofit.Builder();
+                    builder.baseUrl(baseUrl);
+                    builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
+                    builder.addConverterFactory(GsonConverterFactory.create());
+                    //设置cookie管理d
+                    cookieManager = (cookieManager != null ? cookieManager : new CookieManager());
+                    cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
+
+                    OkHttpClient.Builder okBuilder = new OkHttpClient.Builder()
+                            .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)//设置读取超时时间
+                            .writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS)//设置写的超时时间
+                            .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS);//设置连接超时时间
+                    okBuilder.addInterceptor(new RequestInterceptor());
+                    builder.client(okBuilder.build());
+
+                    singleton = builder.build();
+
+                    RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
+                        @Override
+                        public void accept(Throwable throwable) throws Exception {
+                        }
+                    });
+                }
+            }
+        }
+        return singleton.create(clazz);
+    }
+    /**
+     * 请求拦截器,保存cookie和  修改请求header
+     */
+    private static class RequestInterceptor implements Interceptor {
+        @Override
+        public Response intercept(Chain chain) throws IOException {
+            Request request = chain.request()
+                    .newBuilder()
+//                    .addHeader("Accept","*/*")
+//                    .addHeader("Accept-Language", languageS)
+//                    .addHeader("Authorization", UserInfoPreUtils.getInstance(RentingApplication.getInstance()).getAuthorization())
+//                    .addHeader("Wellcee-DID",Constants.EuipmentID)
+                    .build();
+            Response response = chain.proceed(request);
+            MediaType mediaType = response.body().contentType();
+            String content = response.body().string();
+            LogUtils.e("TAG", chain.request().url().toString());
+            LogUtils.e("TAG", content);
+            return response.newBuilder()
+                    .body(ResponseBody.create(mediaType, content))
+                    .build();
+//            return response;
+        }
+    }
+}

+ 25 - 0
app/src/main/java/com/yhx/union/public_store/retrofit/UnionServices.java

@@ -0,0 +1,25 @@
+package com.yhx.union.public_store.retrofit;
+
+
+import com.yhx.union.entity.BannerEntity;
+import com.yhx.union.entity.BaseResponse;
+import com.yhx.union.entity.NewBean;
+import com.yhx.union.entity.request.NewListRequest;
+
+import java.util.List;
+
+import io.reactivex.Observable;
+import retrofit2.http.Body;
+import retrofit2.http.POST;
+
+public interface UnionServices {
+
+
+    //首页轮播图
+    @POST("index.php/index/Political/querytitlelist")
+    Observable<BaseResponse<List<BannerEntity>>> querytitlelist();
+    //获取新闻清单
+    @POST("index.php/index/Political/querynewlist")
+    Observable<BaseResponse<List<NewBean>>> querynewlist(@Body NewListRequest request);
+
+}

+ 17 - 0
app/src/main/java/com/yhx/union/public_store/rx/ApiThrowableExceptionFunc.java

@@ -0,0 +1,17 @@
+package com.yhx.union.public_store.rx;
+
+import io.reactivex.Observable;
+import io.reactivex.functions.Function;
+
+/**
+ *错误处理
+ * Created by Dong on 2017/1/17.
+ */
+
+public class ApiThrowableExceptionFunc<T> implements Function<Throwable, Observable<T>> {
+
+    @Override
+    public Observable<T> apply(Throwable throwable) throws Exception {
+        return Observable.error(ExceptionHandle.handleException(throwable));
+    }
+}

+ 83 - 0
app/src/main/java/com/yhx/union/public_store/rx/DefaultSubscriber.java

@@ -0,0 +1,83 @@
+package com.yhx.union.public_store.rx;
+
+import android.content.Context;
+
+import com.yhx.union.R;
+import com.yhx.union.dialog.SessionPromptDialog;
+import com.yhx.union.entity.BaseResponse;
+import com.yhx.union.public_store.FNNetwork;
+import com.yhx.union.public_store.LogUtils;
+import com.yhx.union.system.BaseActivity;
+import com.yhx.union.system.MyApplication;
+
+import io.reactivex.Observer;
+import io.reactivex.disposables.Disposable;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/6/8 下午8:16
+ */
+public abstract class DefaultSubscriber<T> implements Observer<T> {
+    private Context mContext;
+
+    public DefaultSubscriber(Context mContext) {
+        this.mContext = mContext;
+    }
+
+    public abstract void success(T t);
+
+    @Override
+    public void onSubscribe(Disposable d) {
+        if (!FNNetwork.isConnected(MyApplication.getInstance())) {
+            d.dispose();
+            if (mContext instanceof BaseActivity) {
+                ((BaseActivity) mContext).showSnackBar(mContext.getString(R.string.global_tips_network_error));
+            }
+            return;
+        }
+    }
+
+    @Override
+    public void onComplete() {
+
+    }
+
+    public void onErr(T t) {
+        LogUtils.e("TAG",t.toString());
+    }
+
+    @Override
+    public void onNext(T t) {
+        if (t != null) {
+            if (t instanceof BaseResponse) {
+
+                if (((BaseResponse) t).getCode() == -1) {
+                    SessionPromptDialog sessionPromptDialog = new SessionPromptDialog(mContext);
+                    sessionPromptDialog.setCancelAble(false);
+                    sessionPromptDialog.show();
+                } else if (((BaseResponse) t).getCode() == 200) {
+                    success(t);
+                } else {
+                    onErr(t);
+                }
+            }else {
+                success(t);
+            }
+        } else {
+            onErr(t);
+            if (mContext instanceof BaseActivity) {
+                ((BaseActivity) mContext).showSnackBar(mContext.getString(R.string.loading_error));
+            }
+        }
+    }
+
+    @Override
+    public void onError(Throwable e) {
+        if (mContext instanceof BaseActivity) {
+            ((BaseActivity) mContext).showSnackBar(mContext.getString(R.string.loading_error));
+        }
+    }
+
+}

+ 166 - 0
app/src/main/java/com/yhx/union/public_store/rx/ExceptionHandle.java

@@ -0,0 +1,166 @@
+package com.yhx.union.public_store.rx;
+
+import com.google.gson.JsonParseException;
+import com.google.gson.stream.MalformedJsonException;
+import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
+
+import org.json.JSONException;
+
+import java.net.ConnectException;
+import java.net.SocketTimeoutException;
+import java.text.ParseException;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * Created by Dong on 2017/1/17.
+ */
+
+public class ExceptionHandle {
+    private static final int UNAUTHORIZED = 401;
+    private static final int FORBIDDEN = 403;
+    private static final int NOT_FOUND = 404;
+    private static final int REQUEST_TIMEOUT = 408;
+    private static final int INTERNAL_SERVER_ERROR = 500;
+    private static final int BAD_GATEWAY = 502;
+    private static final int SERVICE_UNAVAILABLE = 503;
+    private static final int GATEWAY_TIMEOUT = 504;
+
+    public static ResponseThrowable handleException(Throwable e) {
+        ResponseThrowable ex;
+        if (e instanceof HttpException) {
+            HttpException httpException = (HttpException) e;
+            ex = new ResponseThrowable(e, ERROR.HTTP_ERROR);
+            switch (httpException.code()) {
+                case UNAUTHORIZED:
+                case FORBIDDEN:
+                case NOT_FOUND:
+                case REQUEST_TIMEOUT:
+                case GATEWAY_TIMEOUT:
+                case INTERNAL_SERVER_ERROR:
+                case BAD_GATEWAY:
+                case SERVICE_UNAVAILABLE:
+                default:
+                    ex.message = "网络错误";
+                    break;
+            }
+            return ex;
+        } else if (e instanceof ServerException) {
+            ServerException resultException = (ServerException) e;
+            ex = new ResponseThrowable(resultException, resultException.code);
+            ex.message = resultException.message;
+            return ex;
+        } else if (e instanceof JsonParseException
+                || e instanceof JSONException
+                || e instanceof MalformedJsonException
+                || e instanceof ParseException) {
+            ex = new ResponseThrowable(e, ERROR.PARSE_ERROR);
+            ex.message = "解析服务器返回的数据错误";
+            return ex;
+        } else if (e instanceof ConnectException) {
+            ex = new ResponseThrowable(e, ERROR.NETWORK_ERROR);
+            ex.message = "连接服务器失败";
+            return ex;
+        } else if (e instanceof TimeoutException || e instanceof SocketTimeoutException) {
+            ex = new ResponseThrowable(e, ERROR.NETWORK_ERROR);
+            ex.message = "连接服务器超时";
+            return ex;
+        } else if (e instanceof javax.net.ssl.SSLHandshakeException) {
+            ex = new ResponseThrowable(e, ERROR.SSL_ERROR);
+            ex.message = "证书验证失败";
+            return ex;
+        }else if (e instanceof HttpException){
+            ex = new ResponseThrowable(e, ERROR.METHOD_ERROR);
+            ex.message = "调用的方法不存在";
+            return ex;
+        } else if (e instanceof NetWorkErrorException) {
+            ex = new ResponseThrowable(e, ERROR.METHOD_ERROR);
+            ex.message = "没有可用的网络,请检查网络设置";
+            return ex;
+        } else {
+            ex = new ResponseThrowable(e, ERROR.UNKNOWN);
+            ex.message = e.getMessage();
+            return ex;
+        }
+    }
+
+    /**
+     * 约定异常
+     */
+    public class ERROR {
+        /**
+         * 未知错误
+         */
+        public static final int UNKNOWN = 1000;
+        /**
+         * 解析错误
+         */
+        public static final int PARSE_ERROR = 1001;
+        /**
+         * 网络错误
+         */
+        public static final int NETWORK_ERROR = 1002;
+        /**
+         * 协议出错
+         */
+        public static final int HTTP_ERROR = 1003;
+
+        /**
+         * 证书出错
+         */
+        public static final int SSL_ERROR = 1005;
+        /**
+         * HTTP 405 Method Not Allowed
+         */
+        public static final int METHOD_ERROR = 1006;
+        /**
+         * 服务器返回的数据为空
+         */
+        public static final int HTTP_DATA_EMPTY = 103;
+
+
+    }
+
+    public static class ResponseThrowable extends Exception {
+        public static final String HTTP_DATA_EMPTY_MSG = "服务器返回数据为空";
+        
+        private int code;
+        private String message;
+
+        public ResponseThrowable() {
+            
+        }
+
+        public ResponseThrowable(String message, int code) {
+            super(message);
+            this.code = code;
+            this.message = message;
+        }
+
+        public int getCode() {
+            return code;
+        }
+
+        public void setCode(int code) {
+            this.code = code;
+        }
+
+        @Override
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+        public ResponseThrowable(Throwable throwable, int code) {
+            super(throwable);
+            this.code = code;
+        }
+    }
+
+    public class ServerException extends RuntimeException {
+        public int code;
+        public String message;
+    }
+}

+ 24 - 0
app/src/main/java/com/yhx/union/public_store/rx/NetWorkErrorException.java

@@ -0,0 +1,24 @@
+package com.yhx.union.public_store.rx;
+
+/**
+ * Created by Dong on 2017/2/27.
+ */
+
+public class NetWorkErrorException extends Exception {
+    
+    public NetWorkErrorException() {
+        super();
+    }
+
+    public NetWorkErrorException(String message) {
+        super(message);
+    }
+
+    public NetWorkErrorException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public NetWorkErrorException(Throwable cause) {
+        super(cause);
+    }
+}

+ 65 - 0
app/src/main/java/com/yhx/union/public_store/rx/ProgressSubscriber.java

@@ -0,0 +1,65 @@
+package com.yhx.union.public_store.rx;
+
+
+import android.app.ProgressDialog;
+import android.content.Context;
+
+import com.yhx.union.public_store.FNNetwork;
+import com.yhx.union.system.HodingView;
+import com.yhx.union.system.MyApplication;
+
+import io.reactivex.disposables.Disposable;
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/6/11 上午10:29
+ * 
+ */
+public abstract class ProgressSubscriber<T> extends DefaultSubscriber<T> {
+
+    private Context mContext;
+    ProgressDialog mProgress;
+    private boolean isCancelable = false;
+
+    
+    public ProgressSubscriber(Context activity) {
+        super(activity);
+        this.mContext = activity;
+    }
+
+    public ProgressSubscriber(Context activity, boolean _isCancelable) {
+        super(activity);
+        this.mContext = activity;
+        this.isCancelable = _isCancelable;
+    }
+
+    @Override
+    public void onSubscribe(Disposable d) {
+        super.onSubscribe(d);
+        if (FNNetwork.isConnected(MyApplication.getInstance())) {
+            showProgressBar("正在加载...");
+        }
+    }
+
+    @Override
+    public void onError(Throwable e) {
+        hideProgressBar();
+        super.onError(e);
+    }
+
+    @Override
+    public void onComplete() {
+        hideProgressBar();
+    }
+
+    public void showProgressBar(String message) {
+        HodingView.build().setContext(mContext).show(message);
+    }
+
+    public void hideProgressBar() {
+        HodingView.build().hide();
+    }
+
+
+}

+ 17 - 0
app/src/main/java/com/yhx/union/public_store/rx/ResponseFunc.java

@@ -0,0 +1,17 @@
+package com.yhx.union.public_store.rx;
+
+
+import com.yhx.union.entity.BaseResponse;
+
+import io.reactivex.functions.Function;
+
+/**
+ * Created by Dong on 2017/1/17.
+ */
+
+public class ResponseFunc<T> implements Function<BaseResponse<T>, T> {
+    @Override
+    public T apply(BaseResponse<T> tBaseResponse) throws Exception {
+        return tBaseResponse.getResultData();
+    }
+}

+ 49 - 0
app/src/main/java/com/yhx/union/public_store/rx/SchedulersCompat.java

@@ -0,0 +1,49 @@
+package com.yhx.union.public_store.rx;
+
+import java.util.concurrent.TimeUnit;
+
+import io.reactivex.Observable;
+import io.reactivex.ObservableSource;
+import io.reactivex.ObservableTransformer;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Created by Dong on 2017/1/17.
+ */
+
+public class SchedulersCompat {
+
+    public static final int NETWORK_REQUEST_DELAY = 16;
+
+    private static ObservableTransformer ioToUiTransformer =
+            new ObservableTransformer() {
+                @Override
+                public ObservableSource apply(Observable upstream) {
+                    return upstream.delay(NETWORK_REQUEST_DELAY, TimeUnit.MILLISECONDS)
+                            .subscribeOn(Schedulers.io())
+                            .unsubscribeOn(Schedulers.io())
+                            .observeOn(AndroidSchedulers.mainThread());
+                }
+            };
+    private static ObservableTransformer ioTransformer =
+            new ObservableTransformer() {
+                @Override
+                public ObservableSource apply(Observable upstream) {
+                    return upstream.delay(NETWORK_REQUEST_DELAY, TimeUnit.MILLISECONDS)
+                            .subscribeOn(Schedulers.io())
+                            .unsubscribeOn(Schedulers.io());
+                }
+            };
+
+    /**
+     * Don't break the chain; use RxJava's compose() operator
+     */
+    public static <T> ObservableTransformer<T, T> applyIoToUiSchedulers() {
+        return (ObservableTransformer<T, T>) ioToUiTransformer;
+    }
+
+    public static <T> ObservableTransformer<T, T> applyIoSchedulers() {
+        return (ObservableTransformer<T, T>) ioTransformer;
+    }
+}

+ 125 - 0
app/src/main/java/com/yhx/union/public_store/statusbarutil/OSUtils.java

@@ -0,0 +1,125 @@
+package com.yhx.union.public_store.statusbarutil;
+
+import android.os.Build;
+import android.text.TextUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * Created by rhm on 2018/1/12.
+ */
+
+public class OSUtils {
+
+private static final String TAG = "Rom";
+
+    public static final String ROM_MIUI = "MIUI";
+    public static final String ROM_EMUI = "EMUI";
+    public static final String ROM_FLYME = "FLYME";
+    public static final String ROM_OPPO = "OPPO";
+    public static final String ROM_SMARTISAN = "SMARTISAN";
+    public static final String ROM_VIVO = "VIVO";
+    public static final String ROM_QIKU = "QIKU";
+
+    private static final String KEY_VERSION_MIUI = "ro.miui.ui.version.name";
+    private static final String KEY_VERSION_EMUI = "ro.build.version.emui";
+    private static final String KEY_VERSION_OPPO = "ro.build.version.opporom";
+    private static final String KEY_VERSION_SMARTISAN = "ro.smartisan.version";
+    private static final String KEY_VERSION_VIVO = "ro.vivo.os.version";
+
+    private static String sName;
+    private static String sVersion;
+
+    public static boolean isEmui() {
+        return check(ROM_EMUI);
+    }
+
+    public static boolean isMiui() {
+        return check(ROM_MIUI);
+    }
+
+    public static boolean isVivo() {
+        return check(ROM_VIVO);
+    }
+
+    public static boolean isOppo() {
+        return check(ROM_OPPO);
+    }
+
+    public static boolean isFlyme() {
+        return check(ROM_FLYME);
+    }
+
+    public static boolean is360() {
+        return check(ROM_QIKU) || check("360");
+    }
+
+    public static boolean isSmartisan() {
+        return check(ROM_SMARTISAN);
+    }
+
+    public static String getName() {
+        if (sName == null) {
+            check("");
+        }
+        return sName;
+    }
+
+    public static String getVersion() {
+        if (sVersion == null) {
+            check("");
+        }
+        return sVersion;
+    }
+
+    public static boolean check(String rom) {
+        if (sName != null) {
+            return sName.equals(rom);
+        }
+
+        if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
+            sName = ROM_MIUI;
+        } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
+            sName = ROM_EMUI;
+        } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
+            sName = ROM_OPPO;
+        } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
+            sName = ROM_VIVO;
+        } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
+            sName = ROM_SMARTISAN;
+        } else {
+            sVersion = Build.DISPLAY;
+            if (sVersion.toUpperCase().contains(ROM_FLYME)) {
+                sName = ROM_FLYME;
+            } else {
+                sVersion = Build.UNKNOWN;
+                sName = Build.MANUFACTURER.toUpperCase();
+            }
+        }
+        return sName.equals(rom);
+    }
+
+    public static String getProp(String name) {
+        String line = null;
+        BufferedReader input = null;
+        try {
+            Process p = Runtime.getRuntime().exec("getprop " + name);
+            input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
+            line = input.readLine();
+            input.close();
+        } catch (IOException ex) {
+            return null;
+        } finally {
+            if (input != null) {
+                try {
+                    input.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return line;
+    }
+}

+ 167 - 0
app/src/main/java/com/yhx/union/public_store/statusbarutil/StatusBarHelper.java

@@ -0,0 +1,167 @@
+package com.yhx.union.public_store.statusbarutil;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Build;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * 描述:设置状态栏黑色
+ *
+ * @author yanghuaxiong
+ * @create 2018/5/8 下午3:51
+ */
+
+public class StatusBarHelper {
+    @IntDef({
+            OTHER,
+            MIUI,
+            FLYME,
+            ANDROID_M
+    })
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface SystemType {
+
+    }
+
+    public static final int OTHER = -1;
+    public static final int MIUI = 1;
+    public static final int FLYME = 2;
+    public static final int ANDROID_M = 3;
+
+    /**
+     * 设置状态栏黑色字体图标,
+     * 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
+     *
+     * @return 1:MIUI 2:Flyme 3:android6.0
+     */
+    public static void statusBarLightMode(Activity activity) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                setStatusBarLightMode(activity, true);
+            } else if (OSUtils.isMiui()) {
+                setMIUIStatusBarLightMode(activity,true);
+            } else if (OSUtils.isFlyme()) {
+                setFlymeStatusBarLightMode(activity,true);
+            }
+        }
+    }
+
+    /**
+     * 已知系统类型时,设置状态栏黑色字体图标。
+     * 适配4.4以上版本MIUI6、Flyme和6.0以上版本其他Android
+     *
+     * @param type 1:MIUI 2:Flyme 3:android6.0
+     */
+    public static void statusBarLightMode(Activity activity, @SystemType int type) {
+        statusBarMode(activity, type, true);
+
+    }
+
+    /**
+     * 清除MIUI或flyme或6.0以上版本状态栏黑色字体
+     */
+    public static void statusBarDarkMode(Activity activity, @SystemType int type) {
+        statusBarMode(activity, type, false);
+    }
+
+    private static void statusBarMode(Activity activity, @SystemType int type, boolean isFontColorDark) {
+        if (type == MIUI) {
+            setMIUIStatusBarLightMode(activity, isFontColorDark);
+        } else if (type == FLYME) {
+            setFlymeStatusBarLightMode(activity, isFontColorDark);
+        } else if (type == ANDROID_M) {
+            setStatusBarLightMode(activity, isFontColorDark);
+        }
+    }
+
+    /**
+     * 设置状态栏字体图标为深色,需要MIUI6以上
+     * @param isFontColorDark 是否把状态栏字体及图标颜色设置为深色
+     */
+    public static void setMIUIStatusBarLightMode(Activity activity, boolean isFontColorDark) {
+        Window window = activity.getWindow();
+        if (window != null) {
+            Class clazz = window.getClass();
+            try {
+                int darkModeFlag = 0;
+                Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
+                Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
+                darkModeFlag = field.getInt(layoutParams);
+                Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
+                if (isFontColorDark) {
+                    extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
+                } else {
+                    extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 设置状态栏图标为深色和魅族特定的文字风格
+     * 可以用来判断是否为Flyme用户
+     *
+     * @param isFontColorDark 是否把状态栏字体及图标颜色设置为深色
+     */
+    public static void setFlymeStatusBarLightMode(Activity activity, boolean isFontColorDark) {
+        Window window = activity.getWindow();
+        if (window != null) {
+            try {
+                WindowManager.LayoutParams lp = window.getAttributes();
+                Field darkFlag = WindowManager.LayoutParams.class
+                        .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
+                Field meizuFlags = WindowManager.LayoutParams.class
+                        .getDeclaredField("meizuFlags");
+                darkFlag.setAccessible(true);
+                meizuFlags.setAccessible(true);
+                int bit = darkFlag.getInt(null);
+                int value = meizuFlags.getInt(lp);
+                if (isFontColorDark) {
+                    value |= bit;
+                } else {
+                    value &= ~bit;
+                }
+                meizuFlags.setInt(lp, value);
+                window.setAttributes(lp);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+    public static void setStatusBarLightMode(Activity activity, boolean isFontColorDark) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            if (isFontColorDark) {
+                // 沉浸式
+                //                activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+                //非沉浸式
+                activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+            } else {
+                //非沉浸式
+                activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
+            }
+        }
+    }
+    public static int getStatusBarHeight(Context context) {
+        int result = 0;
+        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
+        if (resourceId > 0) {
+            result = context.getResources().getDimensionPixelSize(resourceId);
+        }
+        return result;
+    }
+
+}

+ 161 - 0
app/src/main/java/com/yhx/union/public_store/statusbarutil/StatusBarUtil.java

@@ -0,0 +1,161 @@
+package com.yhx.union.public_store.statusbarutil;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.graphics.Color;
+import android.os.Build;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.annotation.IntDef;
+import com.yhx.union.R;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Created by rhm on 2018/1/13.
+ */
+
+public class StatusBarUtil {
+    public final static int TYPE_MIUI = 0;
+    public final static int TYPE_FLYME = 1;
+    public final static int TYPE_M = 3;//6.0
+
+    @IntDef({TYPE_MIUI,
+            TYPE_FLYME,
+            TYPE_M})
+    @Retention(RetentionPolicy.SOURCE)
+    @interface ViewType {
+    }
+
+    /**
+     * 修改状态栏颜色,支持4.4以上版本
+     * @param colorId 颜色
+     */
+    public static void setStatusBarColor(Activity activity, int colorId) {
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            Window window = activity.getWindow();
+            window.setStatusBarColor(colorId);
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            //使用SystemBarTintManager,需要先将状态栏设置为透明
+            setTranslucentStatus(activity);
+            SystemBarTintManager systemBarTintManager = new SystemBarTintManager(activity);
+            systemBarTintManager.setStatusBarTintEnabled(true);//显示状态栏
+            systemBarTintManager.setStatusBarTintColor(colorId);//设置状态栏颜色
+        }
+    }
+
+    /**
+     * 设置状态栏透明
+     */
+    @TargetApi(19)
+    public static void setTranslucentStatus(Activity activity) {
+
+        // 5.0以上系统状态栏透明
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            Window window = activity.getWindow();
+            //清除透明状态栏
+            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+            //设置状态栏颜色必须添加
+            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+            window.setStatusBarColor(Color.TRANSPARENT);//设置透明
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //19
+            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+        }
+    }
+
+    /**
+     * 设置沉浸式状态栏
+     *
+     * @param fontIconDark 状态栏字体和图标颜色是否为深色
+     */
+    public static void setImmersiveStatusBar(Activity activity, boolean fontIconDark) {
+        setTranslucentStatus(activity);
+        if (fontIconDark) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                setStatusBarFontIconDark(activity,TYPE_M);
+            } else if (OSUtils.isMiui()) {
+                setStatusBarFontIconDark(activity,TYPE_MIUI);
+            } else if (OSUtils.isFlyme()) {
+                setStatusBarFontIconDark(activity,TYPE_FLYME);
+            } else {//其他情况下我们将状态栏设置为灰色,就不会看不见字体
+              setStatusBarColor(activity, activity.getResources().getColor(R.color.colorPrimary));//灰色
+            }
+        }
+    }
+
+    /**
+     * 设置文字颜色
+     */
+    public static void setStatusBarFontIconDark(Activity activity, @ViewType int type) {
+        switch (type) {
+            case TYPE_MIUI:
+                setMiuiUI(activity,true);
+                break;
+            case TYPE_M:
+                setCommonUI(activity);
+                break;
+            case TYPE_FLYME:
+                setFlymeUI(activity,true);
+                break;
+        }
+    }
+
+    //设置6.0的字体
+    public static void setCommonUI(Activity activity) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            activity.getWindow().getDecorView().setSystemUiVisibility(
+                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                            | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+        }
+    }
+
+    //设置Flyme的字体
+    public static void setFlymeUI(Activity activity, boolean dark) {
+        try {
+            Window window = activity.getWindow();
+            WindowManager.LayoutParams lp = window.getAttributes();
+            Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
+            Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
+            darkFlag.setAccessible(true);
+            meizuFlags.setAccessible(true);
+            int bit = darkFlag.getInt(null);
+            int value = meizuFlags.getInt(lp);
+            if (dark) {
+                value |= bit;
+            } else {
+                value &= ~bit;
+            }
+            meizuFlags.setInt(lp, value);
+            window.setAttributes(lp);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //设置MIUI字体
+    public static void setMiuiUI(Activity activity, boolean dark) {
+        try {
+            Window window = activity.getWindow();
+            Class clazz = activity.getWindow().getClass();
+            Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
+            Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
+            int darkModeFlag = field.getInt(layoutParams);
+            Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
+            if (dark) {    //状态栏亮色且黑色字体
+                extraFlagField.invoke(window, darkModeFlag, darkModeFlag);
+            } else {
+                extraFlagField.invoke(window, 0, darkModeFlag);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 106 - 0
app/src/main/java/com/yhx/union/public_store/statusbarutil/SystemBarTintManager.java

@@ -0,0 +1,106 @@
+package com.yhx.union.public_store.statusbarutil;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.res.TypedArray;
+import android.os.Build;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+
+/**
+ * Created by rhm on 2018/1/13.
+ */
+
+public class SystemBarTintManager {
+
+    public static final int DEFAULT_TINT_COLOR = 0x99000000;
+    private boolean mStatusBarAvailable;
+    private boolean mStatusBarTintEnabled;
+    private View mStatusBarTintView;
+
+    @TargetApi(19)
+    public SystemBarTintManager(Activity activity) {
+
+        Window win = activity.getWindow();
+        //获取DecorView
+        ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            // 检查主题中是否有透明的状态栏
+            int[] attrs = {android.R.attr.windowTranslucentStatus};
+            TypedArray a = activity.obtainStyledAttributes(attrs);
+            try {
+                mStatusBarAvailable = a.getBoolean(0, false);
+            } finally {
+                a.recycle();
+            }
+            WindowManager.LayoutParams winParams = win.getAttributes();
+            int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;//状态栏透明
+            if ((winParams.flags & bits) != 0) {
+                mStatusBarAvailable = true;
+            }
+        }
+        if (mStatusBarAvailable) {
+            setupStatusBarView(activity, decorViewGroup);
+        }
+    }
+
+    /**
+     * 初始化状态栏
+     *
+     * @param context
+     * @param decorViewGroup
+     */
+    private void setupStatusBarView(Activity context, ViewGroup decorViewGroup) {
+        mStatusBarTintView = new View(context);
+        //设置高度为Statusbar的高度
+        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarHeight(context));
+        params.gravity = Gravity.TOP;
+        mStatusBarTintView.setLayoutParams(params);
+        mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
+        //默认不显示
+        mStatusBarTintView.setVisibility(View.GONE);
+        //decorView添加状态栏高度的View
+        decorViewGroup.addView(mStatusBarTintView);
+    }
+
+    /**
+     * 获取状态栏高度
+     *
+     * @param activity
+     * @return
+     */
+    private int getStatusBarHeight(Activity activity) {
+        int statusBarHeight = 0;
+        int resourceId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android");
+        if (resourceId > 0) {
+            statusBarHeight = activity.getResources().getDimensionPixelSize(resourceId);
+        }
+        return statusBarHeight;
+    }
+
+    /**
+     * 显示状态栏
+     */
+    public void setStatusBarTintEnabled(boolean enabled) {
+        mStatusBarTintEnabled = enabled;
+        if (mStatusBarAvailable) {
+            mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
+        }
+    }
+
+    /**
+     * 设置状态栏颜色
+     *
+     * @param color
+     */
+    public void setStatusBarTintColor(int color) {
+        if (mStatusBarAvailable) {
+            mStatusBarTintView.setBackgroundColor(color);
+        }
+    }
+}

+ 177 - 0
app/src/main/java/com/yhx/union/system/BaseActivity.java

@@ -0,0 +1,177 @@
+package com.yhx.union.system;
+
+import android.content.Context;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+
+import com.google.android.material.snackbar.Snackbar;
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+import com.yhx.union.R;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/4/10 上午11:32
+ */
+public abstract class BaseActivity extends AppCompatActivity {
+    @Nullable
+    @BindView(R.id.toolbar)
+    Toolbar toolbar;
+//    @Nullable
+//    @BindView(R.id.back)
+//    LinearLayout back;
+
+    @Nullable
+    @BindView(R.id.app_name)
+    public TextView appName;
+    @Nullable
+    @BindView(R.id.right_text)
+    public TextView rightText;
+    @Nullable
+    @BindView(R.id.ll_right)
+    public LinearLayout llRight;
+    @Nullable
+    @BindView(R.id.right_icon)
+    public ImageView rightIcon;
+
+    public String TAG = null;
+    public Context mContext = null;
+
+    //set layout
+    public abstract int getContentViewLayoutID();
+
+    //绑定控件,设置listener
+    public abstract void bindViewAndEvent(Bundle savedInstanceState);
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//锁定竖屏
+        //防止截图
+//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
+        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE |
+                WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);//不弹出软键盘
+        super.onCreate(savedInstanceState);
+
+//        getWindow().getDecorView().setFilterTouchesWhenObscured(false);
+        this.TAG = this.getClass().getSimpleName();
+        this.mContext = this;
+
+        if (getContentViewLayoutID() != 0) {
+            super.setContentView(getContentViewLayoutID());
+            ButterKnife.bind(this);
+            bindViewAndEvent(savedInstanceState);
+            if (toolbar != null) {
+                toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        finish();
+                    }
+                });
+            }
+//            if (back != null) {
+//                back.setOnClickListener(new View.OnClickListener() {
+//                    @Override
+//                    public void onClick(View v) {
+//                        finish();
+//                    }
+//                });
+//            }
+        }
+//        StatusBarHelper.statusBarLightMode(this);
+        MyApplication.getInstance().addActivity(this);
+    }
+
+
+    //初始化标题
+    public void initTitle(String title) {
+        if (appName != null) {
+            appName.setText(title);
+        }
+    }
+
+    //初始化标题和右边文字
+    public void initTitle(String title, String rightTextS) {
+        if (appName != null) {
+            appName.setText(title);
+        }
+        if (rightText != null) {
+            rightText.setVisibility(View.VISIBLE);
+            rightText.setText(rightTextS);
+        }
+    }
+
+    //初始化标题和右边图标
+    public void initTitle(String title, int resId) {
+        if (appName != null) {
+            appName.setText(title);
+        }
+        if (llRight != null) {
+            llRight.setVisibility(View.VISIBLE);
+            rightIcon.setImageResource(resId);
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        MyApplication.getInstance().removeActivity(this);
+        super.onDestroy();
+    }
+
+    public void showSnackBar(View topView, String msg) {
+        if (null != msg && !TextUtils.isEmpty(msg)) {
+            Snackbar.make(topView, msg, Snackbar.LENGTH_SHORT).show();
+        }
+    }
+
+    public void showSnackBar(String msg) {
+        if (null != msg && !TextUtils.isEmpty(msg)) {
+            Snackbar.make(getWindow().getDecorView(), msg, Snackbar.LENGTH_SHORT).show();
+        }
+    }
+
+    public void showProgressBar(String message) {
+
+        HodingView.build().setContext(mContext).show(message);
+    }
+
+    public void hideProgressBar() {
+        HodingView.build().hide();
+    }
+    //刷新完成以后刷新处理  防止以后改动
+    public void refreshComplete(SmartRefreshLayout refreshLayout, Boolean isHasMore) {
+        if (refreshLayout.isRefreshing()) {
+            refreshLayout.finishRefresh();
+        } else if (refreshLayout.isLoading()) {
+            if (isHasMore) {
+                refreshLayout.finishLoadMore();
+            }
+        }
+        if (isHasMore) {
+            refreshLayout.setNoMoreData(false);
+        } else {
+            refreshLayout.finishLoadMoreWithNoMoreData();
+        }
+    }
+
+    public void refreshError(SmartRefreshLayout refreshLayout) {
+        if (refreshLayout.isRefreshing()) {
+            refreshLayout.finishRefresh();
+        } else if (refreshLayout.isLoading()) {
+            refreshLayout.finishLoadMore();
+        }
+    }
+}

+ 122 - 0
app/src/main/java/com/yhx/union/system/BaseFragment.java

@@ -0,0 +1,122 @@
+package com.yhx.union.system;
+
+
+import android.text.TextUtils;
+import android.view.View;
+
+import androidx.fragment.app.Fragment;
+
+import com.google.android.material.snackbar.Snackbar;
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/4/10 上午11:32
+ */
+public abstract class BaseFragment extends Fragment {
+
+//    @Nullable
+//    @BindView(R.id.ll_entity)
+//    LinearLayout llEntity;
+//    @Nullable
+//    @BindView(R.id.tv_empty)
+//    TextView tv_empty;
+
+    public void showSnackBar(View topView, String msg) {
+        if (null != msg && !TextUtils.isEmpty(msg)) {
+            Snackbar.make(topView, msg, Snackbar.LENGTH_SHORT).show();
+        }
+    }
+
+    public void showSnackBar(String msg) {
+        if (null != msg && !TextUtils.isEmpty(msg)) {
+            Snackbar.make(getActivity().getWindow().getDecorView(), msg, Snackbar.LENGTH_SHORT).show();
+        }
+    }
+
+    public void showProgressBar(String message) {
+
+        HodingView.build().setContext(getActivity()).show(message);
+    }
+
+    public void hideProgressBar() {
+        HodingView.build().hide();
+    }
+
+
+    //刷新完成以后刷新处理  防止以后改动
+    public void refreshComplete(SmartRefreshLayout refreshLayout, Boolean isHasMore) {
+        if (refreshLayout.isRefreshing()) {
+            refreshLayout.finishRefresh();
+        } else if (refreshLayout.isLoading()) {
+            if (isHasMore) {
+                refreshLayout.finishLoadMore();
+            }
+        }
+        if (isHasMore) {
+            refreshLayout.setNoMoreData(false);
+        } else {
+            refreshLayout.finishLoadMoreWithNoMoreData();
+        }
+    }
+
+    public void refreshError(SmartRefreshLayout refreshLayout) {
+        if (refreshLayout.isRefreshing()) {
+            refreshLayout.finishRefresh();
+        } else if (refreshLayout.isLoading()) {
+            refreshLayout.finishLoadMore();
+        }
+    }
+//
+//    //设置空页面
+//    public void setEntityView(LinearLayout cotent,Boolean isEntity) {
+//        if (isEntity) {
+//            if (llEntity != null && cotent != null) {
+//                cotent.setVisibility(View.GONE);
+//                llEntity.setVisibility(View.VISIBLE);
+//            }
+//
+//        } else {
+//            if (llEntity != null && cotent != null) {
+//                cotent.setVisibility(View.VISIBLE);
+//                llEntity.setVisibility(View.GONE);
+//            }
+//
+//        }
+//    }
+//
+//    //设置空页面
+//    public void setEntityView(SmartRefreshLayout refreshLayout, Boolean isEntity) {
+//        if (isEntity) {
+//            if (refreshLayout != null && llEntity != null) {
+//                refreshLayout.setVisibility(View.GONE);
+//                llEntity.setVisibility(View.VISIBLE);
+//            }
+//        } else {
+//
+//            if (refreshLayout != null && llEntity != null) {
+//                refreshLayout.setVisibility(View.VISIBLE);
+//                llEntity.setVisibility(View.GONE);
+//            }
+//        }
+//    }
+//
+//    //设置空页面
+//    public void setEntityView(SmartRefreshLayout refreshLayout, String tvEntity, Boolean isEntity) {
+//        if (isEntity) {
+//            if (refreshLayout != null && llEntity != null) {
+//                refreshLayout.setVisibility(View.GONE);
+//                llEntity.setVisibility(View.VISIBLE);
+//                tv_empty.setText(tvEntity);
+//            }
+//        } else {
+//
+//            if (refreshLayout != null && llEntity != null) {
+//                refreshLayout.setVisibility(View.VISIBLE);
+//                llEntity.setVisibility(View.GONE);
+//            }
+//        }
+//    }
+}

+ 70 - 0
app/src/main/java/com/yhx/union/system/HodingView.java

@@ -0,0 +1,70 @@
+package com.yhx.union.system;/**
+ * Created by Administrator on 2016/4/29.
+ */
+
+import android.content.Context;
+
+
+/**
+ * 描述:加载等待视图
+ * @author yanghuaxiong
+ * @create 2018/5/8 下午2:35
+ *
+ */
+public class HodingView {
+    private static HodingView mHodingView;
+    private Context activityContext;
+    public HodingViewDialog hodingViewDialog;
+    private String message;
+
+    //不允许被直接实例化
+    protected HodingView() {
+    }
+
+    //HodingView的访问实例
+    public static HodingView build() {
+        if (mHodingView == null) {
+            mHodingView = new HodingView();
+        }
+        return mHodingView;
+    }
+
+    public HodingView setContext(Context context) {
+        this.activityContext = context;
+        return mHodingView;
+    }
+
+    public void show() {
+        message="";
+        hide();
+        if (hodingViewDialog == null) {
+            hodingViewDialog = new HodingViewDialog(activityContext,message);
+        }
+        if (!hodingViewDialog.isShowing()) {
+            hodingViewDialog.setMessage(message);
+            hodingViewDialog.show();
+        }
+    }
+    public void show(String msg) {
+        message=msg;
+        hide();
+        if (hodingViewDialog == null) {
+            hodingViewDialog = new HodingViewDialog(activityContext,message);
+        }
+        if (!hodingViewDialog.isShowing()) {
+            hodingViewDialog.setMessage(message);
+            hodingViewDialog.show();
+        }
+    }
+
+    public void hide() {
+        if (hodingViewDialog != null) {
+            try {
+                hodingViewDialog.dismiss();
+            } catch (Exception e) {
+
+            }
+            hodingViewDialog = null;
+        }
+    }
+}

+ 67 - 0
app/src/main/java/com/yhx/union/system/HodingViewDialog.java

@@ -0,0 +1,67 @@
+package com.yhx.union.system;/**
+ * Created by Administrator on 2016/4/29.
+ */
+
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.drawable.AnimationDrawable;
+import android.text.Html;
+import android.text.TextUtils;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.yhx.union.R;
+
+
+/**
+ * 描述:
+ * @author yanghuaxiong
+ * @create 2018/5/8 下午2:36
+ *
+ */
+public class HodingViewDialog extends Dialog {
+    private ImageView ivProcess;
+    private TextView tvHodingText;
+    private Context mContext;
+    public HodingViewDialog(Context context, String message) {
+        super(context, R.style.dialogHodingView);
+        setContentView(R.layout.layout_viewhandler);
+        this.mContext=context;
+        ivProcess=(ImageView)findViewById(R.id.iv_progressbar);
+        tvHodingText=(TextView) findViewById(R.id.tv_hodingtext);
+        setCancelable(false);
+        if(message==null|| TextUtils.isEmpty(message)) {
+           message=context.getResources().getString(R.string.app_name);
+        }
+        tvHodingText.setText(Html.fromHtml(message));
+        AnimationDrawable animationDrawable=(AnimationDrawable)ivProcess.getBackground();
+        animationDrawable.start();
+    }
+    public void setMessage(String message){
+        if(mContext!=null&&tvHodingText!=null) {
+            if (message == null || TextUtils.isEmpty(message)) {
+                message = mContext.getResources().getString(R.string.app_name);
+            }
+            tvHodingText.setText(Html.fromHtml(message));
+        }
+    }
+    @SuppressWarnings("deprecation")
+    @Override
+    public void show() {
+        Window dialogWindow = this.getWindow();
+        //dialogWindow.setWindowAnimations(yn.huanyi.app.components.R.style.dialogWindowAnim);
+        WindowManager windowManager = dialogWindow.getWindowManager();
+        Display display = windowManager.getDefaultDisplay();
+        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
+        dialogWindow.setGravity(Gravity.CENTER_HORIZONTAL
+                | Gravity.CENTER_VERTICAL);
+        lp.width = display.getWidth();
+        lp.height=display.getWidth();
+        dialogWindow.setAttributes(lp);
+        super.show();
+    }
+}

+ 145 - 0
app/src/main/java/com/yhx/union/system/MyApplication.java

@@ -0,0 +1,145 @@
+package com.yhx.union.system;
+
+import android.app.Activity;
+import android.app.Application;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+
+import com.scwang.smart.refresh.footer.ClassicsFooter;
+import com.scwang.smart.refresh.header.MaterialHeader;
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+import com.scwang.smart.refresh.layout.api.RefreshFooter;
+import com.scwang.smart.refresh.layout.api.RefreshHeader;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
+import com.yhx.union.R;
+import com.yhx.union.public_store.AppDataFile;
+import com.yhx.union.public_store.CrashHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by ynyxmac on 16/2/4.
+ */
+public class MyApplication extends Application {
+
+    protected static final String TAG = "MyApplication";
+
+    private static MyApplication mInstance;
+
+    /**
+     * 获取全局Application
+     *
+     * @return
+     */
+    public static MyApplication getInstance() {
+        return mInstance;
+    }
+
+    //static 代码段可以防止内存泄露
+    static {
+        //设置全局的Header构建器
+        SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
+            @Override
+            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
+                layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);//全局设置主题颜色
+                return new MaterialHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
+            }
+        });
+        //设置全局的Footer构建器
+        SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
+            @Override
+            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
+                //指定为经典Footer,默认是 BallPulseFooter
+                ClassicsFooter.REFRESH_FOOTER_LOADING = context.getResources().getString(R.string.rc_loadmore_loading);
+                return new ClassicsFooter(context).setDrawableSize(20);
+            }
+        });
+
+    }
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        mInstance = this;
+
+//        if(BuildConfig.DEBUG) Stetho.initializeWithDefaults(this);
+        CrashHandler crashHandler = CrashHandler.getInstance();
+        crashHandler.init(this.getApplicationContext());
+//        SangforAuthForward.getInstance().initSangforHook();
+        AppDataFile.init(AppDataFile.FILE_PICTURE);
+    }
+
+    private List<Activity> mActivityList = new ArrayList<>();
+
+    public void addActivity(Activity activity) {
+        mActivityList.add(activity);
+    }
+
+    public void removeActivity(Activity activity) {
+        mActivityList.remove(activity);
+    }
+    public void removeAllActivity() {
+        try {
+            for (Activity activity : mActivityList) {
+                if (activity != null)
+                    activity.finish();
+            }
+            mActivityList.clear();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void exit() {
+        try {
+            for (Activity activity : mActivityList) {
+                if (activity != null)
+                    activity.finish();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            System.exit(0);
+        }
+    }
+
+    public static void openPlatform(Context context) {
+        Intent intent = null;
+        PackageManager pm = context.getPackageManager();
+        try {
+            String packagename = "com.yxst.epic.unifyplatform";
+            PackageInfo pi = pm.getPackageInfo(packagename, 0);
+
+            Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
+            //resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+            resolveIntent.setPackage(pi.packageName);
+
+            List<ResolveInfo> apps = pm.queryIntentActivities(resolveIntent, 0);
+
+            ResolveInfo ri = apps.iterator().next();
+            if (ri != null) {
+                String packageName = ri.activityInfo.packageName;
+                String className = ri.activityInfo.name;
+
+                intent = new Intent(Intent.ACTION_MAIN);
+                intent.addCategory(Intent.CATEGORY_LAUNCHER);
+
+                ComponentName cn = new ComponentName(packageName, className);
+
+                intent.setComponent(cn);
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+        }
+
+        if (intent != null) {
+            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//设置标志如果app已经打开后直接激活
+            context.startActivity(intent);
+        }
+    }
+}

+ 158 - 0
app/src/main/java/com/yhx/union/system/WebviewActivity.java

@@ -0,0 +1,158 @@
+package com.yhx.union.system;
+
+import android.app.AlertDialog;
+import android.graphics.Bitmap;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.webkit.JavascriptInterface;
+import android.webkit.JsResult;
+import android.webkit.WebChromeClient;
+import android.webkit.WebResourceError;
+import android.webkit.WebResourceRequest;
+import android.webkit.WebResourceResponse;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ProgressBar;
+
+import com.yhx.union.R;
+
+import butterknife.BindView;
+
+/**
+ * 描述:
+ *
+ * @author yanghuaxiong
+ * @create 2018/8/17  上午10:46
+ */
+public class WebviewActivity extends BaseActivity {
+    @BindView(R.id.progressbar)
+    ProgressBar progressbar;
+    @BindView(R.id.webview)
+    WebView webview;
+    private String title;
+    private String url;
+
+    @Override
+    public int getContentViewLayoutID() {
+        return R.layout.activity_webview;
+    }
+
+    @Override
+    public void bindViewAndEvent(Bundle savedInstanceState) {
+        title = getIntent().getStringExtra("title");
+        initTitle(title);
+        url = getIntent().getStringExtra("url");
+        webview.loadUrl(url);//加载url
+        webview.addJavascriptInterface(this, "android");//添加js监听 这样html就能调用客户端
+        webview.setWebChromeClient(webChromeClient);
+        webview.setWebViewClient(webViewClient);
+        WebSettings webSettings = webview.getSettings();
+        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
+        webSettings.setJavaScriptEnabled(true);
+        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
+        webSettings.setDomStorageEnabled(true);
+        webSettings.setBlockNetworkImage(false);
+        webSettings.setUseWideViewPort(true);
+        webSettings.setLoadWithOverviewMode(true);
+        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
+        }
+    }
+
+    //WebViewClient主要帮助WebView处理各种通知、请求事件
+    private WebViewClient webViewClient = new WebViewClient() {
+        @Override
+        public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
+            super.onReceivedHttpError(view, request, errorResponse);
+        }
+
+        @Override
+        public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
+            super.onReceivedError(view, request, error);
+        }
+
+        @Override
+        public void onPageFinished(WebView view, String url) {//页面加载完成
+            progressbar.setVisibility(View.GONE);
+        }
+
+        @Override
+        public void onPageStarted(WebView view, String url, Bitmap favicon) {//页面开始加载
+            progressbar.setVisibility(View.VISIBLE);
+        }
+
+        @Override
+        public boolean shouldOverrideUrlLoading(WebView view, String url) {
+//            if (url.equals("http://www.google.com/")) {
+//                return true;//表示我已经处理过了
+//            }
+            return super.shouldOverrideUrlLoading(view, url);
+        }
+
+    };
+
+    //WebChromeClient主要辅助WebView处理Javascript的对话框、网站图标、网站title、加载进度等
+    private WebChromeClient webChromeClient = new WebChromeClient() {
+        //不支持js的alert弹窗,需要自己监听然后通过dialog弹窗
+        @Override
+        public boolean onJsAlert(WebView webview, String url, String message, JsResult result) {
+            AlertDialog.Builder localBuilder = new AlertDialog.Builder(webview.getContext());
+            localBuilder.setMessage(message).setPositiveButton("确定", null);
+            localBuilder.setCancelable(false);
+            localBuilder.create().show();
+
+            //注意:
+            //必须要这一句代码:result.confirm()表示:
+            //处理结果为确定状态同时唤醒WebCore线程
+            //否则不能继续点击按钮
+            result.confirm();
+            return true;
+        }
+
+        //获取网页标题
+        @Override
+        public void onReceivedTitle(WebView view, String title) {
+            super.onReceivedTitle(view, title);
+        }
+
+        //加载进度回调
+        @Override
+        public void onProgressChanged(WebView view, int newProgress) {
+            progressbar.setProgress(newProgress);
+        }
+    };
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (webview.canGoBack() && keyCode == KeyEvent.KEYCODE_BACK) {//点击返回按钮的时候判断有没有上一页
+            webview.goBack(); // goBack()表示返回webView的上一页面
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    /**
+     * JS调用android的方法
+     *
+     * @param str
+     * @return
+     */
+    @JavascriptInterface //仍然必不可少
+    public void getClient(String str) {
+        Log.i("ansen", "html调用客户端:" + str);
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+
+        //释放资源
+        webview.destroy();
+        webview = null;
+    }
+
+}

+ 30 - 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml

@@ -0,0 +1,30 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:aapt="http://schemas.android.com/aapt"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
+        <aapt:attr name="android:fillColor">
+            <gradient
+                android:endX="85.84757"
+                android:endY="92.4963"
+                android:startX="42.9492"
+                android:startY="49.59793"
+                android:type="linear">
+                <item
+                    android:color="#44000000"
+                    android:offset="0.0" />
+                <item
+                    android:color="#00000000"
+                    android:offset="1.0" />
+            </gradient>
+        </aapt:attr>
+    </path>
+    <path
+        android:fillColor="#FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
+        android:strokeWidth="1"
+        android:strokeColor="#00000000" />
+</vector>

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

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:topLeftRadius="5dp" android:topRightRadius="5dp" />
+    <solid android:color="@color/orange" />
+</shape>

+ 7 - 0
app/src/main/res/drawable/drawable_orange_oval.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
+
+	<solid android:color="#FE3824" />
+	<size android:width="5dp"
+		android:height="5dp" />
+</shape>

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

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

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

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

+ 38 - 0
app/src/main/res/drawable/drawable_raduis_dialogviewhandler.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!-- 连框颜色值 -->
+    <item>
+        <shape>
+            <solid android:color="#80000000" />
+
+            <corners android:radius="10dp" />
+        </shape>
+    </item>
+    <!-- 主体背景颜色值 -->
+    <item
+        android:bottom="0dp"
+        android:left="0dp"
+        android:right="0dp"
+        android:top="0dp">
+        <shape>
+            <gradient
+                android:angle="90"
+                android:centerColor="#80000000"
+                android:centerX="0.5"
+                android:centerY="0.5"
+                android:endColor="#80000000"
+                android:startColor="#80000000"
+                android:type="linear" />
+
+            <padding
+                android:bottom="0dp"
+                android:left="0dp"
+                android:right="0dp"
+                android:top="0dp" />
+            <!-- 应该是圆角 -->
+            <corners android:radius="10dp" />
+        </shape>
+    </item>
+
+</layer-list>

BIN
app/src/main/res/drawable/empty_photo.png


+ 170 - 0
app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#3DDC84"
+        android:pathData="M0,0h108v108h-108z" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M9,0L9,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,0L19,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,0L29,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,0L39,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,0L49,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,0L59,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,0L69,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,0L79,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M89,0L89,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M99,0L99,108"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,9L108,9"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,19L108,19"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,29L108,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,39L108,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,49L108,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,59L108,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,69L108,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,79L108,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,89L108,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M0,99L108,99"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,29L89,29"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,39L89,39"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,49L89,49"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,59L89,59"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,69L89,69"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M19,79L89,79"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M29,19L29,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M39,19L39,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M49,19L49,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M59,19L59,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M69,19L69,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+    <path
+        android:fillColor="#00000000"
+        android:pathData="M79,19L79,89"
+        android:strokeWidth="0.8"
+        android:strokeColor="#33FFFFFF" />
+</vector>

+ 39 - 0
app/src/main/res/drawable/progressbar_viewhandler.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:drawable="@mipmap/common_loading_large1"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large2"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large3"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large4"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large5"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large6"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large7"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large8"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large9"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large10"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large11"
+        android:duration="70"/>
+    <item
+        android:drawable="@mipmap/common_loading_large12"
+        android:duration="70"/>
+</animation-list>

+ 5 - 0
app/src/main/res/drawable/tagpage_group.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="@mipmap/tabbar_group_active" android:state_selected="true" />
+    <item android:drawable="@mipmap/tabbar_group_normal" />
+</selector>

+ 5 - 0
app/src/main/res/drawable/tagpage_home.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="@mipmap/tabbar_home_active" android:state_selected="true" />
+    <item android:drawable="@mipmap/tabbar_home_normal" />
+</selector>

+ 5 - 0
app/src/main/res/drawable/tagpage_personal.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="@mipmap/tabbar_personal_active" android:state_selected="true" />
+    <item android:drawable="@mipmap/tabbar_personal_normal" />
+</selector>

+ 5 - 0
app/src/main/res/drawable/tagpage_union.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="@mipmap/tabbar_union_active" android:state_selected="true" />
+    <item android:drawable="@mipmap/tabbar_union_normal" />
+</selector>

+ 73 - 0
app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    >
+
+    <FrameLayout
+        android:id="@+id/fragment_continer"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
+
+    </FrameLayout>
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="@color/separated" />
+
+    <LinearLayout
+        android:id="@+id/ll_main_viewbottom"
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:background="@color/white"
+        android:orientation="horizontal">
+
+        <com.yhx.union.public_store.fragment.FragmentTab
+            android:id="@+id/mt_home"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            app:tab_icon="@drawable/tagpage_home"
+            app:tab_text="首页"
+            app:tab_text_blurcolor="@color/text_black"
+            app:tab_text_focuscolor="@color/red" />
+
+
+        <com.yhx.union.public_store.fragment.FragmentTab
+            android:id="@+id/mt_union"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            app:tab_icon="@drawable/tagpage_union"
+            app:tab_text="工会"
+            app:tab_text_blurcolor="@color/text_black"
+            app:tab_text_focuscolor="@color/red" />
+
+
+        <com.yhx.union.public_store.fragment.FragmentTab
+            android:id="@+id/mt_group"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            app:tab_icon="@drawable/tagpage_group"
+            app:tab_text="找活"
+            app:tab_text_blurcolor="@color/text_black"
+            app:tab_text_focuscolor="@color/red" />
+
+        <com.yhx.union.public_store.fragment.FragmentTab
+            android:id="@+id/mt_personal"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            app:tab_icon="@drawable/tagpage_personal"
+            app:tab_text="我的"
+            app:tab_text_blurcolor="@color/text_black"
+            app:tab_text_focuscolor="@color/red" />
+    </LinearLayout>
+
+</LinearLayout>

+ 22 - 0
app/src/main/res/layout/activity_new_list.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    android:orientation="vertical">
+
+    <include layout="@layout/include_title" />
+    <com.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        app:srlEnableFooterFollowWhenLoadFinished="true">
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:overScrollMode="never"
+            android:scrollbars="none" />
+    </com.scwang.smart.refresh.layout.SmartRefreshLayout>
+</LinearLayout>

+ 23 - 0
app/src/main/res/layout/activity_webview.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/white"
+    android:orientation="vertical">
+
+    <include layout="@layout/include_title" />
+
+    <ProgressBar
+        android:id="@+id/progressbar"
+        style="@android:style/Widget.ProgressBar.Horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="3dp"
+        android:max="100"
+        android:progress="0" />
+
+    <WebView
+        android:id="@+id/webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+</LinearLayout>

+ 146 - 0
app/src/main/res/layout/custom_date_picker.xml

@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:padding="10dp">
+
+        <TextView
+            android:id="@+id/tv_cancle"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:padding="10dp"
+            android:text="@string/cancle"
+            android:textColor="@color/text_green"
+            android:textSize="16sp" />
+
+        <TextView
+            android:id="@+id/tv_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:text="@string/title"
+            android:textColor="@color/text_green"
+            android:textSize="20sp" />
+
+        <TextView
+            android:id="@+id/tv_select"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:padding="10dp"
+            android:text="@string/commit"
+            android:textColor="@color/text_green"
+            android:textSize="16sp"
+            android:layout_alignParentRight="true" />
+
+    </RelativeLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="0.5dp"
+        android:background="@color/split_line" />
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="5dp"
+            android:background="@color/white"
+            android:orientation="horizontal"
+            android:paddingBottom="15dp"
+            android:paddingLeft="20dp"
+            android:paddingRight="20dp"
+            android:paddingTop="15dp">
+
+            <com.yxst.epic.logisticsmanagekm.custom_view.DatePickerView
+                android:id="@+id/year_pv"
+                android:layout_width="0dp"
+                android:layout_height="160dp"
+                android:layout_weight="3" />
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/year"
+                android:textColor="@color/text_black"
+                android:textSize="18sp" />
+
+            <com.yxst.epic.logisticsmanagekm.custom_view.DatePickerView
+                android:id="@+id/month_pv"
+                android:layout_width="0dp"
+                android:layout_height="160dp"
+                android:layout_weight="2" />
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/month"
+                android:textColor="@color/text_black"
+                android:textSize="18sp" />
+
+            <com.yxst.epic.logisticsmanagekm.custom_view.DatePickerView
+                android:id="@+id/day_pv"
+                android:layout_width="0dp"
+                android:layout_height="160dp"
+                android:layout_weight="2" />
+
+            <TextView
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/day"
+                android:textColor="@color/text_black"
+                android:textSize="18sp" />
+
+            <com.yxst.epic.logisticsmanagekm.custom_view.DatePickerView
+                android:id="@+id/hour_pv"
+                android:layout_width="0dp"
+                android:layout_height="160dp"
+                android:layout_weight="2" />
+
+            <TextView
+                android:id="@+id/hour_text"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/hour"
+                android:textColor="@color/text_black"
+                android:textSize="18sp" />
+
+            <com.yxst.epic.logisticsmanagekm.custom_view.DatePickerView
+                android:id="@+id/minute_pv"
+                android:layout_width="0dp"
+                android:layout_height="160dp"
+                android:layout_weight="2" />
+
+            <TextView
+                android:id="@+id/minute_text"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="@string/minute"
+                android:textColor="@color/text_black"
+                android:textSize="18sp" />
+
+        </LinearLayout>
+
+    </RelativeLayout>
+
+</LinearLayout>

+ 46 - 0
app/src/main/res/layout/dialog_session_timeout_prompt.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/main"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="#00000000"
+    android:padding="25dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/drawable_orange_stroke_radius5"
+        android:orientation="vertical">
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:background="@drawable/drawable_orang_radius_top_5"
+            android:gravity="center"
+            android:text="温馨提示"
+            android:textColor="@color/white"
+            android:textSize="@dimen/textSize_16" />
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="100dp"
+            android:gravity="center"
+            android:text="会话超时,请重新登录"
+            android:textColor="@color/text_black"
+            android:textSize="@dimen/textSize_16" />
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/orange"
+            />
+
+        <TextView
+            android:id="@+id/sure"
+            android:layout_width="match_parent"
+            android:layout_height="40dp"
+            android:gravity="center"
+            android:text="确定"
+            android:textColor="@color/orange"
+            android:textSize="@dimen/textSize_16" />
+
+    </LinearLayout>
+</LinearLayout>

+ 10 - 0
app/src/main/res/layout/fragment_group.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    android:clickable="true"
+    android:orientation="vertical">
+
+
+</LinearLayout>

+ 250 - 0
app/src/main/res/layout/fragment_home.xml

@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    android:background="@color/bg"
+    android:clickable="true"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="44dp"
+        android:background="@color/red"
+        android:gravity="center"
+        android:text="层零散务工人员工会"
+        android:textColor="@color/white"
+        android:textSize="@dimen/textSize_18" />
+
+    <androidx.core.widget.NestedScrollView
+        android:id="@+id/nestedscrollview"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:overScrollMode="never"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:descendantFocusability="blocksDescendants"
+            android:orientation="vertical">
+
+            <cn.bingoogolapple.bgabanner.BGABanner
+                android:id="@+id/bga_banner"
+                style="@style/BannerDefaultStyle"
+                android:layout_height="210dp"
+                android:layout_centerInParent="true"
+                app:banner_placeholderDrawable="@mipmap/bg_placeholder"
+                app:banner_transitionEffect="depth" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="@color/white"
+                android:orientation="vertical"
+                android:padding="10dp">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:id="@+id/function01"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home01" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="工会新闻"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function02"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home02" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="会员入会"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function03"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home03" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="会费缴纳"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function04"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home04" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="关爱救助"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="10dp"
+                    android:orientation="horizontal">
+
+
+                    <LinearLayout
+                        android:id="@+id/function05"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical"
+                        android:visibility="visible">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home05" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="技能培训"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function06"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical"
+                        android:visibility="visible">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home06" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="文体活动"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function07"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical"
+                        android:visibility="visible">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home07" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="政策咨询"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:id="@+id/function08"
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:gravity="center"
+                        android:orientation="vertical">
+
+                        <ImageView
+                            android:layout_width="53dp"
+                            android:layout_height="53dp"
+                            android:src="@mipmap/home08" />
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginTop="@dimen/vertical_margin"
+                            android:text="法律援助"
+                            android:textColor="@color/text_black_333"
+                            android:textSize="@dimen/textSize_14" />
+                    </LinearLayout>
+
+                </LinearLayout>
+            </LinearLayout>
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/recyclerView"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:overScrollMode="never"
+                android:scrollbars="none" />
+        </LinearLayout>
+    </androidx.core.widget.NestedScrollView>
+</LinearLayout>

+ 11 - 0
app/src/main/res/layout/fragment_my.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    android:background="@color/white"
+    android:clickable="true"
+    android:orientation="vertical">
+
+
+</LinearLayout>

+ 10 - 0
app/src/main/res/layout/fragment_union.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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"
+    android:background="@color/white"
+    android:clickable="true"
+    android:orientation="vertical">
+
+</LinearLayout>

+ 59 - 0
app/src/main/res/layout/include_title.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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="wrap_content"
+    android:background="@color/white"
+    android:orientation="vertical">
+
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/red"
+        android:minHeight="?attr/actionBarSize"
+        app:navigationIcon="@mipmap/back"
+        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
+        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
+
+        <TextView
+            android:id="@+id/app_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerHorizontal="true"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="10dp"
+            android:text="标题"
+            android:textColor="@color/white"
+            android:textSize="@dimen/textSize_18" />
+
+        <TextView
+            android:id="@+id/right_text"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:gravity="center"
+            android:layout_gravity="right"
+            android:layout_marginRight="@dimen/horizontal_margin_20"
+            android:text="提交"
+            android:textSize="@dimen/textSize_18"
+            android:textColor="@color/text_black"
+            android:visibility="gone"
+            />
+        <LinearLayout
+            android:id="@+id/ll_right"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_gravity="center_vertical|right"
+            android:orientation="vertical"
+            android:visibility="gone"
+            android:paddingLeft="@dimen/horizontal_margin_20"
+            android:paddingRight="@dimen/horizontal_margin_20">
+
+            <ImageView
+                android:id="@+id/right_icon"
+                android:layout_width="24dp"
+                android:layout_height="24dp"
+                android:layout_gravity="center" />
+        </LinearLayout>
+    </androidx.appcompat.widget.Toolbar>
+</LinearLayout>

+ 51 - 0
app/src/main/res/layout/item_new.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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="wrap_content"
+    android:layout_marginLeft="15dp"
+    android:layout_marginRight="15dp"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp">
+
+        <com.yhx.union.custom_view.RoundImageView
+            android:id="@+id/image"
+            android:layout_width="110dp"
+            android:layout_height="80dp"
+            app:radius="10dp"
+            app:type="round" />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="80dp"
+            android:orientation="vertical"
+            android:paddingLeft="8dp">
+
+            <TextView
+                android:id="@+id/title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textColor="@color/text_black_333"
+                android:textSize="14sp"
+                android:maxLines="3"
+                android:layout_weight="1"
+                android:ellipsize="end"/>
+            <TextView
+                android:id="@+id/time"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textColor="@color/text_black_999"
+                android:textSize="14sp"/>
+        </LinearLayout>
+    </LinearLayout>
+
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="@color/separated" />
+</LinearLayout>

+ 39 - 0
app/src/main/res/layout/layout_majortab.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:gravity="center">
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <ImageView
+            android:id="@+id/iv_tabicon"
+            android:layout_width="25dp"
+            android:layout_height="25dp"
+            android:layout_centerHorizontal="true"/>
+        <TextView
+            android:id="@+id/tv_tabtips"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textSize="14sp"
+            android:textColor="@color/colorPrimary"
+            android:layout_centerHorizontal="true"
+            android:layout_below="@id/iv_tabicon"/>
+        <TextView
+            android:id="@+id/tv_tabtext"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:minWidth="15dp"
+            android:minHeight="15dp"
+            android:layout_marginLeft="15dp"
+            android:layout_alignLeft="@id/iv_tabicon"
+            android:gravity="center"
+            android:textColor="@android:color/white"
+            android:background="@drawable/drawable_orange_oval"
+            android:textSize="8sp"
+            android:text="0"
+            android:visibility="gone" />
+    </RelativeLayout>
+</LinearLayout>

+ 38 - 0
app/src/main/res/layout/layout_viewhandler.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#00000000">
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:orientation="vertical"
+        android:padding="15dp"
+        android:gravity="center_horizontal"
+        android:background="@drawable/drawable_raduis_dialogviewhandler">
+        <!--<Button-->
+            <!--android:id="@+id/prg_viewhodler"-->
+            <!--android:layout_width="30dp"-->
+            <!--android:layout_height="30dp"-->
+            <!--android:background="@drawable/progressbar_viewhandler"/>-->
+        <!--<ProgressBar-->
+        <!--style="@style/baseprogressbarviewhandler" />-->
+        <ImageView
+            android:id="@+id/iv_progressbar"
+            android:layout_width="32dp"
+            android:layout_height="32dp"
+            android:layout_margin="5dp"
+            android:background="@drawable/progressbar_viewhandler"/>
+        <TextView
+            android:id="@+id/tv_hodingtext"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="5dp"
+            android:gravity="center"
+            android:textSize="14sp"
+            android:textColor="@color/white"
+            android:text="@string/app_name"/>
+    </LinearLayout>
+</RelativeLayout>
+

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@drawable/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png


Неке датотеке нису приказане због велике количине промена