diff --git a/Examples/TicTacToe/android/app/BUCK b/Examples/TicTacToe/android/app/BUCK new file mode 100644 index 00000000000..5c7c9b83345 --- /dev/null +++ b/Examples/TicTacToe/android/app/BUCK @@ -0,0 +1,31 @@ +include_defs('//ReactAndroid/DEFS') + +android_binary( + name = 'app', + manifest = 'src/main/AndroidManifest.xml', + keystore = '//keystores:debug', + deps = [ + ':tictactoe-lib', + ], +) + +android_library( + name = 'tictactoe-lib', + srcs = glob(['src/main/java/**/*.java']), + deps = [ + ':res', + react_native_dep('third-party/java/jsr-305:jsr-305'), + react_native_target('java/com/facebook/react/modules/core:core'), + react_native_target('java/com/facebook/react/shell:shell'), + react_native_target('java/com/facebook/react:react'), + react_native_target('jni/prebuilt:android-jsc'), + # .so files are prebuilt by Gradle with `./gradlew :ReactAndroid:packageReactNdkLibsForBuck` + react_native_target('jni/prebuilt:reactnative-libs'), + ], +) + +android_resource( + name = 'res', + res = 'src/main/res', + package = 'com.facebook.react.tictactoe', +) diff --git a/Examples/TicTacToe/android/app/build.gradle b/Examples/TicTacToe/android/app/build.gradle new file mode 100644 index 00000000000..94509eca564 --- /dev/null +++ b/Examples/TicTacToe/android/app/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.1" + + defaultConfig { + applicationId "com.facebook.react.tictactoe" + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + ndk { + abiFilters "armeabi-v7a", "x86" + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:23.0.1' + + // Build React Native from source + compile project(':ReactAndroid') +} diff --git a/Examples/TicTacToe/android/app/gradle.properties b/Examples/TicTacToe/android/app/gradle.properties new file mode 100644 index 00000000000..dfbe478748b --- /dev/null +++ b/Examples/TicTacToe/android/app/gradle.properties @@ -0,0 +1 @@ +android.useDeprecatedNdk=true diff --git a/Examples/TicTacToe/android/app/proguard-rules.pro b/Examples/TicTacToe/android/app/proguard-rules.pro new file mode 100644 index 00000000000..a92fa177ee4 --- /dev/null +++ b/Examples/TicTacToe/android/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/Examples/TicTacToe/android/app/src/main/AndroidManifest.xml b/Examples/TicTacToe/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..a6dbe21557a --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeActivity.java b/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeActivity.java new file mode 100644 index 00000000000..3589ea4e5a6 --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeActivity.java @@ -0,0 +1,23 @@ +/** + * The examples provided by Facebook are for non-commercial testing and + * evaluation purposes only. + * + * Facebook reserves all rights not expressly granted. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL + * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.facebook.react.tictactoe; + +import com.facebook.react.ReactActivity; + +public class TicTacToeActivity extends ReactActivity { + @Override + protected String getMainComponentName() { + return "TicTacToeApp"; + } +} diff --git a/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeApplication.java b/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeApplication.java new file mode 100644 index 00000000000..bf56be8f4df --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/java/com/facebook/react/tictactoe/TicTacToeApplication.java @@ -0,0 +1,58 @@ +/** + * The examples provided by Facebook are for non-commercial testing and + * evaluation purposes only. + * + * Facebook reserves all rights not expressly granted. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL + * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.facebook.react.tictactoe; + +import android.app.Application; + +import com.facebook.react.ReactApplication; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.shell.MainReactPackage; + +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Nullable; + +public class TicTacToeApplication extends Application implements ReactApplication { + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + @Override + public String getJSMainModuleName() { + return "Examples/TicTacToe/TicTacToeApp"; + } + + @Override + public @Nullable String getBundleAssetName() { + return "TicTacToeApp.bundle"; + } + + @Override + protected boolean getUseDeveloperSupport() { + return true; + } + + @Override + protected List getPackages() { + return Arrays.asList( + new MainReactPackage() + ); + } + }; + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } +} diff --git a/Examples/TicTacToe/android/app/src/main/res/drawable/launcher_icon.png b/Examples/TicTacToe/android/app/src/main/res/drawable/launcher_icon.png new file mode 100644 index 00000000000..a4aa3bd6d9a Binary files /dev/null and b/Examples/TicTacToe/android/app/src/main/res/drawable/launcher_icon.png differ diff --git a/Examples/TicTacToe/android/app/src/main/res/layout/activity_main.xml b/Examples/TicTacToe/android/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000000..7d338d621d0 --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/Examples/TicTacToe/android/app/src/main/res/values/strings.xml b/Examples/TicTacToe/android/app/src/main/res/values/strings.xml new file mode 100644 index 00000000000..26cdf63c684 --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + TicTacToeApp + diff --git a/Examples/TicTacToe/android/app/src/main/res/values/styles.xml b/Examples/TicTacToe/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000000..319eb0ca100 --- /dev/null +++ b/Examples/TicTacToe/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/settings.gradle b/settings.gradle index c952f9077a4..ccc7b3b962e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ // Copyright 2004-present Facebook. All Rights Reserved. -include ':ReactAndroid', ':Examples:UIExplorer:android:app', ':Examples:Movies:android:app' +include ':ReactAndroid', ':Examples:UIExplorer:android:app', ':Examples:Movies:android:app', ':Examples:TicTacToe:android:app'