Adding Android ViroAR stuff

This commit is contained in:
John Lyon-Smith
2018-03-29 15:40:37 -07:00
parent bd5cd8a0d8
commit b301bf17eb
16 changed files with 126 additions and 84 deletions

View File

@@ -15,8 +15,8 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-4322" />
<option name="y" value="122" />
<option name="x" value="82" />
<option name="y" value="121" />
<option name="width" value="1522" />
<option name="height" value="1014" />
</component>
@@ -58,8 +58,8 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane" />
<pane id="Scratches" />
<pane id="AndroidView">
<subPane>
<expand>
@@ -71,8 +71,8 @@
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -191,7 +191,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-4322" y="122" width="1522" height="1014" extended-state="0" />
<frame x="82" y="121" width="1522" height="1014" extended-state="0" />
<layout>
<window_info id="Android Profiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />

View File

@@ -96,11 +96,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
@@ -112,12 +109,11 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-25.3.1" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-25.3.1" level="project" />

View File

@@ -94,13 +94,11 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion 25
defaultConfig {
applicationId "com.deightonar"
minSdkVersion rootProject.ext.targetSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
@@ -126,7 +124,7 @@ android {
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
@@ -134,14 +132,28 @@ android {
}
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-navigation')
compile project(':react-native-maps')
implementation fileTree(include: ['*.jar'], dir: 'libs')
api "com.android.support:appcompat-v7:25.3.1"
api 'com.facebook.react:react-native:+'
// From node_modules
api project(':react-native-navigation')
api project(':react-native-maps')
api project(':gvr_common')
api project(':arcore_client')
api project(path: ':react_viro')
api project(path: ':viro_renderer')
api 'com.google.android.exoplayer:exoplayer:r2.2.0'
api 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
api 'com.amazonaws:aws-android-sdk-core:2.2.+'
api 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
api 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.+'
api 'com.amazonaws:aws-android-sdk-cognito:2.2.+'
api 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'
}
// Run this once to be able to run the application with BUCK

View File

@@ -5,31 +5,33 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk
android:minSdkVersion="24"
android:targetSdkVersion="27" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDN4E_vzO4cKjKHkMg_49hX1GBnU34kx4U"/>
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyAC7r1GjMFL1atZdbEcFSdCaXDrPnISqTc" />
<meta-data android:name="com.google.ar.core" android:value="required" />
</application>
</manifest>

View File

@@ -14,6 +14,8 @@ import java.util.List;
import com.reactnativenavigation.NavigationApplication;
import com.airbnb.android.react.maps.MapsPackage;
import com.viromedia.bridge.ReactViroPackage;
public class MainApplication extends NavigationApplication {
@Override
public boolean isDebug() {
@@ -25,7 +27,8 @@ public class MainApplication extends NavigationApplication {
// Add additional packages you require here
// No need to add RnnPackage and MainReactPackage
return Arrays.<ReactPackage>asList(
new MapsPackage()
new MapsPackage(),
new ReactViroPackage(ReactViroPackage.ViroPlatform.GVR)
);
}

View File

@@ -23,13 +23,3 @@ allprojects {
}
}
}
ext {
compileSdkVersion = 27
targetSdkVersion = 27
minSdkVersion = 24
buildToolsVersion = "27.0.3"
supportLibVersion = "25.3.1"
googlePlayServicesVersion = "11.8.0"
androidMapsUtilsVersion = "0.5+"
}

Binary file not shown.

View File

@@ -5,3 +5,8 @@ include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react_viro', ':arcore_client', ':gvr_common', ':viro_renderer'
project(':arcore_client').projectDir = new File('../node_modules/react-viro/android/arcore_client')
project(':gvr_common').projectDir = new File('../node_modules/react-viro/android/gvr_common')
project(':viro_renderer').projectDir = new File('../node_modules/react-viro/android/viro_renderer')
project(':react_viro').projectDir = new File('../node_modules/react-viro/android/react_viro')

View File

@@ -321,6 +321,7 @@
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.us.kss.deighton-ar";
PRODUCT_NAME = DeightonAR;
VERSIONING_SYSTEM = "apple-generic";
};
@@ -347,6 +348,7 @@
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.us.kss.deighton-ar";
PRODUCT_NAME = DeightonAR;
VERSIONING_SYSTEM = "apple-generic";
};

View File

@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.us.kss.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>20180328.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
@@ -35,10 +35,10 @@
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo use</string>
<key>UILaunchStoryboardName</key>

