├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── eu │ │ └── gsottbauer │ │ └── equalizerviewsample │ │ └── MainActivity.java │ └── res │ ├── layout │ └── activity_main.xml │ ├── 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 │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── equalizerview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── eu │ │ └── gsottbauer │ │ └── equalizerview │ │ └── EqualizerView.java │ └── res │ └── values │ ├── attrs.xml │ └── strings.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | settings.xml 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # IntelliJ IDEA 30 | .idea/ 31 | */.idea/ 32 | *.iml 33 | */gen-gen-external-apklibs/ 34 | */gen-external-apklibs/ 35 | 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simple Equalizer Library for Android 4 | ================================== 5 | 6 | This Android library project is developed to you use an animated equalizer for your music related apps. Original version from [@claucookie](https://github.com/claucookie/mini-equalizer-library-android). 7 | 8 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Simple%20Equalizer%20Library-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/3715) 9 | 10 | Requirements 11 | -------- 12 | Android 4.0 or higher. 13 | 14 | Installation 15 | -------- 16 | Step 1: Add this in your `build.gradle` (Project) at the end of repositories 17 | ```groovy 18 | allprojects { 19 | ... 20 | repositories { 21 | maven { url "https://jitpack.io" } 22 | } 23 | } 24 | ``` 25 | Step 2: Add this in your `build.gradle` (Module) 26 | ```groovy 27 | dependencies { 28 | implementation "com.github.gsotti:EqualizerView:v0.2" 29 | } 30 | ``` 31 | Layout 32 | -------- 33 | ````xml 34 | 45 | ```` 46 | 47 | Attributes 48 | -------- 49 | |Attribute|Description|Type|Default| 50 | |--|--|--|--| 51 | |barColor|Color of the bars|Color|Black| 52 | |barAnimationDuration|The animation follows a pattern and the number of loops is infinite. To set the duration of each loop, use this attribute|Integer (Miliseconds)| 53 | |barCount|Number of the bars|Integer| 54 | |barWidth|Width of the bars|Dimension| 55 | |marginLeft|Margin left between each bar|Dimension| 56 | |marginRight|Margin right between each bar|Dimension| 57 | |runInBatterySaveMode|Play animation if even battery saver is on|Boolean| 58 | 59 | 60 | 61 | Controlling the animation 62 | -------- 63 | 64 | ````java 65 | EqualizerView equalizer = findViewById(R.id.equalizer); 66 | equalizer.animateBars(); // To start the animation 67 | equalizer.stopBars(); // To stop the animation 68 | ```` 69 | 70 | Contribution 71 | -------- 72 | Every idea, fork and suggestion is very welcome. 73 | 74 | Author 75 | -------- 76 | Stefan Gsottbauer ([@gsotti](https://github.com/gsotti)) 77 | 78 | License 79 | -------- 80 | [MIT](https://opensource.org/licenses/MIT) 81 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | applicationId "eu.gsottbauer.equalizerview" 9 | minSdkVersion 16 10 | targetSdkVersion 23 11 | versionCode 2 12 | versionName "0.2" 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(include: ['*.jar'], dir: 'libs') 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.4.0' 26 | compile project(':equalizerview') 27 | } 28 | -------------------------------------------------------------------------------- /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 /Users/Gsottbauer/Library/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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/eu/gsottbauer/equalizerviewsample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package eu.gsottbauer.equalizerviewsample; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.util.TypedValue; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.SeekBar; 9 | import android.widget.TextView; 10 | 11 | import eu.gsottbauer.equalizerview.EqualizerView; 12 | 13 | public class MainActivity extends AppCompatActivity { 14 | 15 | private EqualizerView mEqualizerView; 16 | private Button mPlayPauseButton; 17 | private SeekBar mBarCountSeekBar; 18 | private TextView mBarCountTextView; 19 | private SeekBar mAnimationDurationSeekBar; 20 | private TextView mAnimationDurationTextView; 21 | private SeekBar mBarWidthSeekBar; 22 | private TextView mBarWidthTextView; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_main); 28 | 29 | mEqualizerView = (EqualizerView) findViewById(R.id.equalizer); 30 | mPlayPauseButton = (Button) findViewById(R.id.play_button); 31 | mBarCountTextView = (TextView) findViewById(R.id.bar_count); 32 | mAnimationDurationTextView = (TextView) findViewById(R.id.animation_duration); 33 | mBarWidthTextView = (TextView) findViewById(R.id.bar_width_textview); 34 | 35 | mBarCountSeekBar = (SeekBar) findViewById(R.id.bar_count_seekbar); 36 | mAnimationDurationSeekBar = (SeekBar) findViewById(R.id.animation_duration_seekbar); 37 | mBarWidthSeekBar= (SeekBar) findViewById(R.id.bar_width_seekbar); 38 | 39 | mPlayPauseButton.setOnClickListener(mPlayButtonOnClickListener); 40 | mBarCountSeekBar.setOnSeekBarChangeListener(mBarCountSeekBarChangeListener); 41 | mAnimationDurationSeekBar.setOnSeekBarChangeListener(mAnimationDurationSeekBarChangeListener); 42 | mBarWidthSeekBar.setOnSeekBarChangeListener(mBarWidthSeekBarChangeListener); 43 | 44 | mBarCountTextView.setText("40 Bars used"); 45 | mAnimationDurationTextView.setText("2000 ms"); 46 | mBarWidthTextView.setText("2 dp"); 47 | 48 | /* 49 | * Set Bar Color 50 | * mEqualizerView.setBarColor("#ff00ff"); 51 | * mEqualizerView.setBarColor(ContextCompat.getColor(this,R.color.colorAccent)); 52 | * 53 | * Set Bar Count 54 | * mEqualizerView.setBarCount(10); 55 | * 56 | * Set Animation Duration 57 | * mEqualizerView.setAnimationDuration(1000); 58 | * 59 | * Set Animation Value Count 60 | * mEqualizerView.setObjectAnimationValueCount(10); 61 | * 62 | * Set MarginLeft/Right 63 | * mEqualizerView.setMarginLeft(10); 64 | * mEqualizerView.setMarginRight(10); 65 | * 66 | * Set Bar Width 67 | * mEqualizerView.setBarWidth(5); 68 | * 69 | */ 70 | } 71 | 72 | private SeekBar.OnSeekBarChangeListener mBarCountSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() { 73 | @Override 74 | public void onProgressChanged(SeekBar seekBar, int i, boolean b) { 75 | mEqualizerView.stopBars(); 76 | mPlayPauseButton.setText(getString(R.string.start)); 77 | mEqualizerView.setBarCount(i + 1); 78 | mBarCountTextView.setText((i + 1) + " bars used"); 79 | } 80 | 81 | @Override 82 | public void onStartTrackingTouch(SeekBar seekBar) { 83 | 84 | } 85 | 86 | @Override 87 | public void onStopTrackingTouch(SeekBar seekBar) { 88 | 89 | } 90 | }; 91 | 92 | private SeekBar.OnSeekBarChangeListener mAnimationDurationSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() { 93 | @Override 94 | public void onProgressChanged(SeekBar seekBar, int i, boolean b) { 95 | mEqualizerView.stopBars(); 96 | mPlayPauseButton.setText(getString(R.string.start)); 97 | mEqualizerView.setAnimationDuration((i + 1) * 100); 98 | mAnimationDurationTextView.setText(((i + 1) * 100) + " ms"); 99 | } 100 | 101 | @Override 102 | public void onStartTrackingTouch(SeekBar seekBar) { 103 | 104 | } 105 | 106 | @Override 107 | public void onStopTrackingTouch(SeekBar seekBar) { 108 | 109 | } 110 | }; 111 | 112 | 113 | private SeekBar.OnSeekBarChangeListener mBarWidthSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() { 114 | @Override 115 | public void onProgressChanged(SeekBar seekBar, int i, boolean b) { 116 | mEqualizerView.stopBars(); 117 | mPlayPauseButton.setText(getString(R.string.start)); 118 | 119 | int width = (i <= 0) ? -1 : (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, i, getResources().getDisplayMetrics()); 120 | 121 | mEqualizerView.setBarWidth(width); 122 | mBarWidthTextView.setText(((i)) + " dp"); 123 | } 124 | 125 | @Override 126 | public void onStartTrackingTouch(SeekBar seekBar) { 127 | 128 | } 129 | 130 | @Override 131 | public void onStopTrackingTouch(SeekBar seekBar) { 132 | 133 | } 134 | }; 135 | 136 | 137 | 138 | 139 | private View.OnClickListener mPlayButtonOnClickListener = new View.OnClickListener() { 140 | @Override 141 | public void onClick(View view) { 142 | if (mEqualizerView.isAnimating()) { 143 | mEqualizerView.stopBars(); 144 | mPlayPauseButton.setText(getString(R.string.start)); 145 | } else { 146 | mEqualizerView.animateBars(); 147 | mPlayPauseButton.setText(getString(R.string.stop)); 148 | } 149 | } 150 | }; 151 | } 152 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 22 | 23 | 33 | 34 | 35 |