summaryrefslogtreecommitdiff
path: root/generate_notification_styles.sh
blob: 19bb1322e01c1fa91650d4d4bffeaf7b9946efa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash

my_path="$(dirname "$(realpath "$0")")"

# Get overlay generation functions
. "$my_path"/generate_overlay.sh

notif_dark_overlay_package="com.aicp.overlay.notif_dark"
notif_light_overlay_package="com.aicp.overlay.notif_light"
product_packages_makefile="$my_path/product_packages_notif_styles.mk"

function generate_notif_dark_style() {
    # generate_notif_dark_style <name> <background>
    name="$1"
    background="$2"
    background_dimmed="$3"
    shade="$4"
    name_lc=`echo "$name" | tr '[:upper:]' '[:lower:]'`

    out_dir="$my_path/NotifDark-SystemUI-$name"
    generate_overlay --night "theming_notif_dark_$name_lc" "aicp.notif_dark" "$my_path/notif_template_dark" "$out_dir" "com.android.systemui" "$notif_dark_overlay_package.$name_lc" "" "$product_packages_makefile"
    colors_file="$out_dir/res/values-night/colors.xml"
    sed -i "s|?background_dimmed|$background_dimmed|g" "$colors_file"
    sed -i "s|?shade|$shade|g" "$colors_file"
    sed -i "s|?background|$background|g" "$colors_file"

    out_dir="$my_path/NotifDark-System-$name"
    generate_overlay --night "theming_notif_dark_$name_lc" "aicp.notif_dark" "$my_path/notif_template_dark" "$out_dir" "android" "$notif_dark_overlay_package.$name_lc" "" "$product_packages_makefile"
    colors_file="$out_dir/res/values-night/colors.xml"
    sed -i "s|?background|$background|g" "$colors_file"
}

function generate_notif_light_style() {
    # generate_notif_light_style <name> <background> <background_dimmed> <shade>
    name="$1"
    background="$2"
    background_dimmed="$3"
    shade="$4"
    name_lc=`echo "$name" | tr '[:upper:]' '[:lower:]'`

    out_dir="$my_path/NotifLight-SystemUI-$name"
    generate_overlay "theming_notif_light_$name_lc" "aicp.notif_light" "$my_path/notif_template_light" "$out_dir" "com.android.systemui" "$notif_light_overlay_package.$name_lc" "" "$product_packages_makefile"
    colors_file="$out_dir/res/values/colors.xml"
    sed -i "s|?background_dimmed|$background_dimmed|g" "$colors_file"
    sed -i "s|?shade|$shade|g" "$colors_file"
    sed -i "s|?background|$background|g" "$colors_file"

    out_dir="$my_path/NotifLight-System-$name"
    generate_overlay "theming_notif_light_$name_lc" "aicp.notif_light" "$my_path/notif_template_light" "$out_dir" "android" "$notif_light_overlay_package.$name_lc" "" "$product_packages_makefile"
    colors_file="$out_dir/res/values/colors.xml"
    sed -i "s|?background|$background|g" "$colors_file"
}

# Clean previous makefile
rm -f "$product_packages_makefile"

generate_notif_dark_style "Gray" "#ff303030" "#aa000000" "#212121"
# For transparent styles, we can't use shade = 0 or invalidate won't be called in NotificationStackScrollLayout's updateBackgroundDimming as mCachedBackgroundColor == color
# #00000001 looks the same though.
generate_notif_dark_style "TransparentGray50" "#80303030" "#80000000" "#00000001"
generate_notif_dark_style "TransparentGray75" "#b3303030" "#80000000" "#00000001"
generate_notif_dark_style "TransparentBlack50" "#80000000" "#60000000" "#00000001"
generate_notif_dark_style "TransparentBlack75" "#b3000000" "#80000000" "#00000001"
generate_notif_light_style "TransparentWhite" "#b3ffffff" "#80ffffff" "#00000001"