diff --git a/ParanoidGlyph/phone1/res/values/animations.xml b/ParanoidGlyph/phone1/res/values/animations.xml
index d5cbba8..af234e6 100644
--- a/ParanoidGlyph/phone1/res/values/animations.xml
+++ b/ParanoidGlyph/phone1/res/values/animations.xml
@@ -46,15 +46,6 @@
1
-
- - 8
- - 15
- - 14
- - 10
- - 12
- - 9
- - 11
- - 13
-
+ 8
diff --git a/ParanoidGlyph/phone2/res/values/animations.xml b/ParanoidGlyph/phone2/res/values/animations.xml
index 02a5138..b3107d0 100644
--- a/ParanoidGlyph/phone2/res/values/animations.xml
+++ b/ParanoidGlyph/phone2/res/values/animations.xml
@@ -52,23 +52,6 @@
24
-
- - 2
- - 3
- - 4
- - 5
- - 6
- - 7
- - 8
- - 14
- - 15
- - 16
- - 17
- - 18
- - 19
- - 20
- - 26
- - 27
-
+ 16
diff --git a/ParanoidGlyph/res/values/animations.xml b/ParanoidGlyph/res/values/animations.xml
index 3a9984e..b2d5409 100644
--- a/ParanoidGlyph/res/values/animations.xml
+++ b/ParanoidGlyph/res/values/animations.xml
@@ -33,7 +33,6 @@
-
-
+
diff --git a/ParanoidGlyph/src/co/aospa/glyph/Manager/AnimationManager.java b/ParanoidGlyph/src/co/aospa/glyph/Manager/AnimationManager.java
index 426228b..1beba6a 100644
--- a/ParanoidGlyph/src/co/aospa/glyph/Manager/AnimationManager.java
+++ b/ParanoidGlyph/src/co/aospa/glyph/Manager/AnimationManager.java
@@ -176,19 +176,30 @@ public final class AnimationManager {
StatusManager.setVolumeLedActive(true);
StatusManager.setAnimationActive(true);
- int[] volumeArray = ResourceUtils.getIntArray("glyph_settings_volume_levels");
+ int[] volumeArray = new int[ResourceUtils.getInteger("glyph_settings_volume_levels_num")];
int amount = (int) (Math.floor((volumeLevel / 100D) * (volumeArray.length - 1)) + 1);
+ int last = StatusManager.getVolumeLedLast();
try {
- if (checkInterruption("volume")) throw new InterruptedException();
for (int i = 0; i < volumeArray.length; i++) {
- if (checkInterruption("volume")) throw new InterruptedException();
- if ( i <= amount - 1 && volumeLevel > 0) {
- FileUtils.writeSingleLed(volumeArray[i], Constants.getBrightness());
- } else {
- FileUtils.writeSingleLed(volumeArray[i], 0);
+ if (volumeLevel == 0) {
+ if (checkInterruption("volume")) throw new InterruptedException();
+ StatusManager.setVolumeLedLast(0);
+ updateLedFrame(new int[volumeArray.length]);
+ break;
+ } else if ( i <= amount - 1 && volumeLevel > 0) {
+ if (checkInterruption("volume")) throw new InterruptedException();
+ StatusManager.setVolumeLedLast(i);
+ volumeArray[i] = Constants.getBrightness();
+ if (last == 0) {
+ updateLedFrame(volumeArray);
+ Thread.sleep(15);
+ }
}
- Thread.sleep(15);
+ }
+ if (last != 0) {
+ if (checkInterruption("volume")) throw new InterruptedException();
+ updateLedFrame(volumeArray);
}
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start <= 1800) {
@@ -196,22 +207,25 @@ public final class AnimationManager {
}
for (int i = volumeArray.length - 1; i >= 0; i--) {
if (checkInterruption("volume")) throw new InterruptedException();
- FileUtils.writeSingleLed(volumeArray[i], 0);
- Thread.sleep(15);
+ if (volumeArray[i] != 0) {
+ StatusManager.setVolumeLedLast(i);
+ volumeArray[i] = 0;
+ updateLedFrame(volumeArray);
+ Thread.sleep(15);
+ }
}
long start2 = System.currentTimeMillis();
- while (System.currentTimeMillis() - start2 <= 800) {
+ while (System.currentTimeMillis() - start2 <= 730) {
if (checkInterruption("volume")) throw new InterruptedException();
}
} catch (InterruptedException e) {
if (DEBUG) Log.d(TAG, "Exception while playing animation, interrupted | name: volume");
if (!StatusManager.isAllLedActive() && !StatusManager.isVolumeLedUpdate()) {
- for (int i : volumeArray) {
- FileUtils.writeSingleLed(i, 0);
- }
+ updateLedFrame(new int[volumeArray.length]);
}
} finally {
if (!StatusManager.isVolumeLedUpdate()) {
+ StatusManager.setVolumeLedLast(0);
StatusManager.setAnimationActive(false);
StatusManager.setVolumeLedActive(false);
}
diff --git a/ParanoidGlyph/src/co/aospa/glyph/Manager/StatusManager.java b/ParanoidGlyph/src/co/aospa/glyph/Manager/StatusManager.java
index 3bd80ec..bd0d6ca 100644
--- a/ParanoidGlyph/src/co/aospa/glyph/Manager/StatusManager.java
+++ b/ParanoidGlyph/src/co/aospa/glyph/Manager/StatusManager.java
@@ -26,6 +26,7 @@ public final class StatusManager {
private static boolean callLedActive = false;
private static boolean essentialLedActive = false;
private static boolean volumeLedActive = false;
+ private static int volumeLedLast = 0;
private static boolean volumeLedUpdate = false;
private static boolean callLedEnabled = false;
@@ -70,6 +71,14 @@ public final class StatusManager {
volumeLedActive = status;
}
+ public static int getVolumeLedLast() {
+ return volumeLedLast;
+ }
+
+ public static void setVolumeLedLast(int last) {
+ volumeLedLast = last;
+ }
+
public static boolean isVolumeLedUpdate() {
return volumeLedUpdate;
}