Skip to content

Commit 56811d6

Browse files
authored
Merge pull request #1 from scrobot/develop
raw sources of feature
2 parents efe1e37 + c7824e2 commit 56811d6

36 files changed

Lines changed: 198 additions & 23 deletions

File tree

4 Bytes
Binary file not shown.

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

audiovisualizer/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ apply plugin: 'com.android.library'
33
android {
44
compileSdkVersion 28
55

6-
7-
86
defaultConfig {
97
minSdkVersion 15
108
targetSdkVersion 28

audiovisualizer/src/main/java/com/github/scrobot/audiovisualizer/PlayerVisualizerView.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.scrobot.audiovisualizer;
22

33
import android.content.Context;
4+
import android.content.res.TypedArray;
45
import android.graphics.Canvas;
56
import android.graphics.Paint;
67
import android.support.annotation.Nullable;
@@ -38,13 +39,26 @@ public class PlayerVisualizerView extends View {
3839
private int width;
3940
private int height;
4041

42+
private int playedStateColor;
43+
private int nonPlayedStateColor;
44+
4145
public PlayerVisualizerView(Context context) {
4246
super(context);
4347
init();
4448
}
4549

4650
public PlayerVisualizerView(Context context, @Nullable AttributeSet attrs) {
4751
super(context, attrs);
52+
53+
TypedArray a = context.obtainStyledAttributes(attrs,
54+
R.styleable.PlayerVisualizerView, 0, 0);
55+
playedStateColor = a.getColor(R.styleable.PlayerVisualizerView_statePlayingColor,
56+
ContextCompat.getColor(context, R.color.gray));
57+
nonPlayedStateColor = a.getColor(R.styleable.PlayerVisualizerView_stateNonPlayingColor,
58+
ContextCompat.getColor(context, R.color.black));
59+
60+
a.recycle();
61+
4862
init();
4963
}
5064

@@ -53,10 +67,10 @@ private void init() {
5367

5468
playedStatePainting.setStrokeWidth(1f);
5569
playedStatePainting.setAntiAlias(true);
56-
playedStatePainting.setColor(ContextCompat.getColor(getContext(), R.color.gray));
70+
playedStatePainting.setColor(playedStateColor);
5771
notPlayedStatePainting.setStrokeWidth(1f);
5872
notPlayedStatePainting.setAntiAlias(true);
59-
notPlayedStatePainting.setColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
73+
notPlayedStatePainting.setColor(nonPlayedStateColor);
6074
}
6175

6276
/**
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="PlayerVisualizerView">
4+
<attr name="statePlayingColor" format="color" />
5+
<attr name="stateNonPlayingColor" format="color" />
6+
</declare-styleable>
7+
8+
</resources>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="gray">#CCCCCC</color>
4+
<color name="black">#000000</color>
5+
</resources>
File renamed without changes.

0 commit comments

Comments
 (0)