Browse Source

Pushing to Github

jarjonam 5 years ago
commit
d12091bf59
100 changed files with 9334 additions and 0 deletions
  1. 3 0
      .babelrc
  2. 6 0
      .buckconfig
  3. 45 0
      .flowconfig
  4. 1 0
      .gitattributes
  5. 55 0
      .gitignore
  6. 1 0
      .watchmanconfig
  7. 12 0
      __tests__/index.android.js
  8. 12 0
      __tests__/index.ios.js
  9. 65 0
      android/app/BUCK
  10. 159 0
      android/app/build.gradle
  11. 70 0
      android/app/proguard-rules.pro
  12. 33 0
      android/app/src/main/AndroidManifest.xml
  13. 7135 0
      android/app/src/main/assets/characterlist.json
  14. 137 0
      android/app/src/main/assets/main.html
  15. 1 0
      android/app/src/main/assets/recognition/TeXDrawNN.json
  16. 1 0
      android/app/src/main/assets/recognition/TeXDrawNN_metadata.json
  17. BIN
      android/app/src/main/assets/recognition/TeXDrawNN_weights.buf
  18. 31 0
      android/app/src/main/assets/texdraw.html
  19. 1450 0
      android/app/src/main/assets/texdraw.js
  20. 1 0
      android/app/src/main/assets/texdraw.js.map
  21. 21 0
      android/app/src/main/assets/text2svg.js
  22. 36 0
      android/app/src/main/assets/weblas.js
  23. 15 0
      android/app/src/main/java/com/texdraw/MainActivity.java
  24. 44 0
      android/app/src/main/java/com/texdraw/MainApplication.java
  25. BIN
      android/app/src/main/res/drawable-hdpi/tex0.png
  26. BIN
      android/app/src/main/res/drawable-hdpi/tex1.png
  27. BIN
      android/app/src/main/res/drawable-hdpi/tex10.png
  28. BIN
      android/app/src/main/res/drawable-hdpi/tex100.png
  29. BIN
      android/app/src/main/res/drawable-hdpi/tex101.png
  30. BIN
      android/app/src/main/res/drawable-hdpi/tex102.png
  31. BIN
      android/app/src/main/res/drawable-hdpi/tex103.png
  32. BIN
      android/app/src/main/res/drawable-hdpi/tex104.png
  33. BIN
      android/app/src/main/res/drawable-hdpi/tex105.png
  34. BIN
      android/app/src/main/res/drawable-hdpi/tex106.png
  35. BIN
      android/app/src/main/res/drawable-hdpi/tex107.png
  36. BIN
      android/app/src/main/res/drawable-hdpi/tex108.png
  37. BIN
      android/app/src/main/res/drawable-hdpi/tex109.png
  38. BIN
      android/app/src/main/res/drawable-hdpi/tex11.png
  39. BIN
      android/app/src/main/res/drawable-hdpi/tex110.png
  40. BIN
      android/app/src/main/res/drawable-hdpi/tex111.png
  41. BIN
      android/app/src/main/res/drawable-hdpi/tex112.png
  42. BIN
      android/app/src/main/res/drawable-hdpi/tex113.png
  43. BIN
      android/app/src/main/res/drawable-hdpi/tex114.png
  44. BIN
      android/app/src/main/res/drawable-hdpi/tex115.png
  45. BIN
      android/app/src/main/res/drawable-hdpi/tex116.png
  46. BIN
      android/app/src/main/res/drawable-hdpi/tex117.png
  47. BIN
      android/app/src/main/res/drawable-hdpi/tex118.png
  48. BIN
      android/app/src/main/res/drawable-hdpi/tex119.png
  49. BIN
      android/app/src/main/res/drawable-hdpi/tex12.png
  50. BIN
      android/app/src/main/res/drawable-hdpi/tex120.png
  51. BIN
      android/app/src/main/res/drawable-hdpi/tex121.png
  52. BIN
      android/app/src/main/res/drawable-hdpi/tex122.png
  53. BIN
      android/app/src/main/res/drawable-hdpi/tex123.png
  54. BIN
      android/app/src/main/res/drawable-hdpi/tex124.png
  55. BIN
      android/app/src/main/res/drawable-hdpi/tex125.png
  56. BIN
      android/app/src/main/res/drawable-hdpi/tex126.png
  57. BIN
      android/app/src/main/res/drawable-hdpi/tex127.png
  58. BIN
      android/app/src/main/res/drawable-hdpi/tex128.png
  59. BIN
      android/app/src/main/res/drawable-hdpi/tex129.png
  60. BIN
      android/app/src/main/res/drawable-hdpi/tex13.png
  61. BIN
      android/app/src/main/res/drawable-hdpi/tex130.png
  62. BIN
      android/app/src/main/res/drawable-hdpi/tex131.png
  63. BIN
      android/app/src/main/res/drawable-hdpi/tex132.png
  64. BIN
      android/app/src/main/res/drawable-hdpi/tex133.png
  65. BIN
      android/app/src/main/res/drawable-hdpi/tex134.png
  66. BIN
      android/app/src/main/res/drawable-hdpi/tex135.png
  67. BIN
      android/app/src/main/res/drawable-hdpi/tex136.png
  68. BIN
      android/app/src/main/res/drawable-hdpi/tex137.png
  69. BIN
      android/app/src/main/res/drawable-hdpi/tex138.png
  70. BIN
      android/app/src/main/res/drawable-hdpi/tex139.png
  71. BIN
      android/app/src/main/res/drawable-hdpi/tex14.png
  72. BIN
      android/app/src/main/res/drawable-hdpi/tex140.png
  73. BIN
      android/app/src/main/res/drawable-hdpi/tex141.png
  74. BIN
      android/app/src/main/res/drawable-hdpi/tex142.png
  75. BIN
      android/app/src/main/res/drawable-hdpi/tex143.png
  76. BIN
      android/app/src/main/res/drawable-hdpi/tex144.png
  77. BIN
      android/app/src/main/res/drawable-hdpi/tex145.png
  78. BIN
      android/app/src/main/res/drawable-hdpi/tex146.png
  79. BIN
      android/app/src/main/res/drawable-hdpi/tex147.png
  80. BIN
      android/app/src/main/res/drawable-hdpi/tex148.png
  81. BIN
      android/app/src/main/res/drawable-hdpi/tex149.png
  82. BIN
      android/app/src/main/res/drawable-hdpi/tex15.png
  83. BIN
      android/app/src/main/res/drawable-hdpi/tex150.png
  84. BIN
      android/app/src/main/res/drawable-hdpi/tex151.png
  85. BIN
      android/app/src/main/res/drawable-hdpi/tex152.png
  86. BIN
      android/app/src/main/res/drawable-hdpi/tex153.png
  87. BIN
      android/app/src/main/res/drawable-hdpi/tex154.png
  88. BIN
      android/app/src/main/res/drawable-hdpi/tex155.png
  89. BIN
      android/app/src/main/res/drawable-hdpi/tex156.png
  90. BIN
      android/app/src/main/res/drawable-hdpi/tex157.png
  91. BIN
      android/app/src/main/res/drawable-hdpi/tex158.png
  92. BIN
      android/app/src/main/res/drawable-hdpi/tex159.png
  93. BIN
      android/app/src/main/res/drawable-hdpi/tex16.png
  94. BIN
      android/app/src/main/res/drawable-hdpi/tex160.png
  95. BIN
      android/app/src/main/res/drawable-hdpi/tex161.png
  96. BIN
      android/app/src/main/res/drawable-hdpi/tex162.png
  97. BIN
      android/app/src/main/res/drawable-hdpi/tex163.png
  98. BIN
      android/app/src/main/res/drawable-hdpi/tex164.png
  99. BIN
      android/app/src/main/res/drawable-hdpi/tex165.png
  100. 0 0
      android/app/src/main/res/drawable-hdpi/tex166.png

