Password and money input

Former-commit-id: 40ee3283c8
This commit is contained in:
virvar 2016-04-01 12:09:51 +03:00
parent 15f1a547a1
commit 3746f4a7d6
6 changed files with 53 additions and 23 deletions

View File

@ -8,19 +8,24 @@
text-input
touchable-highlight]]
[syng-im.components.chat.plain-message-input :refer [plain-message-input-view]]
[syng-im.components.chat.simple-command-input :refer [simple-command-input-view]]
[syng-im.components.chat.phone-input :refer [phone-input-view]]
[syng-im.components.chat.input.simple-command :refer [simple-command-input-view]]
[syng-im.components.chat.input.phone :refer [phone-input-view]]
[syng-im.components.chat.input.password :refer [password-input-view]]
[syng-im.components.chat.input.money :refer [money-input-view]]
[syng-im.utils.utils :refer [log toast http-post]]
[syng-im.utils.logging :as log]
[syng-im.resources :as res]
[reagent.core :as r]))
(defn default-command-input-view [command]
[simple-command-input-view command "default"])
[simple-command-input-view command {}])
(defn special-input-view [command]
(case (:command command)
:phone [phone-input-view command]
:keypair-password [password-input-view command]
:money [money-input-view command]
:request [money-input-view command]
[default-command-input-view command]))
(defn chat-message-new []

View File

@ -0,0 +1,15 @@
(ns syng-im.components.chat.input.money
(:require
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.chat.input.simple-command :refer [simple-command-input-view]]
[syng-im.utils.utils :refer [log toast http-post]]
[syng-im.utils.logging :as log]))
(defn money-input-view [command]
[simple-command-input-view command {:keyboardType "numeric"
:style {:flex 1
:marginLeft 8
:lineHeight 42
:fontSize 32
:fontFamily "Avenir-Roman"
:color "black"}}])

View File

@ -0,0 +1,9 @@
(ns syng-im.components.chat.input.password
(:require
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.chat.input.simple-command :refer [simple-command-input-view]]
[syng-im.utils.utils :refer [log toast http-post]]
[syng-im.utils.logging :as log]))
(defn password-input-view [command]
[simple-command-input-view command {:secureTextEntry true}])

View File

@ -1,9 +1,9 @@
(ns syng-im.components.chat.phone-input
(ns syng-im.components.chat.input.phone
(:require
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.chat.simple-command-input :refer [simple-command-input-view]]
[syng-im.components.chat.input.simple-command :refer [simple-command-input-view]]
[syng-im.utils.utils :refer [log toast http-post]]
[syng-im.utils.logging :as log]))
(defn phone-input-view [command]
[simple-command-input-view command "phone-pad"])
[simple-command-input-view command {:keyboardType "phone-pad"}])

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat.simple-command-input
(ns syng-im.components.chat.input.simple-command
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.react :refer [android?
view
@ -14,7 +14,7 @@
(defn cancel-command-input []
(dispatch [:set-input-command nil]))
(defn simple-command-input-view [command input-type]
(defn simple-command-input-view [command input-options]
(let [message-atom (r/atom nil)
chat-id (subscribe [:get-current-chat-id])]
(fn []
@ -49,20 +49,21 @@
[image {:source res/att
:style {:width 17
:height 14}}]]]
[text-input {:style {:flex 1
:marginLeft 8
:lineHeight 42
:fontSize 14
:fontFamily "Avenir-Roman"
:color "#9CBFC0"}
:underlineColorAndroid "transparent"
:autoFocus true
:keyboardType input-type
:value message
:onChangeText (fn [new-text]
)
:onSubmitEditing (fn [e]
)}]]]
[text-input (merge {:style {:flex 1
:marginLeft 8
:lineHeight 42
:fontSize 14
:fontFamily "Avenir-Roman"
:color "black"}
:underlineColorAndroid "transparent"
:autoFocus true
:keyboardType "default"
:value message
:onChangeText (fn [new-text]
)
:onSubmitEditing (fn [e]
)}
input-options)]]]
[touchable-highlight {:style {:marginTop 14
:marginRight 16
:position "absolute"

View File

@ -18,7 +18,7 @@
:text "!phone"
:description "Send phone number"
:color "#48ba30"
:suggestion false}
:suggestion true}
{:command :send
:text "!send"
:description "Send location"