Password and money input

This commit is contained in:
virvar 2016-04-01 12:09:51 +03:00
parent 1ed93ffd49
commit 40ee3283c8
6 changed files with 53 additions and 23 deletions

View File

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

View File

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