+ 3 - 0
.babelrc

@@ -0,0 +1,3 @@
+{
+  "presets": ["react-native"]
+}

+ 6 - 0
.buckconfig

@@ -0,0 +1,6 @@
+
+[android]
+  target = Google Inc.:Google APIs:23
+
+[maven_repositories]
+  central = https://repo1.maven.org/maven2

+ 45 - 0
.flowconfig

@@ -0,0 +1,45 @@
+[ignore]
+; We fork some components by platform
+.*/*[.]android.js
+
+; Ignore "BUCK" generated dirs
+<PROJECT_ROOT>/\.buckd/
+
+; Ignore unexpected extra "@providesModule"
+.*/node_modules/.*/node_modules/fbjs/.*
+
+; Ignore duplicate module providers
+; For RN Apps installed via npm, "Libraries" folder is inside
+; "node_modules/react-native" but in the source repo it is in the root
+.*/Libraries/react-native/React.js
+.*/Libraries/react-native/ReactNative.js
+
+[include]
+
+[libs]
+node_modules/react-native/Libraries/react-native/react-native-interface.js
+node_modules/react-native/flow
+flow/
+
+[options]
+emoji=true
+
+module.system=haste
+
+munge_underscores=true
+
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
+
+suppress_type=$FlowIssue
+suppress_type=$FlowFixMe
+suppress_type=$FixMe
+
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
+suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
+
+unsafe.enable_getters_and_setters=true
+
+[version]
+^0.49.1

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+*.pbxproj -text

