Let the Yoga sample app compile

Summary:
The sample app is really old and has a lot of legacy code. Here I'm refreshing it a bit.
Will do another pass later (perhaps rewrite it in Kotlin?).

Reviewed By: mdvacca

Differential Revision: D45694414

fbshipit-source-id: 36a84609b0dcf5b4a5237da900f665e4eb7895a5
This commit is contained in:
Nicola Corti
2023-05-09 10:43:02 -07:00
committed by Facebook GitHub Bot
parent 420f0016c6
commit 172bd0a88e
33 changed files with 305 additions and 335 deletions

View File

@@ -1,48 +0,0 @@
<?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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
>
<variable name="applicationId" value="com.facebook.yoga"/>
<variable name="app_label" value="Yoga Sample App"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:allowBackup="false"
android:theme="@style/NoTitleBarWhiteBG"
android:supportsRtl="true"
>
<activity
android:name=".MainActivity"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".BenchmarkActivity"
android:exported="false"
/>
</application>
</manifest>

Binary file not shown.

View File

@@ -1,3 +0,0 @@
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View File

@@ -1,19 +0,0 @@
<?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.
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:id="@+id/action_home"
android:title="Home"
android:showAsAction="always"
/>
</menu>

View File

@@ -1,19 +0,0 @@
<?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.
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:id="@+id/action_benchmark"
android:title="Benchmark"
android:showAsAction="always"
/>
</menu>

View File

@@ -7,6 +7,8 @@
# Project-wide Gradle settings. # Project-wide Gradle settings.
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
VERSION_NAME=1.19.0 VERSION_NAME=1.19.0

32
sample/build.gradle Normal file
View File

@@ -0,0 +1,32 @@
/*
* 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.
*/
apply plugin: 'com.android.application'
android {
namespace 'com.facebook.yoga.sample'
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
ndkVersion rootProject.ndkVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
}
compileOptions {
targetCompatibility rootProject.targetCompatibilityVersion
sourceCompatibility rootProject.sourceCompatibilityVersion
}
}
dependencies {
implementation project(':yoga-layout')
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.facebook.soloader:soloader:0.10.4")
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/NoTitleBarWhiteBG">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BenchmarkActivity"
android:exported="false" />
</application>
</manifest>

View File

@@ -5,23 +5,23 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.Menu;
import android.support.v7.app.ActionBar;
import com.facebook.samples.yoga.R; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;
import com.facebook.yoga.android.YogaViewLayoutFactory; import com.facebook.yoga.android.YogaViewLayoutFactory;
public class BenchmarkActivity extends AppCompatActivity { public class BenchmarkActivity extends AppCompatActivity {
@@ -33,21 +33,24 @@ public class BenchmarkActivity extends AppCompatActivity {
setContentView(R.layout.benchmark_select_layout); setContentView(R.layout.benchmark_select_layout);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); ViewPager viewPager = findViewById(R.id.viewpager);
viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager())); viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
final ActionBar actionBar = getSupportActionBar(); final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.TabListener tabListener = new ActionBar.TabListener() { ActionBar.TabListener tabListener = new ActionBar.TabListener() {
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); ViewPager viewPager = findViewById(R.id.viewpager);
viewPager.setCurrentItem(tab.getPosition()); viewPager.setCurrentItem(tab.getPosition());
} }
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
} }
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
} }
}; };

View File

@@ -5,17 +5,14 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import java.io.File; import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.Math; import java.lang.Math;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import android.content.Context; import android.content.Context;

View File

