diff options
-rw-r--r-- | .classpath | 8 | ||||
-rw-r--r-- | .project | 33 | ||||
-rw-r--r-- | AndroidManifest.xml | 27 | ||||
-rw-r--r-- | demo/demo-1.gif | bin | 1380348 -> 0 bytes | |||
-rw-r--r-- | demo/demo-2.gif | bin | 1801970 -> 0 bytes | |||
-rw-r--r-- | demo/demo-3.gif | bin | 1905223 -> 0 bytes | |||
-rw-r--r-- | demo/demo-4.gif | bin | 1953753 -> 0 bytes | |||
-rw-r--r-- | demo/demo.m4v | bin | 18808901 -> 0 bytes | |||
-rw-r--r-- | proguard.cfg | 40 | ||||
-rw-r--r-- | project.properties | 11 | ||||
-rw-r--r-- | res/drawable-hdpi/ic_launcher.png | bin | 4147 -> 0 bytes | |||
-rw-r--r-- | res/drawable-ldpi/ic_launcher.png | bin | 1723 -> 0 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_launcher.png | bin | 2574 -> 0 bytes | |||
-rw-r--r-- | res/drawable/bg.xml | 11 | ||||
-rw-r--r-- | res/layout/main.xml | 97 | ||||
-rw-r--r-- | res/raw/test.mp3 | bin | 225576 -> 0 bytes | |||
-rw-r--r-- | res/raw/workaround_1min.mp3 | bin | 961305 -> 0 bytes | |||
-rw-r--r-- | res/values/strings.xml | 7 | ||||
-rw-r--r-- | src/com/pheelicks/app/MainActivity.java | 208 | ||||
-rw-r--r-- | src/com/pheelicks/utils/SystemPropertiesProxy.java | 73 | ||||
-rw-r--r-- | src/com/pheelicks/utils/TunnelPlayerWorkaround.java | 72 |
21 files changed, 0 insertions, 587 deletions
diff --git a/.classpath b/.classpath deleted file mode 100644 index a4763d1..0000000 --- a/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="gen"/> - <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> - <classpathentry kind="output" path="bin/classes"/> -</classpath> diff --git a/.project b/.project deleted file mode 100644 index f09ea83..0000000 --- a/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Visualizer</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.ApkBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>com.android.ide.eclipse.adt.AndroidNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index a1235d8..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.pheelicks.visualizer" - android:versionCode="1" - android:versionName="1.0" > - - <uses-sdk android:minSdkVersion="9" /> - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" > - <activity - android:configChanges="orientation|keyboard|keyboardHidden" - android:label="@string/app_name" - android:name="com.pheelicks.app.MainActivity" - android:screenOrientation="portrait" > - <intent-filter > - <action android:name="android.intent.action.MAIN" /> - - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - - <uses-permission android:name="android.permission.RECORD_AUDIO" /> - -</manifest>
\ No newline at end of file diff --git a/demo/demo-1.gif b/demo/demo-1.gif Binary files differdeleted file mode 100644 index 46f5970..0000000 --- a/demo/demo-1.gif +++ /dev/null diff --git a/demo/demo-2.gif b/demo/demo-2.gif Binary files differdeleted file mode 100644 index e34a0e1..0000000 --- a/demo/demo-2.gif +++ /dev/null diff --git a/demo/demo-3.gif b/demo/demo-3.gif Binary files differdeleted file mode 100644 index c57bcf7..0000000 --- a/demo/demo-3.gif +++ /dev/null diff --git a/demo/demo-4.gif b/demo/demo-4.gif Binary files differdeleted file mode 100644 index 2dcc1e2..0000000 --- a/demo/demo-4.gif +++ /dev/null diff --git a/demo/demo.m4v b/demo/demo.m4v Binary files differdeleted file mode 100644 index 7151468..0000000 --- a/demo/demo.m4v +++ /dev/null diff --git a/proguard.cfg b/proguard.cfg deleted file mode 100644 index b1cdf17..0000000 --- a/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native <methods>; -} - --keepclasseswithmembers class * { - public <init>(android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public <init>(android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/project.properties b/project.properties deleted file mode 100644 index 113acb7..0000000 --- a/project.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-9 diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 8074c4c..0000000 --- a/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/res/drawable-ldpi/ic_launcher.png b/res/drawable-ldpi/ic_launcher.png Binary files differdeleted file mode 100644 index 1095584..0000000 --- a/res/drawable-ldpi/ic_launcher.png +++ /dev/null diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index a07c69f..0000000 --- a/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/res/drawable/bg.xml b/res/drawable/bg.xml deleted file mode 100644 index 3fadd34..0000000 --- a/res/drawable/bg.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape - xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <gradient - android:startColor="#acacac" - android:centerColor="#4f4f4f" - android:endColor="#3f3f3f" - android:angle="-90"> - </gradient> -</shape>
\ No newline at end of file diff --git a/res/layout/main.xml b/res/layout/main.xml deleted file mode 100644 index bc323a8..0000000 --- a/res/layout/main.xml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@drawable/bg" - android:orientation="vertical" > - - <FrameLayout - android:layout_width="fill_parent" - android:layout_height="0dp" - android:layout_margin="10dp" - android:layout_weight="1" - android:background="#000" > - - <com.pheelicks.visualizer.VisualizerView - android:id="@+id/visualizerView" - android:layout_width="fill_parent" - android:layout_height="fill_parent" > - </com.pheelicks.visualizer.VisualizerView> - </FrameLayout> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_weight="0" > - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.25" - android:onClick="barPressed" - android:text="Bar" > - </Button> - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.25" - android:onClick="circlePressed" - android:text="Circle" > - </Button> - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.25" - android:onClick="circleBarPressed" - android:text="Circle Bar" > - </Button> - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.25" - android:onClick="linePressed" - android:text="Line" > - </Button> - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.25" - android:onClick="clearPressed" - android:text="Clear" > - </Button> - </LinearLayout> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_weight="0" > - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.5" - android:onClick="startPressed" - android:text="Start" > - </Button> - - <Button - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:layout_weight="0.5" - android:onClick="stopPressed" - android:text="Stop" > - </Button> - </LinearLayout> - -</LinearLayout>
\ No newline at end of file diff --git a/res/raw/test.mp3 b/res/raw/test.mp3 Binary files differdeleted file mode 100644 index 14ce147..0000000 --- a/res/raw/test.mp3 +++ /dev/null diff --git a/res/raw/workaround_1min.mp3 b/res/raw/workaround_1min.mp3 Binary files differdeleted file mode 100644 index 199d19c..0000000 --- a/res/raw/workaround_1min.mp3 +++ /dev/null diff --git a/res/values/strings.xml b/res/values/strings.xml deleted file mode 100644 index b40cf1d..0000000 --- a/res/values/strings.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <string name="hello">Hello World, VisualizerActivity!</string> - <string name="app_name">Visualizer</string> - -</resources>
\ No newline at end of file diff --git a/src/com/pheelicks/app/MainActivity.java b/src/com/pheelicks/app/MainActivity.java deleted file mode 100644 index a2d52dd..0000000 --- a/src/com/pheelicks/app/MainActivity.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Copyright 2011, Felix Palmer - * - * Licensed under the MIT license: - * http://creativecommons.org/licenses/MIT/ - */ -package com.pheelicks.app; - -import java.io.IOException; - -import android.app.Activity; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PorterDuff.Mode; -import android.graphics.PorterDuffXfermode; -import android.media.MediaPlayer; -import android.os.Bundle; -import android.view.View; - -import com.pheelicks.utils.TunnelPlayerWorkaround; -import com.pheelicks.visualizer.R; -import com.pheelicks.visualizer.VisualizerView; -import com.pheelicks.visualizer.renderer.BarGraphRenderer; -import com.pheelicks.visualizer.renderer.CircleBarRenderer; -import com.pheelicks.visualizer.renderer.CircleRenderer; -import com.pheelicks.visualizer.renderer.LineRenderer; - -/** - * Demo to show how to use VisualizerView - */ -public class MainActivity extends Activity { - private MediaPlayer mPlayer; - private MediaPlayer mSilentPlayer; /* to avoid tunnel player issue */ - private VisualizerView mVisualizerView; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } - - @Override - protected void onResume() - { - super.onResume(); - initTunnelPlayerWorkaround(); - init(); - } - - @Override - protected void onPause() - { - cleanUp(); - super.onPause(); - } - - @Override - protected void onDestroy() - { - cleanUp(); - super.onDestroy(); - } - - private void init() - { - mPlayer = MediaPlayer.create(this, R.raw.test); - mPlayer.setLooping(true); - mPlayer.start(); - - // We need to link the visualizer view to the media player so that - // it displays something - mVisualizerView = (VisualizerView) findViewById(R.id.visualizerView); - mVisualizerView.link(mPlayer); - - // Start with just line renderer - addLineRenderer(); - } - - private void cleanUp() - { - if (mPlayer != null) - { - mVisualizerView.release(); - mPlayer.release(); - mPlayer = null; - } - - if (mSilentPlayer != null) - { - mSilentPlayer.release(); - mSilentPlayer = null; - } - } - - // Workaround (for Galaxy S4) - // - // "Visualization does not work on the new Galaxy devices" - // https://github.com/felixpalmer/android-visualizer/issues/5 - // - // NOTE: - // This code is not required for visualizing default "test.mp3" file, - // because tunnel player is used when duration is longer than 1 minute. - // (default "test.mp3" file: 8 seconds) - // - private void initTunnelPlayerWorkaround() { - // Read "tunnel.decode" system property to determine - // the workaround is needed - if (TunnelPlayerWorkaround.isTunnelDecodeEnabled(this)) { - mSilentPlayer = TunnelPlayerWorkaround.createSilentMediaPlayer(this); - } - } - - // Methods for adding renderers to visualizer - private void addBarGraphRenderers() - { - Paint paint = new Paint(); - paint.setStrokeWidth(50f); - paint.setAntiAlias(true); - paint.setColor(Color.argb(200, 56, 138, 252)); - BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(16, paint, false); - mVisualizerView.addRenderer(barGraphRendererBottom); - - Paint paint2 = new Paint(); - paint2.setStrokeWidth(12f); - paint2.setAntiAlias(true); - paint2.setColor(Color.argb(200, 181, 111, 233)); - BarGraphRenderer barGraphRendererTop = new BarGraphRenderer(4, paint2, true); - mVisualizerView.addRenderer(barGraphRendererTop); - } - - private void addCircleBarRenderer() - { - Paint paint = new Paint(); - paint.setStrokeWidth(8f); - paint.setAntiAlias(true); - paint.setXfermode(new PorterDuffXfermode(Mode.LIGHTEN)); - paint.setColor(Color.argb(255, 222, 92, 143)); - CircleBarRenderer circleBarRenderer = new CircleBarRenderer(paint, 32, true); - mVisualizerView.addRenderer(circleBarRenderer); - } - - private void addCircleRenderer() - { - Paint paint = new Paint(); - paint.setStrokeWidth(3f); - paint.setAntiAlias(true); - paint.setColor(Color.argb(255, 222, 92, 143)); - CircleRenderer circleRenderer = new CircleRenderer(paint, true); - mVisualizerView.addRenderer(circleRenderer); - } - - private void addLineRenderer() - { - Paint linePaint = new Paint(); - linePaint.setStrokeWidth(1f); - linePaint.setAntiAlias(true); - linePaint.setColor(Color.argb(88, 0, 128, 255)); - - Paint lineFlashPaint = new Paint(); - lineFlashPaint.setStrokeWidth(5f); - lineFlashPaint.setAntiAlias(true); - lineFlashPaint.setColor(Color.argb(188, 255, 255, 255)); - LineRenderer lineRenderer = new LineRenderer(linePaint, lineFlashPaint, true); - mVisualizerView.addRenderer(lineRenderer); - } - - // Actions for buttons defined in xml - public void startPressed(View view) throws IllegalStateException, IOException - { - if(mPlayer.isPlaying()) - { - return; - } - mPlayer.prepare(); - mPlayer.start(); - } - - public void stopPressed(View view) - { - mPlayer.stop(); - } - - public void barPressed(View view) - { - addBarGraphRenderers(); - } - - public void circlePressed(View view) - { - addCircleRenderer(); - } - - public void circleBarPressed(View view) - { - addCircleBarRenderer(); - } - - public void linePressed(View view) - { - addLineRenderer(); - } - - public void clearPressed(View view) - { - mVisualizerView.clearRenderers(); - } -}
\ No newline at end of file diff --git a/src/com/pheelicks/utils/SystemPropertiesProxy.java b/src/com/pheelicks/utils/SystemPropertiesProxy.java deleted file mode 100644 index 6e49979..0000000 --- a/src/com/pheelicks/utils/SystemPropertiesProxy.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright 2013, Haruki Hasegawa - * - * Licensed under the MIT license: - * http://creativecommons.org/licenses/MIT/ - */ - -/** - * from http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties - */ - -package com.pheelicks.utils; - -import java.lang.reflect.Method; - -import android.content.Context; -import android.util.Log; - -public class SystemPropertiesProxy { - private static final String TAG = "SystemPropertiesProxy"; - - /** - * Get the value for the given key, returned as a boolean. Values 'n', 'no', - * '0', 'false' or 'off' are considered false. Values 'y', 'yes', '1', 'true' - * or 'on' are considered true. (case insensitive). If the key does not exist, - * or has any other value, then the default result is returned. - * - * @param key the key to lookup - * @param def a default value to return - * @return the key parsed as a boolean, or def if the key isn't found or is - * not able to be parsed as a boolean. - * @throws IllegalArgumentException if the key exceeds 32 characters - */ - public static Boolean getBoolean(Context context, String key, boolean def) - throws IllegalArgumentException { - return getBoolean(context.getClassLoader(), key, def); - } - - public static Boolean getBoolean(ClassLoader cl, String key, boolean def) - throws IllegalArgumentException { - - Boolean ret = def; - - try { - @SuppressWarnings("rawtypes") - Class SystemProperties = cl.loadClass("android.os.SystemProperties"); - - // Parameters Types - @SuppressWarnings("rawtypes") - Class[] paramTypes = new Class[2]; - paramTypes[0] = String.class; - paramTypes[1] = boolean.class; - - @SuppressWarnings("unchecked") - Method getBoolean = SystemProperties.getMethod("getBoolean", paramTypes); - - // Parameters - Object[] params = new Object[2]; - params[0] = new String(key); - params[1] = Boolean.valueOf(def); - - ret = (Boolean) getBoolean.invoke(SystemProperties, params); - - } catch (IllegalArgumentException iAE) { - throw iAE; - } catch (Exception e) { - Log.e(TAG, "getBoolean(context, key: " + key + ", def:" + def + ")", e); - ret = def; - } - - return ret; - } -} diff --git a/src/com/pheelicks/utils/TunnelPlayerWorkaround.java b/src/com/pheelicks/utils/TunnelPlayerWorkaround.java deleted file mode 100644 index c25caf0..0000000 --- a/src/com/pheelicks/utils/TunnelPlayerWorkaround.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2013, Haruki Hasegawa - * - * Licensed under the MIT license: - * http://creativecommons.org/licenses/MIT/ - */ - -package com.pheelicks.utils; - -import java.io.IOException; - -import android.content.Context; -import android.media.AudioManager; -import android.media.MediaPlayer; -import android.util.Log; - -import com.pheelicks.visualizer.R; - -public class TunnelPlayerWorkaround { - private static final String TAG = "TunnelPlayerWorkaround"; - - private static final String SYSTEM_PROP_TUNNEL_DECODE_ENABLED = "tunnel.decode"; - - private TunnelPlayerWorkaround() - { - } - - /** - * Obtain "tunnel.decode" system property value - * - * @param context Context - * @return Whether tunnel player is enabled - */ - public static boolean isTunnelDecodeEnabled(Context context) - { - return SystemPropertiesProxy.getBoolean( - context, SYSTEM_PROP_TUNNEL_DECODE_ENABLED, false); - } - - /** - * Create silent MediaPlayer instance to avoid tunnel player issue - * - * @param context Context - * @return MediaPlayer instance - */ - public static MediaPlayer createSilentMediaPlayer(Context context) - { - boolean result = false; - - MediaPlayer mp = null; - try { - mp = MediaPlayer.create(context, R.raw.workaround_1min); - mp.setAudioStreamType(AudioManager.STREAM_MUSIC); - - // NOTE: start() is no needed - // mp.start(); - - result = true; - } catch (RuntimeException e) { - Log.e(TAG, "createSilentMediaPlayer()", e); - } finally { - if (!result && mp != null) { - try { - mp.release(); - } catch (IllegalStateException e) { - } - } - } - - return mp; - } -} |