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:
committed by
Facebook GitHub Bot
parent
420f0016c6
commit
172bd0a88e
@@ -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.
@@ -1,3 +0,0 @@
|
||||
key.alias=androiddebugkey
|
||||
key.store.password=android
|
||||
key.alias.password=android
|
@@ -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>
|
@@ -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>
|
@@ -7,6 +7,8 @@
|
||||
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
android.useAndroidX=true
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=1.19.0
|
||||
|
32
sample/build.gradle
Normal file
32
sample/build.gradle
Normal 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")
|
||||
}
|
28
sample/src/main/AndroidManifest.xml
Normal file
28
sample/src/main/AndroidManifest.xml
Normal 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>
|
@@ -5,23 +5,23 @@
|
||||
* 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.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.Menu;
|
||||
import android.view.MenuInflater;
|
||||
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;
|
||||
|
||||
public class BenchmarkActivity extends AppCompatActivity {
|
||||
@@ -33,21 +33,24 @@ public class BenchmarkActivity extends AppCompatActivity {
|
||||
|
||||
setContentView(R.layout.benchmark_select_layout);
|
||||
|
||||
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||
ViewPager viewPager = findViewById(R.id.viewpager);
|
||||
viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
|
||||
ActionBar.TabListener tabListener = new ActionBar.TabListener() {
|
||||
@Override
|
||||
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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||
}
|
||||
};
|
@@ -5,17 +5,14 @@
|
||||
* 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.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.Math;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import android.content.Context;
|
@@ -5,25 +5,26 @@
|
||||
* 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.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
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 java.util.Random;
|
||||
|
||||
public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSelectedListener {
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSel
|
||||
container,
|
||||
false);
|
||||
|
||||
Spinner benchmarkSelect = (Spinner) rootLayout.findViewById(R.id.benchmarkSelect);
|
||||
Spinner benchmarkSelect = rootLayout.findViewById(R.id.benchmarkSelect);
|
||||
String[] items = new String[]{"Basic", "Typical", "Nested"};
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
||||
benchmarkSelect.setAdapter(adapter);
|
||||
@@ -104,7 +105,7 @@ public class BenchmarkFragment extends Fragment implements AdapterView.OnItemSel
|
||||
}
|
||||
|
||||
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);
|
||||
v.setLayoutParams(new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
@@ -5,40 +5,31 @@
|
||||
* 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.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.view.ViewGroup;
|
||||
import android.util.Log;
|
||||
import com.facebook.samples.yoga.R;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class BenchmarkInflate extends BenchmarkFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater,
|
||||
ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
Button b = (Button) rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startBenchmark();
|
||||
}
|
||||
});
|
||||
Button b = rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(v -> startBenchmark());
|
||||
|
||||
return rootLayout;
|
||||
}
|
||||
|
||||
protected void startBenchmark() {
|
||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
TextView textView = (TextView) rootLayout.findViewById(R.id.text);
|
||||
TextView textView = rootLayout.findViewById(R.id.text);
|
||||
|
||||
final int ITERATIONS = 500;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* 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.util.Log;
|
||||
@@ -14,9 +14,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.facebook.samples.yoga.R;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BenchmarkLayout extends BenchmarkFragment {
|
||||
|
||||
@@ -27,21 +24,15 @@ public class BenchmarkLayout extends BenchmarkFragment {
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
Button b = (Button) rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startBenchmark();
|
||||
}
|
||||
});
|
||||
Button b = rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(v -> startBenchmark());
|
||||
|
||||
return rootLayout;
|
||||
}
|
||||
|
||||
protected void startBenchmark() {
|
||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
TextView textView = (TextView) rootLayout.findViewById(R.id.text);
|
||||
Random random = new Random();
|
||||
TextView textView = rootLayout.findViewById(R.id.text);
|
||||
|
||||
final int ITERATIONS = 500;
|
||||
|
||||
@@ -67,13 +58,13 @@ public class BenchmarkLayout extends BenchmarkFragment {
|
||||
}
|
||||
|
||||
textView.setText(
|
||||
yogaInflationAggregator.toString()+
|
||||
yogaInflationAggregator +
|
||||
"\n" +
|
||||
linearInflationAggregator.toString());
|
||||
linearInflationAggregator);
|
||||
Log.i(
|
||||
"YogaLayoutBenchmark",
|
||||
yogaInflationAggregator.toString()+
|
||||
yogaInflationAggregator +
|
||||
"\n" +
|
||||
linearInflationAggregator.toString());
|
||||
linearInflationAggregator);
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
* 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.util.Log;
|
||||
@@ -14,7 +14,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import com.facebook.samples.yoga.R;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -27,13 +26,8 @@ public class BenchmarkMeasure extends BenchmarkFragment {
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
Button b = (Button) rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startBenchmark();
|
||||
}
|
||||
});
|
||||
Button b = rootLayout.findViewById(R.id.btn);
|
||||
b.setOnClickListener(v -> startBenchmark());
|
||||
|
||||
return rootLayout;
|
||||
}
|
@@ -5,17 +5,18 @@
|
||||
* 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.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
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.yoga.android.YogaViewLayoutFactory;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
// There is only one option
|
||||
Intent intent = new Intent(this, BenchmarkActivity.class);
|
||||
startActivity(intent);
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<YogaLayout
|
||||
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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="column"
|
||||
app:yg_flexDirection="column"
|
||||
>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_height="50dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_height="50dp"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/btn"
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Run benchmark"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<Spinner
|
||||
android:id="@+id/benchmarkSelect"
|
||||
@@ -34,12 +34,12 @@
|
||||
android:layout_height="match_parent"
|
||||
android:textSize="10sp"
|
||||
android:fontFamily="monospace"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/yoga_grey"
|
||||
android:background="@android:color/darker_gray"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/preview"
|
@@ -1,30 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<YogaLayout
|
||||
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_height="60dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<View
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_flex="0"
|
||||
yoga:yg_marginAll="5dp"
|
||||
app:yg_flex="0"
|
||||
app:yg_marginAll="5dp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_1_text"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_flex="0"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_2_text"
|
||||
yoga:yg_flex="1"
|
||||
yoga:yg_marginHorizontal="5dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginHorizontal="5dp"
|
||||
/>
|
||||
</YogaLayout>
|
@@ -1,102 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<YogaLayout
|
||||
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_height="60dp"
|
||||
yoga:yg_flexDirection="column"
|
||||
yoga:yg_alignItems="stretch"
|
||||
app:yg_flexDirection="column"
|
||||
app:yg_alignItems="stretch"
|
||||
>
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:height="40dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="stretch"
|
||||
app:height="40dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="stretch"
|
||||
>
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginAll="10dp"
|
||||
yoga:yg_aspectRatio="1"
|
||||
app:yg_marginAll="10dp"
|
||||
app:yg_aspectRatio="1"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:height="40dp"
|
||||
yoga:yg_flexDirection="column"
|
||||
yoga:yg_alignItems="stretch"
|
||||
yoga:yg_flex="1"
|
||||
yoga:yg_justifyContent="space_around"
|
||||
app:height="40dp"
|
||||
app:yg_flexDirection="column"
|
||||
app:yg_alignItems="stretch"
|
||||
app:yg_flex="1"
|
||||
app:yg_justifyContent="space_around"
|
||||
>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:height="8dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="stretch"
|
||||
app:height="8dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="stretch"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_1_text"
|
||||
android:textSize="5sp"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_aspectRatio="1"
|
||||
app:yg_aspectRatio="1"
|
||||
/>
|
||||
</VirtualYogaLayout>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:height="8dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="stretch"
|
||||
app:height="8dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="stretch"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_1_text"
|
||||
android:textSize="5sp"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_aspectRatio="1"
|
||||
app:yg_aspectRatio="1"
|
||||
/>
|
||||
</VirtualYogaLayout>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:height="8dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="stretch"
|
||||
app:height="8dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="stretch"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/child_1_text"
|
||||
android:textSize="5sp"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flex="1"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_aspectRatio="1"
|
||||
app:yg_aspectRatio="1"
|
||||
/>
|
||||
</VirtualYogaLayout>
|
||||
</VirtualYogaLayout>
|
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<LinearLayout
|
||||
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="60dp"
|
||||
android:orientation="vertical"
|
@@ -1,192 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<YogaLayout
|
||||
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_height="wrap_content"
|
||||
yoga:yg_alignItems="center"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_justifyContent="center"
|
||||
app:yg_alignItems="center"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_justifyContent="center"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="column"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="column"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="column"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="column"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="column"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="column"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_blue"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/yoga_grey"
|
||||
yoga:yg_marginLeft="10dp"
|
||||
app:yg_marginLeft="10dp"
|
||||
/>
|
||||
<VirtualYogaLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_flex="1"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_flex="1"
|
||||
>
|
||||
</VirtualYogaLayout>
|
||||
</VirtualYogaLayout>
|
@@ -1,5 +1,5 @@
|
||||
<?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"
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
@@ -10,7 +10,7 @@
|
||||
|
||||
<YogaLayout
|
||||
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_height="match_parent"
|
||||
>
|
||||
@@ -18,120 +18,120 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:yg_marginHorizontal="10dp"
|
||||
yoga:yg_marginTop="5dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_marginHorizontal="10dp"
|
||||
app:yg_marginTop="5dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_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:yg_flex="1"
|
||||
yoga:yg_marginStart="8dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginStart="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:yg_marginHorizontal="10dp"
|
||||
yoga:yg_marginTop="5dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_marginHorizontal="10dp"
|
||||
app:yg_marginTop="5dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_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:yg_flex="1"
|
||||
yoga:yg_marginStart="8dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginStart="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:yg_marginHorizontal="10dp"
|
||||
yoga:yg_marginTop="5dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_marginHorizontal="10dp"
|
||||
app:yg_marginTop="5dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_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:yg_flex="1"
|
||||
yoga:yg_marginStart="8dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginStart="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:yg_marginHorizontal="10dp"
|
||||
yoga:yg_marginTop="5dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_marginHorizontal="10dp"
|
||||
app:yg_marginTop="5dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_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:yg_flex="1"
|
||||
yoga:yg_marginStart="8dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginStart="8dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
<YogaLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sample_children_background"
|
||||
yoga:yg_marginHorizontal="10dp"
|
||||
yoga:yg_marginTop="5dp"
|
||||
yoga:yg_flexDirection="row"
|
||||
yoga:yg_alignItems="center"
|
||||
app:yg_marginHorizontal="10dp"
|
||||
app:yg_marginTop="5dp"
|
||||
app:yg_flexDirection="row"
|
||||
app:yg_alignItems="center"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/ic_launcher"
|
||||
yoga:yg_flex="0"
|
||||
app:yg_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:yg_flex="1"
|
||||
yoga:yg_marginStart="10dp"
|
||||
app:yg_flex="1"
|
||||
app:yg_marginStart="10dp"
|
||||
/>
|
||||
</YogaLayout>
|
||||
</YogaLayout>
|
8
sample/src/main/res/menu/action_bar_benchmark.xml
Normal file
8
sample/src/main/res/menu/action_bar_benchmark.xml
Normal 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>
|
8
sample/src/main/res/menu/action_bar_home.xml
Normal file
8
sample/src/main/res/menu/action_bar_home.xml
Normal 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>
|
@@ -30,4 +30,6 @@
|
||||
name="child_5_text"
|
||||
description="Placeholder text for the fifth element in the layout"
|
||||
>Who are you?</string>
|
||||
<string name="home">Home</string>
|
||||
<string name="benchmark">Benchmark</string>
|
||||
</resources>
|
@@ -7,8 +7,10 @@
|
||||
|
||||
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-layout").projectDir = file("android")
|
||||
|
||||
rootProject.name = "yoga-github"
|
||||
|
Reference in New Issue
Block a user