#!/data/data/com.termux/files/usr/bin/bash
###################################################################### 
#Copyright (C) 2022  Kris Occhipinti
#https://filmsbykris.com

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.
###################################################################### 

a=$(termux-dialog spinner -t "Please Select A Name" -v "John,Jack,Jill" |jq .text)
[[ "$a" == "John" ]] && echo Hey $a || echo Hello $a

a=$(termux-dialog sheet -t "Please Select A Name" -v "John,Jack,Jill" |jq .text)
[[ "$a" == "John" ]] && echo Hey $a || echo Hello $a

termux-dialog checkbox -t "Please Select People" -v "John,Jack,Jill" |\
  jq -r '.values[].text'|\
  while read name
  do
    echo "$name has been selected."
  done

#date select
a="$(termux-dialog date -t "Please Select Your Birthday" )"
#make sure ok is clicked
code="$(echo $a|jq .code -r)"
if [[ "$code" == "-1" ]]
then
  d="$(echo $a|jq .text -r)"
  d="$(date -d "$d" "+%B %d")"
  msg="Your Birthday is $d"
  echo "$msg"
  termux-dialog confirm -t "Your Birthday Is" -i "$msg"
fi