+ 55 - 0
.gitignore

@@ -0,0 +1,55 @@
+.index.androidold.js
+
+# OSX
+#
+.DS_Store
+
+# Xcode
+#
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
+project.xcworkspace
+
+# Android/IntelliJ
+#
+build/
+.idea
+.gradle
+local.properties
+*.iml
+
+# node.js
+#
+node_modules/
+npm-debug.log
+yarn-error.log
+
+# BUCK
+buck-out/
+\.buckd/
+*.keystore
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
+# screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots

+ 1 - 0
.watchmanconfig

@@ -0,0 +1 @@
+{}

+ 12 - 0
__tests__/index.android.js

@@ -0,0 +1,12 @@
+import 'react-native';
+import React from 'react';
+import Index from '../index.android.js';
+
+// Note: test renderer must be required after react-native.
+import renderer from 'react-test-renderer';
+
+it('renders correctly', () => {
+  const tree = renderer.create(
+    <Index />
+  );
+});

+ 12 - 0
__tests__/index.ios.js

@@ -0,0 +1,12 @@
+import 'react-native';
+import React from 'react';
+import Index from '../index.ios.js';
+
+// Note: test renderer must be required after react-native.
+import renderer from 'react-test-renderer';
+
+it('renders correctly', () => {
+  const tree = renderer.create(
+    <Index />
+  );
+});

+ 65 - 0
android/app/BUCK

@@ -0,0 +1,65 @@
+# To learn about Buck see [Docs](https://buckbuild.com/).
+# To run your application with Buck:
+# - install Buck
+# - `npm start` - to start the packager
+# - `cd android`
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
+# - `buck install -r android/app` - compile, install and run application
+#
+
+lib_deps = []
+
+for jarfile in glob(['libs/*.jar']):
+  name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
+  lib_deps.append(':' + name)
+  prebuilt_jar(
+    name = name,
+    binary_jar = jarfile,
+  )
+
+for aarfile in glob(['libs/*.aar']):
+  name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
+  lib_deps.append(':' + name)
+  android_prebuilt_aar(
+    name = name,
+    aar = aarfile,
+  )
+
+android_library(
+    name = "all-libs",
+    exported_deps = lib_deps,
+)
+
+android_library(
+    name = "app-code",
+    srcs = glob([
+        "src/main/java/**/*.java",
+    ]),
+    deps = [
+        ":all-libs",
+        ":build_config",
+        ":res",
+    ],
+)
+
+android_build_config(
+    name = "build_config",
+    package = "com.texdraw",
+)
+
+android_resource(
+    name = "res",
+    package = "com.texdraw",
+    res = "src/main/res",
+)
+
+android_binary(
+    name = "app",
+    keystore = "//android/keystores:debug",
+    manifest = "src/main/AndroidManifest.xml",
+    package_type = "debug",
+    deps = [
+        ":app-code",
+    ],
+)

+ 159 - 0
android/app/build.gradle

