소스 검색

remove http module.

zhpanvip 4 년 전
부모
커밋
e7704609da
68개의 변경된 파일146개의 추가작업 그리고 3982개의 파일을 삭제
  1. 16 5
      app/build.gradle
  2. 0 2
      app/src/main/java/com/example/zhpan/circleviewpager/App.java
  3. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/activity/WelcomeActivity.kt
  4. 4 3
      app/src/main/java/com/example/zhpan/circleviewpager/fragment/HomeFragment.java
  5. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/fragment/IndicatorFragment.java
  6. 7 8
      app/src/main/java/com/example/zhpan/circleviewpager/fragment/OthersFragment.java
  7. 4 5
      app/src/main/java/com/example/zhpan/circleviewpager/fragment/PageFragment.java
  8. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/RetrofitGnerator.java
  9. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/RxUtil.java
  10. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/BasicResponse.java
  11. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/Constants.java
  12. 4 4
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/ErrorCode.java
  13. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/IdeaApi.java
  14. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/ProgressUtils.java
  15. 12 12
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/ResponseObserver.java
  16. 7 11
      app/src/main/java/com/example/zhpan/circleviewpager/net/common/RetrofitUtils.java
  17. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonConverterFactory.java
  18. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonRequestBodyConverter.java
  19. 8 8
      app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonResponseBodyConverter.java
  20. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/dialog/CustomProgressDialog.java
  21. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/dialog/DialogUtils.java
  22. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/exception/NoDataExceptionException.java
  23. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/exception/RemoteLoginExpiredException.java
  24. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/exception/ServerResponseException.java
  25. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/https/SafeHostnameVerifier.java
  26. 5 6
      app/src/main/java/com/example/zhpan/circleviewpager/net/https/SslContextFactory.java
  27. 3 4
      app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/HttpCacheInterceptor.java
  28. 1 1
      app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/HttpHeaderInterceptor.java
  29. 2 2
      app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/LoggingInterceptor.java
  30. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_1.png
  31. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_2.png
  32. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_3.png
  33. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_4.png
  34. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_5.png
  35. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_6.png
  36. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_7.png
  37. 0 0
      app/src/main/res/drawable-xxxhdpi/progress_8.png
  38. 0 0
      app/src/main/res/drawable/progress_round.xml
  39. 0 0
      app/src/main/res/layout/dialog_progress.xml
  40. 0 0
      app/src/main/res/raw/cabks.bks
  41. 0 0
      app/src/main/res/raw/capk.pkcs12
  42. 0 0
      app/src/main/res/raw/srca.cer
  43. 18 0
      app/src/main/res/values/strings.xml
  44. 28 0
      app/src/main/res/values/styles.xml
  45. 0 1
      ideahttp/.gitignore
  46. 0 45
      ideahttp/build.gradle
  47. 0 21
      ideahttp/proguard-rules.pro
  48. 0 2
      ideahttp/src/main/AndroidManifest.xml
  49. 0 54
      ideahttp/src/main/java/com/zhpan/idea/utils/CloseUtils.java
  50. 0 174
      ideahttp/src/main/java/com/zhpan/idea/utils/ConstUtils.java
  51. 0 627
      ideahttp/src/main/java/com/zhpan/idea/utils/ConvertUtils.java
  52. 0 230
      ideahttp/src/main/java/com/zhpan/idea/utils/DataConversionTools.java
  53. 0 51
      ideahttp/src/main/java/com/zhpan/idea/utils/DensityUtils.java
  54. 0 1290
      ideahttp/src/main/java/com/zhpan/idea/utils/FileUtils.java
  55. 0 130
      ideahttp/src/main/java/com/zhpan/idea/utils/JsonHelper.java
  56. 0 62
      ideahttp/src/main/java/com/zhpan/idea/utils/KeyTools.java
  57. 0 118
      ideahttp/src/main/java/com/zhpan/idea/utils/LogUtils.java
  58. 0 347
      ideahttp/src/main/java/com/zhpan/idea/utils/NetworkUtils.java
  59. 0 216
      ideahttp/src/main/java/com/zhpan/idea/utils/SharedPreferencesHelper.java
  60. 0 161
      ideahttp/src/main/java/com/zhpan/idea/utils/ShellUtils.java
  61. 0 174
      ideahttp/src/main/java/com/zhpan/idea/utils/StringUtils.java
  62. 0 63
      ideahttp/src/main/java/com/zhpan/idea/utils/ToastUtils.java
  63. 0 43
      ideahttp/src/main/java/com/zhpan/idea/utils/Utils.java
  64. 0 6
      ideahttp/src/main/res/values/dimens.xml
  65. 0 21
      ideahttp/src/main/res/values/strings.xml
  66. 0 31
      ideahttp/src/main/res/values/styles.xml
  67. 0 17
      ideahttp/src/test/java/com/zhpan/idea/ExampleUnitTest.java
  68. 1 1
      settings.gradle

+ 16 - 5
app/build.gradle

@@ -40,20 +40,30 @@ repositories {
 
 
 dependencies {
 dependencies {
     implementation fileTree(include: ['*.jar'], dir: 'libs')
     implementation fileTree(include: ['*.jar'], dir: 'libs')
-    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
     androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
     androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
         exclude group: 'com.android.support', module: 'support-annotations'
         exclude group: 'com.android.support', module: 'support-annotations'
     })
     })
+    api "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxjava2Version"
+    api "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit2Version"
+    api "com.squareup.retrofit2:converter-scalars:$rootProject.ext.retrofit2Version"
+    api "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofit2Version"
+    api "com.squareup.retrofit2:adapter-rxjava2:$rootProject.ext.retrofit2Version"
+    api "com.trello.rxlifecycle2:rxlifecycle:$rootProject.ext.rxlifecycle"
+    //compile "com.trello.rxlifecycle2:rxlifecycle-android:$rootProject.ext.rxlifecycle"
+    api "com.trello.rxlifecycle2:rxlifecycle-components:$rootProject.ext.rxlifecycle"
+    api 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
+    api 'io.reactivex.rxjava2:rxandroid:2.1.1'
+    api 'com.squareup.okhttp3:logging-interceptor:3.10.0'
+
     implementation 'androidx.appcompat:appcompat:1.2.0'
     implementation 'androidx.appcompat:appcompat:1.2.0'
     implementation 'androidx.recyclerview:recyclerview:1.1.0'
     implementation 'androidx.recyclerview:recyclerview:1.1.0'
     implementation 'com.github.bumptech.glide:glide:4.11.0'
     implementation 'com.github.bumptech.glide:glide:4.11.0'
-    implementation 'com.github.chrisbanes:PhotoView:2.1.0'
-    implementation project(path: ':bannerview')
+    implementation 'com.github.chrisbanes:PhotoView:2.3.0'
     implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
     implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
     implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
     implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
     debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
     debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
-    implementation project(path: ':ideahttp')
     implementation 'androidx.core:core-ktx:1.3.2'
     implementation 'androidx.core:core-ktx:1.3.2'
     implementation 'androidx.cardview:cardview:1.0.0'
     implementation 'androidx.cardview:cardview:1.0.0'
     implementation 'androidx.viewpager2:viewpager2:1.0.0'
     implementation 'androidx.viewpager2:viewpager2:1.0.0'
@@ -63,5 +73,6 @@ dependencies {
     implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
     implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
     implementation 'com.tencent.bugly:crashreport:3.2.1'
     implementation 'com.tencent.bugly:crashreport:3.2.1'
     implementation 'com.google.android.material:material:1.2.1'
     implementation 'com.google.android.material:material:1.2.1'
-    //    implementation 'com.github.zhpanvip:BannerViewPager:3.2.0'
+    implementation 'com.blankj:utilcodex:1.30.5'
+    implementation project(path: ':bannerview')
 }
 }

+ 0 - 2
app/src/main/java/com/example/zhpan/circleviewpager/App.java

@@ -4,7 +4,6 @@ import android.app.Application;
 
 
 import com.tencent.bugly.crashreport.CrashReport;
 import com.tencent.bugly.crashreport.CrashReport;
 import com.zhpan.bannerview.utils.BannerUtils;
 import com.zhpan.bannerview.utils.BannerUtils;
-import com.zhpan.idea.utils.Utils;
 
 
 /**
 /**
  * <pre>
  * <pre>
@@ -17,7 +16,6 @@ public class App extends Application {
     @Override
     @Override
     public void onCreate() {
     public void onCreate() {
         super.onCreate();
         super.onCreate();
-        Utils.init(getApplicationContext());
         BannerUtils.setDebugMode(true);
         BannerUtils.setDebugMode(true);
         CrashReport.initCrashReport(getApplicationContext(), "69b176a2b6", true);
         CrashReport.initCrashReport(getApplicationContext(), "69b176a2b6", true);
     }
     }

+ 2 - 2
app/src/main/java/com/example/zhpan/circleviewpager/activity/WelcomeActivity.kt

@@ -7,6 +7,7 @@ import android.view.View
 import android.view.animation.DecelerateInterpolator
 import android.view.animation.DecelerateInterpolator
 import androidx.core.content.ContextCompat
 import androidx.core.content.ContextCompat
 import androidx.viewpager2.widget.ViewPager2
 import androidx.viewpager2.widget.ViewPager2
+import com.blankj.utilcode.util.ToastUtils
 import com.example.zhpan.circleviewpager.R
 import com.example.zhpan.circleviewpager.R
 import com.example.zhpan.circleviewpager.adapter.WelcomeAdapter
 import com.example.zhpan.circleviewpager.adapter.WelcomeAdapter
 import com.example.zhpan.circleviewpager.bean.CustomBean
 import com.example.zhpan.circleviewpager.bean.CustomBean
@@ -15,7 +16,6 @@ import com.example.zhpan.circleviewpager.viewholder.CustomPageViewHolder
 import com.zhpan.bannerview.BannerViewPager
 import com.zhpan.bannerview.BannerViewPager
 import com.example.zhpan.circleviewpager.transform.TransformerStyle
 import com.example.zhpan.circleviewpager.transform.TransformerStyle
 import com.zhpan.bannerview.utils.BannerUtils
 import com.zhpan.bannerview.utils.BannerUtils
-import com.zhpan.idea.utils.ToastUtils
 import com.zhpan.indicator.enums.IndicatorSlideMode
 import com.zhpan.indicator.enums.IndicatorSlideMode
 import kotlinx.android.synthetic.main.activity_welcome.*
 import kotlinx.android.synthetic.main.activity_welcome.*
 import java.util.*
 import java.util.*
@@ -63,7 +63,7 @@ class WelcomeActivity : BaseDataActivity() {
                 }
                 }
             })
             })
             adapter = WelcomeAdapter().apply {
             adapter = WelcomeAdapter().apply {
-                mOnSubViewClickListener = CustomPageViewHolder.OnSubViewClickListener { _, position -> ToastUtils.show("Logo Clicked,position:$position") }
+                mOnSubViewClickListener = CustomPageViewHolder.OnSubViewClickListener { _, position -> ToastUtils.showShort("Logo Clicked,position:$position") }
             }
             }
             setIndicatorSliderColor(ContextCompat.getColor(this@WelcomeActivity, R.color.white),
             setIndicatorSliderColor(ContextCompat.getColor(this@WelcomeActivity, R.color.white),
                     ContextCompat.getColor(this@WelcomeActivity, R.color.white_alpha_75))
                     ContextCompat.getColor(this@WelcomeActivity, R.color.white_alpha_75))

+ 4 - 3
app/src/main/java/com/example/zhpan/circleviewpager/fragment/HomeFragment.java

@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.viewpager2.widget.ViewPager2;
 import androidx.viewpager2.widget.ViewPager2;
 
 
+import com.blankj.utilcode.util.LogUtils;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.activity.WebViewActivity;
 import com.example.zhpan.circleviewpager.activity.WebViewActivity;
 import com.example.zhpan.circleviewpager.adapter.ArticleAdapter;
 import com.example.zhpan.circleviewpager.adapter.ArticleAdapter;
@@ -20,6 +21,7 @@ import com.example.zhpan.circleviewpager.bean.ArticleWrapper;
 import com.example.zhpan.circleviewpager.bean.DataWrapper;
 import com.example.zhpan.circleviewpager.bean.DataWrapper;
 import com.example.zhpan.circleviewpager.net.BannerData;
 import com.example.zhpan.circleviewpager.net.BannerData;
 import com.example.zhpan.circleviewpager.net.RetrofitGnerator;
 import com.example.zhpan.circleviewpager.net.RetrofitGnerator;
+import com.example.zhpan.circleviewpager.net.RxUtil;
 import com.example.zhpan.circleviewpager.recyclerview.ui.CustomRecyclerView;
 import com.example.zhpan.circleviewpager.recyclerview.ui.CustomRecyclerView;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.scwang.smartrefresh.header.MaterialHeader;
 import com.scwang.smartrefresh.header.MaterialHeader;
@@ -28,9 +30,7 @@ import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.BaseViewHolder;
 import com.zhpan.bannerview.BaseViewHolder;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.utils.BannerUtils;
 import com.zhpan.bannerview.utils.BannerUtils;
-import com.zhpan.idea.net.common.ResponseObserver;
-import com.zhpan.idea.utils.LogUtils;
-import com.zhpan.idea.utils.RxUtil;
+import com.example.zhpan.circleviewpager.net.common.ResponseObserver;
 import com.zhpan.indicator.IndicatorView;
 import com.zhpan.indicator.IndicatorView;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorStyle;
 import com.zhpan.indicator.enums.IndicatorStyle;
@@ -38,6 +38,7 @@ import com.zhpan.indicator.enums.IndicatorStyle;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
+
 import io.reactivex.Observable;
 import io.reactivex.Observable;
 import io.reactivex.schedulers.Schedulers;
 import io.reactivex.schedulers.Schedulers;
 
 

+ 2 - 2
app/src/main/java/com/example/zhpan/circleviewpager/fragment/IndicatorFragment.java

@@ -6,13 +6,13 @@ import android.view.ViewGroup;
 import android.widget.RadioButton;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
 import android.widget.RadioGroup;
 
 
+import com.blankj.utilcode.util.ToastUtils;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.BaseBannerAdapter;
 import com.zhpan.bannerview.BaseBannerAdapter;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.utils.BannerUtils;
 import com.zhpan.bannerview.utils.BannerUtils;
-import com.zhpan.idea.utils.ToastUtils;
 import com.zhpan.indicator.annotation.AIndicatorSlideMode;
 import com.zhpan.indicator.annotation.AIndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorStyle;
 import com.zhpan.indicator.enums.IndicatorStyle;
@@ -57,7 +57,7 @@ public class IndicatorFragment extends BaseFragment {
                 .setScrollDuration(800)
                 .setScrollDuration(800)
                 .setLifecycleRegistry(getLifecycle())
                 .setLifecycleRegistry(getLifecycle())
                 .setIndicatorGravity(IndicatorGravity.CENTER)
                 .setIndicatorGravity(IndicatorGravity.CENTER)
-                .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
+                .setOnPageClickListener(position -> ToastUtils.showShort("position:" + position))
                 .setAdapter(new BaseBannerAdapter<Integer, ImageResourceViewHolder>() {
                 .setAdapter(new BaseBannerAdapter<Integer, ImageResourceViewHolder>() {
                     @Override
                     @Override
                     protected void onBind(ImageResourceViewHolder holder, Integer data, int position, int pageSize) {
                     protected void onBind(ImageResourceViewHolder holder, Integer data, int position, int pageSize) {

+ 7 - 8
app/src/main/java/com/example/zhpan/circleviewpager/fragment/OthersFragment.java

@@ -8,6 +8,8 @@ import android.widget.RadioGroup;
 
 
 import androidx.annotation.NonNull;
 import androidx.annotation.NonNull;
 
 
+import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.ToastUtils;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.adapter.ImageResourceAdapter;
 import com.example.zhpan.circleviewpager.adapter.ImageResourceAdapter;
 import com.example.zhpan.circleviewpager.view.FigureIndicatorView;
 import com.example.zhpan.circleviewpager.view.FigureIndicatorView;
@@ -17,14 +19,11 @@ import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.constants.IndicatorGravity;
 import com.zhpan.bannerview.utils.BannerUtils;
 import com.zhpan.bannerview.utils.BannerUtils;
-import com.zhpan.idea.utils.LogUtils;
-import com.zhpan.idea.utils.ToastUtils;
 import com.zhpan.indicator.DrawableIndicator;
 import com.zhpan.indicator.DrawableIndicator;
 import com.zhpan.indicator.IndicatorView;
 import com.zhpan.indicator.IndicatorView;
 import com.zhpan.indicator.base.IIndicator;
 import com.zhpan.indicator.base.IIndicator;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 
 
-import java.util.List;
 import java.util.Random;
 import java.util.Random;
 
 
 /**
 /**
@@ -77,12 +76,12 @@ public class OthersFragment extends BaseFragment implements View.OnClickListener
                 .setLifecycleRegistry(getLifecycle())
                 .setLifecycleRegistry(getLifecycle())
                 .setRoundCorner(BannerUtils.dp2px(6))
                 .setRoundCorner(BannerUtils.dp2px(6))
                 .setOnPageClickListener(position -> {
                 .setOnPageClickListener(position -> {
-                    ToastUtils.show("position:" + position);
+                    ToastUtils.showShort("position:" + position);
                     int currentItem = mViewPager.getCurrentItem();
                     int currentItem = mViewPager.getCurrentItem();
                     LogUtils.e("currentItem:", currentItem + "");
                     LogUtils.e("currentItem:", currentItem + "");
                 })
                 })
                 .setAdapter(new ImageResourceAdapter(0))
                 .setAdapter(new ImageResourceAdapter(0))
-                .setOnPageClickListener(position -> ToastUtils.show("Position:" + position))
+                .setOnPageClickListener(position -> ToastUtils.showShort("Position:" + position))
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color)).create();
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color)).create();
         initRadioGroup();
         initRadioGroup();
     }
     }
@@ -169,7 +168,7 @@ public class OthersFragment extends BaseFragment implements View.OnClickListener
 
 
     private void updateData() {
     private void updateData() {
         mViewPager.refreshData(getPicList(new Random().nextInt(5) - 1));
         mViewPager.refreshData(getPicList(new Random().nextInt(5) - 1));
-        ToastUtils.show("size=" + mViewPager.getData().size());
+        ToastUtils.showShort("size=" + mViewPager.getData().size());
     }
     }
 
 
     @Override
     @Override
@@ -187,14 +186,14 @@ public class OthersFragment extends BaseFragment implements View.OnClickListener
             default:
             default:
                 int position = new Random().nextInt(5);
                 int position = new Random().nextInt(5);
                 mViewPager.setCurrentItem(position, true);
                 mViewPager.setCurrentItem(position, true);
-                ToastUtils.show("Jump to position:" + position);
+                ToastUtils.showShort("Jump to position:" + position);
                 break;
                 break;
         }
         }
     }
     }
 
 
     private void addData() {
     private void addData() {
         mViewPager.addData(getPicList(2));
         mViewPager.addData(getPicList(2));
-        ToastUtils.show("size=" + mViewPager.getData().size());
+        ToastUtils.showShort("size=" + mViewPager.getData().size());
     }
     }
 
 
     private void insertItem() {
     private void insertItem() {

+ 4 - 5
app/src/main/java/com/example/zhpan/circleviewpager/fragment/PageFragment.java

@@ -2,9 +2,9 @@ package com.example.zhpan.circleviewpager.fragment;
 
 
 import android.os.Bundle;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View;
-import android.widget.RadioButton;
 import android.widget.RadioGroup;
 import android.widget.RadioGroup;
 
 
+import com.blankj.utilcode.util.ToastUtils;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.R;
 import com.example.zhpan.circleviewpager.adapter.ImageResourceAdapter;
 import com.example.zhpan.circleviewpager.adapter.ImageResourceAdapter;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
 import com.example.zhpan.circleviewpager.viewholder.ImageResourceViewHolder;
@@ -12,7 +12,6 @@ import com.zhpan.bannerview.BannerViewPager;
 import com.zhpan.bannerview.annotation.APageStyle;
 import com.zhpan.bannerview.annotation.APageStyle;
 import com.zhpan.bannerview.constants.PageStyle;
 import com.zhpan.bannerview.constants.PageStyle;
 import com.zhpan.bannerview.utils.BannerUtils;
 import com.zhpan.bannerview.utils.BannerUtils;
-import com.zhpan.idea.utils.ToastUtils;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 import com.zhpan.indicator.enums.IndicatorSlideMode;
 
 
 /**
 /**
@@ -57,7 +56,7 @@ public class PageFragment extends BaseFragment {
         if (position != mViewPager.getCurrentItem()) {
         if (position != mViewPager.getCurrentItem()) {
             mViewPager.setCurrentItem(position, true);
             mViewPager.setCurrentItem(position, true);
         }
         }
-        ToastUtils.show("position:" + position);
+        ToastUtils.showShort("position:" + position);
     }
     }
 
 
     private void initRadioGroup() {
     private void initRadioGroup() {
@@ -118,7 +117,7 @@ public class PageFragment extends BaseFragment {
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_20))
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_20))
                 .setRevealWidth(getResources().getDimensionPixelOffset(R.dimen.dp_m_10))
                 .setRevealWidth(getResources().getDimensionPixelOffset(R.dimen.dp_m_10))
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
-                .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
+                .setOnPageClickListener(position -> ToastUtils.showShort("position:" + position))
                 .setInterval(5000).create(getPicList(4));
                 .setInterval(5000).create(getPicList(4));
         mViewPager.removeDefaultPageTransformer();
         mViewPager.removeDefaultPageTransformer();
     }
     }
@@ -129,7 +128,7 @@ public class PageFragment extends BaseFragment {
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_15))
                 .setPageMargin(getResources().getDimensionPixelOffset(R.dimen.dp_15))
                 .setRevealWidth(BannerUtils.dp2px(0))
                 .setRevealWidth(BannerUtils.dp2px(0))
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
                 .setIndicatorSliderColor(getColor(R.color.red_normal_color), getColor(R.color.red_checked_color))
-                .setOnPageClickListener(position -> ToastUtils.show("position:" + position))
+                .setOnPageClickListener(position -> ToastUtils.showShort("position:" + position))
                 .setInterval(5000).create(getPicList(4));
                 .setInterval(5000).create(getPicList(4));
         mViewPager.removeDefaultPageTransformer();
         mViewPager.removeDefaultPageTransformer();
     }
     }

+ 1 - 1
app/src/main/java/com/example/zhpan/circleviewpager/net/RetrofitGnerator.java

@@ -1,6 +1,6 @@
 package com.example.zhpan.circleviewpager.net;
 package com.example.zhpan.circleviewpager.net;
 
 
-import com.zhpan.idea.net.common.IdeaApi;
+import com.example.zhpan.circleviewpager.net.common.IdeaApi;
 
 
 /**
 /**
  * <pre>
  * <pre>

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/utils/RxUtil.java → app/src/main/java/com/example/zhpan/circleviewpager/net/RxUtil.java

@@ -1,10 +1,10 @@
-package com.zhpan.idea.utils;
+package com.example.zhpan.circleviewpager.net;
 
 
+import com.example.zhpan.circleviewpager.net.common.ProgressUtils;
 import com.trello.rxlifecycle2.android.ActivityEvent;
 import com.trello.rxlifecycle2.android.ActivityEvent;
 import com.trello.rxlifecycle2.android.FragmentEvent;
 import com.trello.rxlifecycle2.android.FragmentEvent;
 import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
 import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
 import com.trello.rxlifecycle2.components.support.RxFragment;
 import com.trello.rxlifecycle2.components.support.RxFragment;
-import com.zhpan.idea.net.common.ProgressUtils;
 
 
 import io.reactivex.Observable;
 import io.reactivex.Observable;
 import io.reactivex.ObservableSource;
 import io.reactivex.ObservableSource;

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/common/BasicResponse.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/BasicResponse.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 /**
 /**
  *
  *

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/common/Constants.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/Constants.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 /**
 /**
  * Created by zhpan on 2018/2/1.
  * Created by zhpan on 2018/2/1.

+ 4 - 4
ideahttp/src/main/java/com/zhpan/idea/net/common/ErrorCode.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/ErrorCode.java

@@ -1,10 +1,10 @@
 
 
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 import androidx.annotation.StringRes;
 import androidx.annotation.StringRes;
 
 
-import com.zhpan.idea.R;
-import com.zhpan.idea.utils.Utils;
+import com.blankj.utilcode.util.Utils;
+import com.example.zhpan.circleviewpager.R;
 
 
 /**
 /**
  * Created by zhpan on 2018/3/27.
  * Created by zhpan on 2018/3/27.
@@ -85,6 +85,6 @@ public class ErrorCode {
     }
     }
 
 
     private static String getString(@StringRes int resId) {
     private static String getString(@StringRes int resId) {
-        return Utils.getContext().getString(resId);
+        return Utils.getApp().getString(resId);
     }
     }
 }
 }

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/common/IdeaApi.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/IdeaApi.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 import retrofit2.Retrofit;
 import retrofit2.Retrofit;
 
 

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/common/ProgressUtils.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/ProgressUtils.java

@@ -1,9 +1,9 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 import android.app.Activity;
 import android.app.Activity;
 import androidx.annotation.NonNull;
 import androidx.annotation.NonNull;
 
 
-import com.zhpan.idea.dialog.DialogUtils;
+import com.example.zhpan.circleviewpager.net.dialog.DialogUtils;
 
 
 import java.lang.ref.WeakReference;
 import java.lang.ref.WeakReference;
 
 

+ 12 - 12
ideahttp/src/main/java/com/zhpan/idea/net/common/ResponseObserver.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/ResponseObserver.java

@@ -1,14 +1,14 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
 import android.widget.Toast;
 import android.widget.Toast;
 
 
+import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.ToastUtils;
+import com.example.zhpan.circleviewpager.R;
 import com.google.gson.JsonParseException;
 import com.google.gson.JsonParseException;
 import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
 import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
-import com.zhpan.idea.R;
-import com.zhpan.idea.net.exception.NoDataExceptionException;
-import com.zhpan.idea.net.exception.ServerResponseException;
-import com.zhpan.idea.utils.LogUtils;
-import com.zhpan.idea.utils.ToastUtils;
+import com.example.zhpan.circleviewpager.net.exception.NoDataExceptionException;
+import com.example.zhpan.circleviewpager.net.exception.ServerResponseException;
 
 
 import org.json.JSONException;
 import org.json.JSONException;
 
 
@@ -80,7 +80,7 @@ public abstract class ResponseObserver<T> implements Observer<T> {
      * 服务器返回数据,但响应码不为1000
      * 服务器返回数据,但响应码不为1000
      */
      */
     public void onFail(String message) {
     public void onFail(String message) {
-        ToastUtils.show(message);
+        ToastUtils.showShort(message);
     }
     }
 
 
     public void onFinish(){}
     public void onFinish(){}
