Skip to content

Commit 4fd767c

Browse files
new repo
1 parent 7968ad5 commit 4fd767c

File tree

214 files changed

+369160
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+369160
-101
lines changed

App.js

Lines changed: 110 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,115 @@
1-
import React, {useState} from 'react';
2-
import {StyleSheet} from 'react-native';
3-
import {
4-
ViroARScene,
5-
ViroText,
6-
ViroConstants,
7-
ViroARSceneNavigator,
8-
} from '@viro-community/react-viro';
9-
10-
const HelloWorldSceneAR = () => {
11-
const [text, setText] = useState('Initializing AR...');
12-
13-
function onInitialized(state, reason) {
14-
console.log('guncelleme', state, reason);
15-
if (state === ViroConstants.TRACKING_NORMAL) {
16-
setText('Hello World!');
17-
} else if (state === ViroConstants.TRACKING_NONE) {
18-
// Handle loss of tracking
1+
import React, { Component } from 'react';
2+
import { SafeAreaView, View, Image, Text, TouchableOpacity, StyleSheet, FlatList, Linking, Button } from 'react-native';
3+
import { Navigation } from 'react-native-navigation';
4+
5+
import ARBusinessCard from './js/ARBusinessCard';
6+
import ARCarDemo from './js/ARCarDemo';
7+
import ARDrivingCarDemo from './js/ARDrivingCarDemo';
8+
import ARPhysicsSample from './js/ARPhysicsSample';
9+
import ARPosterDemo from './js/ARPosterDemo';
10+
//import ViroARSampleApp from './js/ViroARSampleApp';
11+
12+
const Views = [
13+
{index: 0, name: 'Business Card', component: ARBusinessCard, media: require('./assets/business_card.gif')},
14+
{index: 1, name: 'Car Demo', component: ARCarDemo, media: require('./assets/viro_car_marker_demo.gif')},
15+
{index: 2, name: 'Driving Car', component: ARDrivingCarDemo, media: require('./assets/ARDrivingCarDemo.gif')},
16+
{index: 3, name: 'Physics Sample', component: ARPhysicsSample, media: require('./assets/ar_sample.gif')},
17+
{index: 4, name: 'Poster Demo', component: ARPosterDemo, media: require('./assets/viro_black_panther_marker_demo.gif')},
18+
//{index: 5, name: 'Sample App', component: ViroARSampleApp}
19+
];
20+
21+
class NavigationView extends Component{
22+
constructor(props){
23+
super(props);
24+
this.renderItem = this.renderItem.bind(this);
25+
this.navigate = this.navigate.bind(this);
26+
this.footer = this.footer.bind(this);
27+
}
28+
29+
navigate = (screen, index, name) => {
30+
if(index == 2){
31+
Navigation.push(this.props.componentId, {
32+
component: {
33+
name: 'com.virocommunity.demo.ar.driving'
34+
}
35+
});
36+
}
37+
else{
38+
Navigation.push(this.props.componentId, {
39+
component: {
40+
name: 'com.virocommunity.demo.ar',
41+
passProps: {
42+
screen: screen
43+
},
44+
options: {
45+
topBar: {
46+
title: {
47+
text: name
48+
}
49+
}
50+
}
51+
}
52+
});
1953
}
2054
}
2155

22-
return (
23-
<ViroARScene onTrackingUpdated={onInitialized}>
24-
<ViroText
25-
text={text}
26-
scale={[0.5, 0.5, 0.5]}
27-
position={[0, 0, -1]}
28-
style={styles.helloWorldTextStyle}
29-
/>
30-
</ViroARScene>
31-
);
32-
};
33-
34-
export default () => {
35-
return (
36-
<ViroARSceneNavigator
37-
autofocus={true}
38-
initialScene={{
39-
scene: HelloWorldSceneAR,
40-
}}
41-
style={styles.f1}
42-
/>
43-
);
44-
};
45-
46-
var styles = StyleSheet.create({
47-
f1: {flex: 1},
48-
helloWorldTextStyle: {
49-
fontFamily: 'Arial',
50-
fontSize: 30,
51-
color: '#ffffff',
52-
textAlignVertical: 'center',
53-
textAlign: 'center',
56+
renderItem = ({item}) => {
57+
return(
58+
<TouchableOpacity style={styles.renderItem} key={item.index} onPress={() => this.navigate(item.component, item.index, item.name)}>
59+
<Image source={item.media} style={styles.media}/>
60+
<Text>{item.name}</Text>
61+
</TouchableOpacity>
62+
);
63+
}
64+
65+
footer = () => {
66+
return(
67+
<View style={styles.discord}>
68+
<Button title="Join us at Discord" onPress={() => Linking.openURL('https://discord.gg/WWFwSQdCyF')}/>
69+
</View>
70+
);
71+
}
72+
73+
render(){
74+
return(
75+
<SafeAreaView style={styles.container}>
76+
<FlatList
77+
numColumns={2}
78+
data={Views}
79+
renderItem={this.renderItem}
80+
ListFooterComponent={this.footer}
81+
/>
82+
</SafeAreaView>
83+
);
84+
}
85+
}
86+
87+
const styles = StyleSheet.create({
88+
container: {
89+
width: '100%',
90+
height: '100%',
91+
backgroundColor: 'white',
5492
},
93+
renderItem: {
94+
width: '50%',
95+
height: 200,
96+
backgroundColor: 'white',
97+
padding: 5,
98+
alignItems: 'center'
99+
},
100+
media:{
101+
width: '100%',
102+
height: 150,
103+
resizeMode: 'contain'
104+
},
105+
discord: {
106+
backgroundColor: 'white',
107+
width: '100%',
108+
height: 50,
109+
alignItems: 'center',
110+
justifyContent: 'center',
111+
color: 'white'
112+
}
55113
});
114+
115+
export default NavigationView;

android/app/BUCK

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android_library(
3535

3636
android_build_config(
3737
name = "build_config",
38-
package = "com.myviroapp",
38+
package = "com.virocommunity.demo",
3939
)
4040

4141
android_resource(
4242
name = "res",
43-
package = "com.myviroapp",
43+
package = "com.virocommunity.demo",
4444
res = "src/main/res",
4545
)
4646

android/app/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ import com.android.build.OutputFile
7878
*/
7979

8080
project.ext.react = [
81-
enableHermes: false, // clean and rebuild if changing
81+
enableHermes: true, // clean and rebuild if changing
8282
]
8383

8484
apply from: "../../node_modules/react-native/react.gradle"
@@ -91,7 +91,7 @@ apply from: "../../node_modules/react-native/react.gradle"
9191
* Upload all the APKs to the Play Store and people will download
9292
* the correct one based on the CPU architecture of their device.
9393
*/
94-
def enableSeparateBuildPerCPUArchitecture = false
94+
def enableSeparateBuildPerCPUArchitecture = true
9595

9696
/**
9797
* Run Proguard to shrink the Java bytecode in release builds.
@@ -129,7 +129,7 @@ android {
129129
}
130130

131131
defaultConfig {
132-
applicationId "com.myviroapp"
132+
applicationId "com.virocommunity.demo"
133133
minSdkVersion rootProject.ext.minSdkVersion
134134
targetSdkVersion rootProject.ext.targetSdkVersion
135135
versionCode 1
@@ -191,6 +191,7 @@ dependencies {
191191
implementation project(':arcore_client')
192192
implementation project(path: ':react_viro')
193193
implementation project(path: ':viro_renderer')
194+
implementation 'com.facebook.fresco:animated-gif:2.0.0'
194195
implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
195196
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
196197

android/app/src/debug/java/com/myviroapp/ReactNativeFlipper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
66
*/
7-
package com.myviroapp;
7+
package com.virocommunity.demo;
88

99
import android.content.Context;
1010
import com.facebook.flipper.android.AndroidFlipperClient;

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
2-
package="com.myviroapp">
2+
package="com.virocommunity.demo">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55
<uses-permission android:name="android.permission.CAMERA" />
66
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
77
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
88
<uses-feature android:name="android.hardware.camera" />
9+
<uses-feature android:name="android.hardware.camera.ar"/>
910
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" tools:replace="required"/>
1011
<uses-feature android:glEsVersion="0x00030000" android:required="false" tools:node="remove" tools:replace="required" />
1112
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" tools:replace="required" />
@@ -19,7 +20,7 @@
1920
android:allowBackup="false"
2021
android:usesCleartextTraffic="true"
2122
android:theme="@style/AppTheme">
22-
<meta-data android:name="com.google.ar.core" android:value="optional" />
23+
<meta-data android:name="com.google.ar.core" android:value="required" />
2324
<activity
2425
android:name=".MainActivity"
2526
android:label="@string/app_name"
86.2 KB
Loading

android/app/src/main/java/com/myviroapp/MainActivity.java

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.virocommunity.demo;
2+
3+
import com.reactnativenavigation.NavigationActivity;
4+
5+
public class MainActivity extends NavigationActivity {
6+
7+
8+
}

android/app/src/main/java/com/myviroapp/MainApplication.java renamed to android/app/src/main/java/com/virocommunity/demo/MainApplication.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
package com.myviroapp;
1+
package com.virocommunity.demo;
22

33
import android.app.Application;
44
import android.content.Context;
55
import com.facebook.react.PackageList;
6-
import com.facebook.react.ReactApplication;
6+
import com.reactnativenavigation.NavigationApplication;
77
import com.facebook.react.ReactInstanceManager;
88
import com.facebook.react.ReactNativeHost;
9+
import com.reactnativenavigation.react.NavigationReactNativeHost;
910
import com.facebook.react.ReactPackage;
1011
import com.facebook.soloader.SoLoader;
1112
import java.lang.reflect.InvocationTargetException;
1213
import java.util.List;
1314
import com.viromedia.bridge.ReactViroPackage;
1415

15-
public class MainApplication extends Application implements ReactApplication {
16+
public class MainApplication extends NavigationApplication {
1617

1718
private final ReactNativeHost mReactNativeHost =
18-
new ReactNativeHost(this) {
19+
new NavigationReactNativeHost(this) {
1920
@Override
2021
public boolean getUseDeveloperSupport() {
2122
return BuildConfig.DEBUG;
@@ -45,7 +46,7 @@ public ReactNativeHost getReactNativeHost() {
4546
@Override
4647
public void onCreate() {
4748
super.onCreate();
48-
SoLoader.init(this, /* native exopackage */ false);
49+
4950
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
5051
}
5152

@@ -64,7 +65,7 @@ private static void initializeFlipper(
6465
We use reflection here to pick up the class that initializes Flipper,
6566
since Flipper library is not available in release mode
6667
*/
67-
Class<?> aClass = Class.forName("com.myviroapp.ReactNativeFlipper");
68+
Class<?> aClass = Class.forName("com.virocommunity.demo.ReactNativeFlipper");
6869
aClass
6970
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
7071
.invoke(null, context, reactInstanceManager);
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector
3+
android:height="108dp"
4+
android:width="108dp"
5+
android:viewportHeight="108"
6+
android:viewportWidth="108"
7+
xmlns:android="http://schemas.android.com/apk/res/android">
8+
<path android:fillColor="#3DDC84"
9+
android:pathData="M0,0h108v108h-108z"/>
10+
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
11+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
12+
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
13+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
14+
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
15+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
16+
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
17+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
18+
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
19+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
20+
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
21+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
22+
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
23+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
24+
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
25+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
26+
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
27+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
28+
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
29+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
30+
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
31+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
32+
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
33+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
34+
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
35+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
36+
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
37+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
38+
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
39+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
40+
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
41+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
42+
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
43+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
44+
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
45+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
46+
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
47+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
48+
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
49+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
50+
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
51+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
52+
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
53+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
54+
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
55+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
56+
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
57+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
58+
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
59+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
60+
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
61+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
62+
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
63+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
64+
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
65+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
66+
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
67+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
68+
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
69+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
70+
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
71+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
72+
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
73+
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
74+
</vector>

0 commit comments

Comments
 (0)