From cc2b747865f30e70d709bbdfd0183b0c870cb3c8 Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 27 Aug 2015 20:54:00 +0200 Subject: [PATCH 1/5] Update buildToolsVersion and target to API 23 --- app/app.iml | 1 + app/build.gradle | 2 +- vumeterlibrary/build.gradle | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/app.iml b/app/app.iml index 628a14f..17fb6ab 100644 --- a/app/app.iml +++ b/app/app.iml @@ -86,6 +86,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index eb0adf3..fca548e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 - buildToolsVersion "23.0.0 rc3" + buildToolsVersion "23.0.0" defaultConfig { applicationId "io.gresse.hugo.vumeter" diff --git a/vumeterlibrary/build.gradle b/vumeterlibrary/build.gradle index 2c7a50a..783b11b 100644 --- a/vumeterlibrary/build.gradle +++ b/vumeterlibrary/build.gradle @@ -6,11 +6,11 @@ apply plugin: 'com.github.dcendents.android-maven' android { compileSdkVersion 22 - buildToolsVersion "23.0.0 rc3" + buildToolsVersion "23.0.0" defaultConfig { minSdkVersion 9 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 10 versionName "1.0.9" } From 228d3c64bb6756cf594bda2f3288af73fdf67ec0 Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 27 Aug 2015 20:54:21 +0200 Subject: [PATCH 2/5] Add startOff attr --- .../gresse/hugo/vumeterlibrary/Dynamics.java | 4 ++++ .../hugo/vumeterlibrary/VuMeterView.java | 22 ++++++++++++++++--- .../main/res/values/attrs_vu_meter_view.xml | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/Dynamics.java b/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/Dynamics.java index 84cb87f..dbe661a 100644 --- a/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/Dynamics.java +++ b/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/Dynamics.java @@ -68,6 +68,10 @@ public boolean isAtRest() { return mIsToTarget; } + public void setAtRest(boolean atRest){ + mIsToTarget = atRest; + } + public float getPosition() { return mPosition; } diff --git a/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/VuMeterView.java b/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/VuMeterView.java index ccc562d..74ca3c1 100644 --- a/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/VuMeterView.java +++ b/vumeterlibrary/src/main/java/io/gresse/hugo/vumeterlibrary/VuMeterView.java @@ -1,12 +1,12 @@ package io.gresse.hugo.vumeterlibrary; +import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import java.util.Random; @@ -26,6 +26,7 @@ public class VuMeterView extends View { public static final int DEFAULT_BLOCK_SPACING = 20; public static final int DEFAULT_SPEED = 10; public static final int DEFAULT_STOP_SIZE = 30; + public static final boolean DEFAULT_START_OFF = false; public static final int FPS = 60; public static final int STATE_PAUSE = 0; @@ -82,18 +83,25 @@ private void init(AttributeSet attrs, int defStyle) { mBlockSpacing = a.getDimension(R.styleable.VuMeterView_blockSpacing, DEFAULT_BLOCK_SPACING); mSpeed = a.getInt(R.styleable.VuMeterView_speed, DEFAULT_SPEED); mStopSize = a.getDimension(R.styleable.VuMeterView_stopSize, DEFAULT_STOP_SIZE); + boolean startOff = a.getBoolean(R.styleable.VuMeterView_startOff, DEFAULT_START_OFF); a.recycle(); // Init initialiseCollections(); mPaint.setColor(mColor); - mState = STATE_PLAYING; + + if(startOff){ + mState = STATE_PAUSE; + } else { + mState = STATE_PLAYING; + } mDrawPass = mBlockPass = mContentHeight = mContentWidth = mPaddingLeft = mPaddingTop = mLeft = mTop = mPaddingRight = mPaddingBottom = mRight = 0; } + @SuppressLint("DrawAllocation") @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); @@ -107,6 +115,15 @@ protected void onDraw(Canvas canvas) { if (mBlockWidth == 0) { mBlockWidth = (int) ((mContentWidth - (mBlockNumber - 1) * mBlockSpacing) / mBlockNumber); + + // called if startOff is true + if(mState == STATE_PAUSE){ + int stopSize = (int) (mContentHeight - mStopSize); + for (int i = 0; i < mBlockNumber; i++) { + mDestinationValues[i] = new Dynamics(mSpeed, stopSize); + mDestinationValues[i].setAtRest(true); + } + } } @@ -296,7 +313,6 @@ public void pause(){ public void stop(boolean withAnimation){ mState = STATE_STOP; int collapseSize = (int) (mContentHeight - mStopSize); - Log.d(LOG_TAG, "collapseSize: " + collapseSize); for(int i = 0; i < mBlockNumber; i++){ if(withAnimation){ mDestinationValues[i].setTargetPosition(collapseSize); diff --git a/vumeterlibrary/src/main/res/values/attrs_vu_meter_view.xml b/vumeterlibrary/src/main/res/values/attrs_vu_meter_view.xml index 2920d4d..57f6a81 100644 --- a/vumeterlibrary/src/main/res/values/attrs_vu_meter_view.xml +++ b/vumeterlibrary/src/main/res/values/attrs_vu_meter_view.xml @@ -5,5 +5,6 @@ + From 463d98270c29b0caf3ef4b01bafee1c93cd7e116 Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 27 Aug 2015 21:14:52 +0200 Subject: [PATCH 3/5] Upgrade buildsTool to gradle 1.3.1 and android api 23 --- app/app.iml | 16 ++++++++-------- app/build.gradle | 4 ++-- app/src/main/res/menu/menu_main.xml | 7 ++++--- build.gradle | 2 +- vumeterlibrary/build.gradle | 4 ++-- vumeterlibrary/vumeterlibrary.iml | 17 +++++++---------- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/app/app.iml b/app/app.iml index 17fb6ab..d157232 100644 --- a/app/app.iml +++ b/app/app.iml @@ -36,13 +36,13 @@ - + - + @@ -71,8 +71,8 @@ - - + + @@ -88,11 +88,11 @@ - + - - - + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index fca548e..ef037a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { @@ -21,6 +21,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:appcompat-v7:23.0.0' compile project(':vumeterlibrary') } \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 8650c6b..6136a19 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -7,17 +7,18 @@ android:id="@+id/action_stop" android:orderInCategory="100" android:title="@string/action_stop" - app:showAsAction="ifRoom"/> + app:showAsAction="always" + tools:ignore="AlwaysShowAction"/> + app:showAsAction="always"/> + app:showAsAction="always"/> diff --git a/build.gradle b/build.gradle index d9448d9..e3686c4 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.3.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' diff --git a/vumeterlibrary/build.gradle b/vumeterlibrary/build.gradle index 783b11b..c18252f 100644 --- a/vumeterlibrary/build.gradle +++ b/vumeterlibrary/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'com.jfrog.bintray' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 22 + compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { @@ -24,7 +24,7 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:appcompat-v7:23.0.0' } /////////////////////////////////////////// diff --git a/vumeterlibrary/vumeterlibrary.iml b/vumeterlibrary/vumeterlibrary.iml index 198ab57..9e8ca6a 100644 --- a/vumeterlibrary/vumeterlibrary.iml +++ b/vumeterlibrary/vumeterlibrary.iml @@ -1,5 +1,5 @@ - + @@ -37,13 +37,13 @@ - + - + @@ -65,7 +65,6 @@ - @@ -85,15 +84,13 @@ - - - + - - - + + + \ No newline at end of file From 58b81a16646597af27f6f7beba107d976a76711e Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 27 Aug 2015 21:15:07 +0200 Subject: [PATCH 4/5] Update version to 1.0.10 --- app/build.gradle | 7 ++++--- vumeterlibrary/build.gradle | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ef037a8..147b140 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,9 +7,10 @@ android { defaultConfig { applicationId "io.gresse.hugo.vumeter" minSdkVersion 9 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" + targetSdkVersion 23 + versionCode 2 + versionName "1.0.10" + archivesBaseName = "VuMeterLibrary-demo-" + versionName } buildTypes { release { diff --git a/vumeterlibrary/build.gradle b/vumeterlibrary/build.gradle index c18252f..8e24a60 100644 --- a/vumeterlibrary/build.gradle +++ b/vumeterlibrary/build.gradle @@ -11,8 +11,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 23 - versionCode 10 - versionName "1.0.9" + versionCode 11 + versionName "1.0.10" } buildTypes { release { From 3421ae8888db800ef596534e5be2bcae20e92baa Mon Sep 17 00:00:00 2001 From: Hugo Gresse Date: Thu, 27 Aug 2015 21:20:22 +0200 Subject: [PATCH 5/5] Update readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db817ea..ae382f5 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ Usage vumeter:speed="10" vumeter:blockNumber="5" vumeter:blockSpacing="20dp" - vumeter:backgroundColor="#33b5e5"/> + vumeter:backgroundColor="#33b5e5" + vumeter:startOff="false"/> ``` See [DemoApp](https://github.com/HugoGresse/AndroidVuMeter/blob/master/app/src/main/java/io/gresse/hugo/vumeter/MainActivity.java) for complete usage example. @@ -40,7 +41,7 @@ Download Using Gradle: ``` -compile 'io.gresse.hugo.vumeterlibrary:vumeterlibrary:1.0.9' +compile 'io.gresse.hugo.vumeterlibrary:vumeterlibrary:1.0.10' ``` *Hosted on jCenter only.*