taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

import-svg-assets.sh (1548B)


      1 #!/bin/bash
      2 #
      3 # This file is part of GNU Taler
      4 # (C) 2024 Taler Systems S.A.
      5 #
      6 # GNU Taler is free software; you can redistribute it and/or modify it under the
      7 # terms of the GNU General Public License as published by the Free Software
      8 # Foundation; either version 3, or (at your option) any later version.
      9 #
     10 # GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
     11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License along with
     15 # GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     16 #
     17 
     18 # To get the s2v command, do this:
     19 #
     20 # $ npm install svg2vectordrawable -g
     21 #
     22 
     23 ASSETS_DIR="../taler-assets/svg"
     24 TMP_DIR="../taler-assets/s2v-tmp"
     25 OUTPUT_DIR="./wallet/src/main/res/drawable/"
     26 
     27 set -ex
     28 
     29 mkdir -p "$TMP_DIR"
     30 
     31 for d in "$ASSETS_DIR"/*; do
     32   s2v --folder="$d" --output="$TMP_DIR" --tint="?attr/colorControlNormal"
     33 done
     34 
     35 # remove unneeded icons
     36 rm "$TMP_DIR/taler_logo_2021_plain.xml"
     37 rm "$TMP_DIR/taler_logo_2022.xml"
     38 rm "$TMP_DIR/logo_2021.xml"
     39 
     40 # add tint
     41 sed -i 's@android:viewportWidth@android:tint="?attr/colorControlNormal"\n    android:viewportWidth@g' "$TMP_DIR"/*.xml
     42 # reduce size
     43 sed -i 's@"1200dp"@"24dp"@g' "$TMP_DIR"/*.xml
     44 # add path fillColor
     45 sed -i 's@<path@<path\n        android:fillColor="#FF000000"@g' "$TMP_DIR"/*.xml
     46 
     47 # move final files
     48 mv "$TMP_DIR"/*.xml "$OUTPUT_DIR"
     49 
     50 # remove tmp dir
     51 rm -rf "$TMP_DIR"