Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 19 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,41 @@ apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
compileSdkVersion 31
defaultConfig {
applicationId "space.siy.waveformviewdemo"
minSdkVersion 21
targetSdkVersion 26
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildFeatures {
viewBinding = true
}
buildToolsVersion '31.0.0'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation "com.android.support:cardview-v7:26.1.0"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.1'
compile project(path: ':waveformview')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1-native-mt'
implementation project(path: ':waveformview')
}

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
44 changes: 23 additions & 21 deletions app/src/main/java/space/siy/waveformviewdemo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ package space.siy.waveformviewdemo
import android.media.MediaPlayer
import android.os.Bundle
import android.os.Handler
import android.support.v7.app.AppCompatActivity
import android.view.View
import android.widget.SeekBar
import kotlinx.android.synthetic.main.activity_main.*
import androidx.appcompat.app.AppCompatActivity
import space.siy.waveformview.WaveFormData
import space.siy.waveformview.WaveFormView
import space.siy.waveformviewdemo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)

//Open From Assets Folder
val afd = assets.openFd("jazz_in_paris.mp3")
Expand All @@ -24,41 +26,41 @@ class MainActivity : AppCompatActivity() {
.build(object : WaveFormData.Factory.Callback {
//When Complete, you can receive data and set to the view
override fun onComplete(waveFormData: WaveFormData) {
progressBar.visibility = View.GONE
binding.progressBar.visibility = View.GONE

waveFormView.data = waveFormData
binding.waveFormView.data = waveFormData


//UI setup
seekBar1.progress = (waveFormView.secPerBlock*100f).toInt()
seekBar2.progress = (waveFormView.blockWidth).toInt()
seekBar3.progress = (waveFormView.topBlockScale*100f).toInt()
seekBar4.progress = (waveFormView.bottomBlockScale*100f).toInt()
binding.seekBar1.progress = (binding.waveFormView.secPerBlock*100f).toInt()
binding.seekBar2.progress = (binding.waveFormView.blockWidth).toInt()
binding.seekBar3.progress = (binding.waveFormView.topBlockScale*100f).toInt()
binding.seekBar4.progress = (binding.waveFormView.bottomBlockScale*100f).toInt()

seekBar1.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
binding.seekBar1.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
waveFormView.secPerBlock = seekBar.progress / 100f
binding.waveFormView.secPerBlock = seekBar.progress / 100f
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
})
seekBar2.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
binding.seekBar2.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
waveFormView.blockWidth = seekBar.progress.toFloat()
binding.waveFormView.blockWidth = seekBar.progress.toFloat()
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
})
seekBar3.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
binding.seekBar3.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
waveFormView.topBlockScale = seekBar.progress / 100f
binding.waveFormView.topBlockScale = seekBar.progress / 100f
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
})
seekBar4.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
binding.seekBar4.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
waveFormView.bottomBlockScale = seekBar.progress / 100f
binding.waveFormView.bottomBlockScale = seekBar.progress / 100f
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
Expand All @@ -71,7 +73,7 @@ class MainActivity : AppCompatActivity() {
player.start()

//Synchronize with MediaPlayer using WaveFormView.Callback
waveFormView.callback = object : WaveFormView.Callback {
binding.waveFormView.callback = object : WaveFormView.Callback {
override fun onPlayPause() {
if (player.isPlaying)
player.pause()
Expand All @@ -86,15 +88,15 @@ class MainActivity : AppCompatActivity() {
//You have to notify current position to the view
Handler().postDelayed(object : Runnable {
override fun run() {
waveFormView.position = player.currentPosition.toLong()
binding.waveFormView.position = player.currentPosition.toLong()
Handler().postDelayed(this, 20)
}
}, 20)

}

override fun onProgress(progress: Float) {
progressBar.progress = (progress*10).toInt()
binding.progressBar.progress = (progress*10).toInt()
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:min="0" />


<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -127,6 +127,6 @@
</FrameLayout>
</LinearLayout>

</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>

</FrameLayout>
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.30'
ext.kotlin_version = '1.5.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.novoda:bintray-release:0.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
41 changes: 17 additions & 24 deletions waveformview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@ buildscript {
}

dependencies {
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.16"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18"
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka-android'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 26
compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
targetSdkVersion 31
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

}

Expand All @@ -32,23 +27,29 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildToolsVersion '31.0.0'

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1-native-mt'
implementation('org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1-native-mt')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

repositories {
mavenCentral()
jcenter()
}

task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
Expand All @@ -69,14 +70,6 @@ task dokkaMarkdown(type: org.jetbrains.dokka.gradle.DokkaTask) {
}
}

publish {
userOrg = 'siy1121'
groupId = 'space.siy'
artifactId = 'waveformview'
publishVersion = '1.0.0'
desc = 'Provide the view to show audio wave form'
website = 'https://github.com/SIY1121/WaveFormViewDemo'
}

tasks.withType(Javadoc).all {
enabled = false
Expand Down

This file was deleted.

Loading