├── .classpath ├── .project ├── AndroidManifest.xml ├── README.md ├── bin ├── AndroidManifest.xml ├── VolumeView.apk ├── classes.dex ├── classes │ └── com │ │ └── example │ │ └── volumeview │ │ ├── BuildConfig.class │ │ ├── MainActivity$RandomThreand.class │ │ ├── MainActivity.class │ │ ├── R$attr.class │ │ ├── R$dimen.class │ │ ├── R$drawable.class │ │ ├── R$id.class │ │ ├── R$layout.class │ │ ├── R$menu.class │ │ ├── R$string.class │ │ ├── R$style.class │ │ ├── R.class │ │ ├── VolumeView$MoveThread.class │ │ ├── VolumeView.class │ │ ├── VolumeViewDoubleMoveWave$MoveThread.class │ │ ├── VolumeViewDoubleMoveWave.class │ │ ├── VolumeViewDoubleMoveWaveOpt$MoveThread.class │ │ ├── VolumeViewDoubleMoveWaveOpt.class │ │ ├── VolumeViewDoubleSine.class │ │ ├── VolumeViewMoveWave$MoveThread.class │ │ ├── VolumeViewMoveWave.class │ │ ├── VolumeViewScaleWave.class │ │ ├── VolumeViewScaleWaveOpt.class │ │ ├── VolumeViewSine.class │ │ └── VolumeViewWave.class ├── res │ └── crunch │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ └── drawable-xxhdpi │ │ └── ic_launcher.png └── resources.ap_ ├── gen └── com │ └── example │ └── volumeview │ ├── BuildConfig.java │ └── R.java ├── ic_launcher-web.png ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable-xxhdpi │ └── ic_launcher.png ├── layout │ └── activity_main.xml ├── menu │ └── main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── values-w820dp │ └── dimens.xml └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── src └── com └── example └── volumeview ├── MainActivity.java ├── VolumeView.java ├── VolumeViewDoubleMoveWave.java ├── VolumeViewDoubleMoveWaveOpt.java ├── VolumeViewDoubleSine.java ├── VolumeViewMoveWave.java ├── VolumeViewScaleWave.java ├── VolumeViewScaleWaveOpt.java ├── VolumeViewSine.java └── VolumeViewWave.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | VolumeView 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # (自定义view实现)音量波形图 2 | 3 | 标签: 自定义view 音量波形 音波 4 | 5 | --- 6 | 7 | 本文目的:主要是记录自己在实现自定义view的时候,一些思路和解决方案。 8 | 9 | ## 目标 10 | 11 | ![音量波形图][1] 12 | 13 | 绘制两个音量波形,并且能够向右运动,上面的波形移动速度慢,下面的波形移动速度快,并且振幅能够根据音量的高低进行改变。 14 | 15 | ## 分解目标 16 | 先考虑静止状态,上图有两个波形图,现只考虑一个波形图,每个波形图类似于两个正弦函数的闭合。所以我们第一步要绘制一个**正弦图形**。 17 | 18 | ![正弦函数图像][2] 19 | 20 | ## 绘制正弦函数 21 | 关于自定义view的图形绘制,一般都需要onMeasure,onLayout,onDraw三个步骤。由于是自定义view,而不是viewGroup,所以并不需要实现onLayout方法。 22 | 在绘制之前,要在onMeasure方法里,计算出画布的高度、宽度、中心点等需要计算的变量,这里就不详细说明了。 23 | 为了便于绘制图形正弦函数,要把画布的坐标原点移动到绘制view的中间位置。 24 | 也就是下图中标明的点,这样坐标原点(0,0),就位于view的中间,便于函数计算。 25 | 26 | 正弦函数方法参考: 27 | 28 | private double sine(float x, int period, float drawWidth) { 29 | return Math.sin(2 * Math.PI * period * x / drawWidth); 30 | } 31 | 32 | 其中period为在画布里有多少个周期,假设period为3,就是在画布里有三个周期。drawWidth为画布宽度。 33 | 34 | 在ondraw 方法里进行绘制。 35 | 这里调用drawsine方法 36 | 37 | private void drawSine(Canvas canvas, Path path, Paint paint, int period, float drawWidth, float amplitude) { 38 | float halfDrawWidth = drawWidth / 2f; 39 | path.reset(); 40 | path.moveTo(-halfDrawWidth, 0);//将绘制的起点移动到最左边 41 | float y; 42 | for (float x = -halfDrawWidth; x <= halfDrawWidth; x++) { 43 | y = (float) sine(x, period, drawWidth) * amplitude; 44 | path.lineTo(x, y); 45 | } 46 | canvas.drawPath(path, paint); 47 | canvas.save(); 48 | canvas.restore(); 49 | } 50 | amplitude 为振幅的高度,也就是半个画布的高度。绘制出的图形如下(在手机里,y轴正方形是向下的,x轴正方形是向右的) 51 | 52 | ![正弦函数图][3] 53 | 54 | ## 绘制两个关于y轴对称正弦函数 55 | 绘制反方向正弦函数,并且填充里面的内容。只是相当于将y值乘以-1,这里不详细列出具体代码 56 | 57 | ![两个正弦函数图][4] 58 | 59 | 进行内容填充 mPaint.setStyle(Style.FILL); 画笔的样式设置为填充,填充后的效果如下 60 | 61 | ![音波图][5] 62 | 63 | 这样勉强能算作一个波形图了。 64 | ## 缩放波形图 65 | 观察刚开始的效果图,发现每个波形的振幅并不相同,所以要考虑对波形图进行缩放。 66 | 采用缩放函数,就是按比例将振幅逐渐增大或者减小。 67 | 68 | double scaling; 69 | for (float x = -halfDrawWidth; x <= halfDrawWidth; x++) { 70 | scaling = 1 - Math.pow(x / halfDrawWidth, 2);// 对y进行缩放 71 | y = (float) (sine(x, period, drawWidth) * amplitude * (1) * Math 72 | .pow(scaling, 3)); 73 | path.lineTo(x, y); 74 | } 75 | 为了更好的效果,我们缩放了三次,Math.pow(scaling, 3) 76 | 现在感觉和图一的效果差不多了。基本满足需求,就是每个波形之间的间隙还是很小。(后续会进行优化) 77 | 78 | ![音波缩放图][6] 79 | 80 | ## 让波形图动起来 81 | 在view里定义一个移动线程MoveThread,每隔一段时间就执行一次刷新postInvalidate(),每次刷新图像的时候,都会改变该图形的相位。 82 | 所谓相位,查看下图,一个函数是sin(x),另外一个函数是sin(x+0.5),两个函数之间就相差了0.5个相位。 83 | ![正弦函数相位 + 0.5 图][7] 84 | 相位变化了0.5,看起来就会向左移动0.5的距离。(图形右上角有标注函数) 85 | 在线程中不断更新相位的取值,这样不断的刷新图形,就会看起来形成一种移动的效果。(大家可以想象以前放电影时用的胶片,实现原理类似)这样我们的图形就能运动起来了。 86 | 修改后的sine函数 87 | 88 | private double sine(float x, int period, float drawWidth, double phase) { 89 | return Math.sin(2 * Math.PI * period * (x + phase) / drawWidth); 90 | } 91 | 定义一个MoveThread 92 | 93 | private class MoveThread extends Thread { 94 | private static final int MOVE_STOP = 1; 95 | 96 | private static final int MOVE_START = 0; 97 | 98 | private int state; 99 | 100 | @Override 101 | public void run() { 102 | mPhase = 0; 103 | state = MOVE_START; 104 | while (true) { 105 | if (state == MOVE_STOP) { 106 | break; 107 | } 108 | try { 109 | sleep(30); 110 | } catch (InterruptedException e) { 111 | } 112 | mPhase -= MOVE_DISTACE; 113 | postInvalidate(); 114 | } 115 | } 116 | public void stopRunning() { 117 | state = MOVE_STOP; 118 | } 119 | } 120 | 121 | 这样当线程开启的时候,我们就能根据不断的改变sine函数的相位,就会形成不断右移动的效果。 122 | 123 | ## 绘制两个波形,并且设置不同的移动速度 124 | 两个波形的区别只是颜色不同,最大振幅不同,以及移动速度不同。 125 | 所谓移动速度不同,就是相位每次改变的值不同。可以在计算sine函数的时候,对固定相位值乘以不同的比例,就会得到不同的移动速度。从下图中的移动我们可以看到效果,已经很接近目标了。 126 | 127 | ![音波移动图形][8] 128 | 129 | (这里可以在图中看到不同的实现效果,为了便于有些同学学习和实践,将整个view进行了解剖,能更快的学习view的绘制过程) 130 | 131 | ## 根据音量改变波形图的振幅 132 | 通过音量设置波形图振幅,这样能够让波形图随着声音大小的变化而变化。 133 | 我们改变sin函数的振幅,图形就会升高或者下降。也就是在相同的x位置处,y的取值会发生变化。 134 | 135 | ![振幅不同,两个正弦的高度也不同][9] 136 | 137 | 但是,随着音频的变化,振幅的变动幅度变大,这样会造成一种图形的闪动。 138 | 139 | ## 解决图形闪动 140 | 当音量变化时,我们的振幅会发生变化,也就是这个图形,会随着振幅的变化按比例变大或者变小。如下图标记的两个点,如果我们刷新间隔为1s,就是1s之后,点1会突然变成点2的位置。这样就会造成闪动。 141 | 142 | ![点在不同的振幅,所在的高度不同][10] 143 | 144 | 我们的要求是图形要平滑的变动,意思就是不能这么快的进行变化,要怎么解决呢? 145 | 首先我们规定上升的最大速度为为1px每秒,现在的y值为1px,也就是当前1的位置。 146 | 现在只考虑点1的位置,假设我们每1s刷新一次,上升的最大速度为1px每秒,这样我们就可以计算出下一次变化y的最高位置为 1px + 1px/秒 * 1秒 = 2。 147 | 148 | - 如果当前音量发生变化,也就是振幅发生改变,得到的y值为3px,这个时候y值,3px > 149 | 我们计算的2px,这个时候就要用我们的2px。也就保证了最大速度不能超过我们规定的速度。 150 | - 如果当前音量发生变化,也就是振幅发生改变,得到的y值为1.5px,这个时候y值,1.5px < 151 | 我们计算的2px,这个时候就要用我们的1.5px。根据实际位置进行设定。 152 | 153 | 下降同理,这样我们就能保证上升或者下降的最大速度。 154 | 155 | // 计算当前时间下的振幅 156 | private float currentVolumeAmplitude(long curTime) { 157 | if (lastAmplitude == nextTargetAmplitude) { 158 | return nextTargetAmplitude; 159 | } 160 | 161 | if (curTime == amplitudeSetTime) { 162 | return lastAmplitude; 163 | } 164 | 165 | if (nextTargetAmplitude > lastAmplitude) { 166 | float target = lastAmplitude + mVerticalSpeed 167 | * (curTime - amplitudeSetTime) / 1000; 168 | if (target >= nextTargetAmplitude) { 169 | target = nextTargetAmplitude; 170 | lastAmplitude = nextTargetAmplitude; 171 | amplitudeSetTime = curTime; 172 | nextTargetAmplitude = mMinAmplitude; 173 | } 174 | return target; 175 | } 176 | 177 | if (nextTargetAmplitude < lastAmplitude) { 178 | float target = lastAmplitude - mVerticalRestoreSpeed 179 | * (curTime - amplitudeSetTime) / 1000; 180 | if (target <= nextTargetAmplitude) { 181 | target = nextTargetAmplitude; 182 | lastAmplitude = nextTargetAmplitude; 183 | amplitudeSetTime = curTime; 184 | nextTargetAmplitude = mMinAmplitude; 185 | } 186 | return target; 187 | } 188 | 189 | return mMinAmplitude; 190 | } 191 | 192 | ## 图形优化 193 | 因为中间的间隙过小,我们要把中间的间歇变大,类似于下图。这样效果可能会更好一点。 194 | 195 | ![优化后的波形图][11] 196 | 197 | 实施方案,将正弦函数上移,下面的正弦函数下移动,这样中间留有固定宽度的,通过缩放函数之后,效果如下: 198 | 199 | ![优化后的音量波形图][12] 200 | 201 | ## 实验过程中存在的问题以及解决方案: 202 | ### 中间线条的问题 203 | 横线的原因,是因为缩放造成了这 两个波形之间的点 x对应的值,y不等于0,会闭合不到中间的点。造成这个的现象是因为我们只是针对半个正弦曲线就进行填充了 204 | 205 | ![有瑕疵的波形图][13] 206 | 207 | 所以我们要将正反两个曲线画出来之后,把路径闭合之后再进行填充。这样就不会出现上面中间有横线的瑕疵 208 | 209 | ![修复后的波形图][14] 210 | 211 | ### 闪动问题 212 | 参考上文解决方案 213 | 214 | ## 可以直接使用的view 215 | 216 | 源代码地址:[https://github.com/duchao/VolumeView][15] 217 | 218 | ##可以直接使用的view 219 | VolumeView.java 220 | API: start() 开始 221 |       stop() 结束 222 |       setVolume(float volume) 设置音量 223 | 224 | [1]: http://upload-images.jianshu.io/upload_images/3050535-330c294cd7882d02.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 225 | [2]: http://upload-images.jianshu.io/upload_images/3050535-eadb0d5bbea603bd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 226 | [3]: http://upload-images.jianshu.io/upload_images/3050535-cf4afe45500e5c25.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 227 | [4]: http://upload-images.jianshu.io/upload_images/3050535-2d83125173ad0cbd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 228 | [5]: http://upload-images.jianshu.io/upload_images/3050535-d1a39b1e5ec3a2a6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 229 | [6]: http://upload-images.jianshu.io/upload_images/3050535-462a1fd28452cc6d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 230 | [7]: http://upload-images.jianshu.io/upload_images/3050535-b4cff2b8776c3600.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 231 | [8]: http://upload-images.jianshu.io/upload_images/3050535-5a9e12ec667ce851.gif?imageMogr2/auto-orient/strip 232 | [9]: http://upload-images.jianshu.io/upload_images/3050535-7c1c959115883a06.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 233 | [10]: http://upload-images.jianshu.io/upload_images/3050535-283ad28a988d46ce.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 234 | [11]: http://upload-images.jianshu.io/upload_images/3050535-4804659eb60b780a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 235 | [12]: http://upload-images.jianshu.io/upload_images/3050535-1a47d6f71bb450f1.gif?imageMogr2/auto-orient/strip 236 | [13]: http://upload-images.jianshu.io/upload_images/3050535-c2fa84fa7e1157b0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 237 | [14]: http://upload-images.jianshu.io/upload_images/3050535-42955fd827a69809.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 238 | [15]: https://github.com/duchao/VolumeView 239 | -------------------------------------------------------------------------------- /bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /bin/VolumeView.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/VolumeView.apk -------------------------------------------------------------------------------- /bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes.dex -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/BuildConfig.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/MainActivity$RandomThreand.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/MainActivity$RandomThreand.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/MainActivity.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$attr.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$dimen.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$drawable.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$id.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$layout.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$menu.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$string.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R$style.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/R.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeView$MoveThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeView$MoveThread.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeView.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewDoubleMoveWave$MoveThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewDoubleMoveWave$MoveThread.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewDoubleMoveWave.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewDoubleMoveWave.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewDoubleMoveWaveOpt$MoveThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewDoubleMoveWaveOpt$MoveThread.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewDoubleMoveWaveOpt.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewDoubleMoveWaveOpt.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewDoubleSine.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewDoubleSine.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewMoveWave$MoveThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewMoveWave$MoveThread.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewMoveWave.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewMoveWave.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewScaleWave.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewScaleWave.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewScaleWaveOpt.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewScaleWaveOpt.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewSine.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewSine.class -------------------------------------------------------------------------------- /bin/classes/com/example/volumeview/VolumeViewWave.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/classes/com/example/volumeview/VolumeViewWave.class -------------------------------------------------------------------------------- /bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/bin/resources.ap_ -------------------------------------------------------------------------------- /gen/com/example/volumeview/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.example.volumeview; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /gen/com/example/volumeview/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.example.volumeview; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class dimen { 14 | /** Default screen margins, per the Android Design guidelines. 15 | 16 | Example customization of dimensions originally defined in res/values/dimens.xml 17 | (such as screen margins) for screens with more than 820dp of available width. This 18 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). 19 | 20 | */ 21 | public static final int activity_horizontal_margin=0x7f040000; 22 | public static final int activity_vertical_margin=0x7f040001; 23 | } 24 | public static final class drawable { 25 | public static final int ic_launcher=0x7f020000; 26 | } 27 | public static final class id { 28 | public static final int action_settings=0x7f08000c; 29 | public static final int move_wave=0x7f080002; 30 | public static final int move_wave_double=0x7f080005; 31 | public static final int move_wave_double_start=0x7f080003; 32 | public static final int move_wave_double_stop=0x7f080004; 33 | public static final int move_wave_opt_double=0x7f080008; 34 | public static final int move_wave_opt_double_start=0x7f080006; 35 | public static final int move_wave_opt_double_stop=0x7f080007; 36 | public static final int move_wave_start=0x7f080000; 37 | public static final int move_wave_stop=0x7f080001; 38 | public static final int volume_view=0x7f08000b; 39 | public static final int volume_view_random_start=0x7f080009; 40 | public static final int volume_view_random_stop=0x7f08000a; 41 | } 42 | public static final class layout { 43 | public static final int activity_main=0x7f030000; 44 | } 45 | public static final class menu { 46 | public static final int main=0x7f070000; 47 | } 48 | public static final class string { 49 | public static final int action_settings=0x7f050002; 50 | public static final int app_name=0x7f050000; 51 | public static final int button_random_volume_start=0x7f05000e; 52 | public static final int button_random_volume_stop=0x7f05000f; 53 | public static final int button_start=0x7f05000c; 54 | public static final int button_stop=0x7f05000d; 55 | public static final int hello_world=0x7f050001; 56 | public static final int volume_view_double_move_wave_opt_tips=0x7f05000a; 57 | public static final int volume_view_double_move_wave_tips=0x7f050008; 58 | public static final int volume_view_double_sine_tips=0x7f050004; 59 | public static final int volume_view_move_wave_tips=0x7f050007; 60 | public static final int volume_view_scale_wave_opt_tips=0x7f050009; 61 | public static final int volume_view_scale_wave_tips=0x7f050006; 62 | public static final int volume_view_sine_tips=0x7f050003; 63 | public static final int volume_view_tips=0x7f05000b; 64 | public static final int volume_view_wave_tips=0x7f050005; 65 | } 66 | public static final class style { 67 | /** 68 | Base application theme, dependent on API level. This theme is replaced 69 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 70 | 71 | 72 | Theme customizations available in newer API levels can go in 73 | res/values-vXX/styles.xml, while customizations related to 74 | backward-compatibility can go here. 75 | 76 | 77 | Base application theme for API 11+. This theme completely replaces 78 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 79 | 80 | API 11 theme customizations can go here. 81 | 82 | Base application theme for API 14+. This theme completely replaces 83 | AppBaseTheme from BOTH res/values/styles.xml and 84 | res/values-v11/styles.xml on API 14+ devices. 85 | 86 | API 14 theme customizations can go here. 87 | */ 88 | public static final int AppBaseTheme=0x7f060000; 89 | /** Application theme. 90 | All customizations that are NOT specific to a particular API-level can go here. 91 | */ 92 | public static final int AppTheme=0x7f060001; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/ic_launcher-web.png -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-23 15 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/duchao/VolumeView/316a139a73d7fe39bb159ad61f67839e78ebde1c/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 15 | 16 | 17 | 18 | 23 | 24 | 28 | 29 | 30 | 31 | 36 | 37 | 41 | 42 | 43 | 44 | 49 | 50 | 54 | 55 | 56 | 57 | 62 | 63 | 67 | 68 | 69 | 70 | 75 | 76 | 80 | 81 |