├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable-xhdpi │ │ │ │ └── bg_clips.jpg │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_end_clips.png │ │ │ │ ├── ic_start_clips.png │ │ │ │ └── img_graduation.png │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── luowei │ │ │ └── audioclips │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── luowei │ │ │ └── audioclips │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── luowei │ │ └── audioclips │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── audioclip ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── luowei │ │ │ └── audioclip │ │ │ ├── ClipsMarkerTextView.java │ │ │ ├── MusicEditor.java │ │ │ ├── soundfile │ │ │ ├── WAVHeader.java │ │ │ ├── MP4Header.java │ │ │ └── SoundFile.java │ │ │ └── ClipsFrameLayout.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── luowei │ │ │ └── audioclip │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── luowei │ │ └── audioclip │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── picture └── demo.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /audioclip/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':audioclip' 2 | -------------------------------------------------------------------------------- /picture/demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/picture/demo.jpg -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AudioClips 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /audioclip/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AudioClip 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/bg_clips.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/drawable-xhdpi/bg_clips.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_end_clips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/drawable-xxhdpi/ic_end_clips.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_start_clips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/drawable-xxhdpi/ic_start_clips.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/img_graduation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luoweii/AudioClips/HEAD/app/src/main/res/drawable-xxhdpi/img_graduation.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 26 16:08:02 CST 2016 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-2.10-all.zip 7 | -------------------------------------------------------------------------------- /audioclip/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/test/java/com/luowei/audioclips/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclips; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /audioclip/src/test/java/com/luowei/audioclip/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclip; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/luowei/audioclips/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclips; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Android generated 2 | bin/ 3 | gen/ 4 | 5 | # Ant 6 | build.xml 7 | local.properties 8 | 9 | # Maven 10 | target/ 11 | pom.xml.* 12 | release.properties 13 | 14 | # Eclipse 15 | .classpath 16 | .project 17 | .externalToolBuilders/ 18 | 19 | # IntelliJ 20 | *.iml 21 | *.ipr 22 | *.iws 23 | .idea/ 24 | out/ 25 | 26 | # Mac 27 | .DS_Store 28 | 29 | # Ignore gradle files 30 | .gradle/ 31 | build/ 32 | 33 | # Private 34 | signing.properties 35 | 36 | captures/ -------------------------------------------------------------------------------- /audioclip/src/androidTest/java/com/luowei/audioclip/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclip; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\software\android_sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /audioclip/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\software\android_sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /audioclip/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.luowei.audioclips" 9 | minSdkVersion 16 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.1.1' 26 | compile project(':audioclip') 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /audioclip/src/main/java/com/luowei/audioclip/ClipsMarkerTextView.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclip; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.widget.TextView; 9 | 10 | import java.text.SimpleDateFormat; 11 | import java.util.Date; 12 | 13 | /** 14 | * 自定义剪辑的marker 15 | * Created by 骆巍 on 2015/10/27. 16 | */ 17 | public class ClipsMarkerTextView extends TextView { 18 | private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); 19 | private int second; 20 | private float pointWidth; 21 | 22 | public ClipsMarkerTextView(Context context) { 23 | this(context, null); 24 | } 25 | 26 | public ClipsMarkerTextView(Context context, AttributeSet attrs) { 27 | super(context, attrs); 28 | paint.setColor(Color.WHITE); 29 | } 30 | 31 | @Override 32 | protected void onDraw(Canvas canvas) { 33 | canvas.drawLine(getWidth() / 2, 0, getWidth() / 2, getCompoundPaddingTop(), paint); 34 | super.onDraw(canvas); 35 | } 36 | 37 | public void setSecond(int second) { 38 | this.second = second; 39 | SimpleDateFormat sdf = new SimpleDateFormat("m:ss"); 40 | String str = sdf.format(new Date(second * 1000)); 41 | setText(str); 42 | } 43 | 44 | public int getSecond() { 45 | return second; 46 | } 47 | 48 | public void setPointWidth(float pointWidth) { 49 | this.pointWidth = pointWidth; 50 | paint.setStrokeWidth(pointWidth); 51 | invalidate(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /audioclip/src/main/java/com/luowei/audioclip/MusicEditor.java: -------------------------------------------------------------------------------- 1 | package com.luowei.audioclip; 2 | 3 | import android.media.MediaExtractor; 4 | import android.media.MediaFormat; 5 | 6 | import java.io.File; 7 | import java.io.FileInputStream; 8 | import java.io.FileNotFoundException; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | import java.nio.ByteBuffer; 13 | 14 | /** 15 | * Created by 骆巍 on 2015/11/26. 16 | */ 17 | public class MusicEditor { 18 | public static int REQUEST_FINISH = 1000; 19 | 20 | public static void editorMusic(InputStream is, File targetFile, int start, int end, int allTime) throws IOException { 21 | byte[] byteMusic = getMusicByte(is); 22 | editorMusic(byteMusic, targetFile, start, end, allTime); 23 | } 24 | 25 | public static void editorMusic(File file, File targetFile, int start, int end, int allTime) throws IOException { 26 | byte[] byteMusic = getMusicByte(file); 27 | editorMusic(byteMusic, targetFile, start, end, allTime); 28 | } 29 | 30 | public static void editorMusic(byte[] bytes, File targetFile, int start, int end, int allTime) throws IOException { 31 | if (bytes == null) return; 32 | int editorStart = (start * REQUEST_FINISH) / allTime; 33 | int editorStop = (end * REQUEST_FINISH) / allTime; 34 | 35 | int num = bytes.length; 36 | int editorStart2 = editorStart * (num / REQUEST_FINISH); 37 | int count = (editorStop * (num / REQUEST_FINISH)) - editorStart2; 38 | FileOutputStream fout = new FileOutputStream(targetFile); 39 | fout.write(bytes, editorStart2, count); 40 | fout.close(); 41 | } 42 | 43 | public static byte[] getMusicByte(File file) throws IOException { 44 | if (!file.exists()) { 45 | return null; 46 | } 47 | return getMusicByte(new FileInputStream(file)); 48 | } 49 | 50 | public static byte[] getMusicByte(InputStream is) throws IOException { 51 | if (is == null) return null; 52 | int num = is.available(); 53 | byte[] buffer = new byte[num]; 54 | is.read(buffer); 55 | is.close(); 56 | return buffer; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AudioClips 2 | 音频剪辑工具,能自定义许多元素 3 | 4 | 5 | 6 | 7 | 使用 8 | ----------------------------- 9 | dependencies { 10 | compile 'com.luowei.warmheart:audioclip:+' 11 | } 12 | 13 | 配置 14 | ------------- 15 | ```xml 16 | 26 | 27 | 32 | 33 | 40 | 41 | 50 | 51 | 62 | 63 | 74 | 75 | ``` 76 | ####标签属性说明 77 | * clip_progressHeight: 播放进度条高度 78 | * clip_startId: 剪辑开始标记的资源Id 79 | * clip_endId: 剪辑结束标记的资源Id 80 | * clip_background: 剪辑的背景图标 81 | * clip_clipsOverColor: 剪辑的覆盖颜色 82 | * clip_clipsMinSecond: 剪辑的最小时间 83 | * clip_point_width: 播放进度条的指定的宽度 84 | * clip_point_color: 播放进度条的颜色 85 | -------------------------------------------------------------------------------- /audioclip/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | apply plugin: 'com.jfrog.bintray' 4 | 5 | def siteUrl = 'https://github.com/luoweii/AudioClips' // project homepage 6 | def gitUrl = 'https://github.com/luoweii/AudioClips.git' // project git 7 | version = "1.1.0" 8 | group = "com.luowei.warmheart" 9 | 10 | android { 11 | compileSdkVersion 23 12 | buildToolsVersion "23.0.1" 13 | 14 | defaultConfig { 15 | minSdkVersion 16 16 | targetSdkVersion 23 17 | versionCode 1 18 | versionName "1.0.0" 19 | } 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | } 27 | 28 | install { 29 | repositories.mavenInstaller { 30 | // This generates POM.xml with proper parameters 31 | pom { 32 | project { 33 | packaging 'aar' 34 | name 'audioclips' 35 | url siteUrl 36 | licenses { 37 | license { 38 | name 'The Apache Software License, Version 2.0' 39 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 40 | } 41 | } 42 | developers { 43 | developer { 44 | id 'luowei' 45 | name 'luowei' 46 | email 'luowei58@qq.com' 47 | } 48 | } 49 | scm { 50 | connection gitUrl 51 | developerConnection gitUrl 52 | url siteUrl 53 | } 54 | } 55 | } 56 | } 57 | } 58 | 59 | task sourcesJar(type: Jar) { 60 | from android.sourceSets.main.java.srcDirs 61 | classifier = 'sources' 62 | } 63 | 64 | task javadoc(type: Javadoc) { 65 | options.encoding = "UTF-8" 66 | source = android.sourceSets.main.java.srcDirs 67 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 68 | } 69 | 70 | task javadocJar(type: Jar, dependsOn: javadoc) { 71 | classifier = 'javadoc' 72 | from javadoc.destinationDir 73 | } 74 | 75 | artifacts { 76 | archives javadocJar 77 | archives sourcesJar 78 | } 79 | 80 | Properties properties = new Properties() 81 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 82 | bintray { 83 | user = properties.getProperty("bintray.user") 84 | key = properties.getProperty("bintray.apikey") 85 | configurations = ['archives'] 86 | pkg { 87 | repo = "maven" 88 | name = "audioclips" // project name in jcenter 89 | websiteUrl = siteUrl 90 | vcsUrl = gitUrl 91 | licenses = ["Apache-2.0"] 92 | publish = true 93 | } 94 | } 95 | 96 | dependencies { 97 | compile fileTree(dir: 'libs', include: ['*.jar']) 98 | testCompile 'junit:junit:4.12' 99 | compile 'com.android.support:appcompat-v7:23.1.1' 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 21 | 26 | 27 | 34 | 35 | 44 | 45 | 56 | 57 | 68 | 69 | 70 | 76 | 77 |