@@ -0,0 +1,159 @@
+apply plugin: "com.android.application"
+
+import com.android.build.OutputFile
+
+/**
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
+ * and bundleReleaseJsAndAssets).
+ * These basically call `react-native bundle` with the correct arguments during the Android build
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
+ * bundle directly from the development server. Below you can see all the possible configurations
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
+ *
+ * project.ext.react = [
+ *   // the name of the generated asset file containing your JS bundle
+ *   bundleAssetName: "index.android.bundle",
+ *
+ *   // the entry file for bundle generation
+ *   entryFile: "index.android.js",
+ *
+ *   // whether to bundle JS and assets in debug mode
+ *   bundleInDebug: false,
+ *
+ *   // whether to bundle JS and assets in release mode
+ *   bundleInRelease: true,
+ *
+ *   // whether to bundle JS and assets in another build variant (if configured).
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
+ *   // The configuration property can be in the following formats
+ *   //         'bundleIn${productFlavor}${buildType}'
+ *   //         'bundleIn${buildType}'
+ *   // bundleInFreeDebug: true,
+ *   // bundleInPaidRelease: true,
+ *   // bundleInBeta: true,
+ *
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
+ *   // for example: to disable dev mode in the staging build type (if configured)
+ *   devDisabledInStaging: true,
+ *   // The configuration property can be in the following formats
+ *   //         'devDisabledIn${productFlavor}${buildType}'
+ *   //         'devDisabledIn${buildType}'
+ *
+ *   // the root of your project, i.e. where "package.json" lives
+ *   root: "../../",
+ *
+ *   // where to put the JS bundle asset in debug mode
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
+ *
+ *   // where to put the JS bundle asset in release mode
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
+ *
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
+ *   // require('./image.png')), in debug mode
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
+ *
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
+ *   // require('./image.png')), in release mode
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
+ *
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
+ *   // for example, you might want to remove it from here.
+ *   inputExcludes: ["android/**", "ios/**"],
+ *
+ *   // override which node gets called and with what additional arguments
+ *   nodeExecutableAndArgs: ["node"],
+ *
+ *   // supply additional arguments to the packager
+ *   extraPackagerArgs: []
+ * ]
+ */
+
+apply from: "../../node_modules/react-native/react.gradle"
+
+/**
+ * Set this to true to create two separate APKs instead of one:
+ *   - An APK that only works on ARM devices
+ *   - An APK that only works on x86 devices
+ * The advantage is the size of the APK is reduced by about 4MB.
+ * Upload all the APKs to the Play Store and people will download
+ * the correct one based on the CPU architecture of their device.
+ */
+def enableSeparateBuildPerCPUArchitecture = false
+
+/**
+ * Run Proguard to shrink the Java bytecode in release builds.
+ */
+def enableProguardInReleaseBuilds = true
+
+android {
+    compileSdkVersion 23
+    buildToolsVersion "23.0.1"
+
+    defaultConfig {
+        applicationId "com.jesusarjona.texdraw"
+        minSdkVersion 16
+        targetSdkVersion 22
+        versionCode 1
+        versionName "1.0"
+        ndk {
+            abiFilters "armeabi-v7a", "x86"
+        }
+    }
+    signingConfigs {
+        release {
+            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
+                storeFile file(MYAPP_RELEASE_STORE_FILE)
+                storePassword MYAPP_RELEASE_STORE_PASSWORD
+                keyAlias MYAPP_RELEASE_KEY_ALIAS
+                keyPassword MYAPP_RELEASE_KEY_PASSWORD
+            }
+        }
+    }
+    splits {
+        abi {
+            reset()
+            enable enableSeparateBuildPerCPUArchitecture
+            universalApk false  // If true, also generate a universal APK
+            include "armeabi-v7a", "x86"
+        }
+    }
+    buildTypes {
+        release {
+            minifyEnabled enableProguardInReleaseBuilds
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
+            signingConfig signingConfigs.release
+        }
+    }
+    // applicationVariants are e.g. debug, release
+    applicationVariants.all { variant ->
+        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 abi = output.getFilter(OutputFile.ABI)
+            if (abi != null) {  // null for the universal-debug, universal-release variants
+                output.versionCodeOverride =
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
+            }
+        }
+    }
+}
+
+dependencies {
+    compile project(':react-native-interactable')
+    compile fileTree(dir: "libs", include: ["*.jar"])
+    compile "com.android.support:appcompat-v7:23.0.1"
+    compile "com.facebook.react:react-native:+"  // From node_modules
+    compile project(':react-native-webview-bridge')
+}
+
+// Run this once to be able to run the application with BUCK
+// puts all compile dependencies into folder libs for BUCK to use
+task copyDownloadableDepsToLibs(type: Copy) {
+    from configurations.compile
+    into 'libs'
+}

+ 70 - 0
android/app/proguard-rules.pro

