Suggestions styles

Former-commit-id: 7f761944a9
This commit is contained in:
virvar 2016-04-01 11:10:38 +03:00
parent ea3bbd7536
commit 2704529dee
6 changed files with 47 additions and 31 deletions

View File

@ -25,7 +25,7 @@
_ (log/debug "messages=" msgs)
datasource (to-realm-datasource msgs)]
[view {:style {:flex 1
:backgroundColor "white"}}
:backgroundColor "#eef2f5"}}
(when android?
;; TODO add IOS version
[toolbar-android {:logo res/logo-icon

View File

@ -32,7 +32,6 @@
[view {:style {:flexDirection "row"}}
[view {:style {:flexDirection "column"
:margin 10
:width 120
:backgroundColor "blue"
:borderRadius 10}}
[text {:style {:marginVertical 3

View File

@ -30,7 +30,6 @@
[view {:style {:flexDirection "row"}}
[view {:style {:flexDirection "column"
:margin 10
:width 120
:backgroundColor "blue"
:borderRadius 10}}
[text {:style {:marginVertical 3

View File

@ -11,23 +11,23 @@
[reagent.core :as r]))
(defn plain-message-input-view []
(let [text (r/atom nil)
(let [text (r/atom "!")
chat-id (subscribe [:get-current-chat-id])]
(dispatch [:generate-suggestions @text])
(fn []
[view {:style {:flexDirection "column"}}
[suggestions-view]
[view {:style {:flexDirection "row"
:margin 10
:margin 1
:height 40
:backgroundColor "#E5F5F6"
:backgroundColor "white"
:borderRadius 5}}
[image {:source res/mic
:style {:marginTop 11
:marginLeft 14
:width 13
:height 20}}]
[text-input {:underlineColorAndroid "#9CBFC0"
[text-input {:underlineColorAndroid "transparent"
:style {:flex 1
:marginLeft 18
:lineHeight 42
@ -35,7 +35,7 @@
:fontFamily "Avenir-Roman"
:color "#9CBFC0"}
:autoFocus false
:placeholder "Enter your message here"
:placeholder "Type"
:value @text
:onChangeText (fn [new-text]
(dispatch [:generate-suggestions new-text])

View File

@ -21,24 +21,30 @@
[touchable-highlight {:onPress (fn []
(set-command-input (keyword (:command suggestion))))}
[view {:style {:flexDirection "row"
:marginVertical 5
:marginHorizontal 10
:height 20
;; :backgroundColor "white"
}}
:marginVertical 1
:marginHorizontal 0
:height 40
:backgroundColor "white"}}
[view {:style {:flexDirection "column"
:position "absolute"
:top 10
:left 60
:backgroundColor (:color suggestion)
:borderRadius 10}}
[text {:style {:marginTop -2
:marginHorizontal 10
:fontSize 14
:fontFamily "Avenir-Roman"
:color "white"}}
(:text suggestion)]]
[text {:style {:flex 1
:marginLeft 18
:position "absolute"
:top 7
:left 190
:lineHeight 18
:fontSize 14
:fontFamily "Avenir-Roman"
:color "#9CBFC0"}}
(:text suggestion)]
[text {:style {:flex 1
:marginLeft 18
:lineHeight 18
:fontSize 14
:fontFamily "Avenir-Roman"
:color "#9CBFC0"}}
:color "black"}}
(:description suggestion)]]])
(defn render-row [row section-id row-id]
@ -50,10 +56,10 @@
(let [suggestions @suggestions-atom]
(when (not (empty? suggestions))
[view {:style {:flexDirection "row"
:marginVertical 5
:marginHorizontal 10
:height 120
:backgroundColor "#E5F5F6"
:marginVertical 1
:marginHorizontal 0
:height (min 105 (* 42 (count suggestions)))
:backgroundColor "#eef2f5"
:borderRadius 5}}
[list-view {:dataSource (to-datasource suggestions)
:renderRow render-row

View File

@ -4,18 +4,30 @@
[syng-im.utils.utils :refer [log on-error http-post]]
[syng-im.utils.logging :as log]))
(def commands [{:command :phone
(def commands [{:command :money
:text "!money"
:description "Send money"
:color "#48ba30"}
{:command :location
:text "!location"
:description "Send location"
:color "#9a5dcf"}
{:command :phone
:text "!phone"
:description "Send phone number"}
:description "Send phone number"
:color "#48ba30"}
{:command :send
:text "!send"
:description "Send location"}
:description "Send location"
:color "#9a5dcf"}
{:command :request
:text "!request"
:description "Send request"}
:description "Send request"
:color "#48ba30"}
{:command :help
:text "!help"
:description "Help"}])
:description "Help"
:color "#9a5dcf"}])
(defn get-suggestions [text]
(if (= (get text 0) "!")