addMockDevice.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. cd scripts/screenshots/
  3. for i in $(find ../../fastlane | grep png) ; do
  4. device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
  5. textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
  6. locale=$(echo $i | cut -d"/" -f6)
  7. # handle some locales different
  8. case $locale in
  9. "en-US")
  10. locale=""
  11. ;;
  12. *)
  13. locale="-"$locale
  14. esac
  15. if [ -e ../../src/main/res/values$locale/strings.xml ] ; then
  16. text=$(grep $textID ../../src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  17. else
  18. text=""
  19. fi
  20. # fallback to english if there is not translation
  21. if [ -n $text ]; then
  22. text=$(grep $textID ../../src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  23. fi
  24. sed "s#{image}#$i#;s#{text}#$text#g" $device.svg > temp.svg
  25. if [ $textID == "06_davdroid" ] ; then
  26. sed "s#display:none#display:visible#" -i temp.svg
  27. fi
  28. inkscape temp.svg -e $i
  29. done