@@ -93,24 +93,24 @@ public abstract class ResponseObserver<T> implements Observer<T> {
     public void onException(ExceptionReason reason) {
     public void onException(ExceptionReason reason) {
         switch (reason) {
         switch (reason) {
             case CONNECT_ERROR:
             case CONNECT_ERROR:
-                ToastUtils.show(R.string.connect_error, Toast.LENGTH_SHORT);
+                ToastUtils.showShort(R.string.connect_error, Toast.LENGTH_SHORT);
                 break;
                 break;
 
 
             case CONNECT_TIMEOUT:
             case CONNECT_TIMEOUT:
-                ToastUtils.show(R.string.connect_timeout, Toast.LENGTH_SHORT);
+                ToastUtils.showShort(R.string.connect_timeout, Toast.LENGTH_SHORT);
                 break;
                 break;
 
 
             case BAD_NETWORK:
             case BAD_NETWORK:
-                ToastUtils.show(R.string.bad_network, Toast.LENGTH_SHORT);
+                ToastUtils.showShort(R.string.bad_network, Toast.LENGTH_SHORT);
                 break;
                 break;
 
 
             case PARSE_ERROR:
             case PARSE_ERROR:
-                ToastUtils.show(R.string.parse_error, Toast.LENGTH_SHORT);
+                ToastUtils.showShort(R.string.parse_error, Toast.LENGTH_SHORT);
                 break;
                 break;
 
 
             case UNKNOWN_ERROR:
             case UNKNOWN_ERROR:
             default:
             default:
-                ToastUtils.show(R.string.unknown_error, Toast.LENGTH_SHORT);
+                ToastUtils.showShort(R.string.unknown_error, Toast.LENGTH_SHORT);
                 break;
                 break;
         }
         }
     }
     }

+ 7 - 11
ideahttp/src/main/java/com/zhpan/idea/net/common/RetrofitUtils.java → app/src/main/java/com/example/zhpan/circleviewpager/net/common/RetrofitUtils.java

@@ -1,23 +1,19 @@
-package com.zhpan.idea.net.common;
+package com.example.zhpan.circleviewpager.net.common;
 
 
+import com.blankj.utilcode.util.Utils;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.GsonBuilder;
 import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
 import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
-import com.zhpan.idea.net.converter.GsonConverterFactory;
-import com.zhpan.idea.net.interceptor.HttpCacheInterceptor;
-import com.zhpan.idea.net.interceptor.HttpHeaderInterceptor;
-import com.zhpan.idea.net.interceptor.LoggingInterceptor;
-import com.zhpan.idea.utils.LogUtils;
-import com.zhpan.idea.utils.Utils;
+import com.example.zhpan.circleviewpager.net.converter.GsonConverterFactory;
+import com.example.zhpan.circleviewpager.net.interceptor.HttpCacheInterceptor;
+import com.example.zhpan.circleviewpager.net.interceptor.HttpHeaderInterceptor;
+import com.example.zhpan.circleviewpager.net.interceptor.LoggingInterceptor;
 
 
 import java.io.File;
 import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 
 
 import okhttp3.Cache;
 import okhttp3.Cache;
 import okhttp3.OkHttpClient;
 import okhttp3.OkHttpClient;
-import okhttp3.logging.HttpLoggingInterceptor;
 import retrofit2.Retrofit;
 import retrofit2.Retrofit;
 
 
 /**
 /**
@@ -26,7 +22,7 @@ import retrofit2.Retrofit;
 
 
 public class RetrofitUtils {
 public class RetrofitUtils {
     public static OkHttpClient.Builder getOkHttpClientBuilder() {
     public static OkHttpClient.Builder getOkHttpClientBuilder() {
-        File cacheFile = new File(Utils.getContext().getCacheDir(), "cache");
+        File cacheFile = new File(Utils.getApp().getCacheDir(), "cache");
         Cache cache = new Cache(cacheFile, 1024 * 1024 * 100); //100Mb
         Cache cache = new Cache(cacheFile, 1024 * 1024 * 100); //100Mb
 
 
         return new OkHttpClient.Builder()
         return new OkHttpClient.Builder()

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/converter/GsonConverterFactory.java → app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonConverterFactory.java

@@ -14,12 +14,12 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package com.zhpan.idea.net.converter;
+package com.example.zhpan.circleviewpager.net.converter;
 
 
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.google.gson.TypeAdapter;
 import com.google.gson.TypeAdapter;
 import com.google.gson.reflect.TypeToken;
 import com.google.gson.reflect.TypeToken;
-import com.zhpan.idea.net.common.BasicResponse;
+import com.example.zhpan.circleviewpager.net.common.BasicResponse;
 
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.ParameterizedType;

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/converter/GsonRequestBodyConverter.java → app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonRequestBodyConverter.java

@@ -14,7 +14,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package com.zhpan.idea.net.converter;
+package com.example.zhpan.circleviewpager.net.converter;
 
 
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.google.gson.TypeAdapter;
 import com.google.gson.TypeAdapter;

+ 8 - 8
ideahttp/src/main/java/com/zhpan/idea/net/converter/GsonResponseBodyConverter.java → app/src/main/java/com/example/zhpan/circleviewpager/net/converter/GsonResponseBodyConverter.java

@@ -14,22 +14,22 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package com.zhpan.idea.net.converter;
+package com.example.zhpan.circleviewpager.net.converter;
 
 
 import com.google.gson.TypeAdapter;
 import com.google.gson.TypeAdapter;
-import com.zhpan.idea.net.common.BasicResponse;
-import com.zhpan.idea.net.common.ErrorCode;
-import com.zhpan.idea.net.exception.NoDataExceptionException;
-import com.zhpan.idea.net.exception.RemoteLoginExpiredException;
-import com.zhpan.idea.net.exception.ServerResponseException;
+import com.example.zhpan.circleviewpager.net.common.BasicResponse;
+import com.example.zhpan.circleviewpager.net.common.ErrorCode;
+import com.example.zhpan.circleviewpager.net.exception.NoDataExceptionException;
+import com.example.zhpan.circleviewpager.net.exception.RemoteLoginExpiredException;
+import com.example.zhpan.circleviewpager.net.exception.ServerResponseException;
 
 
 import java.io.IOException;
 import java.io.IOException;
 
 
 import okhttp3.ResponseBody;
 import okhttp3.ResponseBody;
 import retrofit2.Converter;
 import retrofit2.Converter;
 
 
-import static com.zhpan.idea.net.common.ErrorCode.REMOTE_LOGIN;
-import static com.zhpan.idea.net.common.ErrorCode.SUCCESS;
+import static com.example.zhpan.circleviewpager.net.common.ErrorCode.REMOTE_LOGIN;
+import static com.example.zhpan.circleviewpager.net.common.ErrorCode.SUCCESS;
 
 
 final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, Object> {
 final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, Object> {
 
 

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/dialog/CustomProgressDialog.java → app/src/main/java/com/example/zhpan/circleviewpager/net/dialog/CustomProgressDialog.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.dialog;
+package com.example.zhpan.circleviewpager.net.dialog;
 
 
 import android.app.Dialog;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.Context;
@@ -9,7 +9,7 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.TextView;
 
 
-import com.zhpan.idea.R;
+import com.example.zhpan.circleviewpager.R;
 
 
 
 
 /**
 /**

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/dialog/DialogUtils.java → app/src/main/java/com/example/zhpan/circleviewpager/net/dialog/DialogUtils.java

@@ -1,8 +1,8 @@
-package com.zhpan.idea.dialog;
+package com.example.zhpan.circleviewpager.net.dialog;
 
 
 import android.content.Context;
 import android.content.Context;
 
 
-import com.zhpan.idea.R;
+import com.example.zhpan.circleviewpager.R;
 
 
 
 
 /**
 /**

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/exception/NoDataExceptionException.java → app/src/main/java/com/example/zhpan/circleviewpager/net/exception/NoDataExceptionException.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.net.exception;
+package com.example.zhpan.circleviewpager.net.exception;
 
 
 /**
 /**
  * 服务器返回的异常
  * 服务器返回的异常

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/exception/RemoteLoginExpiredException.java → app/src/main/java/com/example/zhpan/circleviewpager/net/exception/RemoteLoginExpiredException.java

@@ -1,7 +1,7 @@
 
 
-package com.zhpan.idea.net.exception;
+package com.example.zhpan.circleviewpager.net.exception;
 
 
-import com.zhpan.idea.net.common.ErrorCode;
+import com.example.zhpan.circleviewpager.net.common.ErrorCode;
 
 
 /**
 /**
  * Created by zhpan on 2018/3/27.
  * Created by zhpan on 2018/3/27.

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/exception/ServerResponseException.java → app/src/main/java/com/example/zhpan/circleviewpager/net/exception/ServerResponseException.java

@@ -1,6 +1,6 @@
-package com.zhpan.idea.net.exception;
+package com.example.zhpan.circleviewpager.net.exception;
 
 
-import com.zhpan.idea.net.common.ErrorCode;
+import com.example.zhpan.circleviewpager.net.common.ErrorCode;
 
 
 /**
 /**
  * 服务器返回的异常
  * 服务器返回的异常

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/https/SafeHostnameVerifier.java → app/src/main/java/com/example/zhpan/circleviewpager/net/https/SafeHostnameVerifier.java

@@ -1,7 +1,7 @@
-package com.zhpan.idea.net.https;
+package com.example.zhpan.circleviewpager.net.https;
 
 
 
 
-import com.zhpan.idea.net.common.Constants;
+import com.example.zhpan.circleviewpager.net.common.Constants;
 
 
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSession;

+ 5 - 6
ideahttp/src/main/java/com/zhpan/idea/net/https/SslContextFactory.java → app/src/main/java/com/example/zhpan/circleviewpager/net/https/SslContextFactory.java

@@ -1,14 +1,13 @@
-package com.zhpan.idea.net.https;
+package com.example.zhpan.circleviewpager.net.https;
 
 
 
 
-import com.zhpan.idea.R;
-import com.zhpan.idea.utils.Utils;
+import com.blankj.utilcode.util.Utils;
+import com.example.zhpan.circleviewpager.R;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.security.KeyStore;
 import java.security.KeyStore;
 import java.security.SecureRandom;
 import java.security.SecureRandom;
-import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
 import java.security.cert.CertificateFactory;
 
 
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.KeyManagerFactory;
@@ -70,7 +69,7 @@ public class SslContextFactory {
      */
      */
     public static SSLSocketFactory getSSLSocketFactoryForTwoWay() {
     public static SSLSocketFactory getSSLSocketFactoryForTwoWay() {
         try {
         try {
-            InputStream certificate = Utils.getContext().getResources().openRawResource(R.raw.capk);
+            InputStream certificate = Utils.getApp().getResources().openRawResource(R.raw.capk);
             //  CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", "BC");
             //  CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", "BC");
             KeyStore keyStore = KeyStore.getInstance(CLIENT_TRUST_KEY);
             KeyStore keyStore = KeyStore.getInstance(CLIENT_TRUST_KEY);
             keyStore.load(certificate, SELF_CERT_PWD.toCharArray());
             keyStore.load(certificate, SELF_CERT_PWD.toCharArray());
@@ -86,7 +85,7 @@ public class SslContextFactory {
 
 
             //初始化keystore
             //初始化keystore
             KeyStore clientKeyStore = KeyStore.getInstance(CLIENT_TRUST_KEYSTORE);
             KeyStore clientKeyStore = KeyStore.getInstance(CLIENT_TRUST_KEYSTORE);
-            clientKeyStore.load(Utils.getContext().getResources().openRawResource(R.raw.cabks), TRUST_CA_PWD.toCharArray());
+            clientKeyStore.load(Utils.getApp().getResources().openRawResource(R.raw.cabks), TRUST_CA_PWD.toCharArray());
 
 
             SSLContext sslContext = SSLContext.getInstance(CLIENT_AGREEMENT);
             SSLContext sslContext = SSLContext.getInstance(CLIENT_AGREEMENT);
             TrustManagerFactory trustManagerFactory = TrustManagerFactory.
             TrustManagerFactory trustManagerFactory = TrustManagerFactory.

+ 3 - 4
ideahttp/src/main/java/com/zhpan/idea/net/interceptor/HttpCacheInterceptor.java → app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/HttpCacheInterceptor.java

@@ -1,8 +1,7 @@
-package com.zhpan.idea.net.interceptor;
+package com.example.zhpan.circleviewpager.net.interceptor;
 
 
-
-import com.zhpan.idea.utils.LogUtils;
-import com.zhpan.idea.utils.NetworkUtils;
+import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.NetworkUtils;
 
 
 import java.io.IOException;
 import java.io.IOException;
 
 

+ 1 - 1
ideahttp/src/main/java/com/zhpan/idea/net/interceptor/HttpHeaderInterceptor.java → app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/HttpHeaderInterceptor.java

@@ -1,4 +1,4 @@
-package com.zhpan.idea.net.interceptor;
+package com.example.zhpan.circleviewpager.net.interceptor;
 
 
 import java.io.IOException;
 import java.io.IOException;
 
 

+ 2 - 2
ideahttp/src/main/java/com/zhpan/idea/net/interceptor/LoggingInterceptor.java → app/src/main/java/com/example/zhpan/circleviewpager/net/interceptor/LoggingInterceptor.java

@@ -1,6 +1,6 @@
-package com.zhpan.idea.net.interceptor;
+package com.example.zhpan.circleviewpager.net.interceptor;
 
 
-import com.zhpan.idea.utils.LogUtils;
+import com.blankj.utilcode.util.LogUtils;
 
 
 import java.io.IOException;
 import java.io.IOException;
 
 

+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_1.png → app/src/main/res/drawable-xxxhdpi/progress_1.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_2.png → app/src/main/res/drawable-xxxhdpi/progress_2.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_3.png → app/src/main/res/drawable-xxxhdpi/progress_3.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_4.png → app/src/main/res/drawable-xxxhdpi/progress_4.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_5.png → app/src/main/res/drawable-xxxhdpi/progress_5.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_6.png → app/src/main/res/drawable-xxxhdpi/progress_6.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_7.png → app/src/main/res/drawable-xxxhdpi/progress_7.png


+ 0 - 0
ideahttp/src/main/res/drawable-xhdpi/progress_8.png → app/src/main/res/drawable-xxxhdpi/progress_8.png


+ 0 - 0
ideahttp/src/main/res/drawable/progress_round.xml → app/src/main/res/drawable/progress_round.xml


+ 0 - 0
ideahttp/src/main/res/layout/dialog_progress.xml → app/src/main/res/layout/dialog_progress.xml


+ 0 - 0
ideahttp/src/main/res/raw/cabks.bks → app/src/main/res/raw/cabks.bks


+ 0 - 0
ideahttp/src/main/res/raw/capk.pkcs12 → app/src/main/res/raw/capk.pkcs12


+ 0 - 0
ideahttp/src/main/res/raw/srca.cer → app/src/main/res/raw/srca.cer


+ 18 - 0
app/src/main/res/values/strings.xml

@@ -24,4 +24,22 @@
     <string name="add_data">Add Data</string>
     <string name="add_data">Add Data</string>
     <string name="remove_item">Remove Item</string>
     <string name="remove_item">Remove Item</string>
     <string name="insert_item">Insert Item</string>
     <string name="insert_item">Insert Item</string>
+
+
+    <string name="connect_error">网络连接失败,请检查网络</string>
+    <string name="connect_timeout">连接超时,请稍后再试</string>
+    <string name="bad_network">服务器异常</string>
+    <string name="parse_error">解析服务器响应数据失败</string>
+    <string name="unknown_error">未知错误</string>
+    <string name="response_return_error">服务器返回数据失败</string>
+
+    <string name="request_error">Failed to request server,error code:</string>
+    <string name="parameters_exception">Parameter exception</string>
+    <string name="verify_code_error">输入验证码有误</string>
+    <string name="verify_code_expired">验证码已过期</string>
+    <string name="not_register">该账户还未注册</string>
+    <string name="wrong_pwd_username">用户名或密码错误</string>
+    <string name="user_registered">该账户已存在</string>
+    <string name="wrong_password">密码错误</string>
+    <string name="remote_login">您的账号已在其它设备上登录,如非本人操作,请及时修改密码!</string>
 </resources>
 </resources>

+ 28 - 0
app/src/main/res/values/styles.xml

@@ -13,4 +13,32 @@
     </style>
     </style>
     <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
     <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
     <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
     <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
+
+
+    <style name="ProgressDialog" parent="@android:style/Theme.Dialog">
+        <item name="android:windowFrame">@null</item>
+        <item name="android:windowIsFloating">true</item>
+        <item name="android:windowContentOverlay">@null</item>
+        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
+        <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
+    </style>
+    <!--Progress 主题-->
+    <style name="ProgressDialogStyle" parent="@style/ProgressDialog">
+        <item name="android:windowBackground">@android:color/transparent</item>
+        <item name="android:windowNoTitle">true</item>
+    </style>
+
+    <!--自定义dialog背景全透明无边框theme -->
+    <style name="SrcbDialog" parent="android:style/Theme.Dialog">
+        <!--背景颜色及和透明程度-->
+        <item name="android:windowBackground">@android:color/transparent</item>
+        <!--是否去除标题 -->
+        <item name="android:windowNoTitle">true</item>
+        <!--是否去除边框-->
+        <item name="android:windowFrame">@null</item>
+        <!--是否浮现在activity之上-->
+        <item name="android:windowIsFloating">true</item>
+        <!--是否模糊-->
+        <item name="android:backgroundDimEnabled">false</item>
+    </style>
 </resources>
 </resources>

+ 0 - 1
ideahttp/.gitignore

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

+ 0 - 45
ideahttp/build.gradle

@@ -1,45 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
-    compileSdkVersion rootProject.compileSdkVersion
-    buildToolsVersion '28.0.3'
-    defaultConfig {
-        minSdkVersion rootProject.minSdkVersion
-        targetSdkVersion rootProject.targetSdkVersion
-        versionCode rootProject.releaseVersionCode
-        versionName rootProject.releaseVersionName
-
-        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
-        }
-    }
-
-}
-
-dependencies {
-    implementation fileTree(dir: 'libs', include: ['*.jar'])
-    implementation 'androidx.appcompat:appcompat:1.0.2'
-    testImplementation 'junit:junit:4.12'
-    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
-        exclude group: 'com.android.support', module: 'support-annotations'
-    })
-
-    api "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxjava2Version"
-    api "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit2Version"
-    api "com.squareup.retrofit2:converter-scalars:$rootProject.ext.retrofit2Version"
-    api "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofit2Version"
-    api "com.squareup.retrofit2:adapter-rxjava2:$rootProject.ext.retrofit2Version"
-    api "com.trello.rxlifecycle2:rxlifecycle:$rootProject.ext.rxlifecycle"
-    //compile "com.trello.rxlifecycle2:rxlifecycle-android:$rootProject.ext.rxlifecycle"
-    api "com.trello.rxlifecycle2:rxlifecycle-components:$rootProject.ext.rxlifecycle"
-    api 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
-    api 'io.reactivex.rxjava2:rxandroid:2.1.0'
-    api 'com.squareup.okhttp3:logging-interceptor:3.10.0'
-
-}

+ 0 - 21
ideahttp/proguard-rules.pro

@@ -1,21 +0,0 @@
-# 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

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

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

+ 0 - 54
ideahttp/src/main/java/com/zhpan/idea/utils/CloseUtils.java

@@ -1,54 +0,0 @@
-package com.zhpan.idea.utils;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * <pre>
- *     author: Blankj
- *     blog  : http://blankj.com
- *     time  : 2016/10/9
- *     desc  : 关闭相关工具类
- * </pre>
- */
-public class CloseUtils {
-
-    private CloseUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * 关闭IO
-     *
-     * @param closeables closeable
-     */
-    public static void closeIO(Closeable... closeables) {
-        if (closeables == null) return;
-        for (Closeable closeable : closeables) {
-            if (closeable != null) {
-                try {
-                    closeable.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    }
-
-    /**
-     * 安静关闭IO
-     *
-     * @param closeables closeable
-     */
-    public static void closeIOQuietly(Closeable... closeables) {
-        if (closeables == null) return;
-        for (Closeable closeable : closeables) {
-            if (closeable != null) {
-                try {
-                    closeable.close();
-                } catch (IOException ignored) {
-                }
-            }
-        }
-    }
-}

+ 0 - 174
ideahttp/src/main/java/com/zhpan/idea/utils/ConstUtils.java

@@ -1,174 +0,0 @@
-package com.zhpan.idea.utils;
-
-/**
- * <pre>
- *     author: zhpan
- *     time  : 2016/8/11
- *     desc  : 常量相关工具类
- * </pre>
- */
-public class ConstUtils {
-
-    private ConstUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /******************** 存储相关常量 ********************/
-    /**
-     * KB与Byte的倍数
-     */
-    public static final int KB = 1024;
-    /**
-     * MB与Byte的倍数
-     */
-    public static final int MB = 1048576;
-    /**
-     * GB与Byte的倍数
-     */
-    public static final int GB = 1073741824;
-
-    /**
-     * KB与Byte的倍数Double
-     */
-    public static final double DKB = 1024.0;
-    /**
-     * MB与Byte的倍数Double
-     */
-    public static final double DMB = 1048576.0;
-    /**
-     * GB与Byte的倍数Double
-     */
-    public static final double DGB = 1073741824.0;
-
-    public enum MemoryUnit {
-        BYTE,
-        KB,
-        MB,
-        GB
-    }
-
-    /******************** 时间相关常量 ********************/
-    /**
-     * 秒与毫秒的倍数
-     */
-    public static final int SEC  = 1000;
-    /**
-     * 分与毫秒的倍数
-     */
-    public static final int MIN  = 60000;
-    /**
-     * 时与毫秒的倍数
-     */
-    public static final int HOUR = 3600000;
-    /**
-     * 天与毫秒的倍数
-     */
-    public static final int DAY  = 86400000;
-
-    public enum TimeUnit {
-        MSEC,
-        SEC,
-        MIN,
-        HOUR,
-        DAY
-    }
-
-    /******************** 正则相关常量 ********************/
-    /**
-     * 正则:手机号(简单)
-     */
-    public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
-    /**
-     * 正则:手机号(精确)
-     * <p>移动:134(0-8)、135、136、137、138、139、147、150、151、152、157、158、159、178、182、183、184、187、188</p>
-     * <p>联通:130、131、132、145、155、156、175、176、185、186</p>
-     * <p>电信:133、153、173、177、180、181、189</p>
-     * <p>全球星:1349</p>
-     * <p>虚拟运营商:170</p>
-     */
-    public static final String REGEX_MOBILE_EXACT  = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|(147))\\d{8}$";
-    /**
-     * 正则:电话号码
-     */
-    public static final String REGEX_TEL           = "^0\\d{2,3}[- ]?\\d{7,8}";
-    /**
-     * 正则:身份证号码15位
-     */
-    public static final String REGEX_ID_CARD15     = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
-    /**
-     * 正则:身份证号码18位
-     */
-    public static final String REGEX_ID_CARD18     = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
-    /**
-     * 正则:邮箱
-     */
-    public static final String REGEX_EMAIL         = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
-    /**
-     * 正则:URL
-     */
-    public static final String REGEX_URL           = "[a-zA-z]+://[^\\s]*";
-    /**
-     * 正则:汉字
-     */
-    public static final String REGEX_ZH            = "^[\\u4e00-\\u9fa5]+$";
-    /**
-     * 正则:用户名,取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位
-     */
-    public static final String REGEX_USERNAME      = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";
-    /**
-     * 正则:yyyy-MM-dd格式的日期校验,已考虑平闰年
-     */
-    public static final String REGEX_DATE          = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
-    /**
-     * 正则:IP地址
-     */
-    public static final String REGEX_IP            = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
-
-    /************** 以下摘自http://tool.oschina.net/regex **************/
-    /**
-     * 正则:双字节字符(包括汉字在内)
-     */
-    public static final String REGEX_DOUBLE_BYTE_CHAR     = "[^\\x00-\\xff]";
-    /**
-     * 正则:空白行
-     */
-    public static final String REGEX_BLANK_LINE           = "\\n\\s*\\r";
-    /**
-     * 正则:QQ号
-     */
-    public static final String REGEX_TENCENT_NUM          = "[1-9][0-9]{4,}";
-    /**
-     * 正则:中国邮政编码
-     */
-    public static final String REGEX_ZIP_CODE             = "[1-9]\\d{5}(?!\\d)";
-    /**
-     * 正则:正整数
-     */
-    public static final String REGEX_POSITIVE_INTEGER     = "^[1-9]\\d*$";
-    /**
-     * 正则:负整数
-     */
-    public static final String REGEX_NEGATIVE_INTEGER     = "^-[1-9]\\d*$";
-    /**
-     * 正则:整数
-     */
-    public static final String REGEX_INTEGER              = "^-?[1-9]\\d*$";
-    /**
-     * 正则:非负整数(正整数 + 0)
-     */
-    public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$";
-    /**
-     * 正则:非正整数(负整数 + 0)
-     */
-    public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$";
-    /**
-     * 正则:正浮点数
-     */
-    public static final String REGEX_POSITIVE_FLOAT       = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
-    /**
-     * 正则:负浮点数
-     */
-    public static final String REGEX_NEGATIVE_FLOAT       = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";
-
-    /************** If u want more please visit http://toutiao.com/i6231678548520731137/ **************/
-}

+ 0 - 627
ideahttp/src/main/java/com/zhpan/idea/utils/ConvertUtils.java

@@ -1,627 +0,0 @@
-package com.zhpan.idea.utils;
-
-import android.annotation.SuppressLint;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.view.View;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * <pre>
- *     author: zhpan
- *     time  : 2016/8/13
- *     desc  : 转换相关工具类
- * </pre>
- */
-public class ConvertUtils {
-
-    private ConvertUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    private static final char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
-
-    /**
-     * byteArr转hexString
-     * <p>例如:</p>
-     * bytes2HexString(new byte[] { 0, (byte) 0xa8 }) returns 00A8
-     *
-     * @param bytes 字节数组
-     * @return 16进制大写字符串
-     */
-    public static String bytes2HexString(byte[] bytes) {
-        if (bytes == null) return null;
-        int len = bytes.length;
-        if (len <= 0) return null;
-        char[] ret = new char[len << 1];
-        for (int i = 0, j = 0; i < len; i++) {
-            ret[j++] = hexDigits[bytes[i] >>> 4 & 0x0f];
-            ret[j++] = hexDigits[bytes[i] & 0x0f];
-        }
-        return new String(ret);
-    }
-
-    /**
-     * hexString转byteArr
-     * <p>例如:</p>
-     * hexString2Bytes("00A8") returns { 0, (byte) 0xA8 }
-     *
-     * @param hexString 十六进制字符串
-     * @return 字节数组
-     */
-    public static byte[] hexString2Bytes(String hexString) {
-        if (StringUtils.isSpace(hexString)) return null;
-        int len = hexString.length();
-        if (len % 2 != 0) {
-            hexString = "0" + hexString;
-            len = len + 1;
-        }
-        char[] hexBytes = hexString.toUpperCase().toCharArray();
-        byte[] ret = new byte[len >> 1];
-        for (int i = 0; i < len; i += 2) {
-            ret[i >> 1] = (byte) (hex2Dec(hexBytes[i]) << 4 | hex2Dec(hexBytes[i + 1]));
-        }
-        return ret;
-    }
-
-    /**
-     * hexChar转int
-     *
-     * @param hexChar hex单个字节
-     * @return 0..15
-     */
-    private static int hex2Dec(char hexChar) {
-        if (hexChar >= '0' && hexChar <= '9') {
-            return hexChar - '0';
-        } else if (hexChar >= 'A' && hexChar <= 'F') {
-            return hexChar - 'A' + 10;
-        } else {
-            throw new IllegalArgumentException();
-        }
-    }
-
-    /**
-     * charArr转byteArr
-     *
-     * @param chars 字符数组
-     * @return 字节数组
-     */
-    public static byte[] chars2Bytes(char[] chars) {
-        if (chars == null || chars.length <= 0) return null;
-        int len = chars.length;
-        byte[] bytes = new byte[len];
-        for (int i = 0; i < len; i++) {
-            bytes[i] = (byte) (chars[i]);
-        }
-        return bytes;
-    }
-
-    /**
-     * byteArr转charArr
-     *
-     * @param bytes 字节数组
-     * @return 字符数组
-     */
-    public static char[] bytes2Chars(byte[] bytes) {
-        if (bytes == null) return null;
-        int len = bytes.length;
-        if (len <= 0) return null;
-        char[] chars = new char[len];
-        for (int i = 0; i < len; i++) {
-            chars[i] = (char) (bytes[i] & 0xff);
-        }
-        return chars;
-    }
-
-    /**
-     * 以unit为单位的内存大小转字节数
-     *
-     * @param memorySize 大小
-     * @param unit       单位类型
-     *                   <ul>
-     *                   <li>{@link ConstUtils.MemoryUnit#BYTE}: 字节</li>
-     *                   <li>{@link ConstUtils.MemoryUnit#KB}  : 千字节</li>
-     *                   <li>{@link ConstUtils.MemoryUnit#MB}  : 兆</li>
-     *                   <li>{@link ConstUtils.MemoryUnit#GB}  : GB</li>
-     *                   </ul>
-     * @return 字节数
-     */
-    public static long memorySize2Byte(long memorySize, ConstUtils.MemoryUnit unit) {
-        if (memorySize < 0) return -1;
-        switch (unit) {
-            default:
-            case BYTE:
-                return memorySize;
-            case KB:
-                return memorySize * ConstUtils.KB;
-            case MB:
-                return memorySize * ConstUtils.MB;
-            case GB:
-                return memorySize * ConstUtils.GB;
-        }
-    }
-
-    /**
-     * 字节数转以unit为单位的内存大小
-     *
-     * @param byteNum 字节数
-     * @param unit    单位类型
-     *                <ul>
-     *                <li>{@link ConstUtils.MemoryUnit#BYTE}: 字节</li>
-     *                <li>{@link ConstUtils.MemoryUnit#KB}  : 千字节</li>
-     *                <li>{@link ConstUtils.MemoryUnit#MB}  : 兆</li>
-     *                <li>{@link ConstUtils.MemoryUnit#GB}  : GB</li>
-     *                </ul>
-     * @return 以unit为单位的size
-     */
-    public static double byte2MemorySize(long byteNum, ConstUtils.MemoryUnit unit) {
-        if (byteNum < 0) return -1;
-        switch (unit) {
-            default:
-            case BYTE:
-                return (double) byteNum;
-            case KB:
-                return (double) byteNum / ConstUtils.KB;
-            case MB:
-                return (double) byteNum / ConstUtils.MB;
-            case GB:
-                return (double) byteNum / ConstUtils.GB;
-        }
-    }
-
-    /**
-     * 字节数转合适内存大小
-     * <p>保留3位小数</p>
-     *
-     * @param byteNum 字节数
-     * @return 合适内存大小
-     */
-    @SuppressLint("DefaultLocale")
-    public static String byte2FitMemorySize(long byteNum) {
-        if (byteNum < 0) {
-            return "shouldn't be less than zero!";
-        } else if (byteNum < ConstUtils.KB) {
-            return String.format("%.1fB", byteNum + 0.0005);
-        } else if (byteNum < ConstUtils.MB) {
-            return String.format("%.1fK", byteNum / ConstUtils.DKB + 0.0005);
-        } else if (byteNum < ConstUtils.GB) {
-            return String.format("%.1fM", byteNum / ConstUtils.DMB + 0.0005);
-        } else {
-            return String.format("%.1fG", byteNum / ConstUtils.DGB + 0.0005);
-        }
-    }
-
-    /**
-     * 以unit为单位的时间长度转毫秒时间戳
-     *
-     * @param timeSpan 毫秒时间戳
-     * @param unit     单位类型
-     *                 <ul>
-     *                 <li>{@link ConstUtils.TimeUnit#MSEC}: 毫秒</li>
-     *                 <li>{@link ConstUtils.TimeUnit#SEC }: 秒</li>
-     *                 <li>{@link ConstUtils.TimeUnit#MIN }: 分</li>
-     *                 <li>{@link ConstUtils.TimeUnit#HOUR}: 小时</li>
-     *                 <li>{@link ConstUtils.TimeUnit#DAY }: 天</li>
-     *                 </ul>
-     * @return 毫秒时间戳
-     */
-    public static long timeSpan2Millis(long timeSpan, ConstUtils.TimeUnit unit) {
-        switch (unit) {
-            default:
-            case MSEC:
-                return timeSpan;
-            case SEC:
-                return timeSpan * ConstUtils.SEC;
-            case MIN:
-                return timeSpan * ConstUtils.MIN;
-            case HOUR:
-                return timeSpan * ConstUtils.HOUR;
-            case DAY:
-                return timeSpan * ConstUtils.DAY;
-        }
-    }
-
-    /**
-     * 毫秒时间戳转以unit为单位的时间长度
-     *
-     * @param millis 毫秒时间戳
-     * @param unit   单位类型
-     *               <ul>
-     *               <li>{@link ConstUtils.TimeUnit#MSEC}: 毫秒</li>
-     *               <li>{@link ConstUtils.TimeUnit#SEC }: 秒</li>
-     *               <li>{@link ConstUtils.TimeUnit#MIN }: 分</li>
-     *               <li>{@link ConstUtils.TimeUnit#HOUR}: 小时</li>
-     *               <li>{@link ConstUtils.TimeUnit#DAY }: 天</li>
-     *               </ul>
-     * @return 以unit为单位的时间长度
-     */
-    public static long millis2TimeSpan(long millis, ConstUtils.TimeUnit unit) {
-        switch (unit) {
-            default:
-            case MSEC:
-                return millis;
-            case SEC:
-                return millis / ConstUtils.SEC;
-            case MIN:
-                return millis / ConstUtils.MIN;
-            case HOUR:
-                return millis / ConstUtils.HOUR;
-            case DAY:
-                return millis / ConstUtils.DAY;
-        }
-    }
-
-    /**
-     * 毫秒时间戳转合适时间长度
-     *
-     * @param millis    毫秒时间戳
-     *                  <p>小于等于0,返回null</p>
-     * @param precision 精度
-     *                  <ul>
-     *                  <li>precision = 0,返回null</li>
-     *                  <li>precision = 1,返回天</li>
-     *                  <li>precision = 2,返回天和小时</li>
-     *                  <li>precision = 3,返回天、小时和分钟</li>
-     *                  <li>precision = 4,返回天、小时、分钟和秒</li>
-     *                  <li>precision &gt;= 5,返回天、小时、分钟、秒和毫秒</li>
-     *                  </ul>
-     * @return 合适时间长度
-     */
-    @SuppressLint("DefaultLocale")
-    public static String millis2FitTimeSpan(long millis, int precision) {
-        if (millis <= 0 || precision <= 0) return null;
-        StringBuilder sb = new StringBuilder();
-        String[] units = {"天", "小时", "分钟", "秒", "毫秒"};
-        int[] unitLen = {86400000, 3600000, 60000, 1000, 1};
-        precision = Math.min(precision, 5);
-        for (int i = 0; i < precision; i++) {
-            if (millis >= unitLen[i]) {
-                long mode = millis / unitLen[i];
-                millis -= mode * unitLen[i];
-                sb.append(mode).append(units[i]);
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * bytes转bits
-     *
-     * @param bytes 字节数组
-     * @return bits
-     */
-    public static String bytes2Bits(byte[] bytes) {
-        StringBuilder sb = new StringBuilder();
-        for (byte aByte : bytes) {
-            for (int j = 7; j >= 0; --j) {
-                sb.append(((aByte >> j) & 0x01) == 0 ? '0' : '1');
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * bits转bytes
-     *
-     * @param bits 二进制
-     * @return bytes
-     */
-    public static byte[] bits2Bytes(String bits) {
-        int lenMod = bits.length() % 8;
-        int byteLen = bits.length() / 8;
-        // 不是8的倍数前面补0
-        if (lenMod != 0) {
-            for (int i = lenMod; i < 8; i++) {
-                bits = "0" + bits;
-            }
-            byteLen++;
-        }
-        byte[] bytes = new byte[byteLen];
-        for (int i = 0; i < byteLen; ++i) {
-            for (int j = 0; j < 8; ++j) {
-                bytes[i] <<= 1;
-                bytes[i] |= bits.charAt(i * 8 + j) - '0';
-            }
-        }
-        return bytes;
-    }
-
-    /**
-     * inputStream转outputStream
-     *
-     * @param is 输入流
-     * @return outputStream子类
-     */
-    public static ByteArrayOutputStream input2OutputStream(InputStream is) {
-        if (is == null) return null;
-        try {
-            ByteArrayOutputStream os = new ByteArrayOutputStream();
-            byte[] b = new byte[ConstUtils.KB];
-            int len;
-            while ((len = is.read(b, 0, ConstUtils.KB)) != -1) {
-                os.write(b, 0, len);
-            }
-            return os;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        } finally {
-            CloseUtils.closeIO(is);
-        }
-    }
-
-    /**
-     * outputStream转inputStream
-     *
-     * @param out 输出流
-     * @return inputStream子类
-     */
-    public ByteArrayInputStream output2InputStream(OutputStream out) {
-        if (out == null) return null;
-        return new ByteArrayInputStream(((ByteArrayOutputStream) out).toByteArray());
-    }
-
-    /**
-     * inputStream转byteArr
-     *
-     * @param is 输入流
-     * @return 字节数组
-     */
-    public static byte[] inputStream2Bytes(InputStream is) {
-        if (is == null) return null;
-        return input2OutputStream(is).toByteArray();
-    }
-
-    /**
-     * byteArr转inputStream
-     *
-     * @param bytes 字节数组
-     * @return 输入流
-     */
-    public static InputStream bytes2InputStream(byte[] bytes) {
-        if (bytes == null || bytes.length <= 0) return null;
-        return new ByteArrayInputStream(bytes);
-    }
-
-    /**
-     * outputStream转byteArr
-     *
-     * @param out 输出流
-     * @return 字节数组
-     */
-    public static byte[] outputStream2Bytes(OutputStream out) {
-        if (out == null) return null;
-        return ((ByteArrayOutputStream) out).toByteArray();
-    }
-
-    /**
-     * outputStream转byteArr
-     *
-     * @param bytes 字节数组
-     * @return 字节数组
-     */
-    public static OutputStream bytes2OutputStream(byte[] bytes) {
-        if (bytes == null || bytes.length <= 0) return null;
-        ByteArrayOutputStream os = null;
-        try {
-            os = new ByteArrayOutputStream();
-            os.write(bytes);
-            return os;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        } finally {
-            CloseUtils.closeIO(os);
-        }
-    }
-
-    /**
-     * inputStream转string按编码
-     *
-     * @param is          输入流
-     * @param charsetName 编码格式
-     * @return 字符串
-     */
-    public static String inputStream2String(InputStream is, String charsetName) {
-        if (is == null || StringUtils.isSpace(charsetName)) return null;
-        try {
-            return new String(inputStream2Bytes(is), charsetName);
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * string转inputStream按编码
-     *
-     * @param string      字符串
-     * @param charsetName 编码格式
-     * @return 输入流
-     */
-    public static InputStream string2InputStream(String string, String charsetName) {
-        if (string == null || StringUtils.isSpace(charsetName)) return null;
-        try {
-            return new ByteArrayInputStream(string.getBytes(charsetName));
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * outputStream转string按编码
-     *
-     * @param out         输出流
-     * @param charsetName 编码格式
-     * @return 字符串
-     */
-    public static String outputStream2String(OutputStream out, String charsetName) {
-        if (out == null || StringUtils.isSpace(charsetName)) return null;
-        try {
-            return new String(outputStream2Bytes(out), charsetName);
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * string转outputStream按编码
-     *
-     * @param string      字符串
-     * @param charsetName 编码格式
-     * @return 输入流
-     */
-    public static OutputStream string2OutputStream(String string, String charsetName) {
-        if (string == null || StringUtils.isSpace(charsetName)) return null;
-        try {
-            return bytes2OutputStream(string.getBytes(charsetName));
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * bitmap转byteArr
-     *
-     * @param bitmap bitmap对象
-     * @param format 格式
-     * @return 字节数组
-     */
-    public static byte[] bitmap2Bytes(Bitmap bitmap, Bitmap.CompressFormat format) {
-        if (bitmap == null) return null;
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        bitmap.compress(format, 100, baos);
-        return baos.toByteArray();
-    }
-
-    /**
-     * byteArr转bitmap
-     *
-     * @param bytes 字节数组
-     * @return bitmap
-     */
-    public static Bitmap bytes2Bitmap(byte[] bytes) {
-        return (bytes == null || bytes.length == 0) ? null : BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
-    }
-
-    /**
-     * drawable转bitmap
-     *
-     * @param drawable drawable对象
-     * @return bitmap
-     */
-    public static Bitmap drawable2Bitmap(Drawable drawable) {
-        return drawable == null ? null : ((BitmapDrawable) drawable).getBitmap();
-    }
-
-    /**
-     * bitmap转drawable
-     *
-     * @param res    resources对象
-     * @param bitmap bitmap对象
-     * @return drawable
-     */
-    public static Drawable bitmap2Drawable(Resources res, Bitmap bitmap) {
-        return bitmap == null ? null : new BitmapDrawable(res, bitmap);
-    }
-
-    /**
-     * drawable转byteArr
-     *
-     * @param drawable drawable对象
-     * @param format   格式
-     * @return 字节数组
-     */
-    public static byte[] drawable2Bytes(Drawable drawable, Bitmap.CompressFormat format) {
-        return drawable == null ? null : bitmap2Bytes(drawable2Bitmap(drawable), format);
-    }
-
-    /**
-     * byteArr转drawable
-     *
-     * @param res   resources对象
-     * @param bytes 字节数组
-     * @return drawable
-     */
-    public static Drawable bytes2Drawable(Resources res, byte[] bytes) {
-        return res == null ? null : bitmap2Drawable(res, bytes2Bitmap(bytes));
-    }
-
-    /**
-     * view转Bitmap
-     *
-     * @param view 视图
-     * @return bitmap
-     */
-    public static Bitmap view2Bitmap(View view) {
-        if (view == null) return null;
-        Bitmap ret = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
-        Canvas canvas = new Canvas(ret);
-        Drawable bgDrawable = view.getBackground();
-        if (bgDrawable != null) {
-            bgDrawable.draw(canvas);
-        } else {
-            canvas.drawColor(Color.WHITE);
-        }
-        view.draw(canvas);
-        return ret;
-    }
-
-    /**
-     * dp转px
-     *
-     * @param dpValue dp值
-     * @return px值
-     */
-    public static int dp2px(float dpValue) {
-        final float scale = Utils.getContext().getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-
-    /**
-     * px转dp
-     *
-     * @param pxValue px值
-     * @return dp值
-     */
-    public static int px2dp(float pxValue) {
-        final float scale = Utils.getContext().getResources().getDisplayMetrics().density;
-        return (int) (pxValue / scale + 0.5f);
-    }
-
-    /**
-     * sp转px
-     *
-     * @param spValue sp值
-     * @return px值
-     */
-    public static int sp2px(float spValue) {
-        final float fontScale = Utils.getContext().getResources().getDisplayMetrics().scaledDensity;
-        return (int) (spValue * fontScale + 0.5f);
-    }
-
-    /**
-     * px转sp
-     *
-     * @param pxValue px值
-     * @return sp值
-     */
-    public static int px2sp(float pxValue) {
-        final float fontScale = Utils.getContext().getResources().getDisplayMetrics().scaledDensity;
-        return (int) (pxValue / fontScale + 0.5f);
-    }
-}

+ 0 - 230
ideahttp/src/main/java/com/zhpan/idea/utils/DataConversionTools.java

@@ -1,230 +0,0 @@
-package com.zhpan.idea.utils;
-
-import java.nio.charset.Charset;
-import java.util.Calendar;
-
-/**
- * Created by jokerlee on 16-6-23.
- * 这是一个用于将不同数据类型转换为byte数组或者解码byte组为其它数据的工具类
- * Slc 设备基本采用高位在前的数据传输
- */
-public class DataConversionTools {
-
-    public static byte[] intArrayToByteArray(int[] data){
-        if( data == null ) return null;
-        byte[] result = new byte[data.length];
-        for( int i = 0; i < data.length; i++ ){
-            result[i] = (byte) data[i];
-        }
-        return result;
-    }
-
-    /**
-     * 校验一段byte数组的crc,前bits位的和,取低8位
-     * @param data
-     * @return
-     */
-    public static boolean validCrc(byte[] data){
-        if(data == null){
-            return false;
-        }
-        byte crc = getCrc(data, data.length - 1);
-        return crc == data[data.length - 1];
-    }
-
-    /**
-     * 计算一段byte数组的crc,前bits位的和,取低8位
-     * @param data
-     * @param bits
-     * @return
-     */
-    public static byte getCrc(byte[] data, int bits){
-        int result = 0;
-        for( int i = 0 ; i < bits ; i ++ ){
-            byte b = data[i];
-            result += b & 0xff;
-        }
-        return lowUint16((short) result);
-    }
-
-    /**
-     * 获取低8位的byte数据
-     * @param v
-     * @return
-     */
-    public static byte lowUint16(short v) {
-        return (byte) (v & 0xFF);
-    }
-
-    /**
-     * 获取高8位的byte数据
-     * @param v
-     * @return
-     */
-    public static byte highUint16(short v) {
-        return (byte) (v >> 8);
-    }
-
-    /**
-     * 根据高低8位数据构造一个2 bytes的short数据
-     * @param hi
-     * @param lo
-     * @return
-     */
-    public static short buildUint16(byte hi, byte lo) {
-        return (short) ((hi << 8) + (lo & 0xff));
-    }
-
-
-    /**
-     * byte数组中取int数值,本方法适用于(低位在前,高位在后)
-     * @param src
-     *            byte数组
-     * @param offset
-     *            从数组的第offset位开始
-     * @return int数值
-     */
-    public static int bytesToInt(byte[] src, int offset) {
-        int value;
-        value = (src[offset] & 0xFF)
-                | ((src[offset+1] & 0xFF)<<8)
-                | ((src[offset+2] & 0xFF)<<16)
-                | ((src[offset+3] & 0xFF)<<24);
-        return value;
-    }
-
-    /**
-     * byte数组中取int数值,本方法适用于(低位在后,高位在前)的顺序
-     */
-    public static int bytesToInt2(byte[] src, int offset) {
-        int value;
-        value = ((src[offset] & 0xFF)<<24)
-                |((src[offset+1] & 0xFF)<<16)
-                |((src[offset+2] & 0xFF)<<8)
-                |(src[offset+3] & 0xFF);
-        return value;
-    }
-
-    /**
-     * Encode the string to byte[], use the given charset.
-     * The common charset:
-     * <ul>
-     * <li>ISO-8859-1
-     * <li>US-ASCII
-     * <li>UTF-16
-     * <li>UTF-16BE
-     * <li>UTF-16LE
-     * <li>UTF-8
-     * </ul>
-     * @param value
-     * @param charset
-     * @return
-     */
-    public static byte[] stringToBytes(String value, Charset charset){
-        if( value != null && !value.isEmpty()) {
-            return value.getBytes(charset);
-        }
-        return null;
-    }
-
-    /**
-     * Encode the string to byte[], use the default utf-8
-     * @param value
-     * @return
-     */
-    public static byte[] stringToBytes(String value){
-        if( value != null && !value.isEmpty()) {
-            return value.getBytes(Charset.forName("UTF-8"));
-        }
-        return null;
-    }
-
-    /**
-     * Decode the byte[] to string, use the utf-8 charset.
-     * @param data
-     * @return
-     */
-    public static String bytesToString(byte[] data){
-        if(data!=null && data.length!=0){
-            return new String(data,Charset.forName("UTF-8"));
-        }
-        return null;
-    }
-
-    /**
-     * 将byte数组转换为十六进制的字符串
-     * @param data
-     * @return
-     */
-    public static String bytesToHexString(byte[] data){
-        String result = "";
-        for( byte b : data ){
-            result += String.format("%02x",b);
-        }
-        return  result;
-    }
-
-    public static byte[] hexStringToBytes(String hexString) {
-        if (hexString == null || hexString.equals("")) {
-            return null;
-        }
-        hexString = hexString.toUpperCase();
-        int length = hexString.length() / 2;
-        char[] hexChars = hexString.toCharArray();
-        byte[] result = new byte[length];
-        for (int i = 0; i < length; i++) {
-            int pos = i * 2;
-            result[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
-        }
-        return result;
-    }
-
-    private static byte charToByte(char c) {
-        return (byte) "0123456789ABCDEF".indexOf(c);
-    }
-    /**
-     * 将byte数组转换为acsii字符串
-     * @param data
-     * @return
-     */
-    public static String bytesToAsciiString(byte[] data){
-        String result = "";
-        for( byte b : data ){
-            char c = (char) b;
-            result += c;
-        }
-        return  result;
-    }
-
-    /**
-     * 将5508规则的时间7个bytes数组转换为时间戳timestamp
-     * 数据如:2016-10-31-21:09:55则写入07 e0 10 31 21 09 55
-     * @param data
-     * @return
-     */
-    public static long bytesToTimestamp(byte[] data){
-        if( data==null || data.length != 7 ) return -1;
-        //头两个bytes为年份,高8位在前,低8位在后
-        int year = buildUint16(data[0], data[1]);
-        int month = data[2] - 1; //默认月份为0-11故而取值之后 -1
-        int day = data[3];
-        int hour = data[4];
-        int minute = data[5];
-        int second = data[6];
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(year,month,day,hour,minute,second);
-
-//        PrintTools.printLogs("时间:"
-//                + CommonUtil.getStringDateTime(calendar.getTimeInMillis()));
-        return calendar.getTimeInMillis();
-    }
-
-    public static byte[] getDeviceNameData(String name){
-        //默认15bytes名字长度,不允许用户填写空格故而使用空格填充
-        byte[] data = new byte[15];
-        byte[] temp = DataConversionTools.stringToBytes(name);
-        System.arraycopy(temp,0,data,0,temp.length > 15 ? 15 : temp.length);
-        return data;
-    }
-
-}

+ 0 - 51
ideahttp/src/main/java/com/zhpan/idea/utils/DensityUtils.java

@@ -1,51 +0,0 @@
-package com.zhpan.idea.utils;
-
-import android.content.Context;
-import android.util.DisplayMetrics;
-
-/**
- * dp px转换
- */
-public class DensityUtils {
-    private static int screenW;
-    private static int screenH;
-    private static float screenDensity;
-
-    public static int getScreenW(Context context){
-        if (screenW == 0){
-            initScreen(context);
-        }
-        return screenW;
-    }
-
-    public static int getScreenH(Context context){
-        if (screenH == 0){
-            initScreen(context);
-        }
-        return screenH;
-    }
-
-    public static float getScreenDensity(Context context){
-        if (screenDensity == 0){
-            initScreen(context);
-        }
-        return screenDensity;
-    }
-
-    private static void initScreen(Context context){
-        DisplayMetrics metric = context.getResources().getDisplayMetrics();
-        screenW = metric.widthPixels;
-        screenH = metric.heightPixels;
-        screenDensity = metric.density;
-    }
-
-
-    public static int dp2px(Context context, float dpValue) {
-        return (int) (dpValue * getScreenDensity(context) + 0.5f);
-    }
-
-
-    public static int px2dp(Context context, float pxValue) {
-        return (int) (pxValue / getScreenDensity(context) + 0.5f);
-    }
-}

+ 0 - 1290
ideahttp/src/main/java/com/zhpan/idea/utils/FileUtils.java

@@ -1,1290 +0,0 @@
-package com.zhpan.idea.utils;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * <pre>
- *     author: zhpan
- *     time  : 2016/8/11
- *     desc  : 文件相关工具类
- * </pre>
- */
-public class FileUtils {
-
-    private FileUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * 根据文件路径获取文件
-     *
-     * @param filePath 文件路径
-     * @return 文件
-     */
-    public static File getFileByPath(String filePath) {
-        return StringUtils.isSpace(filePath) ? null : new File(filePath);
-    }
-
-    /**
-     * 判断文件是否存在
-     *
-     * @param filePath 文件路径
-     * @return {@code true}: 存在<br>{@code false}: 不存在
-     */
-    public static boolean isFileExists(String filePath) {
-        return isFileExists(getFileByPath(filePath));
-    }
-
-    /**
-     * 判断文件是否存在
-     *
-     * @param file 文件
-     * @return {@code true}: 存在<br>{@code false}: 不存在
-     */
-    public static boolean isFileExists(File file) {
-        return file != null && file.exists();
-    }
-
-    /**
-     * 重命名文件
-     *
-     * @param filePath 文件路径
-     * @param newName  新名称
-     * @return {@code true}: 重命名成功<br>{@code false}: 重命名失败
-     */
-    public static boolean rename(String filePath, String newName) {
-        return rename(getFileByPath(filePath), newName);
-    }
-
-    /**
-     * 重命名文件
-     *
-     * @param file    文件
-     * @param newName 新名称
-     * @return {@code true}: 重命名成功<br>{@code false}: 重命名失败
-     */
-    public static boolean rename(File file, String newName) {
-        // 文件为空返回false
-        if (file == null) return false;
-        // 文件不存在返回false
-        if (!file.exists()) return false;
-        // 新的文件名为空返回false
-        if (StringUtils.isSpace(newName)) return false;
-        // 如果文件名没有改变返回true
-        if (newName.equals(file.getName())) return true;
-        File newFile = new File(file.getParent() + File.separator + newName);
-        // 如果重命名的文件已存在返回false
-        return !newFile.exists()
-                && file.renameTo(newFile);
-    }
-
-    /**
-     * 判断是否是目录
-     *
-     * @param dirPath 目录路径
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isDir(String dirPath) {
-        return isDir(getFileByPath(dirPath));
-    }
-
-    /**
-     * 判断是否是目录
-     *
-     * @param file 文件
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isDir(File file) {
-        return isFileExists(file) && file.isDirectory();
-    }
-
-    /**
-     * 判断是否是文件
-     *
-     * @param filePath 文件路径
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isFile(String filePath) {
-        return isFile(getFileByPath(filePath));
-    }
-
-    /**
-     * 判断是否是文件
-     *
-     * @param file 文件
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isFile(File file) {
-        return isFileExists(file) && file.isFile();
-    }
-
-    /**
-     * 判断目录是否存在,不存在则判断是否创建成功
-     *
-     * @param dirPath 目录路径
-     * @return {@code true}: 存在或创建成功<br>{@code false}: 不存在或创建失败
-     */
-    public static boolean createOrExistsDir(String dirPath) {
-        return createOrExistsDir(getFileByPath(dirPath));
-    }
-
-    /**
-     * 判断目录是否存在,不存在则判断是否创建成功
-     *
-     * @param file 文件
-     * @return {@code true}: 存在或创建成功<br>{@code false}: 不存在或创建失败
-     */
-    public static boolean createOrExistsDir(File file) {
-        // 如果存在,是目录则返回true,是文件则返回false,不存在则返回是否创建成功
-        return file != null && (file.exists() ? file.isDirectory() : file.mkdirs());
-    }
-
-    /**
-     * 判断文件是否存在,不存在则判断是否创建成功
-     *
-     * @param filePath 文件路径
-     * @return {@code true}: 存在或创建成功<br>{@code false}: 不存在或创建失败
-     */
-    public static boolean createOrExistsFile(String filePath) {
-        return createOrExistsFile(getFileByPath(filePath));
-    }
-
-    /**
-     * 判断文件是否存在,不存在则判断是否创建成功
-     *
-     * @param file 文件
-     * @return {@code true}: 存在或创建成功<br>{@code false}: 不存在或创建失败
-     */
-    public static boolean createOrExistsFile(File file) {
-        if (file == null) return false;
-        // 如果存在,是文件则返回true,是目录则返回false
-        if (file.exists()) return file.isFile();
-        if (!createOrExistsDir(file.getParentFile())) return false;
-        try {
-            return file.createNewFile();
-        } catch (IOException e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 判断文件是否存在,存在则在创建之前删除
-     *
-     * @param filePath 文件路径
-     * @return {@code true}: 创建成功<br>{@code false}: 创建失败
-     */
-    public static boolean createFileByDeleteOldFile(String filePath) {
-        return createFileByDeleteOldFile(getFileByPath(filePath));
-    }
-
-    /**
-     * 判断文件是否存在,存在则在创建之前删除
-     *
-     * @param file 文件
-     * @return {@code true}: 创建成功<br>{@code false}: 创建失败
-     */
-    public static boolean createFileByDeleteOldFile(File file) {
-        if (file == null) return false;
-        // 文件存在并且删除失败返回false
-        if (file.exists() && file.isFile() && !file.delete()) return false;
-        // 创建目录失败返回false
-        if (!createOrExistsDir(file.getParentFile())) return false;
-        try {
-            return file.createNewFile();
-        } catch (IOException e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 复制或移动目录
-     *
-     * @param srcDirPath  源目录路径
-     * @param destDirPath 目标目录路径
-     * @param isMove      是否移动
-     * @return {@code true}: 复制或移动成功<br>{@code false}: 复制或移动失败
-     */
-    private static boolean copyOrMoveDir(String srcDirPath, String destDirPath, boolean isMove) {
-        return copyOrMoveDir(getFileByPath(srcDirPath), getFileByPath(destDirPath), isMove);
-    }
-
-    /**
-     * 复制或移动目录
-     *
-     * @param srcDir  源目录
-     * @param destDir 目标目录
-     * @param isMove  是否移动
-     * @return {@code true}: 复制或移动成功<br>{@code false}: 复制或移动失败
-     */
-    private static boolean copyOrMoveDir(File srcDir, File destDir, boolean isMove) {
-        if (srcDir == null || destDir == null) return false;
-        // 如果目标目录在源目录中则返回false,看不懂的话好好想想递归怎么结束
-        // srcPath : F:\\MyGithub\\AndroidUtilCode\\utilcode\\src\\test\\res
-        // destPath: F:\\MyGithub\\AndroidUtilCode\\utilcode\\src\\test\\res1
-        // 为防止以上这种情况出现出现误判,须分别在后面加个路径分隔符
-        String srcPath = srcDir.getPath() + File.separator;
-        String destPath = destDir.getPath() + File.separator;
-        if (destPath.contains(srcPath)) return false;
-        // 源文件不存在或者不是目录则返回false
-        if (!srcDir.exists() || !srcDir.isDirectory()) return false;
-        // 目标目录不存在返回false
-        if (!createOrExistsDir(destDir)) return false;
-        File[] files = srcDir.listFiles();
-        for (File file : files) {
-            File oneDestFile = new File(destPath + file.getName());
-            if (file.isFile()) {
-                // 如果操作失败返回false
-                if (!copyOrMoveFile(file, oneDestFile, isMove)) return false;
-            } else if (file.isDirectory()) {
-                // 如果操作失败返回false
-                if (!copyOrMoveDir(file, oneDestFile, isMove)) return false;
-            }
-        }
-        return !isMove || deleteDir(srcDir);
-    }
-
-    /**
-     * 复制或移动文件
-     *
-     * @param srcFilePath  源文件路径
-     * @param destFilePath 目标文件路径
-     * @param isMove       是否移动
-     * @return {@code true}: 复制或移动成功<br>{@code false}: 复制或移动失败
-     */
-    private static boolean copyOrMoveFile(String srcFilePath, String destFilePath, boolean isMove) {
-        return copyOrMoveFile(getFileByPath(srcFilePath), getFileByPath(destFilePath), isMove);
-    }
-
-    /**
-     * 复制或移动文件
-     *
-     * @param srcFile  源文件
-     * @param destFile 目标文件
-     * @param isMove   是否移动
-     * @return {@code true}: 复制或移动成功<br>{@code false}: 复制或移动失败
-     */
-    private static boolean copyOrMoveFile(File srcFile, File destFile, boolean isMove) {
-        if (srcFile == null || destFile == null) return false;
-        // 源文件不存在或者不是文件则返回false
-        if (!srcFile.exists() || !srcFile.isFile()) return false;
-        // 目标文件存在且是文件则返回false
-        if (destFile.exists() && destFile.isFile()) return false;
-        // 目标目录不存在返回false
-        if (!createOrExistsDir(destFile.getParentFile())) return false;
-        try {
-            return writeFileFromIS(destFile, new FileInputStream(srcFile), false)
-                    && !(isMove && !deleteFile(srcFile));
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 复制目录
-     *
-     * @param srcDirPath  源目录路径
-     * @param destDirPath 目标目录路径
-     * @return {@code true}: 复制成功<br>{@code false}: 复制失败
-     */
-    public static boolean copyDir(String srcDirPath, String destDirPath) {
-        return copyDir(getFileByPath(srcDirPath), getFileByPath(destDirPath));
-    }
-
-    /**
-     * 复制目录
-     *
-     * @param srcDir  源目录
-     * @param destDir 目标目录
-     * @return {@code true}: 复制成功<br>{@code false}: 复制失败
-     */
-    public static boolean copyDir(File srcDir, File destDir) {
-        return copyOrMoveDir(srcDir, destDir, false);
-    }
-
-    /**
-     * 复制文件
-     *
-     * @param srcFilePath  源文件路径
-     * @param destFilePath 目标文件路径
-     * @return {@code true}: 复制成功<br>{@code false}: 复制失败
-     */
-    public static boolean copyFile(String srcFilePath, String destFilePath) {
-        return copyFile(getFileByPath(srcFilePath), getFileByPath(destFilePath));
-    }
-
-    /**
-     * 复制文件
-     *
-     * @param srcFile  源文件
-     * @param destFile 目标文件
-     * @return {@code true}: 复制成功<br>{@code false}: 复制失败
-     */
-    public static boolean copyFile(File srcFile, File destFile) {
-        return copyOrMoveFile(srcFile, destFile, false);
-    }
-
-    /**
-     * 移动目录
-     *
-     * @param srcDirPath  源目录路径
-     * @param destDirPath 目标目录路径
-     * @return {@code true}: 移动成功<br>{@code false}: 移动失败
-     */
-    public static boolean moveDir(String srcDirPath, String destDirPath) {
-        return moveDir(getFileByPath(srcDirPath), getFileByPath(destDirPath));
-    }
-
-    /**
-     * 移动目录
-     *
-     * @param srcDir  源目录
-     * @param destDir 目标目录
-     * @return {@code true}: 移动成功<br>{@code false}: 移动失败
-     */
-    public static boolean moveDir(File srcDir, File destDir) {
-        return copyOrMoveDir(srcDir, destDir, true);
-    }
-
-    /**
-     * 移动文件
-     *
-     * @param srcFilePath  源文件路径
-     * @param destFilePath 目标文件路径
-     * @return {@code true}: 移动成功<br>{@code false}: 移动失败
-     */
-    public static boolean moveFile(String srcFilePath, String destFilePath) {
-        return moveFile(getFileByPath(srcFilePath), getFileByPath(destFilePath));
-    }
-
-    /**
-     * 移动文件
-     *
-     * @param srcFile  源文件
-     * @param destFile 目标文件
-     * @return {@code true}: 移动成功<br>{@code false}: 移动失败
-     */
-    public static boolean moveFile(File srcFile, File destFile) {
-        return copyOrMoveFile(srcFile, destFile, true);
-    }
-
-    /**
-     * 删除目录
-     *
-     * @param dirPath 目录路径
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteDir(String dirPath) {
-        return deleteDir(getFileByPath(dirPath));
-    }
-
-    /**
-     * 删除目录
-     *
-     * @param dir 目录
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteDir(File dir) {
-        if (dir == null) return false;
-        // 目录不存在返回true
-        if (!dir.exists()) return true;
-        // 不是目录返回false
-        if (!dir.isDirectory()) return false;
-        // 现在文件存在且是文件夹
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.isFile()) {
-                    if (!deleteFile(file)) return false;
-                } else if (file.isDirectory()) {
-                    if (!deleteDir(file)) return false;
-                }
-            }
-        }
-        return dir.delete();
-    }
-
-    /**
-     * 删除文件
-     *
-     * @param srcFilePath 文件路径
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteFile(String srcFilePath) {
-        return deleteFile(getFileByPath(srcFilePath));
-    }
-
-    /**
-     * 删除文件
-     *
-     * @param file 文件
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteFile(File file) {
-        return file != null && (!file.exists() || file.isFile() && file.delete());
-    }
-
-    /**
-     * 删除目录下的所有文件
-     *
-     * @param dirPath 目录路径
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteFilesInDir(String dirPath) {
-        return deleteFilesInDir(getFileByPath(dirPath));
-    }
-
-    /**
-     * 删除目录下的所有文件
-     *
-     * @param dir 目录
-     * @return {@code true}: 删除成功<br>{@code false}: 删除失败
-     */
-    public static boolean deleteFilesInDir(File dir) {
-        if (dir == null) return false;
-        // 目录不存在返回true
-        if (!dir.exists()) return true;
-        // 不是目录返回false
-        if (!dir.isDirectory()) return false;
-        // 现在文件存在且是文件夹
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.isFile()) {
-                    if (!deleteFile(file)) return false;
-                } else if (file.isDirectory()) {
-                    if (!deleteDir(file)) return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * 获取目录下所有文件
-     *
-     * @param dirPath     目录路径
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDir(String dirPath, boolean isRecursive) {
-        return listFilesInDir(getFileByPath(dirPath), isRecursive);
-    }
-
-    /**
-     * 获取目录下所有文件
-     *
-     * @param dir         目录
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDir(File dir, boolean isRecursive) {
-        if (!isDir(dir)) return null;
-        if (isRecursive) return listFilesInDir(dir);
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            Collections.addAll(list, files);
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下所有文件包括子目录
-     *
-     * @param dirPath 目录路径
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDir(String dirPath) {
-        return listFilesInDir(getFileByPath(dirPath));
-    }
-
-    /**
-     * 获取目录下所有文件包括子目录
-     *
-     * @param dir 目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDir(File dir) {
-        if (!isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                list.add(file);
-                if (file.isDirectory()) {
-                    list.addAll(listFilesInDir(file));
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下所有后缀名为suffix的文件
-     * <p>大小写忽略</p>
-     *
-     * @param dirPath     目录路径
-     * @param suffix      后缀名
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(String dirPath, String suffix, boolean isRecursive) {
-        return listFilesInDirWithFilter(getFileByPath(dirPath), suffix, isRecursive);
-    }
-
-    /**
-     * 获取目录下所有后缀名为suffix的文件
-     * <p>大小写忽略</p>
-     *
-     * @param dir         目录
-     * @param suffix      后缀名
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(File dir, String suffix, boolean isRecursive) {
-        if (isRecursive) return listFilesInDirWithFilter(dir, suffix);
-        if (dir == null || !isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.getName().toUpperCase().endsWith(suffix.toUpperCase())) {
-                    list.add(file);
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下所有后缀名为suffix的文件包括子目录
-     * <p>大小写忽略</p>
-     *
-     * @param dirPath 目录路径
-     * @param suffix  后缀名
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(String dirPath, String suffix) {
-        return listFilesInDirWithFilter(getFileByPath(dirPath), suffix);
-    }
-
-    /**
-     * 获取目录下所有后缀名为suffix的文件包括子目录
-     * <p>大小写忽略</p>
-     *
-     * @param dir    目录
-     * @param suffix 后缀名
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(File dir, String suffix) {
-        if (dir == null || !isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.getName().toUpperCase().endsWith(suffix.toUpperCase())) {
-                    list.add(file);
-                }
-                if (file.isDirectory()) {
-                    list.addAll(listFilesInDirWithFilter(file, suffix));
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下所有符合filter的文件
-     *
-     * @param dirPath     目录路径
-     * @param filter      过滤器
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(String dirPath, FilenameFilter filter, boolean isRecursive) {
-        return listFilesInDirWithFilter(getFileByPath(dirPath), filter, isRecursive);
-    }
-
-    /**
-     * 获取目录下所有符合filter的文件
-     *
-     * @param dir         目录
-     * @param filter      过滤器
-     * @param isRecursive 是否递归进子目录
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(File dir, FilenameFilter filter, boolean isRecursive) {
-        if (isRecursive) return listFilesInDirWithFilter(dir, filter);
-        if (dir == null || !isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (filter.accept(file.getParentFile(), file.getName())) {
-                    list.add(file);
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下所有符合filter的文件包括子目录
-     *
-     * @param dirPath 目录路径
-     * @param filter  过滤器
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(String dirPath, FilenameFilter filter) {
-        return listFilesInDirWithFilter(getFileByPath(dirPath), filter);
-    }
-
-    /**
-     * 获取目录下所有符合filter的文件包括子目录
-     *
-     * @param dir    目录
-     * @param filter 过滤器
-     * @return 文件链表
-     */
-    public static List<File> listFilesInDirWithFilter(File dir, FilenameFilter filter) {
-        if (dir == null || !isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (filter.accept(file.getParentFile(), file.getName())) {
-                    list.add(file);
-                }
-                if (file.isDirectory()) {
-                    list.addAll(listFilesInDirWithFilter(file, filter));
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 获取目录下指定文件名的文件包括子目录
-     * <p>大小写忽略</p>
-     *
-     * @param dirPath  目录路径
-     * @param fileName 文件名
-     * @return 文件链表
-     */
-    public static List<File> searchFileInDir(String dirPath, String fileName) {
-        return searchFileInDir(getFileByPath(dirPath), fileName);
-    }
-
-    /**
-     * 获取目录下指定文件名的文件包括子目录
-     * <p>大小写忽略</p>
-     *
-     * @param dir      目录
-     * @param fileName 文件名
-     * @return 文件链表
-     */
-    public static List<File> searchFileInDir(File dir, String fileName) {
-        if (dir == null || !isDir(dir)) return null;
-        List<File> list = new ArrayList<>();
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.getName().toUpperCase().equals(fileName.toUpperCase())) {
-                    list.add(file);
-                }
-                if (file.isDirectory()) {
-                    list.addAll(searchFileInDir(file, fileName));
-                }
-            }
-        }
-        return list;
-    }
-
-    /**
-     * 将输入流写入文件
-     *
-     * @param filePath 路径
-     * @param is       输入流
-     * @param append   是否追加在文件末
-     * @return {@code true}: 写入成功<br>{@code false}: 写入失败
-     */
-    public static boolean writeFileFromIS(String filePath, InputStream is, boolean append) {
-        return writeFileFromIS(getFileByPath(filePath), is, append);
-    }
-
-    /**
-     * 将输入流写入文件
-     *
-     * @param file   文件
-     * @param is     输入流
-     * @param append 是否追加在文件末
-     * @return {@code true}: 写入成功<br>{@code false}: 写入失败
-     */
-    public static boolean writeFileFromIS(File file, InputStream is, boolean append) {
-        if (file == null || is == null) return false;
-        if (!createOrExistsFile(file)) return false;
-        OutputStream os = null;
-        try {
-            os = new BufferedOutputStream(new FileOutputStream(file, append));
-            byte data[] = new byte[1024];
-            int len;
-            while ((len = is.read(data, 0, 1024)) != -1) {
-                os.write(data, 0, len);
-            }
-            return true;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return false;
-        } finally {
-            CloseUtils.closeIO(is, os);
-        }
-    }
-
-    /**
-     * 将字符串写入文件
-     *
-     * @param filePath 文件路径
-     * @param content  写入内容
-     * @param append   是否追加在文件末
-     * @return {@code true}: 写入成功<br>{@code false}: 写入失败
-     */
-    public static boolean writeFileFromString(String filePath, String content, boolean append) {
-        return writeFileFromString(getFileByPath(filePath), content, append);
-    }
-
-    /**
-     * 将字符串写入文件
-     *
-     * @param file    文件
-     * @param content 写入内容
-     * @param append  是否追加在文件末
-     * @return {@code true}: 写入成功<br>{@code false}: 写入失败
-     */
-    public static boolean writeFileFromString(File file, String content, boolean append) {
-        if (file == null || content == null) return false;
-        if (!createOrExistsFile(file)) return false;
-        BufferedWriter bw = null;
-        try {
-            bw = new BufferedWriter(new FileWriter(file, append));
-            bw.write(content);
-            return true;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return false;
-        } finally {
-            CloseUtils.closeIO(bw);
-        }
-    }
-
-    /**
-     * 指定编码按行读取文件到链表中
-     *
-     * @param filePath    文件路径
-     * @param charsetName 编码格式
-     * @return 文件行链表
-     */
-    public static List<String> readFile2List(String filePath, String charsetName) {
-        return readFile2List(getFileByPath(filePath), charsetName);
-    }
-
-    /**
-     * 指定编码按行读取文件到链表中
-     *
-     * @param file        文件
-     * @param charsetName 编码格式
-     * @return 文件行链表
-     */
-    public static List<String> readFile2List(File file, String charsetName) {
-        return readFile2List(file, 0, 0x7FFFFFFF, charsetName);
-    }
-
-    /**
-     * 指定编码按行读取文件到链表中
-     *
-     * @param filePath    文件路径
-     * @param st          需要读取的开始行数
-     * @param end         需要读取的结束行数
-     * @param charsetName 编码格式
-     * @return 包含制定行的list
-     */
-    public static List<String> readFile2List(String filePath, int st, int end, String
-            charsetName) {
-        return readFile2List(getFileByPath(filePath), st, end, charsetName);
-    }
-
-    /**
-     * 指定编码按行读取文件到链表中
-     *
-     * @param file        文件
-     * @param st          需要读取的开始行数
-     * @param end         需要读取的结束行数
-     * @param charsetName 编码格式
-     * @return 包含从start行到end行的list
-     */
-    public static List<String> readFile2List(File file, int st, int end, String charsetName) {
-        if (file == null) return null;
-        if (st > end) return null;
-        BufferedReader reader = null;
-        try {
-            String line;
-            int curLine = 1;
-            List<String> list = new ArrayList<>();
-            if (StringUtils.isSpace(charsetName)) {
-                reader = new BufferedReader(new FileReader(file));
-            } else {
-                reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName));
-            }
-            while ((line = reader.readLine()) != null) {
-                if (curLine > end) break;
-                if (st <= curLine && curLine <= end) list.add(line);
-                ++curLine;
-            }
-            return list;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        } finally {
-            CloseUtils.closeIO(reader);
-        }
-    }
-
-    /**
-     * 指定编码按行读取文件到字符串中
-     *
-     * @param filePath    文件路径
-     * @param charsetName 编码格式
-     * @return 字符串
-     */
-    public static String readFile2String(String filePath, String charsetName) {
-        return readFile2String(getFileByPath(filePath), charsetName);
-    }
-
-    /**
-     * 指定编码按行读取文件到字符串中
-     *
-     * @param file        文件
-     * @param charsetName 编码格式
-     * @return 字符串
-     */
-    public static String readFile2String(File file, String charsetName) {
-        if (file == null) return null;
-        BufferedReader reader = null;
-        try {
-            StringBuilder sb = new StringBuilder();
-            if (StringUtils.isSpace(charsetName)) {
-                reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
-            } else {
-                reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName));
-            }
-            String line;
-            while ((line = reader.readLine()) != null) {
-                sb.append(line).append("\r\n");// windows系统换行为\r\n,Linux为\n
-            }
-            // 要去除最后的换行符
-            return sb.delete(sb.length() - 2, sb.length()).toString();
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        } finally {
-            CloseUtils.closeIO(reader);
-        }
-    }
-
-    /**
-     * 读取文件到字符数组中
-     *
-     * @param filePath 文件路径
-     * @return 字符数组
-     */
-    public static byte[] readFile2Bytes(String filePath) {
-        return readFile2Bytes(getFileByPath(filePath));
-    }
-
-    /**
-     * 读取文件到字符数组中
-     *
-     * @param file 文件
-     * @return 字符数组
-     */
-    public static byte[] readFile2Bytes(File file) {
-        if (file == null) return null;
-        try {
-            return ConvertUtils.inputStream2Bytes(new FileInputStream(file));
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 获取文件最后修改的毫秒时间戳
-     *
-     * @param filePath 文件路径
-     * @return 文件最后修改的毫秒时间戳
-     */
-    public static long getFileLastModified(String filePath) {
-        return getFileLastModified(getFileByPath(filePath));
-    }
-
-    /**
-     * 获取文件最后修改的毫秒时间戳
-     *
-     * @param file 文件
-     * @return 文件最后修改的毫秒时间戳
-     */
-    public static long getFileLastModified(File file) {
-        if (file == null) return -1;
-        return file.lastModified();
-    }
-
-    /**
-     * 简单获取文件编码格式
-     *
-     * @param filePath 文件路径
-     * @return 文件编码
-     */
-    public static String getFileCharsetSimple(String filePath) {
-        return getFileCharsetSimple(getFileByPath(filePath));
-    }
-
-    /**
-     * 简单获取文件编码格式
-     *
-     * @param file 文件
-     * @return 文件编码
-     */
-    public static String getFileCharsetSimple(File file) {
-        int p = 0;
-        InputStream is = null;
-        try {
-            is = new BufferedInputStream(new FileInputStream(file));
-            p = (is.read() << 8) + is.read();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            CloseUtils.closeIO(is);
-        }
-        switch (p) {
-            case 0xefbb:
-                return "UTF-8";
-            case 0xfffe:
-                return "Unicode";
-            case 0xfeff:
-                return "UTF-16BE";
-            default:
-                return "GBK";
-        }
-    }
-
-    /**
-     * 获取文件行数
-     *
-     * @param filePath 文件路径
-     * @return 文件行数
-     */
-    public static int getFileLines(String filePath) {
-        return getFileLines(getFileByPath(filePath));
-    }
-
-    /**
-     * 获取文件行数
-     *
-     * @param file 文件
-     * @return 文件行数
-     */
-    public static int getFileLines(File file) {
-        int count = 1;
-        InputStream is = null;
-        try {
-            is = new BufferedInputStream(new FileInputStream(file));
-            byte[] buffer = new byte[1024];
-            int readChars;
-            while ((readChars = is.read(buffer, 0, 1024)) != -1) {
-                for (int i = 0; i < readChars; ++i) {
-                    if (buffer[i] == '\n') ++count;
-                }
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            CloseUtils.closeIO(is);
-        }
-        return count;
-    }
-
-    /**
-     * 获取目录大小
-     *
-     * @param dirPath 目录路径
-     * @return 文件大小
-     */
-    public static String getDirSize(String dirPath) {
-        return getDirSize(getFileByPath(dirPath));
-    }
-
-    /**
-     * 获取目录大小
-     *
-     * @param dir 目录
-     * @return 文件大小
-     */
-    public static String getDirSize(File dir) {
-        long len = getDirLength(dir);
-        return len == -1 ? "" : ConvertUtils.byte2FitMemorySize(len);
-    }
-
-    /**
-     * 获取文件大小
-     *
-     * @param filePath 文件路径
-     * @return 文件大小
-     */
-    public static String getFileSize(String filePath) {
-        return getFileSize(getFileByPath(filePath));
-    }
-
-    /**
-     * 获取文件大小
-     *
-     * @param file 文件
-     * @return 文件大小
-     */
-    public static String getFileSize(File file) {
-        long len = getFileLength(file);
-        return len == -1 ? "" : ConvertUtils.byte2FitMemorySize(len);
-    }
-
-    /**
-     * 获取目录长度
-     *
-     * @param dirPath 目录路径
-     * @return 文件大小
-     */
-    public static long getDirLength(String dirPath) {
-        return getDirLength(getFileByPath(dirPath));
-    }
-
-    /**
-     * 获取目录长度
-     *
-     * @param dir 目录
-     * @return 文件大小
-     */
-    public static long getDirLength(File dir) {
-        if (!isDir(dir)) return -1;
-        long len = 0;
-        File[] files = dir.listFiles();
-        if (files != null && files.length != 0) {
-            for (File file : files) {
-                if (file.isDirectory()) {
-                    len += getDirLength(file);
-                } else {
-                    len += file.length();
-                }
-            }
-        }
-        return len;
-    }
-
-    /**
-     * 获取文件长度
-     *
-     * @param filePath 文件路径
-     * @return 文件大小
-     */
-    public static long getFileLength(String filePath) {
-        return getFileLength(getFileByPath(filePath));
-    }
-
-    /**
-     * 获取文件长度
-     *
-     * @param file 文件
-     * @return 文件大小
-     */
-    public static long getFileLength(File file) {
-        if (!isFile(file)) return -1;
-        return file.length();
-    }
-
-    /**
-     * 获取文件的MD5校验码
-     *
-     * @param filePath 文件路径
-     * @return 文件的MD5校验码
-     */
-    public static String getFileMD5ToString(String filePath) {
-        File file = StringUtils.isSpace(filePath) ? null : new File(filePath);
-        return getFileMD5ToString(file);
-    }
-
-    /**
-     * 获取文件的MD5校验码
-     *
-     * @param filePath 文件路径
-     * @return 文件的MD5校验码
-     */
-    public static byte[] getFileMD5(String filePath) {
-        File file = StringUtils.isSpace(filePath) ? null : new File(filePath);
-        return getFileMD5(file);
-    }
-
-    /**
-     * 获取文件的MD5校验码
-     *
-     * @param file 文件
-     * @return 文件的MD5校验码
-     */
-    public static String getFileMD5ToString(File file) {
-        return ConvertUtils.bytes2HexString(getFileMD5(file));
-    }
-
-    /**
-     * 获取文件的MD5校验码
-     *
-     * @param file 文件
-     * @return 文件的MD5校验码
-     */
-    public static byte[] getFileMD5(File file) {
-        if (file == null) return null;
-        DigestInputStream dis = null;
-        try {
-            FileInputStream fis = new FileInputStream(file);
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            dis = new DigestInputStream(fis, md);
-            byte[] buffer = new byte[1024 * 256];
-            while (dis.read(buffer) > 0) ;
-            md = dis.getMessageDigest();
-            return md.digest();
-        } catch (NoSuchAlgorithmException | IOException e) {
-            e.printStackTrace();
-        } finally {
-            CloseUtils.closeIO(dis);
-        }
-        return null;
-    }
-
-    /**
-     * 获取全路径中的最长目录
-     *
-     * @param file 文件
-     * @return filePath最长目录
-     */
-    public static String getDirName(File file) {
-        if (file == null) return null;
-        return getDirName(file.getPath());
-    }
-
-    /**
-     * 获取全路径中的最长目录
-     *
-     * @param filePath 文件路径
-     * @return filePath最长目录
-     */
-    public static String getDirName(String filePath) {
-        if (StringUtils.isSpace(filePath)) return filePath;
-        int lastSep = filePath.lastIndexOf(File.separator);
-        return lastSep == -1 ? "" : filePath.substring(0, lastSep + 1);
-    }
-
-    /**
-     * 获取全路径中的文件名
-     *
-     * @param file 文件
-     * @return 文件名
-     */
-    public static String getFileName(File file) {
-        if (file == null) return null;
-        return getFileName(file.getPath());
-    }
-
-    /**
-     * 获取全路径中的文件名
-     *
-     * @param filePath 文件路径
-     * @return 文件名
-     */
-    public static String getFileName(String filePath) {
-        if (StringUtils.isSpace(filePath)) return filePath;
-        int lastSep = filePath.lastIndexOf(File.separator);
-        return lastSep == -1 ? filePath : filePath.substring(lastSep + 1);
-    }
-
-    /**
-     * 获取全路径中的不带拓展名的文件名
-     *
-     * @param file 文件
-     * @return 不带拓展名的文件名
-     */
-    public static String getFileNameNoExtension(File file) {
-        if (file == null) return null;
-        return getFileNameNoExtension(file.getPath());
-    }
-
-    /**
-     * 获取全路径中的不带拓展名的文件名
-     *
-     * @param filePath 文件路径
-     * @return 不带拓展名的文件名
-     */
-    public static String getFileNameNoExtension(String filePath) {
-        if (StringUtils.isSpace(filePath)) return filePath;
-        int lastPoi = filePath.lastIndexOf('.');
-        int lastSep = filePath.lastIndexOf(File.separator);
-        if (lastSep == -1) {
-            return (lastPoi == -1 ? filePath : filePath.substring(0, lastPoi));
-        }
-        if (lastPoi == -1 || lastSep > lastPoi) {
-            return filePath.substring(lastSep + 1);
-        }
-        return filePath.substring(lastSep + 1, lastPoi);
-    }
-
-    /**
-     * 获取全路径中的文件拓展名
-     *
-     * @param file 文件
-     * @return 文件拓展名
-     */
-    public static String getFileExtension(File file) {
-        if (file == null) return null;
-        return getFileExtension(file.getPath());
-    }
-
-    /**
-     * 获取全路径中的文件拓展名
-     *
-     * @param filePath 文件路径
-     * @return 文件拓展名
-     */
-    public static String getFileExtension(String filePath) {
-        if (StringUtils.isSpace(filePath)) return filePath;
-        int lastPoi = filePath.lastIndexOf('.');
-        int lastSep = filePath.lastIndexOf(File.separator);
-        if (lastPoi == -1 || lastSep >= lastPoi) return "";
-        return filePath.substring(lastPoi + 1);
-    }
-}

+ 0 - 130
ideahttp/src/main/java/com/zhpan/idea/utils/JsonHelper.java

@@ -1,130 +0,0 @@
-package com.zhpan.idea.utils;
-
-/**
- * Created by zhpan on 2017/5/27.
- * Description:Json Sting和Object相互转换工具类
- */
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-import org.json.JSONObject;
-import org.json.JSONTokener;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public class JsonHelper {
-    public JsonHelper() {
-    }
-
-    public static <T> T parserJson2Object(String json, Class<T> classOfT) {
-        T bean = null;
-        if (!"".equals(json) && classOfT != null) {
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-
-            try {
-                bean = gson.fromJson(json, classOfT);
-            } catch (Exception var6) {
-                bean = null;
-            }
-        }
-
-        return bean;
-    }
-
-    public static <T> String parserObject2Json(T entity) {
-        String result = "";
-        if (entity != null) {
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-
-            try {
-                result = gson.toJson(entity);
-            } catch (Exception var5) {
-
-            }
-        }
-
-        return result;
-    }
-
-    public static <T> ArrayList<T> parserJson2List(String json, Type typeOfT) {
-        ArrayList beans = null;
-        if (!"".equals(json) && typeOfT != null) {
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-
-            try {
-                beans = (ArrayList) gson.fromJson(json, typeOfT);
-            } catch (Exception var6) {
-                System.out.println("==================parserJson2List:Exception" + var6.toString());
-                beans = null;
-            }
-        }
-
-        return beans;
-    }
-
-    public static <T> HashMap<String, T> parserJson2Map(String json, Type typeOfT) {
-        HashMap beans = null;
-        if (!"".equals(json) && typeOfT != null) {
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-
-            try {
-                beans = (HashMap) gson.fromJson(json, typeOfT);
-            } catch (Exception var6) {
-                System.out.println("==================parserJson2Map:Exception" + var6.toString());
-                beans = null;
-            }
-        }
-
-        return beans;
-    }
-
-    public static <T> String parserList2Json(ArrayList<T> list, Type typeOfT) {
-        String result = "";
-        if (list != null && typeOfT != null) {
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-
-            try {
-                result = gson.toJson(list, typeOfT);
-            } catch (Exception var6) {
-
-            }
-        }
-
-        return result;
-    }
-
-    public static JSONObject getJSONObject(String json) {
-        JSONObject object = null;
-
-        try {
-            JSONTokener jsonParser = new JSONTokener(json.toString());
-            object = (JSONObject) jsonParser.nextValue();
-        } catch (Throwable var3) {
-
-        }
-
-        return object;
-    }
-
-    public static String getJSONValueByKey(String json, String key) {
-        String value = "";
-        JSONObject obj = getJSONObject(json);
-        if (obj != null) {
-            try {
-                value = obj.getString(key);
-            } catch (Throwable var5) {
-
-            }
-        }
-
-        return value;
-    }
-}

+ 0 - 62
ideahttp/src/main/java/com/zhpan/idea/utils/KeyTools.java

@@ -1,62 +0,0 @@
-package com.zhpan.idea.utils;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SignatureException;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-
-/**
- * Created by zhpan on 2017/10/20.
- * Description:
- */
-
-public class KeyTools {
-    private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1";
-    private static final String TAG = "KeyTools";
-
-    /**
-     * 获取MD5加密的之后的hex字符串
-     * @param info
-     * @return
-     */
-    public static String getMD5(String info) {
-        try {
-            MessageDigest md5 = MessageDigest.getInstance("MD5");
-            md5.update(info.getBytes());
-            byte[] encryption = md5.digest();
-            return DataConversionTools.bytesToHexString(encryption);
-        } catch (NoSuchAlgorithmException e) {
-            return "";
-        }
-    }
-
-    /**
-     * 获取HMAC-SHA1加密之后的hex字符串
-     * @param data
-     * @param key
-     * @return
-     * @throws SignatureException
-     */
-    public static String getHmacSHA1(String data, String key) throws SignatureException {
-        try {
-            // get an hmac_sha1 key from the raw key bytes
-            SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(),
-                    HMAC_SHA1_ALGORITHM);
-
-            // get an hmac_sha1 Mac instance and initialize with the signing key
-            Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
-            mac.init(signingKey);
-
-            // compute the hmac on input data bytes
-            byte[] rawHmac = mac.doFinal(data.getBytes());
-
-            return DataConversionTools.bytesToHexString(rawHmac);
-
-        } catch (Exception e) {
-            throw new SignatureException("Failed to generate HMAC : "
-                    + e.getMessage());
-        }
-    }
-}

+ 0 - 118
ideahttp/src/main/java/com/zhpan/idea/utils/LogUtils.java

@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2016 venshine.cn@gmail.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.zhpan.idea.utils;
-
-import android.util.Log;
-
-
-/**
- * Log日志打印操作
- *
- * @author Weiss
- */
-public class LogUtils {
-
-    private static final boolean DEBUG = true;
-
-    /**
-     * 获取当前类名
-     * @return
-     */
-    private static String getClassName() {
-        // 这里的数组的index,即2,是根据你工具类的层级取的值,可根据需求改变
-        StackTraceElement thisMethodStack = (new Exception()).getStackTrace()[2];
-        String result = thisMethodStack.getClassName();
-        int lastIndex = result.lastIndexOf(".");
-        result = result.substring(lastIndex + 1, result.length());
-        return result;
-    }
-
-
-    public static void w(String logString) {
-        if (DEBUG) {
-            Log.w(getClassName(), logString);
-        }
-    }
-
-    /**
-     * debug log
-     *
-     * @param msg
-     */
-    public static void d(String tag, String msg) {
-        if (DEBUG) {
-            Log.d(tag, msg);
-        }
-    }
-
-    /**
-     * error log
-     *
-     * @param msg
-     */
-    public static void e(String tag, String msg) {
-        if (DEBUG) {
-            Log.e(tag, msg);
-        }
-    }
-
-    /**
-     * debug log
-     *
-     * @param msg
-     */
-    public static void d(String msg) {
-        if (DEBUG) {
-            Log.d(getClassName(), msg);
-        }
-    }
-
-    /**
-     * debug log
-     *
-     * @param msg
-     */
-    public static void i(String msg) {
-        if (DEBUG) {
-            Log.i(getClassName(), msg);
-        }
-    }
-    /**
-     * error log
-     *
-     * @param msg
-     */
-    public static void e(String msg) {
-        if (DEBUG) {
-            Log.e(getClassName(), msg);
-        }
-    }
-
-    public static void i(String tag, String logString) {
-        if (DEBUG) {
-            Log.i(tag, logString);
-        }
-    }
-
-
-
-    public static void w(String tag, String logString) {
-        if (DEBUG) {
-            Log.w(tag, logString);
-        }
-    }
-
-}

+ 0 - 347
ideahttp/src/main/java/com/zhpan/idea/utils/NetworkUtils.java

@@ -1,347 +0,0 @@
-package com.zhpan.idea.utils;
-
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.wifi.WifiManager;
-import android.telephony.TelephonyManager;
-
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-/**
- * <pre>
- *     author: Blankj
- *     blog  : http://blankj.com
- *     time  : 2016/8/2
- *     desc  : 网络相关工具类
- * </pre>
- */
-public class NetworkUtils {
-
-    private NetworkUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    public enum NetworkType {
-        NETWORK_WIFI,
-        NETWORK_4G,
-        NETWORK_3G,
-        NETWORK_2G,
-        NETWORK_UNKNOWN,
-        NETWORK_NO
-    }
-
-    /**
-     * 打开网络设置界面
-     * <p>3.0以下打开设置界面</p>
-     */
-    public static void openWirelessSettings() {
-        if (android.os.Build.VERSION.SDK_INT > 10) {
-            Utils.getContext().startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
-        } else {
-            Utils.getContext().startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
-        }
-    }
-
-    /**
-     * 获取活动网络信息
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
-     *
-     * @return NetworkInfo
-     */
-    private static NetworkInfo getActiveNetworkInfo() {
-        ConnectivityManager cm = (ConnectivityManager) Utils.getContext()
-                .getSystemService(Context.CONNECTIVITY_SERVICE);
-        return cm.getActiveNetworkInfo();
-    }
-
-    /**
-     * 判断网络是否连接
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
-     *
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isConnected() {
-        NetworkInfo info = getActiveNetworkInfo();
-        return info != null && info.isConnected();
-    }
-
-    /**
-     * 判断网络是否可用
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
-     *
-     * @return {@code true}: 可用<br>{@code false}: 不可用
-     */
-    public static boolean isAvailableByPing() {
-        ShellUtils.CommandResult result = ShellUtils.execCmd("ping -c 1 -w 1 223.5.5.5", false);
-        boolean ret = result.result == 0;
-        if (result.errorMsg != null) {
-            LogUtils.d("isAvailableByPing errorMsg", result.errorMsg);
-        }
-        if (result.successMsg != null) {
-            LogUtils.d("isAvailableByPing successMsg", result.successMsg);
-        }
-        return ret;
-    }
-
-    /**
-     * 判断移动数据是否打开
-     *
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean getDataEnabled() {
-        try {
-            TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
-            Method getMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("getDataEnabled");
-            if (null != getMobileDataEnabledMethod) {
-                return (boolean) getMobileDataEnabledMethod.invoke(tm);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return false;
-    }
-
-    /**
-     * 打开或关闭移动数据
-     * <p>需系统应用 需添加权限{@code <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>}</p>
-     *
-     * @param enabled {@code true}: 打开<br>{@code false}: 关闭
-     */
-    public static void setDataEnabled(boolean enabled) {
-        try {
-            TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
-            Method setMobileDataEnabledMethod = tm.getClass().getDeclaredMethod("setDataEnabled", boolean.class);
-            if (null != setMobileDataEnabledMethod) {
-                setMobileDataEnabledMethod.invoke(tm, enabled);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 判断网络是否是4G
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
-     *
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean is4G() {
-        NetworkInfo info = getActiveNetworkInfo();
-        return info != null && info.isAvailable() && info.getSubtype() == TelephonyManager.NETWORK_TYPE_LTE;
-    }
-
-    /**
-     * 判断wifi是否打开
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>}</p>
-     *
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean getWifiEnabled() {
-        WifiManager wifiManager = (WifiManager) Utils.getContext().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
-        return wifiManager.isWifiEnabled();
-    }
-
-    /**
-     * 打开或关闭wifi
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>}</p>
-     *
-     * @param enabled {@code true}: 打开<br>{@code false}: 关闭
-     */
-    public static void setWifiEnabled( boolean enabled) {
-        WifiManager wifiManager = (WifiManager)Utils.getContext().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
-        if (enabled) {
-            if (!wifiManager.isWifiEnabled()) {
-                wifiManager.setWifiEnabled(true);
-            }
-        } else {
-            if (wifiManager.isWifiEnabled()) {
-                wifiManager.setWifiEnabled(false);
-            }
-        }
-    }
-
-    /**
-     * 判断wifi是否连接状态
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
-     *
-     * @return {@code true}: 连接<br>{@code false}: 未连接
-     */
-    public static boolean isWifiConnected() {
-        ConnectivityManager cm = (ConnectivityManager) Utils.getContext()
-                .getSystemService(Context.CONNECTIVITY_SERVICE);
-        return cm != null && cm.getActiveNetworkInfo() != null
-                && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
-    }
-
-    /**
-     * 判断wifi数据是否可用
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>}</p>
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
-     *
-     * @return {@code true}: 是<br>{@code false}: 否
-     */
-    public static boolean isWifiAvailable() {
-        return getWifiEnabled() && isAvailableByPing();
-    }
-
-    /**
-     * 获取网络运营商名称
-     * <p>中国移动、如中国联通、中国电信</p>
-     *
-     * @return 运营商名称
-     */
-    public static String getNetworkOperatorName() {
-        TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
-        return tm != null ? tm.getNetworkOperatorName() : null;
-    }
-
-    private static final int NETWORK_TYPE_GSM      = 16;
-    private static final int NETWORK_TYPE_TD_SCDMA = 17;
-    private static final int NETWORK_TYPE_IWLAN    = 18;
-
-    /**
-     * 获取当前网络类型
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
-     *
-     * @return 网络类型
-     * <ul>
-     * <li>{@link NetworkType#NETWORK_WIFI   } </li>
-     * <li>{@link NetworkType#NETWORK_4G     } </li>
-     * <li>{@link NetworkType#NETWORK_3G     } </li>
-     * <li>{@link NetworkType#NETWORK_2G     } </li>
-     * <li>{@link NetworkType#NETWORK_UNKNOWN} </li>
-     * <li>{@link NetworkType#NETWORK_NO     } </li>
-     * </ul>
-     */
-    public static NetworkType getNetworkType() {
-        NetworkType netType = NetworkType.NETWORK_NO;
-        NetworkInfo info = getActiveNetworkInfo();
-        if (info != null && info.isAvailable()) {
-
-            if (info.getType() == ConnectivityManager.TYPE_WIFI) {
-                netType = NetworkType.NETWORK_WIFI;
-            } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
-                switch (info.getSubtype()) {
-
-                    case NETWORK_TYPE_GSM:
-                    case TelephonyManager.NETWORK_TYPE_GPRS:
-                    case TelephonyManager.NETWORK_TYPE_CDMA:
-                    case TelephonyManager.NETWORK_TYPE_EDGE:
-                    case TelephonyManager.NETWORK_TYPE_1xRTT:
-                    case TelephonyManager.NETWORK_TYPE_IDEN:
-                        netType = NetworkType.NETWORK_2G;
-                        break;
-
-                    case NETWORK_TYPE_TD_SCDMA:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_A:
-                    case TelephonyManager.NETWORK_TYPE_UMTS:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_0:
-                    case TelephonyManager.NETWORK_TYPE_HSDPA:
-                    case TelephonyManager.NETWORK_TYPE_HSUPA:
-                    case TelephonyManager.NETWORK_TYPE_HSPA:
-                    case TelephonyManager.NETWORK_TYPE_EVDO_B:
-                    case TelephonyManager.NETWORK_TYPE_EHRPD:
-                    case TelephonyManager.NETWORK_TYPE_HSPAP:
-                        netType = NetworkType.NETWORK_3G;
-                        break;
-
-                    case NETWORK_TYPE_IWLAN:
-                    case TelephonyManager.NETWORK_TYPE_LTE:
-                        netType = NetworkType.NETWORK_4G;
-                        break;
-                    default:
-
-                        String subtypeName = info.getSubtypeName();
-                        if (subtypeName.equalsIgnoreCase("TD-SCDMA")
-                                || subtypeName.equalsIgnoreCase("WCDMA")
-                                || subtypeName.equalsIgnoreCase("CDMA2000")) {
-                            netType = NetworkType.NETWORK_3G;
-                        } else {
-                            netType = NetworkType.NETWORK_UNKNOWN;
-                        }
-                        break;
-                }
-            } else {
-                netType = NetworkType.NETWORK_UNKNOWN;
-            }
-        }
-        return netType;
-    }
-
-    /**
-     * 获取IP地址
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
-     *
-     * @param useIPv4 是否用IPv4
-     * @return IP地址
-     */
-    public static String getIPAddress(boolean useIPv4) {
-        try {
-            for (Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces(); nis.hasMoreElements(); ) {
-                NetworkInterface ni = nis.nextElement();
-                // 防止小米手机返回10.0.2.15
-                if (!ni.isUp()) continue;
-                for (Enumeration<InetAddress> addresses = ni.getInetAddresses(); addresses.hasMoreElements(); ) {
-                    InetAddress inetAddress = addresses.nextElement();
-                    if (!inetAddress.isLoopbackAddress()) {
-                        String hostAddress = inetAddress.getHostAddress();
-                        boolean isIPv4 = hostAddress.indexOf(':') < 0;
-                        if (useIPv4) {
-                            if (isIPv4) return hostAddress;
-                        } else {
-                            if (!isIPv4) {
-                                int index = hostAddress.indexOf('%');
-                                return index < 0 ? hostAddress.toUpperCase() : hostAddress.substring(0, index).toUpperCase();
-                            }
-                        }
-                    }
-                }
-            }
-        } catch (SocketException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    /**
-     * 获取域名ip地址
-     * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
-     *
-     * @param domain 域名
-     * @return ip地址
-     */
-    public static String getDomainAddress(final String domain) {
-        try {
-            ExecutorService exec = Executors.newCachedThreadPool();
-            Future<String> fs = exec.submit(new Callable<String>() {
-                @Override
-                public String call() throws Exception {
-                    InetAddress inetAddress;
-                    try {
-                        inetAddress = InetAddress.getByName(domain);
-                        return inetAddress.getHostAddress();
-                    } catch (UnknownHostException e) {
-                        e.printStackTrace();
-                    }
-                    return null;
-                }
-            });
-            return fs.get();
-        } catch (InterruptedException | ExecutionException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-}

+ 0 - 216
ideahttp/src/main/java/com/zhpan/idea/utils/SharedPreferencesHelper.java

@@ -1,216 +0,0 @@
-package com.zhpan.idea.utils;
-
-/**
- * Created by zhpan on 2017/5/25.
- * Description:处理SP缓存、支持存入基本数据类型以及对象
- */
-
-import android.content.Context;
-import android.content.SharedPreferences;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-public class SharedPreferencesHelper {
-
-    /**
-     * 保存在手机里面的文件名
-     */
-    public static final String FILE_NAME = Utils.getContext().getPackageName();
-
-    /**
-     * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
-     *
-     * @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;
-    }
-
-    public static <T> void saveObject(Context context, T bean) {
-        if (context != null && bean != null) {
-            SharedPreferences share = context.getSharedPreferences(FILE_NAME, 0);
-            GsonBuilder gsonb = new GsonBuilder();
-            Gson gson = gsonb.create();
-            String json = gson.toJson(bean);
-            String className = bean.getClass().getSimpleName();
-            SharedPreferences.Editor editor = share.edit();
-            editor.putString(className, json);
-            editor.apply();
-        }
-    }
-
-    public static <T> void removeObject(Context context,Class bean){
-        String className=bean.getSimpleName();
-        remove(context,className);
-    }
-
-    public static <T> T getObject(Context context, Class<T> classOfT) {
-        T user = null;
-        if (context != null && classOfT != null) {
-            String json = getObjectJson(context, classOfT);
-            user = JsonHelper.parserJson2Object(json, classOfT);
-        }
-
-        return user;
-    }
-
-    public static <T> String getObjectJson(Context context, Class<T> classOfT) {
-        String json = "";
-        if (context != null && classOfT != null) {
-            SharedPreferences share = context.getSharedPreferences(FILE_NAME, 0);
-            String name = classOfT.getSimpleName();
-            json = share.getString(name, "");
-        }
-        return json;
-    }
-
-    /**
-     * 移除某个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().apply();
-        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();
-        }
-    }
-
-}

+ 0 - 161
ideahttp/src/main/java/com/zhpan/idea/utils/ShellUtils.java

@@ -1,161 +0,0 @@
-package com.zhpan.idea.utils;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-
-/**
- * <pre>
- *     author: Blankj
- *     blog  : http://blankj.com
- *     time  : 2016/8/7
- *     desc  : Shell相关工具类
- * </pre>
- */
-public class ShellUtils {
-
-    private ShellUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param command 命令
-     * @param isRoot  是否需要root权限执行
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(String command, boolean isRoot) {
-        return execCmd(new String[]{command}, isRoot, true);
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param commands 多条命令链表
-     * @param isRoot   是否需要root权限执行
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(List<String> commands, boolean isRoot) {
-        return execCmd(commands == null ? null : commands.toArray(new String[]{}), isRoot, true);
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param commands 多条命令数组
-     * @param isRoot   是否需要root权限执行
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(String[] commands, boolean isRoot) {
-        return execCmd(commands, isRoot, true);
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param command         命令
-     * @param isRoot          是否需要root权限执行
-     * @param isNeedResultMsg 是否需要结果消息
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(String command, boolean isRoot, boolean isNeedResultMsg) {
-        return execCmd(new String[]{command}, isRoot, isNeedResultMsg);
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param commands        命令链表
-     * @param isRoot          是否需要root权限执行
-     * @param isNeedResultMsg 是否需要结果消息
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
-        return execCmd(commands == null ? null : commands.toArray(new String[]{}), isRoot, isNeedResultMsg);
-    }
-
-    /**
-     * 是否是在root下执行命令
-     *
-     * @param commands        命令数组
-     * @param isRoot          是否需要root权限执行
-     * @param isNeedResultMsg 是否需要结果消息
-     * @return CommandResult
-     */
-    public static CommandResult execCmd(String[] commands, boolean isRoot, boolean isNeedResultMsg) {
-        int result = -1;
-        if (commands == null || commands.length == 0) {
-            return new CommandResult(result, null, null);
-        }
-        Process process = null;
-        BufferedReader successResult = null;
-        BufferedReader errorResult = null;
-        StringBuilder successMsg = null;
-        StringBuilder errorMsg = null;
-        DataOutputStream os = null;
-        try {
-            process = Runtime.getRuntime().exec(isRoot ? "su" : "sh");
-            os = new DataOutputStream(process.getOutputStream());
-            for (String command : commands) {
-                if (command == null) continue;
-                os.write(command.getBytes());
-                os.writeBytes("\n");
-                os.flush();
-            }
-            os.writeBytes("exit\n");
-            os.flush();
-            result = process.waitFor();
-            if (isNeedResultMsg) {
-                successMsg = new StringBuilder();
-                errorMsg = new StringBuilder();
-                successResult = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8"));
-                errorResult = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
-                String s;
-                while ((s = successResult.readLine()) != null) {
-                    successMsg.append(s);
-                }
-                while ((s = errorResult.readLine()) != null) {
-                    errorMsg.append(s);
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            CloseUtils.closeIO(os, successResult, errorResult);
-            if (process != null) {
-                process.destroy();
-            }
-        }
-        return new CommandResult(
-                result,
-                successMsg == null ? null : successMsg.toString(),
-                errorMsg == null ? null : errorMsg.toString()
-        );
-    }
-
-    /**
-     * 返回的命令结果
-     */
-    public static class CommandResult {
-        /**
-         * 结果码
-         **/
-        public int    result;
-        /**
-         * 成功信息
-         **/
-        public String successMsg;
-        /**
-         * 错误信息
-         **/
-        public String errorMsg;
-
-        public CommandResult(int result, String successMsg, String errorMsg) {
-            this.result = result;
-            this.successMsg = successMsg;
-            this.errorMsg = errorMsg;
-        }
-    }
-}

+ 0 - 174
ideahttp/src/main/java/com/zhpan/idea/utils/StringUtils.java

@@ -1,174 +0,0 @@
-package com.zhpan.idea.utils;
-
-/**
- * <pre>
- *     author: Blankj
- *     blog  : http://blankj.com
- *     time  : 2016/8/16
- *     desc  : 字符串相关工具类
- * </pre>
- */
-public class StringUtils {
-
-    private StringUtils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * 判断字符串是否为null或长度为0
-     *
-     * @param s 待校验字符串
-     * @return {@code true}: 空<br> {@code false}: 不为空
-     */
-    public static boolean isEmpty(CharSequence s) {
-        return s == null || s.length() == 0;
-    }
-
-    /**
-     * 判断字符串是否为null或全为空格
-     *
-     * @param s 待校验字符串
-     * @return {@code true}: null或全空格<br> {@code false}: 不为null且不全空格
-     */
-    public static boolean isSpace(String s) {
-        return (s == null || s.trim().length() == 0);
-    }
-
-    /**
-     * 判断两字符串是否相等
-     *
-     * @param a 待校验字符串a
-     * @param b 待校验字符串b
-     * @return {@code true}: 相等<br>{@code false}: 不相等
-     */
-    public static boolean equals(CharSequence a, CharSequence b) {
-        if (a == b) return true;
-        int length;
-        if (a != null && b != null && (length = a.length()) == b.length()) {
-            if (a instanceof String && b instanceof String) {
-                return a.equals(b);
-            } else {
-                for (int i = 0; i < length; i++) {
-                    if (a.charAt(i) != b.charAt(i)) return false;
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 判断两字符串忽略大小写是否相等
-     *
-     * @param a 待校验字符串a
-     * @param b 待校验字符串b
-     * @return {@code true}: 相等<br>{@code false}: 不相等
-     */
-    public static boolean equalsIgnoreCase(String a, String b) {
-        return (a == b) || (b != null) && (a.length() == b.length()) && a.regionMatches(true, 0, b, 0, b.length());
-    }
-
-    /**
-     * null转为长度为0的字符串
-     *
-     * @param s 待转字符串
-     * @return s为null转为长度为0字符串,否则不改变
-     */
-    public static String null2Length0(String s) {
-        return s == null ? "" : s;
-    }
-
-    /**
-     * 返回字符串长度
-     *
-     * @param s 字符串
-     * @return null返回0,其他返回自身长度
-     */
-    public static int length(CharSequence s) {
-        return s == null ? 0 : s.length();
-    }
-
-    /**
-     * 首字母大写
-     *
-     * @param s 待转字符串
-     * @return 首字母大写字符串
-     */
-    public static String upperFirstLetter(String s) {
-        if (isEmpty(s) || !Character.isLowerCase(s.charAt(0))) return s;
-        return String.valueOf((char) (s.charAt(0) - 32)) + s.substring(1);
-    }
-
-    /**
-     * 首字母小写
-     *
-     * @param s 待转字符串
-     * @return 首字母小写字符串
-     */
-    public static String lowerFirstLetter(String s) {
-        if (isEmpty(s) || !Character.isUpperCase(s.charAt(0))) return s;
-        return String.valueOf((char) (s.charAt(0) + 32)) + s.substring(1);
-    }
-
-    /**
-     * 反转字符串
-     *
-     * @param s 待反转字符串
-     * @return 反转字符串
-     */
-    public static String reverse(String s) {
-        int len = length(s);
-        if (len <= 1) return s;
-        int mid = len >> 1;
-        char[] chars = s.toCharArray();
-        char c;
-        for (int i = 0; i < mid; ++i) {
-            c = chars[i];
-            chars[i] = chars[len - i - 1];
-            chars[len - i - 1] = c;
-        }
-        return new String(chars);
-    }
-
-    /**
-     * 转化为半角字符
-     *
-     * @param s 待转字符串
-     * @return 半角字符串
-     */
-    public static String toDBC(String s) {
-        if (isEmpty(s)) return s;
-        char[] chars = s.toCharArray();
-        for (int i = 0, len = chars.length; i < len; i++) {
-            if (chars[i] == 12288) {
-                chars[i] = ' ';
-            } else if (65281 <= chars[i] && chars[i] <= 65374) {
-                chars[i] = (char) (chars[i] - 65248);
-            } else {
-                chars[i] = chars[i];
-            }
-        }
-        return new String(chars);
-    }
-
-    /**
-     * 转化为全角字符
-     *
-     * @param s 待转字符串
-     * @return 全角字符串
-     */
-    public static String toSBC(String s) {
-        if (isEmpty(s)) return s;
-        char[] chars = s.toCharArray();
-        for (int i = 0, len = chars.length; i < len; i++) {
-            if (chars[i] == ' ') {
-                chars[i] = (char) 12288;
-            } else if (33 <= chars[i] && chars[i] <= 126) {
-                chars[i] = (char) (chars[i] + 65248);
-            } else {
-                chars[i] = chars[i];
-            }
-        }
-        return new String(chars);
-    }
-}

+ 0 - 63
ideahttp/src/main/java/com/zhpan/idea/utils/ToastUtils.java

@@ -1,63 +0,0 @@
-package com.zhpan.idea.utils;
-
-import android.content.Context;
-import android.text.TextUtils;
-import android.widget.Toast;
-
-
-/**
- * ToastUtils
- */
-
-public class ToastUtils {
-
-    private static Context context = Utils.getContext();
-    private static Toast toast;
-
-    public static void show(int resId) {
-        show(context.getResources().getText(resId), Toast.LENGTH_SHORT);
-    }
-
-    public static void show(int resId, int duration) {
-        show(context.getResources().getText(resId), duration);
-    }
-
-    public static void show(CharSequence text) {
-        show(text, Toast.LENGTH_SHORT);
-    }
-
-    /*public static void showDebug(CharSequence text) {
-        if (BuildConfig.DEBUG) {
-            show(text, Toast.LENGTH_SHORT);
-        }
-    }*/
-
-    public static void show(CharSequence text, int duration) {
-        text = TextUtils.isEmpty(text == null ? "" : text.toString()) ? "请检查您的网络!"
-                : text;
-        if (toast == null) {
-            toast = Toast.makeText(context, text, duration);
-        } else {
-            toast.setText(text);
-        }
-        toast.show();
-    }
-
-    public static void show(int resId, Object... args) {
-        show(String.format(context.getResources().getString(resId), args),
-                Toast.LENGTH_SHORT);
-    }
-
-    public static void show(String format, Object... args) {
-        show(String.format(format, args), Toast.LENGTH_SHORT);
-    }
-
-    public static void show(int resId, int duration, Object... args) {
-        show(String.format(context.getResources().getString(resId), args),
-                duration);
-    }
-
-    public static void show(String format, int duration, Object... args) {
-        show(String.format(format, args), duration);
-    }
-}

+ 0 - 43
ideahttp/src/main/java/com/zhpan/idea/utils/Utils.java

@@ -1,43 +0,0 @@
-package com.zhpan.idea.utils;
-
-import android.content.Context;
-
-import androidx.annotation.NonNull;
-
-/**
- * <pre>
- *     author: Blankj
- *     blog  : http://blankj.com
- *     time  : 16/12/08
- *     desc  : Utils初始化相关
- * </pre>
- */
-public class Utils {
-
-    private static Context context;
-
-    private Utils() {
-        throw new UnsupportedOperationException("u can't instantiate me...");
-    }
-
-    /**
-     * 初始化工具类
-     *
-     * @param context 上下文
-     */
-    public static void init(Context context) {
-        Utils.context = context.getApplicationContext();
-    }
-
-    /**
-     * 获取ApplicationContext
-     *
-     * @return ApplicationContext
-     */
-    public static Context getContext() {
-        if (context != null) return context;
-        throw new NullPointerException("u should init first");
-    }
-
-
-}

+ 0 - 6
ideahttp/src/main/res/values/dimens.xml

@@ -1,6 +0,0 @@
-<resources>
-    <!-- Default screen margins, per the Android Design guidelines. -->
-    <dimen name="activity_horizontal_margin">16dp</dimen>
-    <dimen name="activity_vertical_margin">16dp</dimen>
-    <dimen name="fab_margin">16dp</dimen>
-</resources>

+ 0 - 21
ideahttp/src/main/res/values/strings.xml

@@ -1,21 +0,0 @@
-<resources>
-    <string name="app_name">Retrofit</string>
-    <string name="title_activity_base_rx">BaseRxActivity</string>
-
-    <string name="connect_error">网络连接失败,请检查网络</string>
-    <string name="connect_timeout">连接超时,请稍后再试</string>
-    <string name="bad_network">服务器异常</string>
-    <string name="parse_error">解析服务器响应数据失败</string>
-    <string name="unknown_error">未知错误</string>
-    <string name="response_return_error">服务器返回数据失败</string>
-
-    <string name="request_error">Failed to request server,error code:</string>
-    <string name="parameters_exception">Parameter exception</string>
-    <string name="verify_code_error">输入验证码有误</string>
-    <string name="verify_code_expired">验证码已过期</string>
-    <string name="not_register">该账户还未注册</string>
-    <string name="wrong_pwd_username">用户名或密码错误</string>
-    <string name="user_registered">该账户已存在</string>
-    <string name="wrong_password">密码错误</string>
-    <string name="remote_login">您的账号已在其它设备上登录,如非本人操作,请及时修改密码!</string>
-</resources>

+ 0 - 31
ideahttp/src/main/res/values/styles.xml

@@ -1,31 +0,0 @@
-<resources>
-
-
-    <style name="ProgressDialog" parent="@android:style/Theme.Dialog">
-        <item name="android:windowFrame">@null</item>
-        <item name="android:windowIsFloating">true</item>
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
-        <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
-    </style>
-    <!--Progress 主题-->
-    <style name="ProgressDialogStyle" parent="@style/ProgressDialog">
-        <item name="android:windowBackground">@android:color/transparent</item>
-        <item name="android:windowNoTitle">true</item>
-    </style>
-
-    <!--自定义dialog背景全透明无边框theme -->
-    <style name="SrcbDialog" parent="android:style/Theme.Dialog">
-    <!--背景颜色及和透明程度-->
-    <item name="android:windowBackground">@android:color/transparent</item>
-    <!--是否去除标题 -->
-    <item name="android:windowNoTitle">true</item>
-    <!--是否去除边框-->
-    <item name="android:windowFrame">@null</item>
-    <!--是否浮现在activity之上-->
-    <item name="android:windowIsFloating">true</item>
-    <!--是否模糊-->
-    <item name="android:backgroundDimEnabled">false</item>
-    </style>
-
-</resources>

+ 0 - 17
ideahttp/src/test/java/com/zhpan/idea/ExampleUnitTest.java

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

+ 1 - 1
settings.gradle

@@ -1,3 +1,3 @@
-include ':app', ':bannerview', ':ideahttp'
+include ':app', ':bannerview'
 //include "indicator"
 //include "indicator"
 //project(':indicator').projectDir = file('../viewpagerindicator/indicator')
 //project(':indicator').projectDir = file('../viewpagerindicator/indicator')