@@ -5,25 +5,26 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import java.util.Random;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView;
import com.facebook.samples.yoga.R; import androidx.fragment.app.Fragment;
import com.facebook.yoga.android.YogaLayout; import com.facebook.yoga.android.YogaLayout;
import java.util.Random;
public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSelectedListener { public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSelectedListener {
private LayoutInflater mInflater; private LayoutInflater mInflater;
@@ -58,17 +59,17 @@ public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSel
@Override @Override
public View onCreateView( public View onCreateView(
LayoutInflater inflater, LayoutInflater inflater,
ViewGroup container, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
mInflater = inflater; mInflater = inflater;
rootLayout = (YogaLayout) inflater.inflate( rootLayout = (YogaLayout) inflater.inflate(
R.layout.benchmark_fragment, R.layout.benchmark_fragment,
container, container,
false); false);
Spinner benchmarkSelect = (Spinner) rootLayout.findViewById(R.id.benchmarkSelect); Spinner benchmarkSelect = rootLayout.findViewById(R.id.benchmarkSelect);
String[] items = new String[]{"Basic", "Typical", "Nested"}; String[] items = new String[]{"Basic", "Typical", "Nested"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items); ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
benchmarkSelect.setAdapter(adapter); benchmarkSelect.setAdapter(adapter);
@@ -104,11 +105,11 @@ public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSel
} }
private void updatePreview() { private void updatePreview() {
LinearLayout previewLayout = (LinearLayout) rootLayout.findViewById(R.id.preview); LinearLayout previewLayout = rootLayout.findViewById(R.id.preview);
View v = mInflater.inflate(yogaLayout, rootLayout, false); View v = mInflater.inflate(yogaLayout, rootLayout, false);
v.setLayoutParams(new LinearLayout.LayoutParams( v.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT)); LinearLayout.LayoutParams.MATCH_PARENT));
previewLayout.removeAllViews(); previewLayout.removeAllViews();
previewLayout.addView(v); previewLayout.addView(v);
} }

View File

