Add a new charger as a possible replacement for the AOSP charger. Co-Authored-By: Tim Zimmermann <tim@linux4.de> Change-Id: Icdf7ad770bb353f082759b76fd4e58910e8d72e3gugelfrei
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright (C) 2021 The LineageOS Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# Set lineage_charger_density to the density bucket of the device.
|
||||
lineage_charger_density := mdpi
|
||||
ifneq (,$(TARGET_SCREEN_DENSITY))
|
||||
lineage_charger_density := $(strip \
|
||||
$(or $(if $(filter $(shell echo $$(($(TARGET_SCREEN_DENSITY) >= 560))),1),xxxhdpi),\
|
||||
$(if $(filter $(shell echo $$(($(TARGET_SCREEN_DENSITY) >= 400))),1),xxhdpi),\
|
||||
$(if $(filter $(shell echo $$(($(TARGET_SCREEN_DENSITY) >= 280))),1),xhdpi),\
|
||||
$(if $(filter $(shell echo $$(($(TARGET_SCREEN_DENSITY) >= 200))),1),hdpi,mdpi)))
|
||||
else ifneq (,$(filter mdpi hdpi xhdpi xxhdpi xxxhdpi,$(PRODUCT_AAPT_PREF_CONFIG)))
|
||||
# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
|
||||
lineage_charger_density := $(PRODUCT_AAPT_PREF_CONFIG)
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := lineage_charger_battery_scale
|
||||
LOCAL_MODULE_STEM := battery_scale.png
|
||||
LOCAL_SRC_FILES := $(lineage_charger_density)/battery_scale.png
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/res/images/charger
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := lineage_charger_battery_fail
|
||||
LOCAL_MODULE_STEM := battery_fail.png
|
||||
LOCAL_SRC_FILES := $(lineage_charger_density)/battery_fail.png
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/res/images/charger
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := lineage_charger_animation
|
||||
LOCAL_MODULE_STEM := animation.txt
|
||||
LOCAL_SRC_FILES := animation.txt
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/res/values/charger
|
||||
LOCAL_REQUIRED_MODULES := lineage_charger_battery_scale lineage_charger_battery_fail
|
||||
include $(BUILD_PREBUILT)
|
@ -0,0 +1,26 @@
|
||||
# animation: num_cycles, first_frame_repeats, animation_file
|
||||
animation: 7 1 charger/battery_scale
|
||||
|
||||
# frame: disp_time min_level max_level
|
||||
frame: 500 0 4
|
||||
frame: 500 0 9
|
||||
frame: 500 5 14
|
||||
frame: 500 10 19
|
||||
frame: 500 15 24
|
||||
frame: 500 20 29
|
||||
frame: 500 25 34
|
||||
frame: 500 30 39
|
||||
frame: 500 35 44
|
||||
frame: 500 40 49
|
||||
frame: 500 45 54
|
||||
frame: 500 50 59
|
||||
frame: 500 55 64
|
||||
frame: 500 60 69
|
||||
frame: 500 65 74
|
||||
frame: 500 70 79
|
||||
frame: 500 75 84
|
||||
frame: 500 80 89
|
||||
frame: 500 85 94
|
||||
frame: 500 90 99
|
||||
frame: 500 95 99
|
||||
frame: 1000 100 100
|
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$(which convert)" ] || [ -z "$(which pngcrush)" ]; then
|
||||
echo "Please install imagemagick and pngcrush"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for DENSITY in mdpi:160 hdpi:240 xhdpi:320 xxhdpi:480 xxxhdpi:640; do
|
||||
DPI=$(echo $DENSITY | cut -f1 -d ':')
|
||||
WIDTH=$(echo $DENSITY | cut -f2 -d ':')
|
||||
|
||||
rm -rf $DPI
|
||||
mkdir $DPI
|
||||
|
||||
for SVG in svg/*.svg; do
|
||||
PNG="$DPI/$(basename $SVG | cut -f1 -d '.').png"
|
||||
convert -density $WIDTH -resize ${WIDTH}x${WIDTH} $SVG $PNG
|
||||
done
|
||||
|
||||
SCALEFILE="$DPI/battery_scale.png"
|
||||
SCALEFILES="$(ls $DPI/battery_scale_*.png)"
|
||||
FRAMES="$(ls -l $SCALEFILES | wc -l)"
|
||||
SCALEHEIGHT=$(($WIDTH * $FRAMES))
|
||||
|
||||
convert -size ${WIDTH}x${SCALEHEIGHT} canvas:black $SCALEFILES -fx "u[j%$FRAMES+1].p{i,int(j/$FRAMES)}" png24:$SCALEFILE.tmp
|
||||
pngcrush -text b "Frames" "$FRAMES" $SCALEFILE.tmp $SCALEFILE
|
||||
rm $SCALEFILES $SCALEFILE.tmp
|
||||
done
|
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 489 B |
After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 772 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 841 B |
After Width: | Height: | Size: 865 B |
After Width: | Height: | Size: 865 B |
After Width: | Height: | Size: 868 B |
After Width: | Height: | Size: 866 B |
After Width: | Height: | Size: 983 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 538 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 82 KiB |