parent
4e39130176
commit
6beda2ace2
|
@ -131,6 +131,7 @@ dependencies {
|
||||||
compile project(':react-native-linear-gradient')
|
compile project(':react-native-linear-gradient')
|
||||||
compile project(':ReactNativeAndroidSmsListener')
|
compile project(':ReactNativeAndroidSmsListener')
|
||||||
compile project(':react-native-camera')
|
compile project(':react-native-camera')
|
||||||
|
compile project(':react-native-orientation')
|
||||||
// compile(name:'geth', ext:'aar')
|
// compile(name:'geth', ext:'aar')
|
||||||
compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar')
|
compile(group: 'status-im', name: 'android-geth', version: '1.4.0-201604110816-a97a114', ext: 'aar')
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.content.Context;
|
||||||
import com.bitgo.randombytes.RandomBytesPackage;
|
import com.bitgo.randombytes.RandomBytesPackage;
|
||||||
import com.BV.LinearGradient.LinearGradientPackage;
|
import com.BV.LinearGradient.LinearGradientPackage;
|
||||||
import com.centaurwarchief.smslistener.SmsListener;
|
import com.centaurwarchief.smslistener.SmsListener;
|
||||||
|
import com.github.yamill.orientation.OrientationPackage;
|
||||||
|
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -35,7 +36,8 @@ import java.io.File;
|
||||||
import com.lwansbrough.RCTCamera.*;
|
import com.lwansbrough.RCTCamera.*;
|
||||||
import com.i18n.reactnativei18n.ReactNativeI18n;
|
import com.i18n.reactnativei18n.ReactNativeI18n;
|
||||||
import io.realm.react.RealmReactPackage;
|
import io.realm.react.RealmReactPackage;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
public class MainActivity extends ReactActivity {
|
public class MainActivity extends ReactActivity {
|
||||||
|
|
||||||
|
@ -181,7 +183,16 @@ public class MainActivity extends ReactActivity {
|
||||||
new RandomBytesPackage(),
|
new RandomBytesPackage(),
|
||||||
new LinearGradientPackage(),
|
new LinearGradientPackage(),
|
||||||
new RCTCameraPackage(),
|
new RCTCameraPackage(),
|
||||||
new SmsListener(this)
|
new SmsListener(this),
|
||||||
|
new OrientationPackage(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
Intent intent = new Intent("onConfigurationChanged");
|
||||||
|
intent.putExtra("newConfig", newConfig);
|
||||||
|
this.sendBroadcast(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,3 +20,5 @@ include ':ReactNativeAndroidSmsListener'
|
||||||
project(':ReactNativeAndroidSmsListener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-sms-listener/android')
|
project(':ReactNativeAndroidSmsListener').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-sms-listener/android')
|
||||||
include ':react-native-camera'
|
include ':react-native-camera'
|
||||||
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
|
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
|
||||||
|
include ':react-native-orientation', ':app'
|
||||||
|
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"react-native-qrcode": "^0.2.2",
|
"react-native-qrcode": "^0.2.2",
|
||||||
"react-native-randombytes": "^2.1.0",
|
"react-native-randombytes": "^2.1.0",
|
||||||
"react-native-vector-icons": "^1.3.4",
|
"react-native-vector-icons": "^1.3.4",
|
||||||
|
"react-native-orientation": "^1.17.0",
|
||||||
"realm": "^0.11.1"
|
"realm": "^0.11.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[status-im.handlers]
|
[status-im.handlers]
|
||||||
[status-im.subs]
|
[status-im.subs]
|
||||||
[status-im.components.react :refer [navigator app-registry device-event-emitter]]
|
[status-im.components.react :refer [navigator app-registry device-event-emitter
|
||||||
|
orientation]]
|
||||||
[status-im.components.main-tabs :refer [main-tabs]]
|
[status-im.components.main-tabs :refer [main-tabs]]
|
||||||
[status-im.contacts.screen :refer [contact-list]]
|
[status-im.contacts.screen :refer [contact-list]]
|
||||||
[status-im.contacts.views.new-contact :refer [new-contact]]
|
[status-im.contacts.views.new-contact :refer [new-contact]]
|
||||||
|
@ -33,12 +34,20 @@
|
||||||
true)))]
|
true)))]
|
||||||
(add-event-listener "hardwareBackPress" new-listener)))
|
(add-event-listener "hardwareBackPress" new-listener)))
|
||||||
|
|
||||||
|
(defn orientation->keyword [o]
|
||||||
|
(keyword (.toLowerCase o)))
|
||||||
|
|
||||||
(defn app-root []
|
(defn app-root []
|
||||||
(let [signed-up (subscribe [:get :signed-up])
|
(let [signed-up (subscribe [:get :signed-up])
|
||||||
view-id (subscribe [:get :view-id])]
|
view-id (subscribe [:get :view-id])]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-will-mount
|
{:component-will-mount
|
||||||
(fn []
|
(fn []
|
||||||
|
(let [o (orientation->keyword (.getInitialOrientation orientation))]
|
||||||
|
(dispatch [:set :orientation o]))
|
||||||
|
(.addOrientationListener
|
||||||
|
orientation
|
||||||
|
#(dispatch [:set :orientation (orientation->keyword %)]))
|
||||||
(.addListener device-event-emitter
|
(.addListener device-event-emitter
|
||||||
"keyboardDidShow"
|
"keyboardDidShow"
|
||||||
(fn [e]
|
(fn [e]
|
||||||
|
|
|
@ -34,11 +34,15 @@
|
||||||
;; TODO stub data: request message info
|
;; TODO stub data: request message info
|
||||||
"By ???, MMM 1st at HH:mm"]])
|
"By ???, MMM 1st at HH:mm"]])
|
||||||
|
|
||||||
(defn create-response-pan-responder [response-height kb-height]
|
(defn pan-responder [response-height kb-height orientation]
|
||||||
(drag/create-pan-responder
|
(drag/create-pan-responder
|
||||||
{:on-move (fn [_ gesture]
|
{:on-move (fn [_ gesture]
|
||||||
(when (> (Math/abs (.-dy gesture)) 10)
|
(when (> (Math/abs (.-dy gesture)) 10)
|
||||||
(let [to-value (- (:height (react/get-dimensions "window"))
|
(let [w (react/get-dimensions "window")
|
||||||
|
p (if (= :portrait @orientation)
|
||||||
|
:height
|
||||||
|
:width)
|
||||||
|
to-value (- (p w)
|
||||||
@kb-height
|
@kb-height
|
||||||
(.-moveY gesture))]
|
(.-moveY gesture))]
|
||||||
(anim/start
|
(anim/start
|
||||||
|
@ -51,8 +55,9 @@
|
||||||
(.-_value response-height)])))}))
|
(.-_value response-height)])))}))
|
||||||
|
|
||||||
(defn request-info [response-height]
|
(defn request-info [response-height]
|
||||||
(let [kb-height (subscribe [:get :keyboard-height])
|
(let [orientation (subscribe [:get :orientation])
|
||||||
pan-responder (create-response-pan-responder response-height kb-height)
|
kb-height (subscribe [:get :keyboard-height])
|
||||||
|
pan-responder (pan-responder response-height kb-height orientation)
|
||||||
command (subscribe [:get-chat-command])]
|
command (subscribe [:get-chat-command])]
|
||||||
(fn [response-height]
|
(fn [response-height]
|
||||||
[view (merge (drag/pan-handlers pan-responder)
|
[view (merge (drag/pan-handlers pan-responder)
|
||||||
|
@ -73,11 +78,11 @@
|
||||||
(defn container [response-height & children]
|
(defn container [response-height & children]
|
||||||
(let [;; todo to-response-height, cur-response-height must be specific
|
(let [;; todo to-response-height, cur-response-height must be specific
|
||||||
;; for each chat
|
;; for each chat
|
||||||
to-response-height (subscribe [:animations :to-response-height])
|
to-response-height (subscribe [:animations :to-response-height])
|
||||||
changed (subscribe [:animations :response-height-changed])
|
changed (subscribe [:animations :response-height-changed])
|
||||||
context {:to-value to-response-height
|
context {:to-value to-response-height
|
||||||
:val response-height}
|
:val response-height}
|
||||||
on-update (container-animation-logic context)]
|
on-update (container-animation-logic context)]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
on-update
|
on-update
|
||||||
|
|
|
@ -77,3 +77,4 @@
|
||||||
|
|
||||||
(def dismiss-keyboard! (u/require "dismissKeyboard"))
|
(def dismiss-keyboard! (u/require "dismissKeyboard"))
|
||||||
(def device-event-emitter (.-DeviceEventEmitter react))
|
(def device-event-emitter (.-DeviceEventEmitter react))
|
||||||
|
(def orientation (u/require "react-native-orientation"))
|
||||||
|
|
Loading…
Reference in New Issue