@@ -0,0 +1,70 @@
+# 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 *;
+#}
+
+# Disabling obfuscation is useful if you collect stack traces from production crashes
+# (unless you are using a system that supports de-obfuscate the stack traces).
+-dontobfuscate
+
+# React Native
+
+# Keep our interfaces so they can be used by other ProGuard rules.
+# See http://sourceforge.net/p/proguard/bugs/466/
+-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
+-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
+-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
+
+# Do not strip any method/class that is annotated with @DoNotStrip
+-keep @com.facebook.proguard.annotations.DoNotStrip class *
+-keep @com.facebook.common.internal.DoNotStrip class *
+-keepclassmembers class * {
+    @com.facebook.proguard.annotations.DoNotStrip *;
+    @com.facebook.common.internal.DoNotStrip *;
+}
+
+-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
+  void set*(***);
+  *** get*();
+}
+
+-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
+-keep class * extends com.facebook.react.bridge.NativeModule { *; }
+-keepclassmembers,includedescriptorclasses class * { native <methods>; }
+-keepclassmembers class *  { @com.facebook.react.uimanager.UIProp <fields>; }
+-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
+-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
+
+-dontwarn com.facebook.react.**
+
+# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
+# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
+-dontwarn android.text.StaticLayout
+
+# okhttp
+
+-keepattributes Signature
+-keepattributes *Annotation*
+-keep class okhttp3.** { *; }
+-keep interface okhttp3.** { *; }
+-dontwarn okhttp3.**
+
+# okio
+
+-keep class sun.misc.Unsafe { *; }
+-dontwarn java.nio.file.*
+-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
+-dontwarn okio.**

+ 33 - 0
android/app/src/main/AndroidManifest.xml

@@ -0,0 +1,33 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.jesusarjona.texdraw"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+
+    <uses-sdk
+        android:minSdkVersion="16"
+        android:targetSdkVersion="22" />
+
+    <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:label="@string/app_name"
+        android:screenOrientation="portrait"
+        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" />
+    </application>
+
+</manifest>

File diff suppressed because it is too large
+ 7135 - 0
android/app/src/main/assets/characterlist.json


+ 137 - 0
android/app/src/main/assets/main.html