View File

@@ -21,9 +21,10 @@
},
"dependencies": {
"autobind-decorator": "^2.1.0",
"create-react-class": "^15.6.3",
"eventemitter3": "^3.0.1",
"npm": "^5.7.1",
"react": "16.2.0",
"react": "^16.2.0",
"react-form-binder": "^1.2.0",
"react-native": "^0.51.1",
"react-native-google-maps": "^1.0.0",

View File

@@ -5,7 +5,7 @@ import { AsyncStorage } from 'react-native'
const authTokenName = 'AuthToken'
let baseURL = null
let apiPath = null
//
if (__DEV__) {
const localIPAddr = process.env.LOCAL_IP_ADDR

View File

@@ -2,6 +2,11 @@ import { Platform } from 'react-native'
import { Navigation } from 'react-native-navigation'
import { registerScreens } from './screens'
// See https://github.com/facebook/react-native/issues/12981
console.ignoredYellowBox = [
'Setting a timer'
]
registerScreens()
Navigation.startSingleScreenApp({

View File

@@ -100,7 +100,9 @@ export class Home extends React.Component {
return (
<View style={Home.styles.container}>
<MapView
style={{ width: '100%', height: '50%' }}
style={{
width: '100%', height: '50%',
}}
zoomControlEnabled
initialRegion={{
latitude: 43.653908,

View File

@@ -69,7 +69,7 @@ export class Login extends React.Component {
constructor(props) {
super(props)
this.state = {
binder: new FormBinder({email: 'john@lyon-smith.org', password: 'Skunkay'}, Login.bindings)
binder: new FormBinder({email: 'john@lyon-smith.org'}, Login.bindings)
}
}
@@ -90,7 +90,7 @@ export class Login extends React.Component {
render() {
return (
<KeyboardAvoidingView style={Login.styles.page} behavior='padding'
keyboardVerticalOffset={Platform.select({ios: 0, android: 200})}>
keyboardVerticalOffset={Platform.select({ios: 0, android: -220})}>
<Image style={Login.styles.logo} source={logoImage} resizeMode='contain' />
<View style={Login.styles.inputRow}>
<BoundInput name='email' label='Email:' placeholder='name@xyz.com' message='Must enter a valid email' binder={this.state.binder} />

View File

@@ -1,6 +1,40 @@
import React from 'react'
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native'
import backImage from './images/back.png'
import { StyleSheet, View } from 'react-native'
import {
ViroARSceneNavigator, ViroARScene, ViroARPlane, ViroBox, ViroText, ViroAmbientLight
} from 'react-viro'
import createReactClass from 'create-react-class'
const styles = {
helloWorldTextStyle: {
fontFamily: 'Arial',
fontSize: 30,
color: '#ffffff',
textAlignVertical: 'center',
textAlign: 'center',
},
}
const WorkItemSceneAR = createReactClass({
getInitialState: function() {
return {
text : "Initializing AR..."
}
},
render: function() {
return (
<ViroARScene onTrackingInitialized={()=>{this.setState({text : "Hello World!"})}}>
<ViroAmbientLight color="#ffffff" intensity={200}/>
<ViroText text={this.state.text} scale={[.5, .5, .5]} position={[0, 0, -1]}
style={styles.helloWorldTextStyle} />
<ViroARPlane>
<ViroBox position={[0, .5, 0]} />
</ViroARPlane>
</ViroARScene>
)
}
})
export class Viewer extends React.Component {
static navigatorStyle = {
@@ -9,35 +43,25 @@ export class Viewer extends React.Component {
static styles = StyleSheet.create({
container: {
height: '100%',
width: '100%',
justifyContent: 'flex-start',
backgroundColor: '#AAAAAA',
},
button: {
marginTop: 40,
marginLeft: 20,
width: 45,
height: 45,
}
flex: 1,
},
arScene: {
flex: 1,
},
})
constructor(props) {
super(props)
this._handlePressButton = this._handlePressButton.bind(this)
}
_handlePressButton() {
this.props.navigator.pop()
}
}
render() {
return (
<View style={Viewer.styles.container}>
<TouchableOpacity onPress={this._handlePressButton}>
<Image style={Viewer.styles.button} source={backImage} />
</TouchableOpacity>
<View style={Viewer.styles.arScene}>
<ViroARSceneNavigator
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46'
style={Viewer.styles.arScene}
initialScene={{ scene: WorkItemSceneAR }} debug={true} />
</View>
);
)
}
}