├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── testfunction
│ │ └── coordinatorlayoutbehavior
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── testfunction
│ │ │ └── coordinatorlayoutbehavior
│ │ │ ├── MainActivity.java
│ │ │ ├── adapters
│ │ │ └── StringListAdapter.java
│ │ │ ├── behaviors
│ │ │ └── SnackBarBehavior.java
│ │ │ ├── itemdecorations
│ │ │ └── DividerItemDecoration.java
│ │ │ └── views
│ │ │ └── SnackBarExampleView.java
│ └── res
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── list_item.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── testfunction
│ └── coordinatorlayoutbehavior
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #CoordinatorLayout Snackbar Example
2 | This example is to show how to implement a CoordinatorLayout.Behavior on any view element.
3 |
4 | Examples are shown via both app:layout_behavior and a custom class that utilizes the behavior.
5 |
6 | ```
7 | public class SnackBarBehavior extends CoordinatorLayout.Behavior {
8 | private float mTranslationY;
9 |
10 | public SnackBarBehavior() {
11 |
12 | }
13 |
14 | public SnackBarBehavior(Context context, AttributeSet attrs) {
15 | super();
16 | }
17 |
18 | @Override
19 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
20 | return dependency instanceof Snackbar.SnackbarLayout;
21 | }
22 |
23 | @Override
24 | public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
25 | if (dependency instanceof Snackbar.SnackbarLayout) {
26 | this.updateTranslation(parent, child, dependency);
27 | }
28 |
29 | return false;
30 | }
31 |
32 | @Override
33 | public void onDependentViewRemoved(CoordinatorLayout parent, View child, View dependency) {
34 | if (dependency instanceof Snackbar.SnackbarLayout) {
35 | this.updateTranslation(parent, child, dependency);
36 | }
37 | }
38 |
39 | private void updateTranslation(CoordinatorLayout parent, View child, View dependency) {
40 | float translationY = this.getTranslationY(parent, child);
41 | if (translationY != this.mTranslationY) {
42 | ViewCompat.animate(child)
43 | .cancel();
44 | if (Math.abs(translationY - this.mTranslationY) == (float) dependency.getHeight()) {
45 | ViewCompat.animate(child)
46 | .translationY(translationY)
47 | .setListener((ViewPropertyAnimatorListener) null);
48 | } else {
49 | ViewCompat.setTranslationY(child, translationY);
50 | }
51 |
52 | this.mTranslationY = translationY;
53 | }
54 |
55 | }
56 |
57 | private float getTranslationY(CoordinatorLayout parent, View child) {
58 | float minOffset = 0.0F;
59 | List dependencies = parent.getDependencies(child);
60 | int i = 0;
61 |
62 | for (int z = dependencies.size(); i < z; ++i) {
63 | View view = (View) dependencies.get(i);
64 | if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
65 | minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - (float) view.getHeight());
66 | }
67 | }
68 |
69 | return minOffset;
70 | }
71 | }
72 | ```
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.testfunction.coordinatorlayoutbehavior"
9 | minSdkVersion 16
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Brandon\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/testfunction/coordinatorlayoutbehavior/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/testfunction/coordinatorlayoutbehavior/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.view.View;
9 |
10 | import com.testfunction.coordinatorlayoutbehavior.adapters.StringListAdapter;
11 | import com.testfunction.coordinatorlayoutbehavior.behaviors.SnackBarBehavior;
12 | import com.testfunction.coordinatorlayoutbehavior.itemdecorations.DividerItemDecoration;
13 |
14 | public class MainActivity extends AppCompatActivity implements View.OnClickListener {
15 |
16 | private CoordinatorLayout mContainer;
17 | private View mView;
18 | private RecyclerView mRecyclerView;
19 | private boolean mHasBehavior = true;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_main);
25 | setup();
26 | }
27 |
28 | private void setup() {
29 | mContainer = (CoordinatorLayout) findViewById(R.id.container);
30 | mView = (View) findViewById(R.id.view_misc);
31 |
32 | mRecyclerView = (RecyclerView) findViewById(R.id.list);
33 | mRecyclerView.setAdapter(new StringListAdapter(this, mContainer, this));
34 | mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
35 | mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
36 | }
37 |
38 | private void addSnackBarBehavior(View view) {
39 | CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
40 | params.setBehavior(new SnackBarBehavior());
41 | }
42 |
43 | private void removeSnackBarBehavior(View view) {
44 | CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
45 | params.setBehavior(null);
46 | }
47 |
48 | @Override
49 | public void onClick(View v) {
50 | if (mHasBehavior) {
51 | removeSnackBarBehavior(mView);
52 | } else {
53 | addSnackBarBehavior(mView);
54 | }
55 | mHasBehavior = !mHasBehavior;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/testfunction/coordinatorlayoutbehavior/adapters/StringListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior.adapters;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.Snackbar;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import com.testfunction.coordinatorlayoutbehavior.R;
12 |
13 | /**
14 | * Created by lodlock (iamhunted@gmail.com)
15 | * On 12/14/2015 1:21 PM
16 | * For the CoordinatorLayout Behavior (com.testfunction.coordinatorlayoutbehavior.adapters) project
17 | */
18 | public class StringListAdapter extends RecyclerView.Adapter implements View.OnClickListener {
19 |
20 | private final LayoutInflater mInflater;
21 | private final String[] mItems;
22 | private final View mContainer;
23 | private final View.OnClickListener mToggleListener;
24 |
25 | public StringListAdapter(Context context, View container, View.OnClickListener listener) {
26 | mInflater = LayoutInflater.from(context);
27 | mItems = context.getResources().getStringArray(R.array.items);
28 | mContainer = container;
29 | mToggleListener = listener;
30 | }
31 |
32 | @Override
33 | public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
34 | View itemView = mInflater.inflate(R.layout.list_item, parent, false);
35 | itemView.setOnClickListener(this);
36 | return new Holder(itemView);
37 | }
38 |
39 | @Override
40 | public void onBindViewHolder(Holder holder, int position) {
41 | holder.text.setText(mItems[position]);
42 | }
43 |
44 | @Override
45 | public int getItemCount() {
46 | return mItems.length;
47 | }
48 |
49 | @Override
50 | public void onClick(View v) {
51 | Snackbar.make(mContainer, ((TextView) v.findViewById(R.id.text1)).getText(), Snackbar.LENGTH_LONG).show();
52 | }
53 |
54 | public static class Holder extends RecyclerView.ViewHolder {
55 | public final TextView text;
56 |
57 | public Holder(View itemView) {
58 | super(itemView);
59 | this.text = (TextView) itemView.findViewById(R.id.text1);
60 | itemView.setClickable(true);
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/testfunction/coordinatorlayoutbehavior/behaviors/SnackBarBehavior.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior.behaviors;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v4.view.ViewCompat;
7 | import android.support.v4.view.ViewPropertyAnimatorListener;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Created by lodlock (iamhunted@gmail.com)
15 | * On 12/14/2015 11:50 AM
16 | * For the CoordinatorLayout Behavior (com.testfunction.coordinatorlayoutbehavior.behaviors) project
17 | */
18 | public class SnackBarBehavior extends CoordinatorLayout.Behavior {
19 | private float mTranslationY;
20 |
21 | public SnackBarBehavior() {
22 |
23 | }
24 |
25 | public SnackBarBehavior(Context context, AttributeSet attrs) {
26 | super();
27 | }
28 |
29 | @Override
30 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
31 | return dependency instanceof Snackbar.SnackbarLayout;
32 | }
33 |
34 | @Override
35 | public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
36 | if (dependency instanceof Snackbar.SnackbarLayout) {
37 | this.updateTranslation(parent, child, dependency);
38 | }
39 |
40 | return false;
41 | }
42 |
43 | @Override
44 | public void onDependentViewRemoved(CoordinatorLayout parent, View child, View dependency) {
45 | if (dependency instanceof Snackbar.SnackbarLayout) {
46 | this.updateTranslation(parent, child, dependency);
47 | }
48 | }
49 |
50 | private void updateTranslation(CoordinatorLayout parent, View child, View dependency) {
51 | float translationY = this.getTranslationY(parent, child);
52 | if (translationY != this.mTranslationY) {
53 | ViewCompat.animate(child)
54 | .cancel();
55 | if (Math.abs(translationY - this.mTranslationY) == (float) dependency.getHeight()) {
56 | ViewCompat.animate(child)
57 | .translationY(translationY)
58 | .setListener((ViewPropertyAnimatorListener) null);
59 | } else {
60 | ViewCompat.setTranslationY(child, translationY);
61 | }
62 |
63 | this.mTranslationY = translationY;
64 | }
65 |
66 | }
67 |
68 | private float getTranslationY(CoordinatorLayout parent, View child) {
69 | float minOffset = 0.0F;
70 | List dependencies = parent.getDependencies(child);
71 | int i = 0;
72 |
73 | for (int z = dependencies.size(); i < z; ++i) {
74 | View view = (View) dependencies.get(i);
75 | if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
76 | minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - (float) view.getHeight());
77 | }
78 | }
79 |
80 | return minOffset;
81 | }
82 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/testfunction/coordinatorlayoutbehavior/itemdecorations/DividerItemDecoration.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior.itemdecorations;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Rect;
7 | import android.graphics.drawable.Drawable;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.View;
11 |
12 | /*
13 | * Copyright (C) 2014 The Android Open Source Project
14 | *
15 | * Licensed under the Apache License, Version 2.0 (the "License");
16 | * you may not use this file except in compliance with the License.
17 | * You may obtain a copy of the License at
18 | *
19 | * http://www.apache.org/licenses/LICENSE-2.0
20 | *
21 | * Unless required by applicable law or agreed to in writing, software
22 | * distributed under the License is distributed on an "AS IS" BASIS,
23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 | * See the License for the specific language governing permissions and
25 | * limitations under the License.
26 | */
27 | public class DividerItemDecoration extends RecyclerView.ItemDecoration {
28 |
29 | private static final int[] ATTRS = new int[]{
30 | android.R.attr.listDivider
31 | };
32 |
33 | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
34 | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
35 |
36 | private Drawable mDivider;
37 | private int mOrientation;
38 |
39 | public DividerItemDecoration(Context context, int orientation) {
40 | final TypedArray a = context.obtainStyledAttributes(ATTRS);
41 | mDivider = a.getDrawable(0);
42 | a.recycle();
43 | setOrientation(orientation);
44 | }
45 |
46 | public void setOrientation(int orientation) {
47 | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) {
48 | throw new IllegalArgumentException("invalid orientation");
49 | }
50 | mOrientation = orientation;
51 | }
52 |
53 | @Override
54 | public void onDraw(Canvas c, RecyclerView parent) {
55 | if (mOrientation == VERTICAL_LIST) {
56 | drawVertical(c, parent);
57 | } else {
58 | drawHorizontal(c, parent);
59 | }
60 | }
61 |
62 | public void drawVertical(Canvas c, RecyclerView parent) {
63 | final int left = parent.getPaddingLeft();
64 | final int right = parent.getWidth() - parent.getPaddingRight();
65 |
66 | final int childCount = parent.getChildCount();
67 | for (int i = 0; i < childCount; i++) {
68 | final View child = parent.getChildAt(i);
69 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
70 | .getLayoutParams();
71 | final int top = child.getBottom() + params.bottomMargin;
72 | final int bottom = top + mDivider.getIntrinsicHeight();
73 | mDivider.setBounds(left, top, right, bottom);
74 | mDivider.draw(c);
75 | }
76 | }
77 |
78 | public void drawHorizontal(Canvas c, RecyclerView parent) {
79 | final int top = parent.getPaddingTop();
80 | final int bottom = parent.getHeight() - parent.getPaddingBottom();
81 |
82 | final int childCount = parent.getChildCount();
83 | for (int i = 0; i < childCount; i++) {
84 | final View child = parent.getChildAt(i);
85 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
86 | .getLayoutParams();
87 | final int left = child.getRight() + params.rightMargin;
88 | final int right = left + mDivider.getIntrinsicHeight();
89 | mDivider.setBounds(left, top, right, bottom);
90 | mDivider.draw(c);
91 | }
92 | }
93 |
94 | @Override
95 | public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
96 | if (mOrientation == VERTICAL_LIST) {
97 | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
98 | } else {
99 | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
100 | }
101 | }
102 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/testfunction/coordinatorlayoutbehavior/views/SnackBarExampleView.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior.views;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 | import com.testfunction.coordinatorlayoutbehavior.behaviors.SnackBarBehavior;
9 |
10 | /**
11 | * Created by lodlock (iamhunted@gmail.com)
12 | * On 12/14/2015 2:54 PM
13 | * For the CoordinatorLayout Behavior (com.testfunction.coordinatorlayoutbehavior.views) project
14 | */
15 | @CoordinatorLayout.DefaultBehavior(SnackBarBehavior.class)
16 | public class SnackBarExampleView extends View {
17 | public SnackBarExampleView(Context context) {
18 | super(context);
19 | }
20 |
21 | public SnackBarExampleView(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public SnackBarExampleView(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
22 |
23 |
33 |
34 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lodlock/CoordinatorLayout.Behavior/c2dc687abebbc020e083da951d9de6ba1af3e888/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lodlock/CoordinatorLayout.Behavior/c2dc687abebbc020e083da951d9de6ba1af3e888/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lodlock/CoordinatorLayout.Behavior/c2dc687abebbc020e083da951d9de6ba1af3e888/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lodlock/CoordinatorLayout.Behavior/c2dc687abebbc020e083da951d9de6ba1af3e888/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lodlock/CoordinatorLayout.Behavior/c2dc687abebbc020e083da951d9de6ba1af3e888/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - One
5 | - Two
6 | - Three
7 | - Four
8 | - Five
9 | - Six
10 | - Seven
11 | - Eight
12 | - Nine
13 | - Ten
14 | - Eleven
15 | - Twelve
16 | - Thirteen
17 | - Fourteen
18 | - Fifteen
19 | - Sixteen
20 | - Seventeen
21 | - Eighteen
22 | - Nineteen
23 | - Twenty
24 | - Twenty One
25 | - Twenty Two
26 | - Twenty Three
27 | - Twenty Four
28 | - Twenty Five
29 | - Twenty Six
30 | - Twenty Seven
31 | - Twenty Eight
32 | - Twenty Nine
33 | - Thirty
34 | - Thirty One
35 | - Thirty Two
36 | - Thirty Three
37 | - Thirty Four
38 | - Thirty Five
39 | - Thirty Six
40 | - Thirty Seven
41 | - Thirty Eight
42 | - Thirty Nine
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FFFFFF
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CoordinatorLayout Behavior
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/testfunction/coordinatorlayoutbehavior/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.testfunction.coordinatorlayoutbehavior;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------