Skip to content

Commit

Permalink
Merge pull request #1 from wordpress-mobile/clean/autogrow-direct-lin…
Browse files Browse the repository at this point in the history
…k-to-aztec

Clean/autogrow direct link to aztec
  • Loading branch information
mzorz authored Apr 4, 2018
2 parents 8180508 + 8d73633 commit f85a270
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 873 deletions.
2 changes: 1 addition & 1 deletion android/Application/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity"
<activity android:name="com.example.android.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.KeyEvent;

import com.example.android.common.activities.SampleRNBaseActivity;
import com.example.android.recyclerview.R;

/**
* A simple launcher activity containing a summary sample description, sample log and a custom
* {@link android.support.v4.app.Fragment} which can display a view.
* <p>
* 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 SampleRNBaseActivity {

public static final String TAG = "MainActivity";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

if (savedInstanceState == null) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
MyFragment fragment = new MyFragment();
transaction.replace(R.id.sample_content_fragment, fragment);
transaction.commit();
}
}

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
mReactInstanceManager.showDevOptionsDialog();
return true;
}
return super.onKeyUp(keyCode, event);
}

}
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
package com.example.android.recyclerview;
package com.example.android;

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.example.android.common.activities.SampleRNBaseActivity;
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;

@Override
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");
}
}

Expand All @@ -42,16 +36,16 @@ 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");
}
}

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, "RichTextInput", RNProps);
return reactRootView;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;


import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;


import com.facebook.react.ReactPackage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;

import android.content.Context;
import android.support.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.android.recyclerview.AztecRN;
package com.example.android.ReactAztec;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
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.recyclerview.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;
Expand All @@ -31,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
Expand All @@ -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();
Expand Down
Loading

0 comments on commit f85a270

Please sign in to comment.