@@ -0,0 +1,137 @@
+<html>
+    <head>
+        <script type="text/javascript">
+            //alert(Character)
+            var drawing = []
+            var stroke = []
+            var ctx, rect
+            var n = 2
+            function loaded(){
+                if(window.innerHeight==0){
+                    setTimeout(loaded, 100)
+                }
+                else{
+                    var canvas = document.getElementById('canvas')
+                    canvas.width = window.innerWidth*n
+                    canvas.height = window.innerHeight*n
+                    rect = canvas.getBoundingClientRect();
+                    ctx = canvas.getContext("2d")
+                    ctx.fillStyle = "#fdfdfd";
+                    ctx.fillRect(0, 0, canvas.width, canvas.height)
+                    //Loading
+                    ctx.font = "50px Roboto";
+                    ctx.fillStyle = "#555555";
+                    ctx.textAlign = "center";
+                    ctx.fillText("Loading...", canvas.width/2, canvas.height*.4); 
+                }
+            }
+
+            var isDrawing = false;
+            function startDrawing(e){
+                if(isCleaning){
+                    isCleaning = false
+                    cleaningRadius = 20
+                    ctx.fillStyle = "#fafafa";
+                    ctx.fillRect(0, 0, canvas.width, canvas.height)
+                }
+                isDrawing = true
+                ctx.beginPath();
+                ctx.lineWidth = 15;
+                ctx.strokeStyle = "#8b0e51"
+                ctx.moveTo(e.changedTouches[0].clientX*n-rect.left,e.changedTouches[0].clientY*n-rect.top);
+                stroke.push([e.changedTouches[0].clientX*n-rect.left,e.changedTouches[0].clientY*n-rect.top])
+            }
+            function moveDrawing(e){
+                if(isDrawing){
+                    stroke.push([e.changedTouches[0].clientX*n-rect.left,e.changedTouches[0].clientY*n-rect.top])
+                    ctx.lineJoin = ctx.lineCap = 'round'
+                    ctx.lineTo(e.changedTouches[0].clientX*n-rect.left,e.changedTouches[0].clientY*n-rect.top);
+                    ctx.stroke()
+                    /*ctx.fillStyle = "#ffffff";
+                    ctx.lineJoin = ctx.lineCap = 'round';
+                    ctx.fillRect(0, 0, canvas.width, canvas.height)
+                    for(var j = 0; j < drawing.concat([stroke]).length; j++){
+                        var str = drawing.concat([stroke])[j]
+                        ctx.moveTo(str[0][0], str[0][1]);
+                       for (i = 1; i < str.length - 2; i ++){
+                          var xc = (str[i][0] + str[i + 1][0]) / 2;
+                          var yc = (str[i][1] + str[i + 1][1]) / 2;
+                          ctx.quadraticCurveTo(str[i][0], str[i][1], xc, yc);
+                       }
+                        ctx.quadraticCurveTo(str[i][0], str[i][1], str[i+1][0],str[i+1][1]);
+                        ctx.stroke()
+                    }*/
+                }
+            }
+            function stopDrawing(e){
+                isDrawing = false
+                drawing.push(stroke)
+                if(stroke.length==1){
+                    ctx.beginPath();
+                    ctx.arc(stroke[0][0], stroke[0][1], 10, 0, 2 * Math.PI, false);
+                    ctx.fillStyle = '#8b0e51';
+                    ctx.fill();
+                }
+                //WebViewBridge.send(JSON.stringify(drawing))
+                window.postMessage(JSON.stringify(drawing), "*")
+                /*var strs = drawing.map(s => new Stroke(s))
+                var char = new Character({strokes: strs})
+                char.recognizeLatex().then((result) => {
+                    WebViewBridge.send(JSON.stringify(result))
+                    stroke = [] //Empty stroke
+                })*/
+            }
+            
+            /*WebViewBridge.onMessage = function (message) {
+                if(message == "clear"){
+                    drawing = []
+                    stroke = []
+                    isCleaning=true
+                    cleaning()
+                }   
+            }*/
+            document.addEventListener("message", function (message) {
+                if(message.data == "clear"){
+                    drawing = []
+                    stroke = []
+                    isCleaning=true
+                    cleaning()
+                }
+                if(message.data == "loaded"){
+                    ctx.fillStyle = "#ffffff";
+                    ctx.fillRect(0, 0, canvas.width, canvas.height)
+                    canvas.addEventListener("touchstart", startDrawing, false)
+                    canvas.addEventListener("touchend", stopDrawing, false)
+                    canvas.addEventListener("touchmove", moveDrawing, false)
+                }
+            });
+            var cleaningRadius = 20
+            var isCleaning = false
+            function cleaning(){
+                if(isCleaning){
+                    //ctx.fillStyle = "#fafafa";
+                    //ctx.fillRect(0, 0, canvas.width, canvas.height)
+                    ctx.beginPath();
+                    ctx.arc(50, canvas.height-250, cleaningRadius, 0, 2 * Math.PI, false);
+                    var intensity = 240 + Math.floor(cleaningRadius/50)
+                    ctx.fillStyle = 'rgba('+intensity+','+intensity+','+intensity+',.5)';
+                    ctx.fill();
+                    //ctx.lineWidth = 5;
+                    //ctx.strokeStyle = '#003300';
+                    //ctx.stroke();
+                    if(cleaningRadius<canvas.width+canvas.height){
+                        setTimeout(cleaning, 5)
+                        cleaningRadius = cleaningRadius + 20 + Math.floor(cleaningRadius/80)
+                    } 
+                    else{
+                        cleaningRadius = 10
+                        isCleaning=false
+                    }
+                }
+            }
+        </script>
+    </head>
+    <body style="margin:0px" onload="loaded()">
+        <canvas id="canvas" width="400" height="20" style="border-bottom: 0px solid black; width:100%; height:100%"></canvas>
+    </body>
+</html>

File diff suppressed because it is too large
+ 1 - 0
android/app/src/main/assets/recognition/TeXDrawNN.json


File diff suppressed because it is too large
+ 1 - 0
android/app/src/main/assets/recognition/TeXDrawNN_metadata.json


BIN
android/app/src/main/assets/recognition/TeXDrawNN_weights.buf


+ 31 - 0
android/app/src/main/assets/texdraw.html

@@ -0,0 +1,31 @@
+<html>
+    <head>
+        <script type="text/javascript" src="weblas.js" charset="UTF-8"></script>
+        <script type="text/javascript" src="texdraw.js"  charset="UTF-8"></script>
+        <script type="text/javascript">
+            function loaded(){
+                /*setTimeout(function(){
+                    var script = document.createElement("script");
+                    script.type = "text/javascript";
+                    script.charset = "UTF-8"
+                    script.src = "texdraw.js";
+                    script.onload = function(){
+                        WebViewBridge.send("loaded")
+                    }
+                    document.body.appendChild(script);
+                }, 100)*/
+                WebViewBridge.send("loaded")
+            }            
+            WebViewBridge.onMessage = function (message) {
+                var drawing = JSON.parse(message)
+                var strs = drawing.map(s => new Stroke(s))
+                var char = new Character({strokes: strs})
+                char.recognizeLatex().then((result) => {
+                    WebViewBridge.send(JSON.stringify(result))
+                })
+            }
+        </script>
+    </head>
+    <body style="margin:0px; height:0px" onload="loaded()">
+    </body>
+</html>

