Guest User

Untitled

a guest
Nov 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # read user input
  4. speed=0.0
  5. animator=1.0
  6. default=0.6
  7. if [ "$1" = "enable" ]; then
  8. check=`echo "$2" | grep -E ^\-?[0-9]*\.?[0-9]+$`
  9. if [ "$check" != '' ]; then
  10. # got a number arg
  11. speed=$2
  12. else
  13. # no number arg, default to $default
  14. speed=$default
  15. fi
  16. elif [ "$1" == "disable" ]; then
  17. animator=0.0
  18. else
  19. # unknown command, explain
  20. echo -e "\n----- Usage -----\n"
  21. echo -e "~$: device_animations enable"
  22. echo -e " - Window animation speed: $default"
  23. echo -e " - Transitions animation speed: $default"
  24. echo -e " - Animator speed: 1.0\n"
  25. echo -e "~$: device_animations enable 0.2"
  26. echo -e " - Window animation speed: 0.2"
  27. echo -e " - Transitions animation speed: 0.2"
  28. echo -e " - Animator speed: 1.0\n"
  29. echo -e "~$: device_animations disable"
  30. echo -e " - Window animation speed: 0.0"
  31. echo -e " - Transitions animation speed: 0.0"
  32. echo -e " - Animator speed: 0.0\n"
  33. exit
  34. fi
  35.  
  36. # read old values
  37. echo -e "\n----- Before change -----\n"
  38. echo -e "Window animation speed: '`adb shell settings get global window_animation_scale`'"
  39. echo -e "Transitions animation speed: '`adb shell settings get global transition_animation_scale`'"
  40. echo -e "Animator speed: '`adb shell settings get global animator_duration_scale`'"
  41.  
  42. # change values
  43. echo -e "\n----- Changing to '$speed' -----\n"
  44. adb shell settings put global window_animation_scale $speed
  45. adb shell settings put global transition_animation_scale $speed
  46. adb shell settings put global animator_duration_scale $animator
  47. echo -e "Done."
  48.  
  49. # read new values
  50. echo -e "\n----- After change -----\n"
  51. echo -e "Window animation speed: '`adb shell settings get global window_animation_scale`'"
  52. echo -e "Transitions animation speed: '`adb shell settings get global transition_animation_scale`'"
  53. echo -e "Animator speed: '`adb shell settings get global animator_duration_scale`'\n"
Add Comment
Please, Sign In to add comment