Move in yoga sample android app
Summary: The sample app is simply moved into the repo. A few libraries are included and the buck targets rearranged. Reviewed By: emilsjolander Differential Revision: D4528129 fbshipit-source-id: 3e9e779857cd9219711a939876c9275d75e09929
This commit is contained in:
committed by
Facebook Github Bot
parent
ce5d52b54e
commit
a580712b2f
21
android/sample/res/com/facebook/samples/yoga/BUCK
Normal file
21
android/sample/res/com/facebook/samples/yoga/BUCK
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2014-present, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree. An additional grant
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
include_defs('//YOGA_DEFS')
|
||||
|
||||
android_resource(
|
||||
name = 'res',
|
||||
res = 'res',
|
||||
package = 'com.facebook.samples.yoga',
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
||||
|
||||
project_config(
|
||||
src_target = ':res'
|
||||
)
|
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
<solid
|
||||
android:color="@color/yoga_grey"
|
||||
/>
|
||||
</shape>
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
|
||||
<corners
|
||||
android:radius="4dp"
|
||||
/>
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/children_stroke"
|
||||
/>
|
||||
|
||||
<padding
|
||||
android:top="6dp"
|
||||
android:bottom="6dp"
|
||||
android:left="8dp"
|
||||
android:right="8dp"
|
||||
/>
|
||||
|
||||
<solid
|
||||
android:color="@color/children_background"
|
||||
/>
|
||||
</shape>
|
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<YogaLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:yoga="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:margin_horizontal="10dp"
|
||||
yoga:margin_top="5dp"
|
||||
yoga:flex_direction="row"
|
||||
yoga:align_items="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_1_text"
|
||||
android:textColor="@color/children_text"
|
||||
yoga:flex="1"
|
||||
yoga:margin_start="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:margin_horizontal="10dp"
|
||||
yoga:margin_top="5dp"
|
||||
yoga:flex_direction="row"
|
||||
yoga:align_items="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_2_text"
|
||||
android:textColor="@color/children_text"
|
||||
yoga:flex="1"
|
||||
yoga:margin_start="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:margin_horizontal="10dp"
|
||||
yoga:margin_top="5dp"
|
||||
yoga:flex_direction="row"
|
||||
yoga:align_items="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_3_text"
|
||||
android:textColor="@color/children_text"
|
||||
yoga:flex="1"
|
||||
yoga:margin_start="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:margin_horizontal="10dp"
|
||||
yoga:margin_top="5dp"
|
||||
yoga:flex_direction="row"
|
||||
yoga:align_items="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_4_text"
|
||||
android:textColor="@color/children_text"
|
||||
yoga:flex="1"
|
||||
yoga:margin_start="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:margin_horizontal="10dp"
|
||||
yoga:margin_top="5dp"
|
||||
yoga:flex_direction="row"
|
||||
yoga:align_items="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_5_text"
|
||||
android:textColor="@color/children_text"
|
||||
yoga:flex="1"
|
||||
yoga:margin_start="10dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
</YogaLayout>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<YogaLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:yoga="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:align_items="center"
|
||||
yoga:justify_content="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:height="200dp"
|
||||
yoga:aspect_ratio="1"
|
||||
/>
|
||||
</YogaLayout>
|
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
LICENSE file in the root directory of this source tree. An additional grant
|
||||
of patent rights can be found in the PATENTS file in the same directory.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<declare-styleable name="yoga">
|
||||
|
||||
<attr name="align_content" format="enum">
|
||||
<enum name="auto" value="0"/>
|
||||
<enum name="flex-start" value="1"/>
|
||||
<enum name="center" value="2"/>
|
||||
<enum name="flex-end" value="3"/>
|
||||
<enum name="stretch" value="4"/>
|
||||
<enum name="baseline" value="5"/>
|
||||
</attr>
|
||||
|
||||
<attr name="align_items" format="enum">
|
||||
<enum name="auto" value="0"/>
|
||||
<enum name="flex-start" value="1"/>
|
||||
<enum name="center" value="2"/>
|
||||
<enum name="flex-end" value="3"/>
|
||||
<enum name="stretch" value="4"/>
|
||||
<enum name="baseline" value="5"/>
|
||||
</attr>
|
||||
|
||||
<attr name="align_self" format="enum">
|
||||
<enum name="auto" value="0"/>
|
||||
<enum name="flex-start" value="1"/>
|
||||
<enum name="center" value="2"/>
|
||||
<enum name="flex-end" value="3"/>
|
||||
<enum name="stretch" value="4"/>
|
||||
<enum name="baseline" value="5"/>
|
||||
</attr>
|
||||
|
||||
<attr name="aspect_ratio" format="float"/>
|
||||
|
||||
<attr name="border_left" format="dimension"/>
|
||||
<attr name="border_top" format="dimension"/>
|
||||
<attr name="border_right" format="dimension"/>
|
||||
<attr name="border_bottom" format="dimension"/>
|
||||
<attr name="border_start" format="dimension"/>
|
||||
<attr name="border_end" format="dimension"/>
|
||||
<attr name="border_horizontal" format="dimension"/>
|
||||
<attr name="border_vertical" format="dimension"/>
|
||||
<attr name="border_all" format="dimension"/>
|
||||
|
||||
<attr name="direction" format="enum">
|
||||
<enum name="inherit" value="0"/>
|
||||
<enum name="ltr" value="1"/>
|
||||
<enum name="rtl" value="2"/>
|
||||
</attr>
|
||||
|
||||
<attr name="flex" format="float"/>
|
||||
|
||||
<attr name="flex_basis" format="float"/>
|
||||
|
||||
<attr name="flex_basis_percent" format="float"/>
|
||||
|
||||
<attr name="flex_direction" format="enum">
|
||||
<enum name="column" value="0"/>
|
||||
<enum name="column-reverse" value="1"/>
|
||||
<enum name="row" value="2"/>
|
||||
<enum name="row-reverse" value="3"/>
|
||||
</attr>
|
||||
|
||||
<attr name="flex_grow" format="float"/>
|
||||
|
||||
<attr name="flex_shrink" format="float"/>
|
||||
|
||||
<!-- Height format not included as it is in the parent -->
|
||||
<attr name="height"/>
|
||||
|
||||
<attr name="height_percent" format="float"/>
|
||||
|
||||
<attr name="justify_content" format="enum">
|
||||
<enum name="flex-start" value="0"/>
|
||||
<enum name="center" value="1"/>
|
||||
<enum name="flex-end" value="2"/>
|
||||
<enum name="space-between" value="3"/>
|
||||
<enum name="space-around" value="4"/>
|
||||
</attr>
|
||||
|
||||
<attr name="margin_left" format="dimension"/>
|
||||
<attr name="margin_top" format="dimension"/>
|
||||
<attr name="margin_right" format="dimension"/>
|
||||
<attr name="margin_bottom" format="dimension"/>
|
||||
<attr name="margin_start" format="dimension"/>
|
||||
<attr name="margin_end" format="dimension"/>
|
||||
<attr name="margin_horizontal" format="dimension"/>
|
||||
<attr name="margin_vertical" format="dimension"/>
|
||||
<attr name="margin_all" format="dimension"/>
|
||||
|
||||
<attr name="margin_percent_left" format="dimension"/>
|
||||
<attr name="margin_percent_top" format="dimension"/>
|
||||
<attr name="margin_percent_right" format="dimension"/>
|
||||
<attr name="margin_percent_bottom" format="dimension"/>
|
||||
<attr name="margin_percent_start" format="dimension"/>
|
||||
<attr name="margin_percent_end" format="dimension"/>
|
||||
<attr name="margin_percent_horizontal" format="dimension"/>
|
||||
<attr name="margin_percent_vertical" format="dimension"/>
|
||||
<attr name="margin_percent_all" format="dimension"/>
|
||||
|
||||
<attr name="max_height" format="dimension"/>
|
||||
|
||||
<attr name="max_height_percent" format="float"/>
|
||||
|
||||
<attr name="max_width" format="dimension"/>
|
||||
|
||||
<attr name="max_width_percent" format="float"/>
|
||||
|
||||
<attr name="min_height" format="dimension"/>
|
||||
|
||||
<attr name="min_height_percent" format="float"/>
|
||||
|
||||
<attr name="min_width" format="dimension"/>
|
||||
|
||||
<attr name="min_width_percent" format="float"/>
|
||||
|
||||
<attr name="overflow" format="enum">
|
||||
<enum name="visible" value="0"/>
|
||||
<enum name="hidden" value="1"/>
|
||||
<enum name="scroll" value="2"/>
|
||||
</attr>
|
||||
|
||||
<attr name="padding_left" format="dimension"/>
|
||||
<attr name="padding_top" format="dimension"/>
|
||||
<attr name="padding_right" format="dimension"/>
|
||||
<attr name="padding_bottom" format="dimension"/>
|
||||
<attr name="padding_start" format="dimension"/>
|
||||
<attr name="padding_end" format="dimension"/>
|
||||
<attr name="padding_horizontal" format="dimension"/>
|
||||
<attr name="padding_vertical" format="dimension"/>
|
||||
<attr name="padding_all" format="dimension"/>
|
||||
|
||||
<attr name="padding_percent_left" format="float"/>
|
||||
<attr name="padding_percent_top" format="float"/>
|
||||
<attr name="padding_percent_right" format="float"/>
|
||||
<attr name="padding_percent_bottom" format="float"/>
|
||||
<attr name="padding_percent_start" format="float"/>
|
||||
<attr name="padding_percent_end" format="float"/>
|
||||
<attr name="padding_percent_horizontal" format="float"/>
|
||||
<attr name="padding_percent_vertical" format="float"/>
|
||||
<attr name="padding_percent_all" format="float"/>
|
||||
|
||||
<attr name="position_left" format="dimension"/>
|
||||
<attr name="position_top" format="dimension"/>
|
||||
<attr name="position_right" format="dimension"/>
|
||||
<attr name="position_bottom" format="dimension"/>
|
||||
<attr name="position_start" format="dimension"/>
|
||||
<attr name="position_end" format="dimension"/>
|
||||
<attr name="position_horizontal" format="dimension"/>
|
||||
<attr name="position_vertical" format="dimension"/>
|
||||
<attr name="position_all" format="dimension"/>
|
||||
|
||||
<attr name="position_percent_left" format="float"/>
|
||||
<attr name="position_percent_top" format="float"/>
|
||||
<attr name="position_percent_right" format="float"/>
|
||||
<attr name="position_percent_bottom" format="float"/>
|
||||
<attr name="position_percent_start" format="float"/>
|
||||
<attr name="position_percent_end" format="float"/>
|
||||
<attr name="position_percent_horizontal" format="float"/>
|
||||
<attr name="position_percent_vertical" format="float"/>
|
||||
<attr name="position_percent_all" format="float"/>
|
||||
|
||||
<attr name="position_type" format="enum">
|
||||
<enum name="relative" value="0"/>
|
||||
<enum name="absolute" value="1"/>
|
||||
</attr>
|
||||
|
||||
<attr name="width" format="dimension"/>
|
||||
|
||||
<attr name="width_percent" format="float"/>
|
||||
|
||||
<attr name="wrap" format="enum">
|
||||
<enum name="no-wrap" value="0"/>
|
||||
<enum name="wrap" value="1"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
</resources>
|
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<color name="yoga_grey">#FF303846</color>
|
||||
<color name="yoga_blue">#FF97DCCF</color>
|
||||
|
||||
<color name="children_background">#FFFFFFFF</color>
|
||||
<color name="children_stroke">#665890ff</color>
|
||||
<color name="children_text">#FF23355b</color>
|
||||
|
||||
</resources>
|
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">Yoga</string>
|
||||
<string
|
||||
name="child_1_text"
|
||||
description="Placeholder text for the first element in the layout"
|
||||
>Hello. I am Yoga!</string>
|
||||
<string
|
||||
name="child_2_text"
|
||||
description="Placeholder text for the second element in the layout"
|
||||
>I am a layout engine!</string>
|
||||
<string
|
||||
name="child_3_text"
|
||||
description="Placeholder text for the third element in the layout"
|
||||
>I run natively.</string>
|
||||
<string
|
||||
name="child_4_text"
|
||||
description="Placeholder text for the fourth element in the layout"
|
||||
>So I\'m fast.</string>
|
||||
<string
|
||||
name="child_5_text"
|
||||
description="Placeholder text for the fifth element in the layout"
|
||||
>Who are you?</string>
|
||||
</resources>
|
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2014-present, Facebook, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the license found in the
|
||||
LICENSE-examples file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<style name="NoTitleBarWhiteBG" parent="Theme.AppCompat.Light">
|
||||
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
||||
<item name="android:textDirection">locale</item>
|
||||
</style>
|
||||
<style name="MyActionBar" parent="Widget.AppCompat.Light.ActionBar">
|
||||
<item name="android:titleTextStyle">@style/MyTitleText</item>
|
||||
<item name="android:background">@drawable/action_bar_background</item>
|
||||
</style>
|
||||
<style name="MyTitleText" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">@color/yoga_blue</item>
|
||||
</style>
|
||||
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user