├── app ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ ├── test4.txt │ │ │ ├── test1.png │ │ │ ├── test2.jpg │ │ │ └── test3.pdf │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── xml │ │ │ │ └── filepaths.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── alexlu │ │ │ │ └── androidstorage │ │ │ │ ├── App.kt │ │ │ │ ├── bean │ │ │ │ └── MediaStoreImage.kt │ │ │ │ ├── file │ │ │ │ ├── PDFUtils.kt │ │ │ │ ├── FileSizeUtil.java │ │ │ │ ├── PicturesUtil.kt │ │ │ │ └── FilePath.kt │ │ │ │ ├── util │ │ │ │ ├── MediaStoreUtil.kt │ │ │ │ └── BitmapUtil.kt │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── alexlu │ │ │ └── androidstorage │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── alexlu │ │ └── androidstorage │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── misc.xml ├── gradle.xml └── jarRepositories.xml ├── .gitattributes ├── image └── test.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/src/main/assets/test4.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "AndroidStorageDemo" -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /image/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/image/test.jpg -------------------------------------------------------------------------------- /app/src/main/assets/test1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/assets/test1.png -------------------------------------------------------------------------------- /app/src/main/assets/test2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/assets/test2.jpg -------------------------------------------------------------------------------- /app/src/main/assets/test3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/assets/test3.pdf -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidStorageDemo 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xluu233/AndroidStorageDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 19 14:11:07 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/com/alexlu/androidstorage/App.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage 2 | 3 | import android.app.Application 4 | 5 | class App : Application() { 6 | 7 | companion object{ 8 | lateinit var instance:Application 9 | } 10 | 11 | override fun onCreate() { 12 | super.onCreate() 13 | instance = this 14 | } 15 | 16 | 17 | } -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/alexlu/androidstorage/bean/MediaStoreImage.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage.bean 2 | 3 | import android.net.Uri 4 | import java.util.* 5 | 6 | /** 7 | * @ClassName MediaStoreImage 8 | * @Description TODO 9 | * @Author AlexLu_1406496344@qq.com 10 | * @Date 2021/7/23 9:45 11 | */ 12 | data class MediaStoreImage( 13 | val id: Long, 14 | val name: String, 15 | val time:String?, 16 | val contentUri: Uri 17 | ) 18 | -------------------------------------------------------------------------------- /app/src/test/java/com/alexlu/androidstorage/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/alexlu/androidstorage/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.alexlu.androidstorage", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 13 | 14 | 15 | 18 | 19 | 20 | 23 | 24 | 25 | 28 | 29 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | id 'kotlin-kapt' 6 | } 7 | 8 | android { 9 | compileSdkVersion 30 10 | buildToolsVersion "30.0.3" 11 | 12 | defaultConfig { 13 | applicationId "com.alexlu.androidstorage" 14 | minSdkVersion 21 15 | targetSdkVersion 30 16 | versionCode 1 17 | versionName "1.0" 18 | 19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | compileOptions { 29 | sourceCompatibility JavaVersion.VERSION_1_8 30 | targetCompatibility JavaVersion.VERSION_1_8 31 | } 32 | kotlinOptions { 33 | jvmTarget = '1.8' 34 | } 35 | buildFeatures { 36 | dataBinding = true 37 | viewBinding = true 38 | } 39 | } 40 | 41 | dependencies { 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 43 | implementation 'androidx.core:core-ktx:1.3.2' 44 | implementation 'androidx.appcompat:appcompat:1.2.0' 45 | implementation 'com.google.android.material:material:1.3.0' 46 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 47 | testImplementation 'junit:junit:4.+' 48 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 49 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 50 | 51 | //Rxpermissions https://github.com/tbruyelle/RxPermissions 52 | implementation 'com.github.tbruyelle:rxpermissions:0.12' 53 | 54 | 55 | // Glide 56 | implementation 'com.github.bumptech.glide:glide:4.11.0' 57 | kapt 'com.github.bumptech.glide:compiler:4.11.0' 58 | 59 | //rxjava 60 | implementation 'io.reactivex.rxjava3:rxjava:3.0.10' 61 | implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' 62 | 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/alexlu/androidstorage/file/PDFUtils.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage.file 2 | 3 | import android.graphics.Bitmap 4 | import android.graphics.Matrix 5 | import android.graphics.Paint 6 | import android.graphics.pdf.PdfDocument 7 | import android.print.PrintAttributes 8 | import com.alexlu.androidstorage.util.FilePath 9 | import java.io.* 10 | 11 | /** 12 | * @ClassName PdfUtils 13 | * @Description 14 | * @Author AlexLu_1406496344@qq.com 15 | * @Date 2021/3/19 17:33 16 | */ 17 | object PDFUtils { 18 | 19 | const val StorageName = "" 20 | 21 | /** 22 | * 将Bitmap保存为PDF文件在Download目录下 23 | * 24 | * @param bitmaps 25 | * @param fileName 文件名 26 | */ 27 | fun saveBitmapForPdf(bitmaps: ArrayList, fileName: String): File { 28 | val doc = PdfDocument() 29 | val pageWidth: Int = PrintAttributes.MediaSize.ISO_A4.widthMils * 72 / 1000 30 | val scale = pageWidth.toFloat() / bitmaps[0].width.toFloat() 31 | val pageHeight = (bitmaps[0].height * scale).toInt() 32 | val matrix = Matrix() 33 | matrix.postScale(scale, scale) 34 | val paint = Paint(Paint.ANTI_ALIAS_FLAG) 35 | 36 | for (i in 0 until bitmaps.size) { 37 | val newPage = PdfDocument.PageInfo.Builder(pageWidth, pageHeight, i).create() 38 | val page = doc.startPage(newPage) 39 | val canvas = page.canvas 40 | canvas.drawBitmap(bitmaps[i], matrix, paint) 41 | doc.finishPage(page) 42 | } 43 | 44 | val file = File(FilePath.getExternalDownloadPath(StorageName), fileName) 45 | var outputStream: FileOutputStream? = null 46 | try { 47 | outputStream = FileOutputStream(file) 48 | doc.writeTo(outputStream) 49 | } catch (e: FileNotFoundException) { 50 | e.printStackTrace() 51 | } catch (e: IOException) { 52 | e.printStackTrace() 53 | } finally { 54 | doc.close() 55 | try { 56 | outputStream?.close() 57 | } catch (e: IOException) { 58 | e.printStackTrace() 59 | } 60 | } 61 | return file 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/alexlu/androidstorage/util/MediaStoreUtil.kt: -------------------------------------------------------------------------------- 1 | package com.alexlu.androidstorage.util 2 | 3 | import android.content.ContentUris 4 | import android.content.Context 5 | import android.database.Cursor 6 | import android.net.Uri 7 | import android.provider.MediaStore 8 | 9 | 10 | /** 11 | * @ClassName MediaStoreUtil 12 | * @Description TODO 13 | * @Author AlexLu_1406496344@qq.com 14 | * @Date 2021/7/23 9:52 15 | */ 16 | object MediaStoreUtil { 17 | 18 | /** 19 | * TODO 查询相册图片 20 | * 21 | * @param context 22 | */ 23 | fun getAlbumList(context: Context):List{ 24 | val list= mutableListOf() 25 | val cursor = context.contentResolver.query( 26 | MediaStore.Images.Media.EXTERNAL_CONTENT_URI, 27 | null, 28 | null, 29 | null, 30 | "${MediaStore.MediaColumns.DATE_ADDED} desc" 31 | ) 32 | if (cursor != null) { 33 | while (cursor.moveToNext()) { 34 | val id = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns._ID)) 35 | val uri = ContentUris.withAppendedId( 36 | MediaStore.Images.Media.EXTERNAL_CONTENT_URI, 37 | id 38 | ) 39 | list += uri 40 | } 41 | cursor.close() 42 | } 43 | return list 44 | } 45 | 46 | 47 | fun getVideoList(context: Context){ 48 | val project = arrayOf( 49 | MediaStore.Video.Media._ID, 50 | MediaStore.Video.Media.BUCKET_DISPLAY_NAME, 51 | MediaStore.Video.Media.DURATION, //视频的时长 52 | MediaStore.Video.Media.DATE_MODIFIED 53 | ) 54 | 55 | val cursor: Cursor ?= context.contentResolver.query( 56 | MediaStore.Video.Media.EXTERNAL_CONTENT_URI, 57 | project, 58 | MediaStore.Video.Media.MIME_TYPE + "=?", 59 | arrayOf("video/mp4"), //这里只查了mp4格式 60 | MediaStore.Video.Media.DATE_MODIFIED + " desc" 61 | ) 62 | if (cursor != null) { 63 | while (cursor.moveToNext()) { 64 | val id = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns._ID)) 65 | val uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id) 66 | println("image uri is $uri") 67 | } 68 | cursor.close() 69 | } 70 | } 71 | 72 | 73 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 22 | 23 |