• Android简易音乐重构MVVM Java版 -搭建项目(八)


    关于

      本篇主要介绍,简易音乐重构,去掉butterkinfe,去掉mvp,精简代码优化逻辑,使用viewbinding和databinding,升级项目版本工程版本,升级引用等等,但是最终我还是没有使用kotlin去重构这个项目,我是很想用kotlin写的,不管是出于个人目前对kotlin的热爱还是google对kotlin的支持,但是看起来目前对我这个moudle感兴趣的人用java的多点,所以这个项目目前还是用java去写,废话到此结束。
      项目框架MVVM+Retrofit+RxJava+LiveData+viewbinding+databing+other

    新版本配置

      Android studio 2021.2.1 Patch 1截至2022.6.14来说是稳定版的最新版
    在这里插入图片描述
      工程gradle是7.2.1,gradle-wrapper.properties里的gradle是7.3.3:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '7.2.1' apply false
        id 'com.android.library' version '7.2.1' apply false
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    #Sat Jun 11 00:50:53 CST 2022
    distributionBase=GRADLE_USER_HOME
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
    distributionPath=wrapper/dists
    zipStorePath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    在这里插入图片描述
      很多朋友可能会好奇三分的maven仓库啊jitpack库啊跑哪里去了,都跑到settings.gradle里面了:
    在这里插入图片描述
      这也是很大一个变动。
      项目目标版本32,最低支持22
      接下来是moudle里面的build的变化,:

    android {
        compileSdk 32
    
        defaultConfig {
            applicationId "com.tobery.personalmusic"
            minSdk 22
            targetSdk 32
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
    
        dataBinding{
            enabled true
        }
        viewBinding{
            enabled true
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32

      三方引用如下:

    dependencies {
    
       implementation 'androidx.appcompat:appcompat:1.3.0'
        implementation 'com.google.android.material:material:1.4.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    
        // ViewModel
        implementation "androidx.lifecycle:lifecycle-viewmodel:2.4.0"
        implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0"
        //glide引用
        implementation 'com.github.bumptech.glide:glide:4.11.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
        //网络请求retrofit
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
        //RxJava
        implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
        //RxAndroid
        implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
        //Retrofit 支持Rxjava 的支持库
        implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
        //rxjava框架
        implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.1.0'
        implementation 'com.google.code.gson:gson:2.8.6'
        implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
        //音频
        implementation 'com.github.EspoirX:StarrySky:v2.6.5'
        // MultiDex的依赖
        implementation 'androidx.multidex:multidex:2.0.0'
        // Log、吐司打印
        implementation 'com.github.getActivity:ToastUtils:10.3'
        implementation 'com.github.Tobeyr1:DialogLoading:1.0.4'
    
        //banner
        implementation 'io.github.youth5201314:banner:2.2.2'
        implementation "androidx.viewpager2:viewpager2:1.0.0"
        implementation 'com.github.Tobeyr1:liveDataCallAdapter:1.0.2'
    
        testImplementation 'junit:junit:4.13.2'
        androidTestImplementation 'androidx.test.ext:junit:1.1.3'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41

      目前的引用就这么多,后续也会有加减。

    网易云音乐api版本更新

      api当然不是我做的了,我只是个使用者,GitHub地址,当然了,项目里也提供了可供使用的api网址

    重构代码

      (说明)其实项目是重新建的项目,然后对部分copy,大多数重新编写。

    新建app类继承Application

    public class app extends Application {
    
        private final CountDownLatch mCountDownLatch = new CountDownLatch(1);
    
        private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
    
        private static final int CORE_POOL_SIZE = Math.max(2,Math.min(CPU_COUNT-1,4));
    
        private static app instance;
    
        @Override
        public void onCreate() {
            super.onCreate();
            instance = this;
            ToastUtils.init(this, new BlackToastStyle());
            CrashHandler.getInstance().init(this);
            ExecutorService pool = Executors.newFixedThreadPool(CORE_POOL_SIZE);
            pool.submit(new Runnable() {
                @Override
                public void run() {
                    MultiDex.install(instance);
                    mCountDownLatch.countDown();
                }
            });
            pool.submit(new Runnable() {
                @Override
                public void run() {
                    StarrySky.init(instance).apply();
    
                }
            });
            try {
                //如果await之前没有调用countDown那么就会一直阻塞在这里
                mCountDownLatch.await();
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    项目结构

    在这里插入图片描述

      entity文件存放实体类,http则是网络请求的类api等,ui页面viewModel等,util则是一些帮助类等,widget存放的自定义view,暂时这样。

    定义BaseActivity.java

    public abstract class BaseActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //状态栏工具
            StatusBarUtil.setColor(this,getResources().getColor(R.color.colorPrimary),0);
        }
    
        @Override
        protected void onPause() {
            super.onPause();
    
        }
        @Override
        protected void onDestroy() {
            System.gc();
            super.onDestroy();
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    状态栏工具

    /**
     * 2019年7月18日13:55:00
     * 沉浸式管理工具类
     */
    public class StatusBarUtil {
        public static final String TAG = "StatusBarUtil";
        private static final int DEFAULT_STATUS_BAR_ALPHA = 112;
        private static final int FAKE_STATUS_BAR_VIEW_ID = R.id.statusbarutil_fake_status_bar_view;
        private static final int FAKE_TRANSLUCENT_VIEW_ID = R.id.statusbarutil_translucent_view;
        private static final int TAG_KEY_HAVE_SET_OFFSET = -123;
    
        /**
         * 设置状态栏颜色
         *
         * @param activity 需要设置的 activity
         * @param color    状态栏颜色值
         */
        public static void setColor(Activity activity, @ColorInt int color) {
            setColor(activity, color, DEFAULT_STATUS_BAR_ALPHA);
        }
    
        /**
         * 设置状态栏颜色
         * API等级19:Android 4.4 KitKat   API等级20:Android 4.4W   API等级21:Android 5.0 Lollipop
         * API等级22:Android 5.1 Lollipop  API等级23:Android 6.0 Marshmallow   API等级24:Android 7.0 Nougat
         *
         * @param activity       需要设置的activity
         * @param color          状态栏颜色值
         * @param statusBarAlpha 状态栏透明度
         */
        @SuppressLint("ObsoleteSdkInt")
        public static void setColor(Activity activity, @ColorInt int color, @IntRange(from = 0, to = 255) int statusBarAlpha) {
            //21以上
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                activity.getWindow().setStatusBarColor(calculateStatusColor(color, statusBarAlpha));
                //19到21
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                //DecorView是顶级View,内部有titlebar和contentParent两个子元素,
                // contentParent的id是content,而我们设置的main.xml布局则是contentParent里面的一个子元素
                ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
                View fakeStatusBarView = decorView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
                if (fakeStatusBarView != null) {
                    if (fakeStatusBarView.getVisibility() == View.GONE) {
                        fakeStatusBarView.setVisibility(View.VISIBLE);
                    }
                    fakeStatusBarView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
                } else {
                    //第一次加载会先创建并添加
                    decorView.addView(createStatusBarView(activity, color, statusBarAlpha));
                }
                setRootView(activity);
            }
        }
    
        /**
         * 为滑动返回界面设置状态栏颜色
         *
         * @param activity 需要设置的activity
         * @param color    状态栏颜色值
         */
        public static void setColorForSwipeBack(Activity activity, int color) {
            setColorForSwipeBack(activity, color, DEFAULT_STATUS_BAR_ALPHA);
        }
    
        /**
         * 为滑动返回界面设置状态栏颜色
         *
         * @param activity       需要设置的activity
         * @param color          状态栏颜色值
         * @param statusBarAlpha 状态栏透明度
         */
        public static void setColorForSwipeBack(Activity activity, @ColorInt int color,
                                                @IntRange(from = 0, to = 255) int statusBarAlpha) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                ViewGroup contentView = ((ViewGroup) activity.findViewById(android.R.id.content));
                View rootView = contentView.getChildAt(0);
                int statusBarHeight = getStatusBarHeight(activity);
                if (rootView instanceof CoordinatorLayout) {
                    final CoordinatorLayout coordinatorLayout = (CoordinatorLayout) rootView;
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                        coordinatorLayout.setFitsSystemWindows(false);
                        contentView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
                        boolean isNeedRequestLayout = contentView.getPaddingTop() < statusBarHeight;
                        if (isNeedRequestLayout) {
                            contentView.setPadding(0, statusBarHeight, 0, 0);
                            coordinatorLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    coordinatorLayout.requestLayout();
                                }
                            });
                        }
                    } else {
                        coordinatorLayout.setStatusBarBackgroundColor(calculateStatusColor(color, statusBarAlpha));
                    }
                } else {
                    contentView.setPadding(0, statusBarHeight, 0, 0);
                    contentView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
                }
                setTransparentForWindow(activity);
            }
        }
    
        /**
         * 设置状态栏纯色 不加半透明效果
         *
         * @param activity 需要设置的 activity
         * @param color    状态栏颜色值
         */
        public static void setColorNoTranslucent(Activity activity, @ColorInt int color) {
            setColor(activity, color, 0);
        }
    
        /**
         * 设置状态栏颜色(5.0以下无半透明效果,不建议使用)
         *
         * @param activity 需要设置的 activity
         * @param color    状态栏颜色值
         */
        @Deprecated
        public static void setColorDiff(Activity activity, @ColorInt int color) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            transparentStatusBar(activity);
            ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
            // 移除半透明矩形,以免叠加
            View fakeStatusBarView = contentView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
            if (fakeStatusBarView != null) {
                if (fakeStatusBarView.getVisibility() == View.GONE) {
                    fakeStatusBarView.setVisibility(View.VISIBLE);
                }
                fakeStatusBarView.setBackgroundColor(color);
            } else {
                contentView.addView(createStatusBarView(activity, color));
            }
            setRootView(activity);
        }
    
        /**
         * 使状态栏半透明
         * 适用于图片作为背景的界面,此时需要图片填充到状态栏
         *
         * @param activity 需要设置的activity
         */
        public static void setTranslucent(Activity activity) {
            setTranslucent(activity, DEFAULT_STATUS_BAR_ALPHA);
        }
    
        /**
         * 使状态栏半透明
         * 适用于图片作为背景的界面,此时需要图片填充到状态栏
         *
         * @param activity       需要设置的activity
         * @param statusBarAlpha 状态栏透明度
         */
        public static void setTranslucent(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            setTransparent(activity);
            addTranslucentView(activity, statusBarAlpha);
        }
    
        /**
         * 针对根布局是 CoordinatorLayout, 使状态栏半透明
         * 适用于图片作为背景的界面,此时需要图片填充到状态栏
         *
         * @param activity       需要设置的activity
         * @param statusBarAlpha 状态栏透明度
         */
        public static void setTranslucentForCoordinatorLayout(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            transparentStatusBar(activity);
            addTranslucentView(activity, statusBarAlpha);
        }
    
        /**
         * 设置状态栏全透明
         * @param activity 需要设置的activity
         */
        public static void setTransparent(Activity activity) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            transparentStatusBar(activity);
            setRootView(activity);
        }
    
        /**
         * 使状态栏透明(5.0以上半透明效果,不建议使用)
         * 适用于图片作为背景的界面,此时需要图片填充到状态栏
         * @param activity 需要设置的activity
         */
        @Deprecated
        public static void setTranslucentDiff(Activity activity) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                // 设置状态栏透明
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                setRootView(activity);
            }
        }
    
        /**
         * 为DrawerLayout 布局设置状态栏变色
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         * @param color        状态栏颜色值
         */
        public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
            setColorForDrawerLayout(activity, drawerLayout, color, DEFAULT_STATUS_BAR_ALPHA);
        }
    
        /**
         * 为DrawerLayout 布局设置状态栏颜色,纯色
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         * @param color        状态栏颜色值
         */
        public static void setColorNoTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
            setColorForDrawerLayout(activity, drawerLayout, color, 0);
        }
    
        /**
         * 为DrawerLayout 布局设置状态栏变色
         * @param activity       需要设置的activity
         * @param drawerLayout   DrawerLayout
         * @param color          状态栏颜色值
         * @param statusBarAlpha 状态栏透明度
         */
        public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color,
                                                   @IntRange(from = 0, to = 255) int statusBarAlpha) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            } else {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            }
            // 生成一个状态栏大小的矩形
            // ic_option_add statusBarView 到布局中
            ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
            View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
            if (fakeStatusBarView != null) {
                if (fakeStatusBarView.getVisibility() == View.GONE) {
                    fakeStatusBarView.setVisibility(View.VISIBLE);
                }
                fakeStatusBarView.setBackgroundColor(color);
            } else {
                contentLayout.addView(createStatusBarView(activity, color), 0);
            }
            // 内容布局不是 LinearLayout 时,设置padding top
            if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
                contentLayout.getChildAt(1)
                        .setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(),
                                contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
            }
            // 设置属性
            setDrawerLayoutProperty(drawerLayout, contentLayout);
            addTranslucentView(activity, statusBarAlpha);
        }
    
        /**
         * 设置 DrawerLayout 属性
         * @param drawerLayout              DrawerLayout
         * @param drawerLayoutContentLayout DrawerLayout 的内容布局
         */
        private static void setDrawerLayoutProperty(DrawerLayout drawerLayout, ViewGroup drawerLayoutContentLayout) {
            ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
            drawerLayout.setFitsSystemWindows(false);
            drawerLayoutContentLayout.setFitsSystemWindows(false);
            drawerLayoutContentLayout.setClipToPadding(true);
            drawer.setFitsSystemWindows(false);
        }
    
        /**
         * 为DrawerLayout 布局设置状态栏变色(5.0以下无半透明效果,不建议使用)
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         * @param color        状态栏颜色值
         */
        @Deprecated
        public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                // 生成一个状态栏大小的矩形
                ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
                View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
                if (fakeStatusBarView != null) {
                    if (fakeStatusBarView.getVisibility() == View.GONE) {
                        fakeStatusBarView.setVisibility(View.VISIBLE);
                    }
                    fakeStatusBarView.setBackgroundColor(calculateStatusColor(color, DEFAULT_STATUS_BAR_ALPHA));
                } else {
                    // ic_option_add statusBarView 到布局中
                    contentLayout.addView(createStatusBarView(activity, color), 0);
                }
                // 内容布局不是 LinearLayout 时,设置padding top
                if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
                    contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
                }
                // 设置属性
                setDrawerLayoutProperty(drawerLayout, contentLayout);
            }
        }
    
        /**
         * 为 DrawerLayout 布局设置状态栏透明
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         */
        public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
            setTranslucentForDrawerLayout(activity, drawerLayout, DEFAULT_STATUS_BAR_ALPHA);
        }
    
        /**
         * 为 DrawerLayout 布局设置状态栏透明
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         */
        public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout,
                                                         @IntRange(from = 0, to = 255) int statusBarAlpha) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            setTransparentForDrawerLayout(activity, drawerLayout);
            addTranslucentView(activity, statusBarAlpha);
        }
    
        /**
         * 为 DrawerLayout 布局设置状态栏透明
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         */
        public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            } else {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            }
    
            ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
            // 内容布局不是 LinearLayout 时,设置padding top
            if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
                contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
            }
    
            // 设置属性
            setDrawerLayoutProperty(drawerLayout, contentLayout);
        }
    
        /**
         * 为 DrawerLayout 布局设置状态栏透明(5.0以上半透明效果,不建议使用)
         * @param activity     需要设置的activity
         * @param drawerLayout DrawerLayout
         */
        @Deprecated
        public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                // 设置状态栏透明
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                // 设置内容布局属性
                ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
                contentLayout.setFitsSystemWindows(true);
                contentLayout.setClipToPadding(true);
                // 设置抽屉布局属性
                ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
                vg.setFitsSystemWindows(false);
                // 设置 DrawerLayout 属性
                drawerLayout.setFitsSystemWindows(false);
            }
        }
    
        /**
         * 为头部是 ImageView 的界面设置状态栏全透明
         * @param activity       需要设置的activity
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTransparentForImageView(Activity activity, View needOffsetView) {
            setTranslucentForImageView(activity, 0, needOffsetView);
        }
    
        /**
         * 为头部是 ImageView 的界面设置状态栏透明(使用默认透明度)
         * @param activity       需要设置的activity
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTranslucentForImageView(Activity activity, View needOffsetView) {
            setTranslucentForImageView(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
        }
    
        /**
         * 为头部是 ImageView 的界面设置状态栏透明
         * @param activity       需要设置的activity
         * @param statusBarAlpha 状态栏透明度
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTranslucentForImageView(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha,
                                                      View needOffsetView) {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                return;
            }
            setTransparentForWindow(activity);
            addTranslucentView(activity, statusBarAlpha);
            if (needOffsetView != null) {
                Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET);
                if (haveSetOffset != null && (Boolean) haveSetOffset) {
                    return;
                }
                ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
                layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity),
                        layoutParams.rightMargin, layoutParams.bottomMargin);
                needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true);
            }
        }
    
        /**
         * 为 fragment 头部是 ImageView 的设置状态栏透明
         * @param activity       fragment 对应的 activity
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTranslucentForImageViewInFragment(Activity activity, View needOffsetView) {
            setTranslucentForImageViewInFragment(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
        }
    
        /**
         * 为 fragment 头部是 ImageView 的设置状态栏透明
         * @param activity       fragment 对应的 activity
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTransparentForImageViewInFragment(Activity activity, View needOffsetView) {
            setTranslucentForImageViewInFragment(activity, 0, needOffsetView);
        }
    
        /**
         * 为 fragment 头部是 ImageView 的设置状态栏透明
         * @param activity       fragment 对应的 activity
         * @param statusBarAlpha 状态栏透明度
         * @param needOffsetView 需要向下偏移的 View
         */
        public static void setTranslucentForImageViewInFragment(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha,
                                                                View needOffsetView) {
            setTranslucentForImageView(activity, statusBarAlpha, needOffsetView);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                clearPreviousSetting(activity);
            }
        }
    
        /**
         * 隐藏伪状态栏 View
         * @param activity 调用的 Activity
         */
        public static void hideFakeStatusBarView(Activity activity) {
            ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
            View fakeStatusBarView = decorView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
            if (fakeStatusBarView != null) {
                fakeStatusBarView.setVisibility(View.GONE);
            }
            View fakeTranslucentView = decorView.findViewById(FAKE_TRANSLUCENT_VIEW_ID);
            if (fakeTranslucentView != null) {
                fakeTranslucentView.setVisibility(View.GONE);
            }
        }
    
        @TargetApi(Build.VERSION_CODES.KITKAT)
        private static void clearPreviousSetting(Activity activity) {
            ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
            View fakeStatusBarView = decorView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
            if (fakeStatusBarView != null) {
                decorView.removeView(fakeStatusBarView);
                ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
                rootView.setPadding(0, 0, 0, 0);
            }
        }
    
        /**
         * 添加半透明矩形条
         * @param activity       需要设置的 activity
         * @param statusBarAlpha 透明值
         */
        private static void addTranslucentView(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha) {
            ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
            View fakeTranslucentView = contentView.findViewById(FAKE_TRANSLUCENT_VIEW_ID);
            if (fakeTranslucentView != null) {
                if (fakeTranslucentView.getVisibility() == View.GONE) {
                    fakeTranslucentView.setVisibility(View.VISIBLE);
                }
                fakeTranslucentView.setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
            } else {
                contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
            }
        }
    
        /**
         * 生成一个和状态栏大小相同的彩色矩形条
         * @param activity 需要设置的 activity
         * @param color    状态栏颜色值
         * @return 状态栏矩形条
         */
        private static View createStatusBarView(Activity activity, @ColorInt int color) {
            return createStatusBarView(activity, color, 0);
        }
    
        /**
         * 生成一个和状态栏大小相同的半透明矩形条
         * @param activity 需要设置的activity
         * @param color    状态栏颜色值
         * @param alpha    透明值
         * @return 状态栏矩形条
         */
        private static View createStatusBarView(Activity activity, @ColorInt int color, int alpha) {
            // 绘制一个和状态栏一样高的矩形
            View statusBarView = new View(activity);
            LinearLayout.LayoutParams params =
                    new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
            statusBarView.setLayoutParams(params);
            statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
            statusBarView.setId(FAKE_STATUS_BAR_VIEW_ID);
            return statusBarView;
        }
    
        /**
         * 设置根布局参数
         */
        private static void setRootView(Activity activity) {
            ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
            for (int i = 0, count = parent.getChildCount(); i < count; i++) {
                View childView = parent.getChildAt(i);
                if (childView instanceof ViewGroup) {
                    childView.setFitsSystemWindows(true);
                    ((ViewGroup) childView).setClipToPadding(true);
                }
            }
        }
    
        /**
         * 设置透明
         */
        private static void setTransparentForWindow(Activity activity) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
                activity.getWindow()
                        .getDecorView()
                        .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                activity.getWindow()
                        .setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            }
        }
    
        /**
         * 使状态栏透明
         */
        @TargetApi(Build.VERSION_CODES.KITKAT)
        private static void transparentStatusBar(Activity activity) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            } else {
                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            }
        }
    
        /**
         * 创建半透明矩形 View
         * @param alpha 透明值
         * @return 半透明 View
         */
        private static View createTranslucentStatusBarView(Activity activity, int alpha) {
            // 绘制一个和状态栏一样高的矩形
            View statusBarView = new View(activity);
            LinearLayout.LayoutParams params =
                    new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
            statusBarView.setLayoutParams(params);
            statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0));
            statusBarView.setId(FAKE_TRANSLUCENT_VIEW_ID);
            return statusBarView;
        }
    
        /**
         * 获取状态栏高度
         * @param context context
         * @return 状态栏高度
         */
        public static int getStatusBarHeight(Context context) {
            // 获得状态栏高度
            int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
            return context.getResources().getDimensionPixelSize(resourceId);
        }
    
        /**
         * 计算状态栏颜色
         * @param color color值
         * @param alpha alpha值
         * @return 最终的状态栏颜色
         */
        private static int calculateStatusColor(@ColorInt int color, int alpha) {
            if (alpha == 0) {
                return color;
            }
            float a = 1 - alpha / 255f;
            int red = color >> 16 & 0xff;
            int green = color >> 8 & 0xff;
            int blue = color & 0xff;
            red = (int) (red * a + 0.5);
            green = (int) (green * a + 0.5);
            blue = (int) (blue * a + 0.5);
            return 0xff << 24 | red << 16 | green << 8 | blue;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451
    • 452
    • 453
    • 454
    • 455
    • 456
    • 457
    • 458
    • 459
    • 460
    • 461
    • 462
    • 463
    • 464
    • 465
    • 466
    • 467
    • 468
    • 469
    • 470
    • 471
    • 472
    • 473
    • 474
    • 475
    • 476
    • 477
    • 478
    • 479
    • 480
    • 481
    • 482
    • 483
    • 484
    • 485
    • 486
    • 487
    • 488
    • 489
    • 490
    • 491
    • 492
    • 493
    • 494
    • 495
    • 496
    • 497
    • 498
    • 499
    • 500
    • 501
    • 502
    • 503
    • 504
    • 505
    • 506
    • 507
    • 508
    • 509
    • 510
    • 511
    • 512
    • 513
    • 514
    • 515
    • 516
    • 517
    • 518
    • 519
    • 520
    • 521
    • 522
    • 523
    • 524
    • 525
    • 526
    • 527
    • 528
    • 529
    • 530
    • 531
    • 532
    • 533
    • 534
    • 535
    • 536
    • 537
    • 538
    • 539
    • 540
    • 541
    • 542
    • 543
    • 544
    • 545
    • 546
    • 547
    • 548
    • 549
    • 550
    • 551
    • 552
    • 553
    • 554
    • 555
    • 556
    • 557
    • 558
    • 559
    • 560
    • 561
    • 562
    • 563
    • 564
    • 565
    • 566
    • 567
    • 568
    • 569
    • 570
    • 571
    • 572
    • 573
    • 574
    • 575
    • 576
    • 577
    • 578
    • 579
    • 580
    • 581
    • 582
    • 583
    • 584
    • 585
    • 586
    • 587
    • 588
    • 589
    • 590
    • 591
    • 592
    • 593
    • 594
    • 595
    • 596
    • 597
    • 598
    • 599
    • 600
    • 601
    • 602
    • 603
    • 604
    • 605
    • 606
    • 607
    • 608
    • 609
    • 610
    • 611
    • 612
    • 613
    • 614
    • 615
    • 616
    • 617
    • 618
    • 619
    • 620
    • 621
    • 622
    • 623
    • 624
    • 625

      新增values.xml文件:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <item name="statusbarutil_fake_status_bar_view" type="id"/>
        <item name="statusbarutil_translucent_view" type="id"/>
    </resources>
    
    • 1
    • 2
    • 3
    • 4
    • 5

    防恶意多点工具类

    public class ClickUtil {
        //两次按钮点击时间间隔不能少于1s
        private static final long MIN_CLICK_DELAY_TIME = 800L;
        private static long lastClickTime;
    
        public static boolean enableClick() {
            boolean isEnabled = false;
            long curClickTime = System.currentTimeMillis();
            if ((curClickTime - lastClickTime) > MIN_CLICK_DELAY_TIME) {
                isEnabled = true;
            }
            lastClickTime = curClickTime;
            return isEnabled;
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    CrashHandler用于异常处理上报日志

    /**
     * @ClassName: CrashHandler
     * @Author: Tobey_r1
     * @CreateDate: 2022/2/16 10:26
     * @Description: UncaughtException处理类,当程序发生Uncaught异常的时候,有该类来接管程序,并记录发送错误报告.需要在Application中注册,为了要在程序启动器就监控整个程序。
     * @UpdateUser: 更新者
     * @UpdateDate: 2022/2/16 10:26
     * @UpdateRemark: 更新说明
     * @Version: 1.0
     */
    public class CrashHandler implements Thread.UncaughtExceptionHandler {
        public static final String TAG = CrashHandler.class.getSimpleName();
        //系统默认的UncaughtException处理类
        private Thread.UncaughtExceptionHandler mDefaultHandler;
        //CrashHandler 实例
        private static CrashHandler instance;
        private Context mContext;
        //用来存储设备信息和异常信息
        private Map<String,String> infos = new HashMap<>();
        //用于格式化日期,作为日志文件名的一部分
        @SuppressLint("SimpleDateFormat")
        private DateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    
        private CrashHandler(){}
    
        /**
         * @description 单例
         * @return 返回crashhandler实例
         * @author 13115
         * @time 2022/2/16 10:54
         */
        public static CrashHandler getInstance(){
            if (instance == null) {
                synchronized (CrashHandler.class){
                    if (instance == null){
                        instance = new CrashHandler();
                    }
                }
            }
            return instance;
        }
    
        /**
         * @description 初始化
         * @param context context
         * @author 13115
         * @time 2022/2/16 11:14
         */
        public void init(Context context){
            mContext = context;
            //获取系统默认的UncaughtException处理器
            mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
            //设置该CrashHandler微程序的默认处理器
            Thread.setDefaultUncaughtExceptionHandler(this);
        }
    
        /**
         * @description 当UncaughtException发生时会转入该函数来处理
         * @return
         * @author 13115
         * @time 2022/2/16 10:40
         */
        @Override
        public void uncaughtException(@NonNull  Thread t, @NonNull  Throwable e) {
            if (!handleException(e)&&mDefaultHandler !=null){
                //如果用户没有处理或者init则让系统默认的异常处理器处理
                mDefaultHandler.uncaughtException(t, e);
            }else {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException interruptedException) {
                    interruptedException.printStackTrace();
                }
                //退出程序
                System.exit(1);
            }
    
        }
    
        /**
         * @description 自定义错误处理,收集错误信息,上传错误信息
         * @param ex
         * @return true:处理了该异常信息;false:未处理
         * @author 13115
         * @time 2022/2/16 11:22
         */
        private boolean handleException(final Throwable ex){
            if (ex == null) return false;
            //收集设备参数信息
            collectDeviceInfo(mContext);
            //发送错误日志
            //crashReport(ex);
            //Toast提示
            new Thread(){
                @Override
                public void run() {
                    Looper.prepare();
                    Toast.makeText(mContext,ex==null?"":ex.toString(),Toast.LENGTH_SHORT).show();
                    Looper.loop();
                    Looper.myLooper().quit();
                }
            }.start();
            return true;
        }
    
        private void collectDeviceInfo(Context mContext) {
            try {
                PackageManager pm = mContext.getPackageManager();
                PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(),
                        PackageManager.GET_ACTIVITIES);
                if (pi != null) {
                    String versionName = pi.versionName == null ? "null"
                            : pi.versionName;
                    String versionCode = pi.versionCode + "";
                    infos.put("versionName", versionName);
                    infos.put("versionCode", versionCode);
                }
            } catch (PackageManager.NameNotFoundException e) {
            }
            infos.put("OS Version:", Build.VERSION.RELEASE);
            infos.put("-", Build.VERSION.SDK_INT+"");
            infos.put("Model:", Build.MODEL);
            infos.put("BRAND:", Build.BRAND);
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125

      看了下markdown字数,2.6w字,所以本篇先记录到这,后续文章重构ui以及http模块。有问题欢迎批评指正,觉得不错的也请点个赞谢谢。

  • 相关阅读:
    中睿天下荣获2023全国智能驾驶测试赛车联网安全比赛第一名
    易语言 如何调用麦谈帮API接口?
    java继承的优缺点分析
    第十三届蓝桥杯大赛软件赛决赛(Java 大学A组)
    一个神奇的整型常量
    神经网络算法有哪些模型,神经网络算法模型resnet
    pytorch深度学习实战lesson23
    ERROR Broken pipie
    自我博弈1
    Java基础|Java并发相关api
  • 原文地址:https://blog.csdn.net/Tobey_r1/article/details/125287228