ParanoidGlyph: Final changes for Phone (2)
Change-Id: I625f111b4b3c4a1c4ab35dbc7163b34831df57d0
This commit is contained in:
committed by
Wiktor Rudzki
parent
ac11602d5e
commit
5e75aedcae
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2022-2023 Paranoid Android
|
||||
// Copyright (C) 2022-2024 Paranoid Android
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
||||
2017-2018 The LineageOS Project
|
||||
2020-2023 Paranoid Android
|
||||
2020-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022-2023 Paranoid Android
|
||||
~ Copyright (C) 2022-2024 Paranoid Android
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022-2023 Paranoid Android
|
||||
~ Copyright (C) 2022-2024 Paranoid Android
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -44,6 +44,7 @@
|
||||
<!-- Notification Animations -->
|
||||
<string name="glyph_settings_notifs_animations_default" translatable="false">Break (Custom)</string>
|
||||
<string name="glyph_settings_notifs_essential_slug" translatable="false">slant</string>
|
||||
<integer name="glyph_settings_notifs_essential_led" translatable="false"></integer>
|
||||
|
||||
<!-- Volume Animation -->
|
||||
<integer-array name="glyph_settings_volume_levels" translatable="false">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,9 @@
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Device -->
|
||||
<string name="glyph_settings_device" translatable="false">phone1</string>
|
||||
|
||||
<!-- Brighntess -->
|
||||
<integer name="glyph_settings_brightness_max" translatable="false">4095</integer>
|
||||
<integer-array name="glyph_settings_brightness_levels" translatable="false">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@
|
||||
<!-- Notification Animations -->
|
||||
<string name="glyph_settings_notifs_animations_default" translatable="false"></string>
|
||||
<string name="glyph_settings_notifs_essential_slug" translatable="false"></string>
|
||||
<integer name="glyph_settings_notifs_essential_led" translatable="false"></integer>
|
||||
|
||||
<!-- Volume Animation -->
|
||||
<integer-array name="glyph_settings_volume_levels" translatable="false">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,9 @@
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Device -->
|
||||
<string name="glyph_settings_device" translatable="false"></string>
|
||||
|
||||
<!-- Brighntess -->
|
||||
<integer name="glyph_settings_brightness_max" translatable="false"></integer>
|
||||
<integer-array name="glyph_settings_brightness_levels" translatable="false">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 Paranoid Android
|
||||
Copyright (C) 2023-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
Copyright (C) 2013-2016 The CyanogenMod Project
|
||||
2017 The LineageOS Project
|
||||
2020-2023 Paranoid Android
|
||||
2020-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022-2023 Paranoid Android
|
||||
Copyright (C) 2022-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022-2023 Paranoid Android
|
||||
Copyright (C) 2022-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
Copyright (C) 2015 The CyanogenMod Project
|
||||
2018-2019 The LineageOS Project
|
||||
2020-2023 Paranoid Android
|
||||
2020-2024 Paranoid Android
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2017-2019 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,8 @@ public final class Constants {
|
||||
|
||||
public static Context CONTEXT;
|
||||
|
||||
private static String device = null;
|
||||
|
||||
private static int brightness = -1;
|
||||
private static int brightnessMax = -1;
|
||||
private static int[] brightnessLevels = null;
|
||||
@@ -64,6 +66,13 @@ public final class Constants {
|
||||
"com.android.systemui:BAT"
|
||||
};
|
||||
|
||||
public static String getDevice() {
|
||||
if (device == null)
|
||||
device = ResourceUtils.getString("glyph_settings_device");
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
public static boolean setBrightness(int b) {
|
||||
if (b > ResourceUtils.getInteger("glyph_settings_brightness_max"))
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -104,34 +104,78 @@ public final class AnimationManager {
|
||||
if (checkInterruption("csv")) throw new InterruptedException();
|
||||
line = line.endsWith(",") ? line.substring(0, line.length() - 1) : line;
|
||||
String[] split = line.split(",");
|
||||
if (slugs.length == 5 && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
if (Constants.getDevice().equals("phone1") && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
for (int i = 0; i < slugs.length; i++) {
|
||||
updateLedZone(slugs[i], split[i]);
|
||||
}
|
||||
} else if (slugs.length == 11 && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
updateLedZone(slugs[1], split[0]);
|
||||
updateLedZone(slugs[2], split[0]);
|
||||
updateLedZone(slugs[3], split[1]);
|
||||
updateLedZone(slugs[4], split[2]);
|
||||
updateLedZone(slugs[5], split[2]);
|
||||
updateLedZone(slugs[6], split[2]);
|
||||
updateLedZone(slugs[7], split[2]);
|
||||
updateLedZone(slugs[8], split[2]);
|
||||
updateLedZone(slugs[9], split[2]);
|
||||
updateLedZone(slugs[10], split[3]);
|
||||
updateLedZone(slugs[11], split[4]);
|
||||
} else if (slugs.length == 11 && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
updateLedZone(slugs[1], split[0]);
|
||||
updateLedZone(slugs[2], split[1]);
|
||||
updateLedZone(slugs[3], split[2]);
|
||||
updateLedZone(slugs[4], split[3]);
|
||||
updateLedZone(slugs[5], split[19]);
|
||||
updateLedZone(slugs[6], split[20]);
|
||||
updateLedZone(slugs[7], split[21]);
|
||||
updateLedZone(slugs[8], split[22]);
|
||||
updateLedZone(slugs[9], split[23]);
|
||||
updateLedZone(slugs[10], split[25]);
|
||||
updateLedZone(slugs[11], split[24]);
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
updateLedSingle(12, split[0]);
|
||||
updateLedSingle(0, split[0]);
|
||||
updateLedSingle(24, split[1]);
|
||||
updateLedSingle(2, split[2]);
|
||||
updateLedSingle(3, split[2]);
|
||||
updateLedSingle(4, split[2]);
|
||||
updateLedSingle(5, split[2]);
|
||||
updateLedSingle(6, split[2]);
|
||||
updateLedSingle(7, split[2]);
|
||||
updateLedSingle(8, split[2]);
|
||||
updateLedSingle(14, split[2]);
|
||||
updateLedSingle(15, split[2]);
|
||||
updateLedSingle(16, split[2]);
|
||||
updateLedSingle(17, split[2]);
|
||||
updateLedSingle(18, split[2]);
|
||||
updateLedSingle(19, split[2]);
|
||||
updateLedSingle(20, split[2]);
|
||||
updateLedSingle(26, split[2]);
|
||||
updateLedSingle(27, split[2]);
|
||||
updateLedSingle(28, split[2]);
|
||||
updateLedSingle(29, split[2]);
|
||||
updateLedSingle(30, split[2]);
|
||||
updateLedSingle(31, split[2]);
|
||||
updateLedSingle(23, split[2]);
|
||||
updateLedSingle(9, split[3]);
|
||||
updateLedSingle(21, split[4]);
|
||||
updateLedSingle(33, split[4]);
|
||||
updateLedSingle(10, split[4]);
|
||||
updateLedSingle(22, split[4]);
|
||||
updateLedSingle(34, split[4]);
|
||||
updateLedSingle(11, split[4]);
|
||||
updateLedSingle(23, split[4]);
|
||||
updateLedSingle(35, split[4]);
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
updateLedSingle(12, split[0]);
|
||||
updateLedSingle(0, split[1]);
|
||||
updateLedSingle(24, split[2]);
|
||||
updateLedSingle(2, split[3]);
|
||||
updateLedSingle(3, split[4]);
|
||||
updateLedSingle(4, split[5]);
|
||||
updateLedSingle(5, split[6]);
|
||||
updateLedSingle(6, split[7]);
|
||||
updateLedSingle(7, split[8]);
|
||||
updateLedSingle(8, split[9]);
|
||||
updateLedSingle(14, split[10]);
|
||||
updateLedSingle(15, split[11]);
|
||||
updateLedSingle(16, split[12]);
|
||||
updateLedSingle(17, split[13]);
|
||||
updateLedSingle(18, split[14]);
|
||||
updateLedSingle(19, split[15]);
|
||||
updateLedSingle(20, split[16]);
|
||||
updateLedSingle(26, split[17]);
|
||||
updateLedSingle(27, split[18]);
|
||||
updateLedSingle(28, split[19]);
|
||||
updateLedSingle(29, split[20]);
|
||||
updateLedSingle(30, split[21]);
|
||||
updateLedSingle(31, split[22]);
|
||||
updateLedSingle(23, split[23]);
|
||||
updateLedSingle(9, split[24]);
|
||||
updateLedSingle(21, split[25]);
|
||||
updateLedSingle(33, split[26]);
|
||||
updateLedSingle(10, split[27]);
|
||||
updateLedSingle(22, split[28]);
|
||||
updateLedSingle(34, split[29]);
|
||||
updateLedSingle(11, split[30]);
|
||||
updateLedSingle(23, split[31]);
|
||||
updateLedSingle(35, split[32]);
|
||||
} else {
|
||||
if (DEBUG) Log.d(TAG, "Animation line length mismatch | name: " + name + " | line: " + line);
|
||||
throw new InterruptedException();
|
||||
@@ -141,8 +185,14 @@ public final class AnimationManager {
|
||||
} catch (Exception e) {
|
||||
if (DEBUG) Log.d(TAG, "Exception while playing animation | name: " + name + " | exception: " + e);
|
||||
} finally {
|
||||
for (String slug : slugs) {
|
||||
updateLedZone(slug, 0);
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
for (String slug : slugs) {
|
||||
updateLedZone(slug, 0);
|
||||
}
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
for (int led=0; led <= 35; led++) {
|
||||
updateLedSingle(led, 0);
|
||||
}
|
||||
}
|
||||
StatusManager.setAnimationActive(false);
|
||||
if (DEBUG) Log.d(TAG, "Done playing animation | name: " + name);
|
||||
@@ -265,34 +315,78 @@ public final class AnimationManager {
|
||||
if (checkInterruption("call")) throw new InterruptedException();
|
||||
line = line.endsWith(",") ? line.substring(0, line.length() - 1) : line;
|
||||
String[] split = line.split(",");
|
||||
if (slugs.length == 5 && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
if (Constants.getDevice().equals("phone1") && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
for (int i = 0; i < slugs.length; i++) {
|
||||
updateLedZone(slugs[i], split[i]);
|
||||
}
|
||||
} else if (slugs.length == 11 && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
updateLedZone(slugs[0], split[0]);
|
||||
updateLedZone(slugs[1], split[0]);
|
||||
updateLedZone(slugs[2], split[1]);
|
||||
updateLedZone(slugs[3], split[2]);
|
||||
updateLedZone(slugs[4], split[2]);
|
||||
updateLedZone(slugs[5], split[2]);
|
||||
updateLedZone(slugs[6], split[2]);
|
||||
updateLedZone(slugs[7], split[2]);
|
||||
updateLedZone(slugs[8], split[2]);
|
||||
updateLedZone(slugs[9], split[3]);
|
||||
updateLedZone(slugs[10], split[4]);
|
||||
} else if (slugs.length == 11 && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
updateLedZone(slugs[0], split[0]);
|
||||
updateLedZone(slugs[1], split[1]);
|
||||
updateLedZone(slugs[2], split[2]);
|
||||
updateLedZone(slugs[3], split[3]);
|
||||
updateLedZone(slugs[4], split[19]);
|
||||
updateLedZone(slugs[5], split[20]);
|
||||
updateLedZone(slugs[6], split[21]);
|
||||
updateLedZone(slugs[7], split[22]);
|
||||
updateLedZone(slugs[8], split[23]);
|
||||
updateLedZone(slugs[9], split[25]);
|
||||
updateLedZone(slugs[10], split[24]);
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
updateLedSingle(12, split[0]);
|
||||
updateLedSingle(0, split[0]);
|
||||
updateLedSingle(24, split[1]);
|
||||
updateLedSingle(2, split[2]);
|
||||
updateLedSingle(3, split[2]);
|
||||
updateLedSingle(4, split[2]);
|
||||
updateLedSingle(5, split[2]);
|
||||
updateLedSingle(6, split[2]);
|
||||
updateLedSingle(7, split[2]);
|
||||
updateLedSingle(8, split[2]);
|
||||
updateLedSingle(14, split[2]);
|
||||
updateLedSingle(15, split[2]);
|
||||
updateLedSingle(16, split[2]);
|
||||
updateLedSingle(17, split[2]);
|
||||
updateLedSingle(18, split[2]);
|
||||
updateLedSingle(19, split[2]);
|
||||
updateLedSingle(20, split[2]);
|
||||
updateLedSingle(26, split[2]);
|
||||
updateLedSingle(27, split[2]);
|
||||
updateLedSingle(28, split[2]);
|
||||
updateLedSingle(29, split[2]);
|
||||
updateLedSingle(30, split[2]);
|
||||
updateLedSingle(31, split[2]);
|
||||
updateLedSingle(23, split[2]);
|
||||
updateLedSingle(9, split[3]);
|
||||
updateLedSingle(21, split[4]);
|
||||
updateLedSingle(33, split[4]);
|
||||
updateLedSingle(10, split[4]);
|
||||
updateLedSingle(22, split[4]);
|
||||
updateLedSingle(34, split[4]);
|
||||
updateLedSingle(11, split[4]);
|
||||
updateLedSingle(23, split[4]);
|
||||
updateLedSingle(35, split[4]);
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
updateLedSingle(12, split[0]);
|
||||
updateLedSingle(0, split[1]);
|
||||
updateLedSingle(24, split[2]);
|
||||
updateLedSingle(2, split[3]);
|
||||
updateLedSingle(3, split[4]);
|
||||
updateLedSingle(4, split[5]);
|
||||
updateLedSingle(5, split[6]);
|
||||
updateLedSingle(6, split[7]);
|
||||
updateLedSingle(7, split[8]);
|
||||
updateLedSingle(8, split[9]);
|
||||
updateLedSingle(14, split[10]);
|
||||
updateLedSingle(15, split[11]);
|
||||
updateLedSingle(16, split[12]);
|
||||
updateLedSingle(17, split[13]);
|
||||
updateLedSingle(18, split[14]);
|
||||
updateLedSingle(19, split[15]);
|
||||
updateLedSingle(20, split[16]);
|
||||
updateLedSingle(26, split[17]);
|
||||
updateLedSingle(27, split[18]);
|
||||
updateLedSingle(28, split[19]);
|
||||
updateLedSingle(29, split[20]);
|
||||
updateLedSingle(30, split[21]);
|
||||
updateLedSingle(31, split[22]);
|
||||
updateLedSingle(23, split[23]);
|
||||
updateLedSingle(9, split[24]);
|
||||
updateLedSingle(21, split[25]);
|
||||
updateLedSingle(33, split[26]);
|
||||
updateLedSingle(10, split[27]);
|
||||
updateLedSingle(22, split[28]);
|
||||
updateLedSingle(34, split[29]);
|
||||
updateLedSingle(11, split[30]);
|
||||
updateLedSingle(23, split[31]);
|
||||
updateLedSingle(35, split[32]);
|
||||
} else {
|
||||
if (DEBUG) Log.d(TAG, "Animation line length mismatch | name: " + name + " | line: " + line);
|
||||
throw new InterruptedException();
|
||||
@@ -308,8 +402,14 @@ public final class AnimationManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String slug : slugs) {
|
||||
updateLedZone(slug, 0);
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
for (String slug : slugs) {
|
||||
updateLedZone(slug, 0);
|
||||
}
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
for (int led=0; led <= 35; led++) {
|
||||
updateLedSingle(led, 0);
|
||||
}
|
||||
}
|
||||
StatusManager.setCallLedActive(false);
|
||||
if (DEBUG) Log.d(TAG, "Done playing animation | name: " + name);
|
||||
@@ -324,6 +424,7 @@ public final class AnimationManager {
|
||||
public static void playEssential() {
|
||||
if (DEBUG) Log.d(TAG, "Playing Essential Animation");
|
||||
String slug = ResourceUtils.getString("glyph_settings_notifs_essential_slug");
|
||||
int led = ResourceUtils.getInteger("glyph_settings_notifs_essential_led");
|
||||
if (!StatusManager.isEssentialLedActive()) {
|
||||
submit(() -> {
|
||||
if (!check("essential", true))
|
||||
@@ -336,7 +437,11 @@ public final class AnimationManager {
|
||||
int[] steps = {1, 2, 4, 7};
|
||||
for (int i : steps) {
|
||||
if (checkInterruption("essential")) throw new InterruptedException();
|
||||
updateLedZone(slug, Constants.getMaxBrightness() / 100 * i);
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
updateLedZone(slug, Constants.getMaxBrightness() / 100 * i);
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
updateLedSingle(led, Constants.getMaxBrightness() / 100 * i);
|
||||
}
|
||||
Thread.sleep(25);
|
||||
}
|
||||
Thread.sleep(250);
|
||||
@@ -347,7 +452,11 @@ public final class AnimationManager {
|
||||
if (DEBUG) Log.d(TAG, "Done playing animation | name: essential");
|
||||
});
|
||||
} else {
|
||||
updateLedZone(slug, Constants.getMaxBrightness() / 100 * 7);
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
updateLedZone(slug, Constants.getMaxBrightness() / 100 * 7);
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
updateLedSingle(led, Constants.getMaxBrightness() / 100 * 7);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -358,7 +467,12 @@ public final class AnimationManager {
|
||||
StatusManager.setEssentialLedActive(false);
|
||||
if (!StatusManager.isAnimationActive() && !StatusManager.isAllLedActive()) {
|
||||
String slug = ResourceUtils.getString("glyph_settings_notifs_essential_slug");
|
||||
updateLedZone(slug, 0);
|
||||
int led = ResourceUtils.getInteger("glyph_settings_notifs_essential_led");
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
updateLedZone(slug, 0);
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
updateLedSingle(led, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,17 +502,45 @@ public final class AnimationManager {
|
||||
}
|
||||
|
||||
try {
|
||||
updateLedZone(path, Constants.getMaxBrightness());
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
updateLedZone(path, Constants.getMaxBrightness());
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
// Not implemented yet for phone2
|
||||
}
|
||||
Thread.sleep(90);
|
||||
} catch (Exception e) {
|
||||
if (DEBUG) Log.d(TAG, "Exception while playing animation | name: music: " + name + " | exception: " + e);
|
||||
} finally {
|
||||
updateLedZone(path, 0);
|
||||
if (Constants.getDevice().equals("phone1")) {
|
||||
updateLedZone(path, 0);
|
||||
} else if (Constants.getDevice().equals("phone2")) {
|
||||
// Not implemented yet for phone2
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "Done playing animation | name: " + name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void updateLedSingle(int led, String brightness) {
|
||||
updateLedSingle(led, Float.parseFloat(brightness));
|
||||
}
|
||||
|
||||
private static void updateLedSingle(int led, int brightness) {
|
||||
updateLedSingle(led, (float) brightness);
|
||||
}
|
||||
|
||||
private static void updateLedSingle(int led, float brightness) {
|
||||
//if (DEBUG) Log.d(TAG, "Updating led | led: " + led + " | brightness: " + brightness);
|
||||
float maxBrightness = (float) Constants.getMaxBrightness();
|
||||
int essentialLed = ResourceUtils.getInteger("glyph_settings_notifs_essential_led");
|
||||
if (StatusManager.isEssentialLedActive()
|
||||
&& led == essentialLed
|
||||
&& brightness < (maxBrightness / 100 * 7)) {
|
||||
brightness = maxBrightness / 100 * 7;
|
||||
}
|
||||
FileUtils.writeSingleLed(led, brightness / maxBrightness * Constants.getBrightness());
|
||||
}
|
||||
|
||||
private static void updateLedZone(String slug, String brightness) {
|
||||
updateLedZone(slug, Float.parseFloat(brightness));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Paranoid Android
|
||||
* Copyright (C) 2023-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -165,13 +165,13 @@ public class GlyphAnimationPreference extends Preference {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
line = line.endsWith(",") ? line.substring(0, line.length() - 1) : line;
|
||||
String[] split = line.split(",");
|
||||
if (animationSlugs.length == 5 && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
if (Constants.getDevice().equals("phone1") && split.length == 5) { // Phone (1) pattern on Phone (1)
|
||||
mActivity.runOnUiThread(() -> {
|
||||
for (int i = 0; i < animationSlugs.length; i++) {
|
||||
setGlyphsDrawable(animationImgs[i], Integer.parseInt(split[i]));
|
||||
}
|
||||
});
|
||||
} else if (animationSlugs.length == 11 && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 5) { // Phone (1) pattern on Phone (2)
|
||||
mActivity.runOnUiThread(() -> {
|
||||
setGlyphsDrawable(animationImgs[0], Integer.parseInt(split[0]));
|
||||
setGlyphsDrawable(animationImgs[1], Integer.parseInt(split[0]));
|
||||
@@ -185,7 +185,7 @@ public class GlyphAnimationPreference extends Preference {
|
||||
setGlyphsDrawable(animationImgs[9], Integer.parseInt(split[3]));
|
||||
setGlyphsDrawable(animationImgs[10], Integer.parseInt(split[4]));
|
||||
});
|
||||
} else if (animationSlugs.length == 11 && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
} else if (Constants.getDevice().equals("phone2") && split.length == 33) { // Phone (2) pattern on Phone (2)
|
||||
mActivity.runOnUiThread(() -> {
|
||||
setGlyphsDrawable(animationImgs[0], Integer.parseInt(split[0]));
|
||||
setGlyphsDrawable(animationImgs[1], Integer.parseInt(split[1]));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2017-2018 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2017-2018 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Paranoid Android
|
||||
* Copyright (C) 2023-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Paranoid Android
|
||||
* Copyright (C) 2023-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2016 The CyanogenMod Project
|
||||
* 2017 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2017-2019 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* Copyright (C) 2017 The LineageOS Project
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* Copyright (C) 2017 The LineageOS Project
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Paranoid Android
|
||||
* Copyright (C) 2022-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Paranoid Android
|
||||
* Copyright (C) 2023-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The CyanogenMod Project
|
||||
* 2017-2019 The LineageOS Project
|
||||
* 2020-2023 Paranoid Android
|
||||
* 2020-2024 Paranoid Android
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Reference in New Issue
Block a user