@@ -5,40 +5,31 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.TextView;
import android.widget.Button;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.util.Log; import android.widget.Button;
import com.facebook.samples.yoga.R; import android.widget.TextView;
public class BenchmarkInflate extends BenchmarkFragment { public class BenchmarkInflate extends BenchmarkFragment {
@Override @Override
public View onCreateView( public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState); super.onCreateView(inflater, container, savedInstanceState);
Button b = (Button) rootLayout.findViewById(R.id.btn); Button b = rootLayout.findViewById(R.id.btn);
b.setOnClickListener(new View.OnClickListener() { b.setOnClickListener(v -> startBenchmark());
@Override
public void onClick(View v) {
startBenchmark();
}
});
return rootLayout; return rootLayout;
} }
protected void startBenchmark() { protected void startBenchmark() {
LayoutInflater inflater = LayoutInflater.from(getActivity()); LayoutInflater inflater = LayoutInflater.from(getActivity());
TextView textView = (TextView) rootLayout.findViewById(R.id.text); TextView textView = rootLayout.findViewById(R.id.text);
final int ITERATIONS = 500; final int ITERATIONS = 500;
@@ -57,14 +48,14 @@ public class BenchmarkInflate extends BenchmarkFragment {
} }
textView.setText( textView.setText(
yogaInflationAggregator.toString()+ yogaInflationAggregator.toString() +
"\n"+ "\n" +
linearInflationAggregator.toString()); linearInflationAggregator.toString());
Log.i( Log.i(
"YogaLayoutBenchmark", "YogaLayoutBenchmark",
yogaInflationAggregator.toString()+ yogaInflationAggregator.toString() +
"\n"+ "\n" +
linearInflationAggregator.toString()); linearInflationAggregator.toString());
rootLayout.invalidate(); rootLayout.invalidate();
} }
} }

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -14,34 +14,25 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.facebook.samples.yoga.R;
import java.util.Random;
public class BenchmarkLayout extends BenchmarkFragment { public class BenchmarkLayout extends BenchmarkFragment {
@Override @Override
public View onCreateView( public View onCreateView(
LayoutInflater inflater, LayoutInflater inflater,
ViewGroup container, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState); super.onCreateView(inflater, container, savedInstanceState);
Button b = (Button) rootLayout.findViewById(R.id.btn); Button b = rootLayout.findViewById(R.id.btn);
b.setOnClickListener(new View.OnClickListener() { b.setOnClickListener(v -> startBenchmark());
@Override
public void onClick(View v) {
startBenchmark();
}
});
return rootLayout; return rootLayout;
} }
protected void startBenchmark() { protected void startBenchmark() {
LayoutInflater inflater = LayoutInflater.from(getActivity()); LayoutInflater inflater = LayoutInflater.from(getActivity());
TextView textView = (TextView) rootLayout.findViewById(R.id.text); TextView textView = rootLayout.findViewById(R.id.text);
Random random = new Random();
final int ITERATIONS = 500; final int ITERATIONS = 500;
@@ -53,11 +44,11 @@ public class BenchmarkLayout extends BenchmarkFragment {
randomizeText(yogaView); randomizeText(yogaView);
randomizeText(linearView); randomizeText(linearView);
yogaView.measure( yogaView.measure(
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY)); View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY));
linearView.measure( linearView.measure(
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY)); View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY));
yogaInflationAggregator.startTrace(); yogaInflationAggregator.startTrace();
yogaView.layout(0, 0, yogaView.getMeasuredWidth(), yogaView.getMeasuredHeight()); yogaView.layout(0, 0, yogaView.getMeasuredWidth(), yogaView.getMeasuredHeight());
yogaInflationAggregator.endTrace(); yogaInflationAggregator.endTrace();
@@ -67,13 +58,13 @@ public class BenchmarkLayout extends BenchmarkFragment {
} }
textView.setText( textView.setText(
yogaInflationAggregator.toString()+ yogaInflationAggregator +
"\n"+ "\n" +
linearInflationAggregator.toString()); linearInflationAggregator);
Log.i( Log.i(
"YogaLayoutBenchmark", "YogaLayoutBenchmark",
yogaInflationAggregator.toString()+ yogaInflationAggregator +
"\n"+ "\n" +
linearInflationAggregator.toString()); linearInflationAggregator);
} }
} }

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@@ -14,7 +14,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.facebook.samples.yoga.R;
import java.util.Random; import java.util.Random;
@@ -22,18 +21,13 @@ public class BenchmarkMeasure extends BenchmarkFragment {
@Override @Override
public View onCreateView( public View onCreateView(
LayoutInflater inflater, LayoutInflater inflater,
ViewGroup container, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState); super.onCreateView(inflater, container, savedInstanceState);
Button b = (Button) rootLayout.findViewById(R.id.btn); Button b = rootLayout.findViewById(R.id.btn);
b.setOnClickListener(new View.OnClickListener() { b.setOnClickListener(v -> startBenchmark());
@Override
public void onClick(View v) {
startBenchmark();
}
});
return rootLayout; return rootLayout;
} }
@@ -54,25 +48,25 @@ public class BenchmarkMeasure extends BenchmarkFragment {
randomizeText(linearView); randomizeText(linearView);
yogaMeasureAggregator.startTrace(); yogaMeasureAggregator.startTrace();
yogaView.measure( yogaView.measure(
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY)); View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY));
yogaMeasureAggregator.endTrace(); yogaMeasureAggregator.endTrace();
linearMeasureAggregator.startTrace(); linearMeasureAggregator.startTrace();
linearView.measure( linearView.measure(
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY)); View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY));
linearMeasureAggregator.endTrace(); linearMeasureAggregator.endTrace();
} }
textView.setText( textView.setText(
yogaMeasureAggregator.toString()+ yogaMeasureAggregator.toString() +
"\n"+ "\n" +
linearMeasureAggregator.toString()); linearMeasureAggregator.toString());
Log.i( Log.i(
"YogaLayoutBenchmark", "YogaLayoutBenchmark",
yogaMeasureAggregator.toString()+ yogaMeasureAggregator.toString() +
"\n"+ "\n" +
linearMeasureAggregator.toString()); linearMeasureAggregator.toString());
yogaMeasureAggregator.dump(getActivity()); yogaMeasureAggregator.dump(getActivity());
linearMeasureAggregator.dump(getActivity()); linearMeasureAggregator.dump(getActivity());

View File

