Skip to content

Commit

Permalink
Fix Battery Icon stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 23, 2024
1 parent f55f5d9 commit 4d5ecb6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
((BatteryIconsViewHolder)holder).binding.batteryIcon.setVisibility(View.GONE);

if (TextUtils.equals(mEntryValues[position].toString(), mValue)) {
prevPos = position;
((BatteryIconsViewHolder)holder).binding.rootLayout.setStrokeColor(getAppContext().getColor(android.R.color.system_accent1_400));
} else {
((BatteryIconsViewHolder)holder).binding.rootLayout.setStrokeColor(Color.TRANSPARENT);
}

((BatteryIconsViewHolder)holder).binding.rootLayout.setOnClickListener(v -> {
int prev = Integer.parseInt(mValue);
onItemClickListener.onItemClick(v, position);
notifyItemChanged(prev);
mValue = String.valueOf(mEntryValues[position]);
notifyItemChanged(prevPos);
notifyItemChanged(position);
mValue = String.valueOf(position);
});
} else {
((ViewHolder)holder).binding.text.setText(mEntries[position]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,9 @@ private void notifyUpdate() {
Thread.currentThread().wait(500);
}
updating = true;
int currentStyle = 3;
try {
currentStyle = Integer.parseInt(ShellUtils.execCommand("settings get system display_battery_style", true).successMsg);
} catch (Throwable ignored) {}
ShellUtils.execCommand("settings put system display_battery_style 2", true);
Thread.sleep(750);
ShellUtils.execCommand("settings put system display_battery_style " + currentStyle, true);
ShellUtils.execCommand("settings put system display_battery_style 3", true);

Thread.sleep(500);
updating = false;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/statusbar_battery_icon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
app:iconSpaceReserved="false" />

<it.dhd.oxygencustomizer.customprefs.SliderPreference
android:defaultValue="14"
android:key="stock_percentage_size"
android:title="@string/battery_percentage_size"
app:defaultValue="12"
app:maxVal="24"
app:minVal="8" />

Expand Down

0 comments on commit 4d5ecb6

Please sign in to comment.