diff --git a/samples/Support7Demos/Android.mk b/samples/Support7Demos/Android.mk index 0d2fadb0c..e3d54d083 100644 --- a/samples/Support7Demos/Android.mk +++ b/samples/Support7Demos/Android.mk @@ -29,14 +29,20 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v7-mediarouter \ android-support-v7-palette \ android-support-v7-recyclerview \ - android-support-v7-cardview + android-support-v7-cardview \ + android-support-design LOCAL_RESOURCE_DIR = \ $(LOCAL_PATH)/res \ frameworks/support/v7/appcompat/res \ frameworks/support/v7/gridlayout/res \ frameworks/support/v7/mediarouter/res \ - frameworks/support/v7/cardview/res + frameworks/support/v7/cardview/res \ + frameworks/support/design/res LOCAL_AAPT_FLAGS := \ --auto-add-overlay \ - --extra-packages android.support.v7.cardview:android.support.v7.appcompat:android.support.v7.gridlayout:android.support.v7.mediarouter + --extra-packages android.support.v7.appcompat \ + --extra-packages android.support.v7.cardview \ + --extra-packages android.support.v7.gridlayout \ + --extra-packages android.support.v7.mediarouter \ + --extra-packages android.support.design include $(BUILD_PACKAGE) diff --git a/samples/Support7Demos/AndroidManifest.xml b/samples/Support7Demos/AndroidManifest.xml index 3e2ef99b0..321e74e01 100644 --- a/samples/Support7Demos/AndroidManifest.xml +++ b/samples/Support7Demos/AndroidManifest.xml @@ -352,5 +352,14 @@ android:label="@string/palette" android:theme="@style/Theme.AppCompat" /> + + + + + + + diff --git a/samples/Support7Demos/res/color/card_selector.xml b/samples/Support7Demos/res/color/card_selector.xml new file mode 100644 index 000000000..48b35ee1d --- /dev/null +++ b/samples/Support7Demos/res/color/card_selector.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/samples/Support7Demos/res/layout/activity_card_view.xml b/samples/Support7Demos/res/layout/activity_card_view.xml index 9b985f70e..3e1b9285e 100644 --- a/samples/Support7Demos/res/layout/activity_card_view.xml +++ b/samples/Support7Demos/res/layout/activity_card_view.xml @@ -132,46 +132,58 @@ android:text="@string/card_view_bg_color" android:layout_below="@id/alpha_label" android:layout_alignRight="@id/alpha_label"/> - - + + - - - - - - + android:orientation="horizontal"> + + + + + + + + + + card_view:cardElevation="10dp" + android:clickable="true" + android:layout_margin="8dp"> + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml index 541a87fe8..6d1ac8652 100644 --- a/samples/Support7Demos/res/values/strings.xml +++ b/samples/Support7Demos/res/values/strings.xml @@ -166,6 +166,7 @@ Sample text on right Resize CardView Resize Content + Selector Palette Full color palette @@ -173,4 +174,8 @@ Sorted List Add New Item + Design/Floating Action Button + Normal size + Mini size + diff --git a/samples/Support7Demos/res/values/styles.xml b/samples/Support7Demos/res/values/styles.xml index 26a9f70de..253bd4cb5 100644 --- a/samples/Support7Demos/res/values/styles.xml +++ b/samples/Support7Demos/res/values/styles.xml @@ -33,4 +33,10 @@ 35dp + + \ No newline at end of file diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java index ca0c08aac..f5f8c4c0c 100644 --- a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java +++ b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java @@ -16,8 +16,6 @@ package com.example.android.supportv7.view; import android.app.Activity; -import android.graphics.drawable.ColorDrawable; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.view.ViewCompat; @@ -30,8 +28,6 @@ import android.widget.TextView; import com.example.android.supportv7.R; -import java.lang.reflect.Field; - public class CardViewActivity extends Activity { CardView mCardView; @@ -182,6 +178,8 @@ public class CardViewActivity extends Activity { return R.color.card_sunbrite; case R.id.tropical: return R.color.card_tropical; + case R.id.selector: + return R.color.card_selector; default: return R.color.cardview_light_background; } diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/FloatingActionButtonUsage.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/FloatingActionButtonUsage.java new file mode 100644 index 000000000..791d14007 --- /dev/null +++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/FloatingActionButtonUsage.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2015 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.example.android.supportv7.widget; + +import com.example.android.supportv7.R; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; + +/** + * This demonstrates idiomatic usage of the Floating Action Button + */ +public class FloatingActionButtonUsage extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.design_fab); + + // Retrieve the Toolbar from our content view, and set it as the action bar + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + } + +}