() {
+ public SavedState createFromParcel(Parcel in) {
+ return new SavedState(in);
+ }
+
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ };
+ }
+
+ @Override
+ public Parcelable onSaveInstanceState() {
+ Parcelable superState = super.onSaveInstanceState();
+ SavedState ss = new SavedState(superState);
+ ss.checked = isChecked();
+ return ss;
+ }
+
+ @Override
+ public void onRestoreInstanceState(Parcelable state) {
+ SavedState ss = (SavedState) state;
+ super.onRestoreInstanceState(ss.getSuperState());
+ setChecked(ss.checked);
+ requestLayout();
+ }
+
+ /**
+ * On checked change callback interface.
+ */
+ public interface OnCheckedChangeListener {
+ void onCheckedChanged(CompoundLayout compoundLayout, boolean checked);
+ }
+
+}
diff --git a/compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java b/compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java
new file mode 100644
index 0000000..c39378f
--- /dev/null
+++ b/compoundlayout/src/main/java/com/jaouan/compoundlayout/GradientRadioLayout.java
@@ -0,0 +1,201 @@
+package com.jaouan.compoundlayout;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.LinearGradient;
+import android.graphics.Shader;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.RectShape;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewAnimationUtils;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateDecelerateInterpolator;
+import android.view.animation.AlphaAnimation;
+import android.widget.FrameLayout;
+
+/**
+ * Radio layout with a gradient foreground.
+ */
+@TargetApi(Build.VERSION_CODES.LOLLIPOP)
+public class GradientRadioLayout extends RadioLayout {
+
+ /**
+ * First color.
+ */
+ private int mColorA;
+
+ /**
+ * Second color.
+ */
+ private int mColorB;
+
+ /**
+ * Gradient angle in degrees.
+ */
+ private double mDegreesAngle;
+
+ /**
+ * Foreground gradien layout.
+ */
+ private FrameLayout mForegroundLayout;
+
+ /**
+ * View bounds' hypot.
+ */
+ private int mSideHypot;
+
+ public GradientRadioLayout(Context context) {
+ this(context, null);
+ }
+
+ public GradientRadioLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public GradientRadioLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ public GradientRadioLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+
+ // - Initialize widget from XML attributes.
+ final TypedArray styleAttributes = context.obtainStyledAttributes(
+ attrs, R.styleable.GradientRadioLayout, defStyleAttr, defStyleRes);
+ mColorA = styleAttributes.getColor(R.styleable.GradientRadioLayout_colorA, getResources().getColor(R.color.color_a_default));
+ mColorB = styleAttributes.getColor(R.styleable.GradientRadioLayout_colorB, getResources().getColor(R.color.color_b_default));
+ mDegreesAngle = styleAttributes.getInt(R.styleable.GradientRadioLayout_angle, 0);
+ styleAttributes.recycle();
+ }
+
+ @Override
+ protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
+ super.onSizeChanged(width, height, oldWidth, oldHeight);
+ updateGradientParameters();
+ }
+
+ @Override
+ public void setChecked(final boolean checked) {
+ final boolean lastCheckedState = isChecked();
+ super.setChecked(checked);
+
+ // If foreground layout exists and checked state really changed, then animate it.
+ if (mForegroundLayout != null && lastCheckedState != isChecked()) {
+ // Initialize alpha and reveal animation.
+ AlphaAnimation alphaAnimation;
+ Animator circularReveal;
+ if (checked) {
+ alphaAnimation = new AlphaAnimation(0, 1);
+ circularReveal = ViewAnimationUtils.createCircularReveal(mForegroundLayout, (int) (getWidth() * -.2f), getHeight() / 2, 0, mSideHypot);
+ } else {
+ alphaAnimation = new AlphaAnimation(1, 0);
+ alphaAnimation.setStartOffset(100);
+ circularReveal = ViewAnimationUtils.createCircularReveal(mForegroundLayout, (int) (getWidth() * 1.2f), getHeight() / 2, mSideHypot, 0);
+ }
+ alphaAnimation.setDuration(200);
+ alphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
+
+ circularReveal.setDuration(300);
+ circularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
+
+ circularReveal.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ mForegroundLayout.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mForegroundLayout.setVisibility(checked ? View.VISIBLE : View.INVISIBLE);
+ }
+ });
+
+ // Start animations.
+ circularReveal.start();
+ mForegroundLayout.startAnimation(alphaAnimation);
+ }
+ }
+
+ /**
+ * Retrieve first color.
+ *
+ * @return First color.
+ */
+ public int getColorA() {
+ return mColorA;
+ }
+
+ /**
+ * Defines first color.
+ *
+ * @param colorA First color.
+ */
+ public void setColorA(int colorA) {
+ this.mColorA = colorA;
+ updateGradientParameters();
+ }
+
+ /**
+ * Retrieve second color.
+ *
+ * @return Second color.
+ */
+ public int getColorB() {
+ return mColorB;
+ }
+
+ /**
+ * Defines second color.
+ *
+ * @param colorB Second color.
+ */
+ public void setColorB(int colorB) {
+ this.mColorB = colorB;
+ updateGradientParameters();
+ }
+
+ /**
+ * Retrieve gradient angle in degrees.
+ *
+ * @return Gradient angle in degrees.
+ */
+ public double getAngle() {
+ return mDegreesAngle;
+ }
+
+ /**
+ * Defines gradient angle in degrees.
+ *
+ * @param degreesAngle Gradient angle in degrees.
+ */
+ public void setAngle(double degreesAngle) {
+ this.mDegreesAngle = degreesAngle;
+ updateGradientParameters();
+ }
+
+ /**
+ * Update gradient parameters.
+ */
+ private void updateGradientParameters() {
+ // - Initialize gradient.
+ mSideHypot = (int) Math.hypot(getWidth(), getHeight());
+ ShapeDrawable mDrawable = new ShapeDrawable(new RectShape());
+ final double radiansAngle = Math.toRadians(mDegreesAngle);
+ mDrawable.getPaint().setShader(new LinearGradient(0, 0, (int) (mSideHypot * Math.cos(radiansAngle)), (int) (mSideHypot * Math.sin(radiansAngle)), mColorA, mColorB, Shader.TileMode.REPEAT));
+
+ // - Initialize foreground gradient layout.
+ if (mForegroundLayout == null) {
+ mForegroundLayout = new FrameLayout(getContext());
+ mForegroundLayout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ addView(mForegroundLayout);
+ }
+ mForegroundLayout.setVisibility(isChecked() ? View.VISIBLE : View.INVISIBLE);
+ mForegroundLayout.setForeground(mDrawable);
+ }
+
+}
diff --git a/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayout.java b/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayout.java
new file mode 100644
index 0000000..d2367fb
--- /dev/null
+++ b/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayout.java
@@ -0,0 +1,36 @@
+package com.jaouan.compoundlayout;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+/**
+ * Radio layout. It's like a RadioButton, but it's a layout.
+ */
+public class RadioLayout extends CompoundLayout {
+
+ public RadioLayout(Context context) {
+ super(context);
+ }
+
+ public RadioLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public RadioLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public RadioLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ public void toggle() {
+ // we override to prevent toggle when the radio is already
+ // checked (as opposed to check boxes widgets)
+ if (!isChecked()) {
+ super.toggle();
+ }
+ }
+
+}
diff --git a/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java b/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java
new file mode 100644
index 0000000..2eab8b8
--- /dev/null
+++ b/compoundlayout/src/main/java/com/jaouan/compoundlayout/RadioLayoutGroup.java
@@ -0,0 +1,399 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.jaouan.compoundlayout;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.LinearLayout;
+
+
+/**
+ * This class is used to create a multiple-exclusion scope for a set of radio
+ * buttons. Checking one radio button that belongs to a radio group unchecks
+ * any previously checked radio button within the same group.
+ *
+ * Intially, all of the radio buttons are unchecked. While it is not possible
+ * to uncheck a particular radio button, the radio group can be cleared to
+ * remove the checked state.
+ *
+ * The selection is identified by the unique id of the radio button as defined
+ * in the XML layout file.
+ *
+ * XML Attributes
+ * See {@link android.R.styleable#RadioGroup RadioLayoutGroup Attributes},
+ * {@link android.R.styleable#LinearLayout LinearLayout Attributes},
+ * {@link android.R.styleable#ViewGroup ViewGroup Attributes},
+ * {@link android.R.styleable#View View Attributes}
+ * Also see
+ * {@link LinearLayout.LayoutParams LinearLayout.LayoutParams}
+ * for layout attributes.
+ *
+ * @see RadioLayout
+ */
+public class RadioLayoutGroup extends LinearLayout {
+ // holds the checked id; the selection is empty by default
+ private int mCheckedId = -1;
+ // tracks children radio buttons checked state
+ private CompoundLayout.OnCheckedChangeListener mChildOnCheckedChangeListener;
+ // when true, mOnCheckedChangeListener discards events
+ private boolean mProtectFromCheckedChange = false;
+ private OnCheckedChangeListener mOnCheckedChangeListener;
+ private PassThroughHierarchyChangeListener mPassThroughListener;
+
+ /**
+ * {@inheritDoc}
+ */
+ public RadioLayoutGroup(Context context) {
+ super(context);
+ setOrientation(VERTICAL);
+ init();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RadioLayoutGroup(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ // retrieve selected radio button as requested by the user in the
+ // XML layout file
+ TypedArray attributes = context.obtainStyledAttributes(
+ attrs, R.styleable.RadioLayoutGroup, R.attr.radioButtonStyle, 0);
+
+ int value = attributes.getResourceId(R.styleable.RadioLayoutGroup_checkedButton, View.NO_ID);
+ if (value != View.NO_ID) {
+ mCheckedId = value;
+ }
+
+ final int index = attributes.getInt(R.styleable.RadioLayoutGroup_orientation, VERTICAL);
+ setOrientation(index);
+
+ attributes.recycle();
+ init();
+ }
+
+ private void init() {
+ mChildOnCheckedChangeListener = new CheckedStateTracker();
+ mPassThroughListener = new PassThroughHierarchyChangeListener();
+ super.setOnHierarchyChangeListener(mPassThroughListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
+ // the user listener is delegated to our pass-through listener
+ mPassThroughListener.mOnHierarchyChangeListener = listener;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+
+ // checks the appropriate radio button as requested in the XML file
+ if (mCheckedId != -1) {
+ mProtectFromCheckedChange = true;
+ setCheckedStateForView(mCheckedId, true);
+ mProtectFromCheckedChange = false;
+ setCheckedId(mCheckedId);
+ }
+ }
+
+ @Override
+ public void addView(View child, int index, ViewGroup.LayoutParams params) {
+ if (child instanceof RadioLayout) {
+ final RadioLayout button = (RadioLayout) child;
+ if (button.isChecked()) {
+ mProtectFromCheckedChange = true;
+ if (mCheckedId != -1) {
+ setCheckedStateForView(mCheckedId, false);
+ }
+ mProtectFromCheckedChange = false;
+ setCheckedId(button.getId());
+ }
+ }
+
+ super.addView(child, index, params);
+ }
+
+ /**
+ * Sets the selection to the radio button whose identifier is passed in
+ * parameter. Using -1 as the selection identifier clears the selection;
+ * such an operation is equivalent to invoking {@link #clearCheck()}.
+ *
+ * @param id the unique id of the radio button to select in this group
+ * @see #getCheckedRadioLayoutId()
+ * @see #clearCheck()
+ */
+ public void check(int id) {
+ // don't even bother
+ if (id != -1 && (id == mCheckedId)) {
+ return;
+ }
+
+ if (mCheckedId != -1) {
+ setCheckedStateForView(mCheckedId, false);
+ }
+
+ if (id != -1) {
+ setCheckedStateForView(id, true);
+ }
+
+ setCheckedId(id);
+ }
+
+ private void setCheckedId(int id) {
+ mCheckedId = id;
+ if (mOnCheckedChangeListener != null) {
+ mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId);
+ }
+ }
+
+ private void setCheckedStateForView(int viewId, boolean checked) {
+ View checkedView = findViewById(viewId);
+ if (checkedView != null && checkedView instanceof RadioLayout) {
+ ((RadioLayout) checkedView).setChecked(checked);
+ }
+ }
+
+ /**
+ * Returns the identifier of the selected radio button in this group.
+ * Upon empty selection, the returned value is -1.
+ *
+ * @return the unique id of the selected radio button in this group
+ * @attr ref android.R.styleable#RadioGroup_checkedButton
+ * @see #check(int)
+ * @see #clearCheck()
+ */
+ public int getCheckedRadioLayoutId() {
+ return mCheckedId;
+ }
+
+ /**
+ * Clears the selection. When the selection is cleared, no radio button
+ * in this group is selected and {@link #getCheckedRadioLayoutId()} returns
+ * null.
+ *
+ * @see #check(int)
+ * @see #getCheckedRadioLayoutId()
+ */
+ public void clearCheck() {
+ check(-1);
+ }
+
+ /**
+ * Register a callback to be invoked when the checked radio button
+ * changes in this group.
+ *
+ * @param listener the callback to call on checked state change
+ */
+ public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
+ mOnCheckedChangeListener = listener;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public LayoutParams generateLayoutParams(AttributeSet attrs) {
+ return new RadioLayoutGroup.LayoutParams(getContext(), attrs);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+ return p instanceof RadioLayoutGroup.LayoutParams;
+ }
+
+ @Override
+ protected LinearLayout.LayoutParams generateDefaultLayoutParams() {
+ return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ }
+
+ @Override
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ event.setClassName(RadioLayoutGroup.class.getName());
+ }
+
+ @Override
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ info.setClassName(RadioLayoutGroup.class.getName());
+ }
+
+ /**
+ * This set of layout parameters defaults the width and the height of
+ * the children to {@link #WRAP_CONTENT} when they are not specified in the
+ * XML file. Otherwise, this class ussed the value read from the XML file.
+ *
+ * See
+ * {@link android.R.styleable#LinearLayout_Layout LinearLayout Attributes}
+ * for a list of all child view attributes that this class supports.
+ */
+ public static class LayoutParams extends LinearLayout.LayoutParams {
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(Context c, AttributeSet attrs) {
+ super(c, attrs);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(int w, int h) {
+ super(w, h);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(int w, int h, float initWeight) {
+ super(w, h, initWeight);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(ViewGroup.LayoutParams p) {
+ super(p);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public LayoutParams(MarginLayoutParams source) {
+ super(source);
+ }
+
+ /**
+ * Fixes the child's width to
+ * {@link ViewGroup.LayoutParams#WRAP_CONTENT} and the child's
+ * height to {@link ViewGroup.LayoutParams#WRAP_CONTENT}
+ * when not specified in the XML file.
+ *
+ * @param a the styled attributes set
+ * @param widthAttr the width attribute to fetch
+ * @param heightAttr the height attribute to fetch
+ */
+ @Override
+ protected void setBaseAttributes(TypedArray a,
+ int widthAttr, int heightAttr) {
+
+ if (a.hasValue(widthAttr)) {
+ width = a.getLayoutDimension(widthAttr, "layout_width");
+ } else {
+ width = WRAP_CONTENT;
+ }
+
+ if (a.hasValue(heightAttr)) {
+ height = a.getLayoutDimension(heightAttr, "layout_height");
+ } else {
+ height = WRAP_CONTENT;
+ }
+ }
+ }
+
+ /**
+ * Interface definition for a callback to be invoked when the checked
+ * radio button changed in this group.
+ */
+ public interface OnCheckedChangeListener {
+ /**
+ * Called when the checked radio button has changed. When the
+ * selection is cleared, checkedId is -1.
+ *
+ * @param group the group in which the checked radio button has changed
+ * @param checkedId the unique identifier of the newly checked radio button
+ */
+ public void onCheckedChanged(RadioLayoutGroup group, int checkedId);
+ }
+
+ private class CheckedStateTracker implements CompoundLayout.OnCheckedChangeListener {
+ @Override
+ public void onCheckedChanged(CompoundLayout buttonView, boolean isChecked) {
+ // prevents from infinite recursion
+ if (mProtectFromCheckedChange) {
+ return;
+ }
+
+ mProtectFromCheckedChange = true;
+ if (mCheckedId != -1) {
+ setCheckedStateForView(mCheckedId, false);
+ }
+ mProtectFromCheckedChange = false;
+
+ int id = buttonView.getId();
+ setCheckedId(id);
+ }
+ }
+
+ /**
+ * A pass-through listener acts upon the events and dispatches them
+ * to another listener. This allows the table layout to set its own internal
+ * hierarchy change listener without preventing the user to setup his.
+ */
+ private class PassThroughHierarchyChangeListener implements
+ OnHierarchyChangeListener {
+ private OnHierarchyChangeListener mOnHierarchyChangeListener;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onChildViewAdded(View parent, View child) {
+ if (parent == RadioLayoutGroup.this && child instanceof RadioLayout) {
+ int id = child.getId();
+ // generates an id if it's missing
+ if (id == View.NO_ID) {
+ id = View.generateViewId();
+ child.setId(id);
+ }
+ ((RadioLayout) child).setOnCheckedChangeWidgetListener(
+ mChildOnCheckedChangeListener);
+ }
+
+ if (mOnHierarchyChangeListener != null) {
+ mOnHierarchyChangeListener.onChildViewAdded(parent, child);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onChildViewRemoved(View parent, View child) {
+ if (parent == RadioLayoutGroup.this && child instanceof RadioLayout) {
+ ((RadioLayout) child).setOnCheckedChangeWidgetListener(null);
+ }
+
+ if (mOnHierarchyChangeListener != null) {
+ mOnHierarchyChangeListener.onChildViewRemoved(parent, child);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/compoundlayout/src/main/res/drawable/rounded.xml b/compoundlayout/src/main/res/drawable/rounded.xml
new file mode 100644
index 0000000..36845a7
--- /dev/null
+++ b/compoundlayout/src/main/res/drawable/rounded.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/compoundlayout/src/main/res/values/attrs.xml b/compoundlayout/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..a30b5c2
--- /dev/null
+++ b/compoundlayout/src/main/res/values/attrs.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/compoundlayout/src/main/res/values/colors.xml b/compoundlayout/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f91fdd3
--- /dev/null
+++ b/compoundlayout/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+
+
+ #88F06292
+ #00BA68C8
+
diff --git a/compoundlayout/src/main/res/values/strings.xml b/compoundlayout/src/main/res/values/strings.xml
new file mode 100644
index 0000000..ca02ded
--- /dev/null
+++ b/compoundlayout/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ CompoundLayout
+
diff --git a/compoundlayout/src/test/java/com/jaouan/compoundlayout/ExampleUnitTest.java b/compoundlayout/src/test/java/com/jaouan/compoundlayout/ExampleUnitTest.java
new file mode 100644
index 0000000..2cd3452
--- /dev/null
+++ b/compoundlayout/src/test/java/com/jaouan/compoundlayout/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package com.jaouan.compoundlayout;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..122a0dc
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..2bb6673
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app', ':compoundlayout'