File diff suppressed because it is too large
+ 1450 - 0
android/app/src/main/assets/texdraw.js


File diff suppressed because it is too large
+ 1 - 0
android/app/src/main/assets/texdraw.js.map


+ 21 - 0
android/app/src/main/assets/text2svg.js

@@ -0,0 +1,21 @@
+var mathmode = require("mathmode")
+var fs = require('fs');
+var characterlist = require('./characterlist.json');
+
+var i = 0
+function write(){
+    if(i<characterlist.length){
+        var sym = characterlist[i]
+        var fileName = "icons/latex/tex"+i+".png"
+        var myFile = fs.createWriteStream(fileName);
+        var latex = sym["Latex"]
+
+        var image = mathmode(latex, {dpi:3000, packages:["amsmath", "amssymb", "stmaryrd", "latexsym", "textcomp", "wasysym", "marvosym", "mathrsfs", "tipa", "upgreek", "gensymb", "esint", ""]}).pipe(myFile)
+        
+        i++
+        setTimeout(write, 200)
+    }
+}
+
+write()
+//dsfont, bbold

File diff suppressed because it is too large
+ 36 - 0
android/app/src/main/assets/weblas.js


+ 15 - 0
android/app/src/main/java/com/texdraw/MainActivity.java

@@ -0,0 +1,15 @@
+package com.jesusarjona.texdraw;
+
+import com.facebook.react.ReactActivity;
+
+public class MainActivity extends ReactActivity {
+
+    /**
+     * Returns the name of the main component registered from JavaScript.
+     * This is used to schedule rendering of the component.
+     */
+    @Override
+    protected String getMainComponentName() {
+        return "TeXDraw";
+    }
+}

+ 44 - 0
android/app/src/main/java/com/texdraw/MainApplication.java

@@ -0,0 +1,44 @@
+package com.jesusarjona.texdraw;
+
+import android.app.Application;
+
+import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage;
+import com.facebook.react.ReactApplication;
+import com.wix.interactable.Interactable;
+import com.facebook.react.ReactNativeHost;
+import com.facebook.react.ReactPackage;
+import com.facebook.react.shell.MainReactPackage;
+import com.facebook.soloader.SoLoader;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MainApplication extends Application implements ReactApplication {
+
+  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
+    @Override
+    public boolean getUseDeveloperSupport() {
+      return BuildConfig.DEBUG;
+    }
+
+    @Override
+    protected List<ReactPackage> getPackages() {
+      return Arrays.<ReactPackage>asList(
+          new MainReactPackage(),
+            new Interactable(),
+          new WebViewBridgePackage()
+      );
+    }
+  };
+
+  @Override
+  public ReactNativeHost getReactNativeHost() {
+    return mReactNativeHost;
+  }
+
+  @Override
+  public void onCreate() {
+    super.onCreate();
+    SoLoader.init(this, /* native exopackage */ false);
+  }
+}

BIN
android/app/src/main/res/drawable-hdpi/tex0.png


BIN
android/app/src/main/res/drawable-hdpi/tex1.png


BIN
android/app/src/main/res/drawable-hdpi/tex10.png


BIN
android/app/src/main/res/drawable-hdpi/tex100.png


BIN
android/app/src/main/res/drawable-hdpi/tex101.png


BIN
android/app/src/main/res/drawable-hdpi/tex102.png


BIN
android/app/src/main/res/drawable-hdpi/tex103.png


BIN
android/app/src/main/res/drawable-hdpi/tex104.png


BIN
android/app/src/main/res/drawable-hdpi/tex105.png


BIN
android/app/src/main/res/drawable-hdpi/tex106.png


BIN
android/app/src/main/res/drawable-hdpi/tex107.png


BIN
android/app/src/main/res/drawable-hdpi/tex108.png


BIN
android/app/src/main/res/drawable-hdpi/tex109.png


BIN
android/app/src/main/res/drawable-hdpi/tex11.png


BIN
android/app/src/main/res/drawable-hdpi/tex110.png


BIN
android/app/src/main/res/drawable-hdpi/tex111.png


