From 00158d9ac9899a97bc4cb9bd7e439e446e393fae Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:11:25 -0300 Subject: [PATCH 01/11] removed unused imports --- .../com/example/android/recyclerview/MyListFragment.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java b/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java index f47f8131f83bb2..d2e9e30ec8b8f8 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java @@ -3,15 +3,9 @@ import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.LinearLayout; -import android.widget.RadioButton; import com.example.android.common.activities.SampleActivityBase; import com.facebook.react.ReactInstanceManager; From 1c7b855a4768d71dbe79df471c5bcd1378075e73 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:15:36 -0300 Subject: [PATCH 02/11] refactored and eliminated old package --- android/Application/src/main/AndroidManifest.xml | 2 +- .../{recyclerview => }/AztecRN/ReactAztecBlurEvent.java | 2 +- .../{recyclerview => }/AztecRN/ReactAztecFocusEvent.java | 2 +- .../android/{recyclerview => }/AztecRN/ReactAztecManager.java | 2 +- .../android/{recyclerview => }/AztecRN/ReactAztecPackage.java | 2 +- .../android/{recyclerview => }/AztecRN/ReactAztecView.java | 2 +- .../{recyclerview => }/AztecRN/ReactaztecEndEditingEvent.java | 2 +- .../com/example/android/{recyclerview => }/MainActivity.java | 3 ++- .../com/example/android/{recyclerview => }/MyListFragment.java | 2 +- .../example/android/common/activities/SampleActivityBase.java | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactAztecBlurEvent.java (94%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactAztecFocusEvent.java (94%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactAztecManager.java (99%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactAztecPackage.java (93%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactAztecView.java (99%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/AztecRN/ReactaztecEndEditingEvent.java (95%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/MainActivity.java (98%) rename android/Application/src/main/java/com/example/android/{recyclerview => }/MyListFragment.java (99%) diff --git a/android/Application/src/main/AndroidManifest.xml b/android/Application/src/main/AndroidManifest.xml index 1d795917b5fa2c..53d61d2b5ee6ff 100644 --- a/android/Application/src/main/AndroidManifest.xml +++ b/android/Application/src/main/AndroidManifest.xml @@ -29,7 +29,7 @@ android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme"> - diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecBlurEvent.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java similarity index 94% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecBlurEvent.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java index 6457fc32bc0f82..26de351f88b7ff 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecBlurEvent.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecFocusEvent.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java similarity index 94% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecFocusEvent.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java index 5504b6713abafd..0a78c8077f4b46 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecFocusEvent.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecManager.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java similarity index 99% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecManager.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java index e3136aa718261f..16024173ac9c2e 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecManager.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import android.content.Context; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecPackage.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java similarity index 93% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecPackage.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java index d99e774d0f23c8..5d10572c9464a8 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecPackage.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import com.facebook.react.ReactPackage; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecView.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java similarity index 99% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecView.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java index 018066de78d8a1..f39ba50bf95808 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactAztecView.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import android.content.Context; import android.support.annotation.Nullable; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactaztecEndEditingEvent.java b/android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java similarity index 95% rename from android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactaztecEndEditingEvent.java rename to android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java index d2ddf848b7866c..5d828976bfe192 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/AztecRN/ReactaztecEndEditingEvent.java +++ b/android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview.AztecRN; +package com.example.android.AztecRN; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/recyclerview/MainActivity.java b/android/Application/src/main/java/com/example/android/MainActivity.java similarity index 98% rename from android/Application/src/main/java/com/example/android/recyclerview/MainActivity.java rename to android/Application/src/main/java/com/example/android/MainActivity.java index 2ff30bbde399dc..1112a512eab7db 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/MainActivity.java +++ b/android/Application/src/main/java/com/example/android/MainActivity.java @@ -15,7 +15,7 @@ */ -package com.example.android.recyclerview; +package com.example.android; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; @@ -25,6 +25,7 @@ import com.example.android.common.logger.Log; import com.example.android.common.logger.LogWrapper; import com.example.android.common.logger.MessageOnlyLogFilter; +import com.example.android.recyclerview.R; /** * A simple launcher activity containing a summary sample description, sample log and a custom diff --git a/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java b/android/Application/src/main/java/com/example/android/MyListFragment.java similarity index 99% rename from android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java rename to android/Application/src/main/java/com/example/android/MyListFragment.java index d2e9e30ec8b8f8..958f079129ce23 100644 --- a/android/Application/src/main/java/com/example/android/recyclerview/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/MyListFragment.java @@ -1,4 +1,4 @@ -package com.example.android.recyclerview; +package com.example.android; import android.app.Activity; import android.os.Bundle; diff --git a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java b/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java index 068873a150ac18..8253c7221dfa32 100644 --- a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java +++ b/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java @@ -21,7 +21,7 @@ import com.example.android.common.logger.Log; import com.example.android.common.logger.LogWrapper; -import com.example.android.recyclerview.AztecRN.ReactAztecPackage; +import com.example.android.AztecRN.ReactAztecPackage; import com.example.android.recyclerview.BuildConfig; import com.facebook.react.ReactInstanceManager; import com.facebook.react.common.LifecycleState; From f96ca774a334ae102f569b857a40d350cb5d0be2 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:16:13 -0300 Subject: [PATCH 03/11] fixed typo --- .../src/main/java/com/example/android/MyListFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/Application/src/main/java/com/example/android/MyListFragment.java b/android/Application/src/main/java/com/example/android/MyListFragment.java index 958f079129ce23..b6fd2fb84429b9 100644 --- a/android/Application/src/main/java/com/example/android/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/MyListFragment.java @@ -43,9 +43,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa } ReactRootView reactRootView = new ReactRootView(getContext()); - Bundle RNPropos = new Bundle(); - RNPropos.putString("text", EXAMPLE); - reactRootView.startReactApplication(mReactInstanceManager, "SimpleTextInput", RNPropos); + Bundle RNProps = new Bundle(); + RNProps.putString("text", EXAMPLE); + reactRootView.startReactApplication(mReactInstanceManager, "SimpleTextInput", RNProps); return reactRootView; } From db2dd000dd7f7c6eec56a6436304279358ce65c3 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:19:17 -0300 Subject: [PATCH 04/11] removed commented code --- .../com/example/android/MainActivity.java | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/android/Application/src/main/java/com/example/android/MainActivity.java b/android/Application/src/main/java/com/example/android/MainActivity.java index 1112a512eab7db..5fc0ce4ec0a296 100644 --- a/android/Application/src/main/java/com/example/android/MainActivity.java +++ b/android/Application/src/main/java/com/example/android/MainActivity.java @@ -63,43 +63,6 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { return super.onKeyUp(keyCode, event); } - - /* - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - MenuItem logToggle = menu.findItem(R.id.menu_toggle_log); - logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator); - logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log); - - return super.onPrepareOptionsMenu(menu); - } - - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch(item.getItemId()) { - case R.id.menu_toggle_log: - mLogShown = !mLogShown; - ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output); - if (mLogShown) { - output.setDisplayedChild(1); - } else { - output.setDisplayedChild(0); - } - supportInvalidateOptionsMenu(); - return true; - } - return super.onOptionsItemSelected(item); - } - */ - /** Create a chain of targets that will receive log data */ @Override public void initializeLogging() { @@ -112,11 +75,6 @@ public void initializeLogging() { MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter(); logWrapper.setNext(msgFilter); - /* On screen logging via a fragment with a TextView. - LogFragment logFragment = (LogFragment) getSupportFragmentManager() - .findFragmentById(R.id.log_fragment); - msgFilter.setNext(logFragment.getLogView()); -*/ Log.i(TAG, "Ready"); } } From fb3b23b12844687abd7b1c3ad4ad2c9037898e22 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:29:23 -0300 Subject: [PATCH 05/11] eliminated unused logging functionality --- .../com/example/android/MainActivity.java | 20 -- .../common/activities/SampleActivityBase.java | 19 -- .../example/android/common/logger/Log.java | 236 ------------------ .../android/common/logger/LogFragment.java | 109 -------- .../android/common/logger/LogNode.java | 39 --- .../android/common/logger/LogView.java | 145 ----------- .../android/common/logger/LogWrapper.java | 75 ------ .../common/logger/MessageOnlyLogFilter.java | 60 ----- 8 files changed, 703 deletions(-) delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/Log.java delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/LogFragment.java delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/LogNode.java delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/LogView.java delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/LogWrapper.java delete mode 100644 android/Application/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java diff --git a/android/Application/src/main/java/com/example/android/MainActivity.java b/android/Application/src/main/java/com/example/android/MainActivity.java index 5fc0ce4ec0a296..caf80091b11c92 100644 --- a/android/Application/src/main/java/com/example/android/MainActivity.java +++ b/android/Application/src/main/java/com/example/android/MainActivity.java @@ -22,9 +22,6 @@ import android.view.KeyEvent; import com.example.android.common.activities.SampleActivityBase; -import com.example.android.common.logger.Log; -import com.example.android.common.logger.LogWrapper; -import com.example.android.common.logger.MessageOnlyLogFilter; import com.example.android.recyclerview.R; /** @@ -38,9 +35,6 @@ public class MainActivity extends SampleActivityBase { public static final String TAG = "MainActivity"; - // Whether the Log Fragment is currently shown - private boolean mLogShown; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -63,18 +57,4 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { return super.onKeyUp(keyCode, event); } - /** Create a chain of targets that will receive log data */ - @Override - public void initializeLogging() { - // Wraps Android's native log framework. - LogWrapper logWrapper = new LogWrapper(); - // Using Log, front-end to the logging chain, emulates android.util.log method signatures. - Log.setLogNode(logWrapper); - - // Filter strips out everything except the message text. - MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter(); - logWrapper.setNext(msgFilter); - - Log.i(TAG, "Ready"); - } } diff --git a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java b/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java index 8253c7221dfa32..2b5ddf4b67679c 100644 --- a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java +++ b/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java @@ -19,8 +19,6 @@ import android.os.Bundle; import android.support.v4.app.FragmentActivity; -import com.example.android.common.logger.Log; -import com.example.android.common.logger.LogWrapper; import com.example.android.AztecRN.ReactAztecPackage; import com.example.android.recyclerview.BuildConfig; import com.facebook.react.ReactInstanceManager; @@ -50,27 +48,10 @@ protected void onCreate(Bundle savedInstanceState) { .build(); } - @Override - protected void onStart() { - super.onStart(); - initializeLogging(); - } - public ReactInstanceManager getReactInstanceManager() { return mReactInstanceManager; } - /** Set up targets to receive log data */ - public void initializeLogging() { - // Using Log, front-end to the logging chain, emulates android.util.log method signatures. - // Wraps Android's native log framework - LogWrapper logWrapper = new LogWrapper(); - Log.setLogNode(logWrapper); - - Log.i(TAG, "Ready"); - } - - @Override protected void onPause() { super.onPause(); diff --git a/android/Application/src/main/java/com/example/android/common/logger/Log.java b/android/Application/src/main/java/com/example/android/common/logger/Log.java deleted file mode 100644 index 17503c56893d91..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/Log.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.android.common.logger; - -/** - * Helper class for a list (or tree) of LoggerNodes. - * - *

When this is set as the head of the list, - * an instance of it can function as a drop-in replacement for {@link android.util.Log}. - * Most of the methods in this class server only to map a method call in Log to its equivalent - * in LogNode.

- */ -public class Log { - // Grabbing the native values from Android's native logging facilities, - // to make for easy migration and interop. - public static final int NONE = -1; - public static final int VERBOSE = android.util.Log.VERBOSE; - public static final int DEBUG = android.util.Log.DEBUG; - public static final int INFO = android.util.Log.INFO; - public static final int WARN = android.util.Log.WARN; - public static final int ERROR = android.util.Log.ERROR; - public static final int ASSERT = android.util.Log.ASSERT; - - // Stores the beginning of the LogNode topology. - private static LogNode mLogNode; - - /** - * Returns the next LogNode in the linked list. - */ - public static LogNode getLogNode() { - return mLogNode; - } - - /** - * Sets the LogNode data will be sent to. - */ - public static void setLogNode(LogNode node) { - mLogNode = node; - } - - /** - * Instructs the LogNode to print the log data provided. Other LogNodes can - * be chained to the end of the LogNode as desired. - * - * @param priority Log level of the data being logged. Verbose, Error, etc. - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void println(int priority, String tag, String msg, Throwable tr) { - if (mLogNode != null) { - mLogNode.println(priority, tag, msg, tr); - } - } - - /** - * Instructs the LogNode to print the log data provided. Other LogNodes can - * be chained to the end of the LogNode as desired. - * - * @param priority Log level of the data being logged. Verbose, Error, etc. - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. The actual message to be logged. - */ - public static void println(int priority, String tag, String msg) { - println(priority, tag, msg, null); - } - - /** - * Prints a message at VERBOSE priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void v(String tag, String msg, Throwable tr) { - println(VERBOSE, tag, msg, tr); - } - - /** - * Prints a message at VERBOSE priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void v(String tag, String msg) { - v(tag, msg, null); - } - - - /** - * Prints a message at DEBUG priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void d(String tag, String msg, Throwable tr) { - println(DEBUG, tag, msg, tr); - } - - /** - * Prints a message at DEBUG priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void d(String tag, String msg) { - d(tag, msg, null); - } - - /** - * Prints a message at INFO priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void i(String tag, String msg, Throwable tr) { - println(INFO, tag, msg, tr); - } - - /** - * Prints a message at INFO priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void i(String tag, String msg) { - i(tag, msg, null); - } - - /** - * Prints a message at WARN priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void w(String tag, String msg, Throwable tr) { - println(WARN, tag, msg, tr); - } - - /** - * Prints a message at WARN priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void w(String tag, String msg) { - w(tag, msg, null); - } - - /** - * Prints a message at WARN priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void w(String tag, Throwable tr) { - w(tag, null, tr); - } - - /** - * Prints a message at ERROR priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void e(String tag, String msg, Throwable tr) { - println(ERROR, tag, msg, tr); - } - - /** - * Prints a message at ERROR priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void e(String tag, String msg) { - e(tag, msg, null); - } - - /** - * Prints a message at ASSERT priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void wtf(String tag, String msg, Throwable tr) { - println(ASSERT, tag, msg, tr); - } - - /** - * Prints a message at ASSERT priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. - */ - public static void wtf(String tag, String msg) { - wtf(tag, msg, null); - } - - /** - * Prints a message at ASSERT priority. - * - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public static void wtf(String tag, Throwable tr) { - wtf(tag, null, tr); - } -} diff --git a/android/Application/src/main/java/com/example/android/common/logger/LogFragment.java b/android/Application/src/main/java/com/example/android/common/logger/LogFragment.java deleted file mode 100644 index b302acd4b796c2..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/LogFragment.java +++ /dev/null @@ -1,109 +0,0 @@ -/* -* Copyright 2013 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/* - * Copyright 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.android.common.logger; - -import android.graphics.Typeface; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ScrollView; - -/** - * Simple fraggment which contains a LogView and uses is to output log data it receives - * through the LogNode interface. - */ -public class LogFragment extends Fragment { - - private LogView mLogView; - private ScrollView mScrollView; - - public LogFragment() {} - - public View inflateViews() { - mScrollView = new ScrollView(getActivity()); - ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT); - mScrollView.setLayoutParams(scrollParams); - - mLogView = new LogView(getActivity()); - ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams); - logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; - mLogView.setLayoutParams(logParams); - mLogView.setClickable(true); - mLogView.setFocusable(true); - mLogView.setTypeface(Typeface.MONOSPACE); - - // Want to set padding as 16 dips, setPadding takes pixels. Hooray math! - int paddingDips = 16; - double scale = getResources().getDisplayMetrics().density; - int paddingPixels = (int) ((paddingDips * (scale)) + .5); - mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels); - mLogView.setCompoundDrawablePadding(paddingPixels); - - mLogView.setGravity(Gravity.BOTTOM); - mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium); - - mScrollView.addView(mLogView); - return mScrollView; - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - - View result = inflateViews(); - - mLogView.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) {} - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) {} - - @Override - public void afterTextChanged(Editable s) { - mScrollView.fullScroll(ScrollView.FOCUS_DOWN); - } - }); - return result; - } - - public LogView getLogView() { - return mLogView; - } -} \ No newline at end of file diff --git a/android/Application/src/main/java/com/example/android/common/logger/LogNode.java b/android/Application/src/main/java/com/example/android/common/logger/LogNode.java deleted file mode 100644 index bc37cabc07c512..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/LogNode.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.android.common.logger; - -/** - * Basic interface for a logging system that can output to one or more targets. - * Note that in addition to classes that will output these logs in some format, - * one can also implement this interface over a filter and insert that in the chain, - * such that no targets further down see certain data, or see manipulated forms of the data. - * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data - * it received to HTML and sent it along to the next node in the chain, without printing it - * anywhere. - */ -public interface LogNode { - - /** - * Instructs first LogNode in the list to print the log data provided. - * @param priority Log level of the data being logged. Verbose, Error, etc. - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - public void println(int priority, String tag, String msg, Throwable tr); - -} diff --git a/android/Application/src/main/java/com/example/android/common/logger/LogView.java b/android/Application/src/main/java/com/example/android/common/logger/LogView.java deleted file mode 100644 index c01542b9117d22..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/LogView.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.android.common.logger; - -import android.app.Activity; -import android.content.Context; -import android.util.*; -import android.widget.TextView; - -/** Simple TextView which is used to output log data received through the LogNode interface. -*/ -public class LogView extends TextView implements LogNode { - - public LogView(Context context) { - super(context); - } - - public LogView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public LogView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - /** - * Formats the log data and prints it out to the LogView. - * @param priority Log level of the data being logged. Verbose, Error, etc. - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - @Override - public void println(int priority, String tag, String msg, Throwable tr) { - - - String priorityStr = null; - - // For the purposes of this View, we want to print the priority as readable text. - switch(priority) { - case android.util.Log.VERBOSE: - priorityStr = "VERBOSE"; - break; - case android.util.Log.DEBUG: - priorityStr = "DEBUG"; - break; - case android.util.Log.INFO: - priorityStr = "INFO"; - break; - case android.util.Log.WARN: - priorityStr = "WARN"; - break; - case android.util.Log.ERROR: - priorityStr = "ERROR"; - break; - case android.util.Log.ASSERT: - priorityStr = "ASSERT"; - break; - default: - break; - } - - // Handily, the Log class has a facility for converting a stack trace into a usable string. - String exceptionStr = null; - if (tr != null) { - exceptionStr = android.util.Log.getStackTraceString(tr); - } - - // Take the priority, tag, message, and exception, and concatenate as necessary - // into one usable line of text. - final StringBuilder outputBuilder = new StringBuilder(); - - String delimiter = "\t"; - appendIfNotNull(outputBuilder, priorityStr, delimiter); - appendIfNotNull(outputBuilder, tag, delimiter); - appendIfNotNull(outputBuilder, msg, delimiter); - appendIfNotNull(outputBuilder, exceptionStr, delimiter); - - // In case this was originally called from an AsyncTask or some other off-UI thread, - // make sure the update occurs within the UI thread. - ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() { - @Override - public void run() { - // Display the text we just generated within the LogView. - appendToLog(outputBuilder.toString()); - } - }))); - - if (mNext != null) { - mNext.println(priority, tag, msg, tr); - } - } - - public LogNode getNext() { - return mNext; - } - - public void setNext(LogNode node) { - mNext = node; - } - - /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since - * the logger takes so many arguments that might be null, this method helps cut out some of the - * agonizing tedium of writing the same 3 lines over and over. - * @param source StringBuilder containing the text to append to. - * @param addStr The String to append - * @param delimiter The String to separate the source and appended strings. A tab or comma, - * for instance. - * @return The fully concatenated String as a StringBuilder - */ - private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) { - if (addStr != null) { - if (addStr.length() == 0) { - delimiter = ""; - } - - return source.append(addStr).append(delimiter); - } - return source; - } - - // The next LogNode in the chain. - LogNode mNext; - - /** Outputs the string as a new line of log data in the LogView. */ - public void appendToLog(String s) { - append("\n" + s); - } - - -} diff --git a/android/Application/src/main/java/com/example/android/common/logger/LogWrapper.java b/android/Application/src/main/java/com/example/android/common/logger/LogWrapper.java deleted file mode 100644 index 16a9e7ba27d24c..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/LogWrapper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.android.common.logger; - -import android.util.Log; - -/** - * Helper class which wraps Android's native Log utility in the Logger interface. This way - * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously. - */ -public class LogWrapper implements LogNode { - - // For piping: The next node to receive Log data after this one has done its work. - private LogNode mNext; - - /** - * Returns the next LogNode in the linked list. - */ - public LogNode getNext() { - return mNext; - } - - /** - * Sets the LogNode data will be sent to.. - */ - public void setNext(LogNode node) { - mNext = node; - } - - /** - * Prints data out to the console using Android's native log mechanism. - * @param priority Log level of the data being logged. Verbose, Error, etc. - * @param tag Tag for for the log data. Can be used to organize log statements. - * @param msg The actual message to be logged. The actual message to be logged. - * @param tr If an exception was thrown, this can be sent along for the logging facilities - * to extract and print useful information. - */ - @Override - public void println(int priority, String tag, String msg, Throwable tr) { - // There actually are log methods that don't take a msg parameter. For now, - // if that's the case, just convert null to the empty string and move on. - String useMsg = msg; - if (useMsg == null) { - useMsg = ""; - } - - // If an exeption was provided, convert that exception to a usable string and attach - // it to the end of the msg method. - if (tr != null) { - msg += "\n" + Log.getStackTraceString(tr); - } - - // This is functionally identical to Log.x(tag, useMsg); - // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) - Log.println(priority, tag, useMsg); - - // If this isn't the last node in the chain, move things along. - if (mNext != null) { - mNext.println(priority, tag, msg, tr); - } - } -} diff --git a/android/Application/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/android/Application/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java deleted file mode 100644 index 19967dcd430f22..00000000000000 --- a/android/Application/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.example.android.common.logger; - -/** - * Simple {@link LogNode} filter, removes everything except the message. - * Useful for situations like on-screen log output where you don't want a lot of metadata displayed, - * just easy-to-read message updates as they're happening. - */ -public class MessageOnlyLogFilter implements LogNode { - - LogNode mNext; - - /** - * Takes the "next" LogNode as a parameter, to simplify chaining. - * - * @param next The next LogNode in the pipeline. - */ - public MessageOnlyLogFilter(LogNode next) { - mNext = next; - } - - public MessageOnlyLogFilter() { - } - - @Override - public void println(int priority, String tag, String msg, Throwable tr) { - if (mNext != null) { - getNext().println(Log.NONE, null, msg, null); - } - } - - /** - * Returns the next LogNode in the chain. - */ - public LogNode getNext() { - return mNext; - } - - /** - * Sets the LogNode data will be sent to.. - */ - public void setNext(LogNode node) { - mNext = node; - } - -} From ac75fd38a3ddcc1abf49f61385f9599809c2fad6 Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:31:57 -0300 Subject: [PATCH 06/11] renamed SampleActivityBase.java to SampleRNBaseActivity.java --- .../main/java/com/example/android/MainActivity.java | 4 ++-- .../main/java/com/example/android/MyListFragment.java | 10 +++++----- ...mpleActivityBase.java => SampleRNBaseActivity.java} | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename android/Application/src/main/java/com/example/android/common/activities/{SampleActivityBase.java => SampleRNBaseActivity.java} (94%) diff --git a/android/Application/src/main/java/com/example/android/MainActivity.java b/android/Application/src/main/java/com/example/android/MainActivity.java index caf80091b11c92..0db0f2bd1d1720 100644 --- a/android/Application/src/main/java/com/example/android/MainActivity.java +++ b/android/Application/src/main/java/com/example/android/MainActivity.java @@ -21,7 +21,7 @@ import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; -import com.example.android.common.activities.SampleActivityBase; +import com.example.android.common.activities.SampleRNBaseActivity; import com.example.android.recyclerview.R; /** @@ -31,7 +31,7 @@ * For devices with displays with a width of 720dp or greater, the sample log is always visible, * on other devices it's visibility is controlled by an item on the Action Bar. */ -public class MainActivity extends SampleActivityBase { +public class MainActivity extends SampleRNBaseActivity { public static final String TAG = "MainActivity"; diff --git a/android/Application/src/main/java/com/example/android/MyListFragment.java b/android/Application/src/main/java/com/example/android/MyListFragment.java index b6fd2fb84429b9..0fa8b731314e63 100644 --- a/android/Application/src/main/java/com/example/android/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/MyListFragment.java @@ -7,7 +7,7 @@ import android.view.View; import android.view.ViewGroup; -import com.example.android.common.activities.SampleActivityBase; +import com.example.android.common.activities.SampleRNBaseActivity; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactRootView; @@ -21,9 +21,9 @@ public class MyListFragment extends Fragment { public void onAttach(Activity activity) { super.onAttach(activity); try { - mReactInstanceManager = ((SampleActivityBase) activity).getReactInstanceManager(); + mReactInstanceManager = ((SampleRNBaseActivity) activity).getReactInstanceManager(); } catch (ClassCastException e) { - throw new ClassCastException(activity.toString() + " must extends SampleActivityBase"); + throw new ClassCastException(activity.toString() + " must extends SampleRNBaseActivity"); } } @@ -36,9 +36,9 @@ public void onCreate(Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mReactInstanceManager == null) { try { - mReactInstanceManager = ((SampleActivityBase) getActivity()).getReactInstanceManager(); + mReactInstanceManager = ((SampleRNBaseActivity) getActivity()).getReactInstanceManager(); } catch (ClassCastException e) { - throw new ClassCastException(getActivity().toString() + " must extends SampleActivityBase"); + throw new ClassCastException(getActivity().toString() + " must extends SampleRNBaseActivity"); } } diff --git a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java b/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java similarity index 94% rename from android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java rename to android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java index 2b5ddf4b67679c..7e4092de2dc23e 100644 --- a/android/Application/src/main/java/com/example/android/common/activities/SampleActivityBase.java +++ b/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java @@ -29,9 +29,9 @@ /** * Base launcher activity, to handle most of the common plumbing for samples. */ -public class SampleActivityBase extends FragmentActivity implements DefaultHardwareBackBtnHandler { +public class SampleRNBaseActivity extends FragmentActivity implements DefaultHardwareBackBtnHandler { - public static final String TAG = "SampleActivityBase"; + public static final String TAG = "SampleRNBaseActivity"; protected ReactInstanceManager mReactInstanceManager; @Override From 382e29b580a78b1b9f6a1108ed3a77290152fc7d Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:33:38 -0300 Subject: [PATCH 07/11] renamed AztecRN package to ReactAztec to better match classes naming --- .../android/{AztecRN => ReactAztec}/ReactAztecBlurEvent.java | 2 +- .../android/{AztecRN => ReactAztec}/ReactAztecFocusEvent.java | 2 +- .../android/{AztecRN => ReactAztec}/ReactAztecManager.java | 2 +- .../android/{AztecRN => ReactAztec}/ReactAztecPackage.java | 2 +- .../example/android/{AztecRN => ReactAztec}/ReactAztecView.java | 2 +- .../{AztecRN => ReactAztec}/ReactaztecEndEditingEvent.java | 2 +- .../example/android/common/activities/SampleRNBaseActivity.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactAztecBlurEvent.java (95%) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactAztecFocusEvent.java (95%) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactAztecManager.java (99%) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactAztecPackage.java (94%) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactAztecView.java (99%) rename android/Application/src/main/java/com/example/android/{AztecRN => ReactAztec}/ReactaztecEndEditingEvent.java (96%) diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecBlurEvent.java similarity index 95% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecBlurEvent.java index 26de351f88b7ff..43587077bbbbb7 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecBlurEvent.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecBlurEvent.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecFocusEvent.java similarity index 95% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecFocusEvent.java index 0a78c8077f4b46..bcdada58f6806f 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecFocusEvent.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecFocusEvent.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecManager.java similarity index 99% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecManager.java index 16024173ac9c2e..69a111831b95d9 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecManager.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecManager.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import android.content.Context; diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecPackage.java similarity index 94% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecPackage.java index 5d10572c9464a8..2dcfd8f484dee4 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecPackage.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecPackage.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import com.facebook.react.ReactPackage; diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecView.java similarity index 99% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecView.java index f39ba50bf95808..501d0c61a71070 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactAztecView.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactAztecView.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import android.content.Context; import android.support.annotation.Nullable; diff --git a/android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java b/android/Application/src/main/java/com/example/android/ReactAztec/ReactaztecEndEditingEvent.java similarity index 96% rename from android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java rename to android/Application/src/main/java/com/example/android/ReactAztec/ReactaztecEndEditingEvent.java index 5d828976bfe192..3b06876444bdfa 100644 --- a/android/Application/src/main/java/com/example/android/AztecRN/ReactaztecEndEditingEvent.java +++ b/android/Application/src/main/java/com/example/android/ReactAztec/ReactaztecEndEditingEvent.java @@ -1,4 +1,4 @@ -package com.example.android.AztecRN; +package com.example.android.ReactAztec; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap; diff --git a/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java b/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java index 7e4092de2dc23e..01af648eb718b6 100644 --- a/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java +++ b/android/Application/src/main/java/com/example/android/common/activities/SampleRNBaseActivity.java @@ -19,7 +19,7 @@ import android.os.Bundle; import android.support.v4.app.FragmentActivity; -import com.example.android.AztecRN.ReactAztecPackage; +import com.example.android.ReactAztec.ReactAztecPackage; import com.example.android.recyclerview.BuildConfig; import com.facebook.react.ReactInstanceManager; import com.facebook.react.common.LifecycleState; From 93f9a1d59bee8ef47801f8cda4d29685b5624edc Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 14:40:04 -0300 Subject: [PATCH 08/11] changed app name --- android/Application/src/main/res/values/base-strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/Application/src/main/res/values/base-strings.xml b/android/Application/src/main/res/values/base-strings.xml index a12b33e3021bf3..4f296e20a9b069 100644 --- a/android/Application/src/main/res/values/base-strings.xml +++ b/android/Application/src/main/res/values/base-strings.xml @@ -16,7 +16,7 @@ --> - RN FlatList + Aztec React Native example Date: Tue, 3 Apr 2018 15:35:05 -0300 Subject: [PATCH 09/11] simplified example to only use a container view --- .../com/example/android/MyListFragment.java | 2 +- index.js | 47 +++++++------------ 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/android/Application/src/main/java/com/example/android/MyListFragment.java b/android/Application/src/main/java/com/example/android/MyListFragment.java index 0fa8b731314e63..7d77f3a355b2f0 100644 --- a/android/Application/src/main/java/com/example/android/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/MyListFragment.java @@ -45,7 +45,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa ReactRootView reactRootView = new ReactRootView(getContext()); Bundle RNProps = new Bundle(); RNProps.putString("text", EXAMPLE); - reactRootView.startReactApplication(mReactInstanceManager, "SimpleTextInput", RNProps); + reactRootView.startReactApplication(mReactInstanceManager, "RichTextInput", RNProps); return reactRootView; } diff --git a/index.js b/index.js index 14a7ac57693ad6..bf682710fd6335 100644 --- a/index.js +++ b/index.js @@ -1,44 +1,31 @@ import React, { Component } from 'react'; -import {AppRegistry, FlatList, StyleSheet, Text, TextInput, View} from 'react-native'; +import {AppRegistry, StyleSheet, View} from 'react-native'; import RCTAztecView from './AztecView'; -class SimpleTextInput extends React.Component { +class AztecTextInput extends React.Component { constructor(props) { super(props); this.state = {isShowingText: true, height: 200}; } render() { -//let display = this.state.isShowingText ? this.props.my_text : ' '; + let myMinHeight = Math.max(200, this.state.height); return ( - - { - console.log(event.nativeEvent); - }} - onContentSizeChange= {(event) => { - this.setState({height: event.nativeEvent.contentSize.height}); - }} - color = {'black'} - maxImagesWidth = {200} /> - } - /> + { + console.log(event.nativeEvent); + }} + onContentSizeChange= {(event) => { + this.setState({height: event.nativeEvent.contentSize.height}); + }} + color = {'black'} + maxImagesWidth = {200} /> ); } @@ -55,4 +42,4 @@ var styles = StyleSheet.create({ }, }); -AppRegistry.registerComponent('SimpleTextInput', () => SimpleTextInput); +AppRegistry.registerComponent('RichTextInput', () => AztecTextInput); From 9f829dcbf5b9764a8f39574612fae8ab60dd898c Mon Sep 17 00:00:00 2001 From: Mario Zorz Date: Tue, 3 Apr 2018 15:35:50 -0300 Subject: [PATCH 10/11] renamed MyListFragment to MyFragment --- .../src/main/java/com/example/android/MainActivity.java | 2 +- .../example/android/{MyListFragment.java => MyFragment.java} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename android/Application/src/main/java/com/example/android/{MyListFragment.java => MyFragment.java} (98%) diff --git a/android/Application/src/main/java/com/example/android/MainActivity.java b/android/Application/src/main/java/com/example/android/MainActivity.java index 0db0f2bd1d1720..67661b7598cafe 100644 --- a/android/Application/src/main/java/com/example/android/MainActivity.java +++ b/android/Application/src/main/java/com/example/android/MainActivity.java @@ -42,7 +42,7 @@ protected void onCreate(Bundle savedInstanceState) { if (savedInstanceState == null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); - MyListFragment fragment = new MyListFragment(); + MyFragment fragment = new MyFragment(); transaction.replace(R.id.sample_content_fragment, fragment); transaction.commit(); } diff --git a/android/Application/src/main/java/com/example/android/MyListFragment.java b/android/Application/src/main/java/com/example/android/MyFragment.java similarity index 98% rename from android/Application/src/main/java/com/example/android/MyListFragment.java rename to android/Application/src/main/java/com/example/android/MyFragment.java index 7d77f3a355b2f0..7e709952fb5b20 100644 --- a/android/Application/src/main/java/com/example/android/MyListFragment.java +++ b/android/Application/src/main/java/com/example/android/MyFragment.java @@ -11,9 +11,9 @@ import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactRootView; -public class MyListFragment extends Fragment { +public class MyFragment extends Fragment { - private static final String TAG = "MyListFragment"; + private static final String TAG = "MyFragment"; private ReactInstanceManager mReactInstanceManager; From 8d736332a1d89a3ce31d5c2573a037dc5b605cad Mon Sep 17 00:00:00 2001 From: Danilo Ercoli Date: Wed, 4 Apr 2018 11:18:28 +0200 Subject: [PATCH 11/11] Bring the FlatList back in action! --- index.js | 64 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/index.js b/index.js index bf682710fd6335..45b79281758f00 100644 --- a/index.js +++ b/index.js @@ -1,34 +1,46 @@ import React, { Component } from 'react'; -import {AppRegistry, StyleSheet, View} from 'react-native'; +import {AppRegistry, StyleSheet, View, FlatList} from 'react-native'; import RCTAztecView from './AztecView'; class AztecTextInput extends React.Component { - constructor(props) { - super(props); - this.state = {isShowingText: true, height: 200}; - } + constructor(props) { + super(props); + this.state = {isShowingText: true, height: 200}; + } - render() { - - let myMinHeight = Math.max(200, this.state.height); - return ( - - { - console.log(event.nativeEvent); - }} - onContentSizeChange= {(event) => { - this.setState({height: event.nativeEvent.contentSize.height}); - }} - color = {'black'} - maxImagesWidth = {200} /> - - ); - } + render() { + let myMinHeight = Math.max(200, this.state.height); + return ( + + + { + console.log(event.nativeEvent); + }} + onContentSizeChange= {(event) => { + this.setState({height: event.nativeEvent.contentSize.height}); + }} + color = {'black'} + maxImagesWidth = {200} /> + } + /> + + ); + } } var styles = StyleSheet.create({