Added increment activity
Summary: Added simple activity to test how flipper reacts to changes in native UI Reviewed By: passy Differential Revision: D38704012 fbshipit-source-id: 8a593577322922c6f6f0f96dd5cb0761c3035389
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0426966b14
commit
2fc1ff9f9c
@@ -60,6 +60,15 @@
|
||||
<data android:scheme="flipper" android:host="list_activity" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".IncrementActivity"
|
||||
android:exported="true" android:hardwareAccelerated="true">
|
||||
<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="increment_activity" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".AnimationsActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and 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.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class IncrementActivity extends Activity {
|
||||
|
||||
int count = 0;
|
||||
TextView text;
|
||||
Button button;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_increment);
|
||||
|
||||
text = (TextView) findViewById(R.id.count);
|
||||
|
||||
button = (Button) findViewById(com.facebook.flipper.sample.R.id.btn_inc);
|
||||
button.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
IncrementActivity.this.text.setText(String.valueOf(++count));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,17 @@ public class RootComponentSpec {
|
||||
.clickHandler(RootComponent.openAnimationsActivity(c)))
|
||||
.child(
|
||||
Text.create(c)
|
||||
.text("Crash this app")
|
||||
.text("Navigate to increment activity")
|
||||
.key("11")
|
||||
.marginDip(YogaEdge.ALL, 10)
|
||||
.textSizeSp(20)
|
||||
.clickHandler(RootComponent.openIncrementActivity(c)))
|
||||
.child(
|
||||
Text.create(c)
|
||||
.text("Crash this app")
|
||||
.key("12")
|
||||
.marginDip(YogaEdge.ALL, 10)
|
||||
.textSizeSp(20)
|
||||
.clickHandler(RootComponent.triggerCrash(c)))
|
||||
.child(
|
||||
FrescoImage.create(c)
|
||||
@@ -190,4 +197,10 @@ public class RootComponentSpec {
|
||||
final Intent intent = new Intent(c.getAndroidContext(), AnimationsActivity.class);
|
||||
c.getAndroidContext().startActivity(intent);
|
||||
}
|
||||
|
||||
@OnEvent(ClickEvent.class)
|
||||
static void openIncrementActivity(final ComponentContext c) {
|
||||
final Intent intent = new Intent(c.getAndroidContext(), IncrementActivity.class);
|
||||
c.getAndroidContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
26
android/sample/src/main/res/layout/activity_increment.xml
Normal file
26
android/sample/src/main/res/layout/activity_increment.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".IncrementActivity"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_inc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:text="Inc"
|
||||
android:textColor="@android:color/holo_blue_dark"
|
||||
/>
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user