(client) Add Another Activity to Sample App to Test The Functionality
Summary: - add another activity where there are two component overlapping each other Reviewed By: mweststrate Differential Revision: D21040425 fbshipit-source-id: 5514b59140bbf6b726e6777191e1808be5ac5b6f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f06dc46c06
commit
d7172df082
@@ -39,6 +39,14 @@
|
|||||||
<data android:scheme="flipper" android:host="deep_link_activity" />
|
<data android:scheme="flipper" android:host="deep_link_activity" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".LayoutTestActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="flipper" android:host="layout_test_activity" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<activity android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
|
<activity android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
|
||||||
android:exported="true"/>
|
android:exported="true"/>
|
||||||
<activity android:name="com.facebook.flipper.connectivitytest.ConnectionTestActivity"
|
<activity android:name="com.facebook.flipper.connectivitytest.ConnectionTestActivity"
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.flipper.sample;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.facebook.litho.Column;
|
||||||
|
import com.facebook.litho.Component;
|
||||||
|
import com.facebook.litho.ComponentContext;
|
||||||
|
import com.facebook.litho.LithoView;
|
||||||
|
import com.facebook.litho.widget.Text;
|
||||||
|
import com.facebook.yoga.YogaEdge;
|
||||||
|
import com.facebook.yoga.YogaPositionType;
|
||||||
|
|
||||||
|
public class LayoutTestActivity extends AppCompatActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
NavigationFacade.sendNavigationEvent("flipper://layout_test_activity/");
|
||||||
|
|
||||||
|
final ComponentContext context = new ComponentContext(this);
|
||||||
|
|
||||||
|
final Component component =
|
||||||
|
Column.create(context)
|
||||||
|
.child(Text.create(context).text("This is a page to test layout").textSizeDip(20))
|
||||||
|
.child(
|
||||||
|
Text.create(context)
|
||||||
|
.text("This is another welcome text")
|
||||||
|
.textSizeDip(20)
|
||||||
|
.positionDip(YogaEdge.TOP, 10)
|
||||||
|
.positionType(YogaPositionType.ABSOLUTE))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
setContentView(LithoView.create(context, component));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,10 +78,17 @@ public class RootComponentSpec {
|
|||||||
.clickHandler(RootComponent.openAlternateActivityOne(c)))
|
.clickHandler(RootComponent.openAlternateActivityOne(c)))
|
||||||
.child(
|
.child(
|
||||||
Text.create(c)
|
Text.create(c)
|
||||||
.text("Crash this app")
|
.text("Navigate to layout test page")
|
||||||
.key("7")
|
.key("7")
|
||||||
.marginDip(YogaEdge.ALL, 10)
|
.marginDip(YogaEdge.ALL, 10)
|
||||||
.textSizeSp(20)
|
.textSizeSp(20)
|
||||||
|
.clickHandler(RootComponent.openAlternateLayoutTestActivity(c)))
|
||||||
|
.child(
|
||||||
|
Text.create(c)
|
||||||
|
.text("Crash this app")
|
||||||
|
.key("8")
|
||||||
|
.marginDip(YogaEdge.ALL, 10)
|
||||||
|
.textSizeSp(20)
|
||||||
.clickHandler(RootComponent.triggerCrash(c)))
|
.clickHandler(RootComponent.triggerCrash(c)))
|
||||||
.child(
|
.child(
|
||||||
displayImage
|
displayImage
|
||||||
@@ -121,6 +128,12 @@ public class RootComponentSpec {
|
|||||||
c.getAndroidContext().startActivity(intent);
|
c.getAndroidContext().startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnEvent(ClickEvent.class)
|
||||||
|
static void openAlternateLayoutTestActivity(final ComponentContext c) {
|
||||||
|
final Intent intent = new Intent(c.getAndroidContext(), LayoutTestActivity.class);
|
||||||
|
c.getAndroidContext().startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@OnEvent(ClickEvent.class)
|
@OnEvent(ClickEvent.class)
|
||||||
static void triggerCrash(final ComponentContext c) {
|
static void triggerCrash(final ComponentContext c) {
|
||||||
throw new RuntimeException("Artificially triggered crash from Flipper sample app");
|
throw new RuntimeException("Artificially triggered crash from Flipper sample app");
|
||||||
|
|||||||
Reference in New Issue
Block a user