Android (kotlin)MVP基础模板

1.项目页面

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.zhjy.kotlinmvp">

    <!-- 获取GSM网络信息状态,如当前的网络连接是否有效 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- 允许访问Wi-Fi网络状态信息 -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <!-- 允许获取Wi-Fi网络状态改变信息 -->
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <!-- 访问网络 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- 读取手机状态 -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <!-- SD 卡读写权限 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.NoActionBar"
        tools:ignore="GoogleAppIndexingWarning">

        <activity
            android:name=".ui.activity.SplashActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar.FullScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- 主页面 -->
        <activity
            android:name=".ui.activity.MainActivity"
            android:screenOrientation="portrait" />

        <!-- 视频播放详情页面 -->
        <activity
            android:name=".ui.activity.VideoDetailActivity"
            android:configChanges="orientation|keyboardHidden|screenSize" />

        <!-- 分类详情 -->
        <activity
            android:name=".ui.activity.CategoryDetailActivity"
            android:screenOrientation="portrait" />

        <!-- 搜索页面 -->
        <activity
            android:name=".ui.activity.SearchActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan" />

        <!-- 个人主页 -->
        <activity
            android:name=".ui.activity.ProfileHomePageActivity"
            android:screenOrientation="portrait" />

        <!-- 关于 -->
        <activity
            android:name=".ui.activity.AboutActivity"
            android:screenOrientation="portrait" />
        <!-- 观看记录 -->
        <activity android:name=".ui.activity.WatchHistoryActivity"
            android:screenOrientation="portrait"
            />
    </application>

</manifest>

2.项目结构

在这里插入图片描述

3.项目配置

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'  //kapt3插件

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.zhjy.kotlinmvp"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'

    // Support库
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.material:material:1.2.0'//design
    implementation 'androidx.annotation:annotation:1.1.0'

    // 网络请求库
    implementation "com.squareup.retrofit2:retrofit:2.3.0"
    implementation "com.squareup.retrofit2:converter-gson:2.3.0"
    implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'

    // RxJava2
    implementation "io.reactivex.rxjava2:rxjava:2.1.5"
    implementation "io.reactivex.rxjava2:rxandroid:2.0.1"

    // 底部菜单
    implementation('com.flyco.tablayout:FlycoTabLayout_Lib:2.1.0@aar') {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    implementation 'com.github.bumptech.glide:glide:4.9.0'
    // APT dependencies(Kotlin内置的注解处理器)
    kapt 'com.github.bumptech.glide:compiler:4.9.0'
    //GlideOkHttp
    implementation('com.github.bumptech.glide:okhttp3-integration:4.9.0') {
        exclude group: 'glide-parent'
    }
    //smartRefreshLayout 下拉刷新
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
    implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.3'
    //Banner
    implementation 'cn.bingoogolapple:bga-banner:2.2.4@aar'
    // 视屏播放器
    implementation 'com.shuyu:GSYVideoPlayer:2.1.1'
    //Logger
    implementation 'com.orhanobut:logger:2.1.1'
    //Google开源的一个布局控件
    implementation 'com.google.android:flexbox:0.3.1'
    //模糊透明 View
    implementation 'com.github.mmin18:realtimeblurview:1.2.1'
    //leakCanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
    //腾讯 bugly
    implementation 'com.tencent.bugly:crashreport:2.6.6.1'
    //运行时权限
    implementation 'pub.devrel:easypermissions:1.2.0'
//    一个方便在多种状态切换的view
    implementation 'com.classic.common:multiple-status-view:1.1'

}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.3.71'
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url "https://jitpack.io" }
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url "https://jitpack.io" }
        mavenCentral()
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

4.下载地址

CSDN下载地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

魑魅魍魉9527

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值