BIN
android/app/src/main/res/drawable-hdpi/tex112.png


BIN
android/app/src/main/res/drawable-hdpi/tex113.png


BIN
android/app/src/main/res/drawable-hdpi/tex114.png


BIN
android/app/src/main/res/drawable-hdpi/tex115.png


BIN
android/app/src/main/res/drawable-hdpi/tex116.png


BIN
android/app/src/main/res/drawable-hdpi/tex117.png


BIN
android/app/src/main/res/drawable-hdpi/tex118.png


BIN
android/app/src/main/res/drawable-hdpi/tex119.png


BIN
android/app/src/main/res/drawable-hdpi/tex12.png


BIN
android/app/src/main/res/drawable-hdpi/tex120.png


BIN
android/app/src/main/res/drawable-hdpi/tex121.png


BIN
android/app/src/main/res/drawable-hdpi/tex122.png


BIN
android/app/src/main/res/drawable-hdpi/tex123.png


BIN
android/app/src/main/res/drawable-hdpi/tex124.png


BIN
android/app/src/main/res/drawable-hdpi/tex125.png


BIN
android/app/src/main/res/drawable-hdpi/tex126.png


BIN
android/app/src/main/res/drawable-hdpi/tex127.png


BIN
android/app/src/main/res/drawable-hdpi/tex128.png


BIN
android/app/src/main/res/drawable-hdpi/tex129.png


BIN
android/app/src/main/res/drawable-hdpi/tex13.png


BIN
android/app/src/main/res/drawable-hdpi/tex130.png


BIN
android/app/src/main/res/drawable-hdpi/tex131.png


BIN
android/app/src/main/res/drawable-hdpi/tex132.png


BIN
android/app/src/main/res/drawable-hdpi/tex133.png


BIN
android/app/src/main/res/drawable-hdpi/tex134.png


BIN
android/app/src/main/res/drawable-hdpi/tex135.png


BIN
android/app/src/main/res/drawable-hdpi/tex136.png


BIN
android/app/src/main/res/drawable-hdpi/tex137.png


BIN
android/app/src/main/res/drawable-hdpi/tex138.png


BIN
android/app/src/main/res/drawable-hdpi/tex139.png


BIN
android/app/src/main/res/drawable-hdpi/tex14.png


BIN
android/app/src/main/res/drawable-hdpi/tex140.png


BIN
android/app/src/main/res/drawable-hdpi/tex141.png


BIN
android/app/src/main/res/drawable-hdpi/tex142.png


BIN
android/app/src/main/res/drawable-hdpi/tex143.png


BIN
android/app/src/main/res/drawable-hdpi/tex144.png


BIN
android/app/src/main/res/drawable-hdpi/tex145.png


BIN
android/app/src/main/res/drawable-hdpi/tex146.png


BIN
android/app/src/main/res/drawable-hdpi/tex147.png


BIN
android/app/src/main/res/drawable-hdpi/tex148.png


BIN
android/app/src/main/res/drawable-hdpi/tex149.png


BIN
android/app/src/main/res/drawable-hdpi/tex15.png


BIN
android/app/src/main/res/drawable-hdpi/tex150.png


BIN
android/app/src/main/res/drawable-hdpi/tex151.png


BIN
android/app/src/main/res/drawable-hdpi/tex152.png


BIN
android/app/src/main/res/drawable-hdpi/tex153.png


BIN
android/app/src/main/res/drawable-hdpi/tex154.png


BIN
android/app/src/main/res/drawable-hdpi/tex155.png


BIN
android/app/src/main/res/drawable-hdpi/tex156.png


BIN
android/app/src/main/res/drawable-hdpi/tex157.png


BIN
android/app/src/main/res/drawable-hdpi/tex158.png


BIN
android/app/src/main/res/drawable-hdpi/tex159.png


BIN
android/app/src/main/res/drawable-hdpi/tex16.png


BIN
android/app/src/main/res/drawable-hdpi/tex160.png


BIN
android/app/src/main/res/drawable-hdpi/tex161.png


BIN
android/app/src/main/res/drawable-hdpi/tex162.png


BIN
android/app/src/main/res/drawable-hdpi/tex163.png


BIN
android/app/src/main/res/drawable-hdpi/tex164.png


BIN
android/app/src/main/res/drawable-hdpi/tex165.png


+ 0 - 0
android/app/src/main/res/drawable-hdpi/tex166.png


Some files were not shown because too many files changed in this diff