@@ -5,22 +5,23 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
package com.facebook.samples.yoga; package com.facebook.yoga.sample;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.Menu;
import com.facebook.samples.yoga.R; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.facebook.soloader.SoLoader; import com.facebook.soloader.SoLoader;
import com.facebook.yoga.android.YogaViewLayoutFactory; import com.facebook.yoga.android.YogaViewLayoutFactory;
/** /**
* An activity to show off Yoga in Android. This activity shows a simple layout (defined in * An activity to show off Yoga in Android. This activity shows a simple layout (defined in
* {@code main_layout.xml}) that shows off the awesome functionality of the Yoga layout engine * {@code main_layout.xml}) that shows off the awesome functionality of the Yoga layout engine
* as well as some optimisations on layout systems that it facilitates. * as well as some optimisations on layout systems that it facilitates.
*/ */
@@ -43,7 +44,7 @@ public class MainActivity extends AppCompatActivity {
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
// There is only one option // There is only one option
Intent intent = new Intent(this, BenchmarkActivity.class); Intent intent = new Intent(this, BenchmarkActivity.class);
startActivity(intent); startActivity(intent);

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<YogaLayout <YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rt" android:id="@+id/rt"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
> >
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_height="50dp" app:yg_height="50dp"
> >
<Button <Button
android:id="@+id/btn" android:id="@+id/btn"
@@ -19,7 +19,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="Run benchmark" android:text="Run benchmark"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<Spinner <Spinner
android:id="@+id/benchmarkSelect" android:id="@+id/benchmarkSelect"
@@ -34,12 +34,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:textSize="10sp" android:textSize="10sp"
android:fontFamily="monospace" android:fontFamily="monospace"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="2dp" android:layout_height="2dp"
android:background="@color/yoga_grey" android:background="@android:color/darker_gray"
/> />
<LinearLayout <LinearLayout
android:id="@+id/preview" android:id="@+id/preview"

View File

@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<YogaLayout <YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<View <View
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_flex="0" app:yg_flex="0"
yoga:yg_marginAll="5dp" app:yg_marginAll="5dp"
/> />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_1_text" android:text="@string/child_1_text"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_2_text" android:text="@string/child_2_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginHorizontal="5dp" app:yg_marginHorizontal="5dp"
/> />
</YogaLayout> </YogaLayout>

View File

@@ -1,102 +1,102 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<YogaLayout <YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
> >
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:height="40dp" app:height="40dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
> >
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginAll="10dp" app:yg_marginAll="10dp"
yoga:yg_aspectRatio="1" app:yg_aspectRatio="1"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:height="40dp" app:height="40dp"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_justifyContent="space_around" app:yg_justifyContent="space_around"
> >
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:height="8dp" app:height="8dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_1_text" android:text="@string/child_1_text"
android:textSize="5sp" android:textSize="5sp"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_aspectRatio="1" app:yg_aspectRatio="1"
/> />
</VirtualYogaLayout> </VirtualYogaLayout>
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:height="8dp" app:height="8dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_1_text" android:text="@string/child_1_text"
android:textSize="5sp" android:textSize="5sp"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_aspectRatio="1" app:yg_aspectRatio="1"
/> />
</VirtualYogaLayout> </VirtualYogaLayout>
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:height="8dp" app:height="8dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="stretch" app:yg_alignItems="stretch"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_1_text" android:text="@string/child_1_text"
android:textSize="5sp" android:textSize="5sp"
yoga:yg_flex="1" app:yg_flex="1"
/> />
<View <View
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_aspectRatio="1" app:yg_aspectRatio="1"
/> />
</VirtualYogaLayout> </VirtualYogaLayout>
</VirtualYogaLayout> </VirtualYogaLayout>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" 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_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:orientation="vertical" android:orientation="vertical"

View File

@@ -1,192 +1,192 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<YogaLayout <YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_alignItems="center" app:yg_alignItems="center"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_justifyContent="center" app:yg_justifyContent="center"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="column" app:yg_flexDirection="column"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_blue" android:background="@color/yoga_blue"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/yoga_grey" android:background="@color/yoga_grey"
yoga:yg_marginLeft="10dp" app:yg_marginLeft="10dp"
/> />
<VirtualYogaLayout <VirtualYogaLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_flex="1" app:yg_flex="1"
> >
</VirtualYogaLayout> </VirtualYogaLayout>
</VirtualYogaLayout> </VirtualYogaLayout>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/viewpager" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -10,7 +10,7 @@
<YogaLayout <YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res/com.facebook.samples.yoga" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
> >
@@ -18,120 +18,120 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sample_children_background" android:background="@drawable/sample_children_background"
yoga:yg_marginHorizontal="10dp" app:yg_marginHorizontal="10dp"
yoga:yg_marginTop="5dp" app:yg_marginTop="5dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<ImageView <ImageView
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_1_text" android:text="@string/child_1_text"
android:textColor="@color/children_text" android:textColor="@color/children_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginStart="8dp" app:yg_marginStart="8dp"
/> />
</YogaLayout> </YogaLayout>
<YogaLayout <YogaLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sample_children_background" android:background="@drawable/sample_children_background"
yoga:yg_marginHorizontal="10dp" app:yg_marginHorizontal="10dp"
yoga:yg_marginTop="5dp" app:yg_marginTop="5dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<ImageView <ImageView
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_2_text" android:text="@string/child_2_text"
android:textColor="@color/children_text" android:textColor="@color/children_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginStart="8dp" app:yg_marginStart="8dp"
/> />
</YogaLayout> </YogaLayout>
<YogaLayout <YogaLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sample_children_background" android:background="@drawable/sample_children_background"
yoga:yg_marginHorizontal="10dp" app:yg_marginHorizontal="10dp"
yoga:yg_marginTop="5dp" app:yg_marginTop="5dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<ImageView <ImageView
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_3_text" android:text="@string/child_3_text"
android:textColor="@color/children_text" android:textColor="@color/children_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginStart="8dp" app:yg_marginStart="8dp"
/> />
</YogaLayout> </YogaLayout>
<YogaLayout <YogaLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sample_children_background" android:background="@drawable/sample_children_background"
yoga:yg_marginHorizontal="10dp" app:yg_marginHorizontal="10dp"
yoga:yg_marginTop="5dp" app:yg_marginTop="5dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<ImageView <ImageView
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_4_text" android:text="@string/child_4_text"
android:textColor="@color/children_text" android:textColor="@color/children_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginStart="8dp" app:yg_marginStart="8dp"
/> />
</YogaLayout> </YogaLayout>
<YogaLayout <YogaLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sample_children_background" android:background="@drawable/sample_children_background"
yoga:yg_marginHorizontal="10dp" app:yg_marginHorizontal="10dp"
yoga:yg_marginTop="5dp" app:yg_marginTop="5dp"
yoga:yg_flexDirection="row" app:yg_flexDirection="row"
yoga:yg_alignItems="center" app:yg_alignItems="center"
> >
<ImageView <ImageView
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
yoga:yg_flex="0" app:yg_flex="0"
/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/child_5_text" android:text="@string/child_5_text"
android:textColor="@color/children_text" android:textColor="@color/children_text"
yoga:yg_flex="1" app:yg_flex="1"
yoga:yg_marginStart="10dp" app:yg_marginStart="10dp"
/> />
</YogaLayout> </YogaLayout>
</YogaLayout> </YogaLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_home"
android:title="@string/home"
app:showAsAction="always" />
</menu>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_benchmark"
android:title="@string/benchmark"
app:showAsAction="always" />
</menu>

View File

@@ -30,4 +30,6 @@
name="child_5_text" name="child_5_text"
description="Placeholder text for the fifth element in the layout" description="Placeholder text for the fifth element in the layout"
>Who are you?</string> >Who are you?</string>
<string name="home">Home</string>
<string name="benchmark">Benchmark</string>
</resources> </resources>

View File

@@ -7,8 +7,10 @@
plugins { id("com.gradle.enterprise").version("3.7.1") } plugins { id("com.gradle.enterprise").version("3.7.1") }
include(":yoga", ":yoga-layout") include(":sample", ":yoga", ":yoga-layout")
project(":yoga").projectDir = file("java") project(":yoga").projectDir = file("java")
project(":yoga-layout").projectDir = file("android") project(":yoga-layout").projectDir = file("android")
rootProject.name = "yoga-github" rootProject.name = "yoga-github"
@@ -17,4 +19,4 @@ rootProject.name = "yoga-github"
// you can configure your custom Gradle Enterprise instance // you can configure your custom Gradle Enterprise instance
if (file("./gradle/gradle-enterprise.gradle.kts").exists()) { if (file("./gradle/gradle-enterprise.gradle.kts").exists()) {
apply(from = "./gradle/gradle-enterprise.gradle.kts") apply(from = "./gradle/gradle-enterprise.gradle.kts")
} }