Set up MDC Catalog build and docs

PiperOrigin-RevId: 195135469
This commit is contained in:
dniz 2018-05-02 15:44:50 -04:00 committed by Daniel Nizri
parent b8ce66ae69
commit d0e4cc93a9
226 changed files with 10552 additions and 0 deletions

View File

@ -20,6 +20,8 @@ take a look at our [Getting Started](docs/getting-started.md) guide.
- [All Components](https://github.com/material-components/material-components-android/tree/master/lib/)
- [Getting Started](docs/getting-started.md)
- [Contributing](docs/contributing.md)
- [Building From Source](building-from-source.md)
- [Catalog App](catalog-app.md)
- [Class
documentation](https://developer.android.com/reference/com/google/android/material/classes)
(external site)

69
catalog/build.gradle Normal file
View File

@ -0,0 +1,69 @@
apply plugin: 'com.android.application'
dependencies {
api 'com.google.dagger:dagger:2.15'
annotationProcessor 'com.google.dagger:dagger-compiler:2.15'
api 'com.google.dagger:dagger-android:2.15'
api 'com.google.dagger:dagger-android-support:2.15'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.15'
api 'com.android.support:multidex:1.0.3'
api project(':lib')
}
def srcDirs = [
'application',
'application/attrs',
'application/legacymultidex',
'application/scope',
'application/theme',
'assets',
'bottomappbar',
'bottomnav',
'button',
'card',
'chip',
'draggable',
'fab',
'feature',
'font',
'main',
'tableofcontents',
'tabs',
'textfield',
'themeswitcher',
'topappbar',
'transformation'
]
android {
defaultConfig {
manifestPlaceholders = [
application_name : 'CatalogApplication',
application_theme : 'Catalog',
catalog_application_component: 'io.material.catalog.application.DaggerCatalogApplicationComponent'
]
}
sourceSets {
main {
manifest.srcFile 'java/io/material/catalog/AndroidManifest.xml'
java.srcDir 'java'
java.includes = srcDirs.collect { 'io/material/catalog/' + it + '/**/*.java' }
java.excludes = [
'**/build/**',
]
res.srcDirs = ['java/io/material/catalog/res']
srcDirs.forEach {
res.srcDirs += 'java/io/material/catalog/' + it + '/res'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.material.catalog"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="27"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/cat_app_name"
android:name="io.material.catalog.application.${application_name}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.${application_theme}">
<meta-data
android:name="io.material.catalog.application.componentOverride"
android:value="${catalog_application_component}"/>
<activity
android:name=".main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,2 @@
# Catalog

View File

@ -0,0 +1,97 @@
/*
* Copyright 2017 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 io.material.catalog.application;
import android.app.Activity;
import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import java.lang.reflect.InvocationTargetException;
import javax.inject.Inject;
/** Catalog application class that provides support for using dispatching Dagger injectors. */
public class CatalogApplication extends Application implements HasActivityInjector {
/** Logging tag */
public static final String TAG = "CatalogApplication";
/** Key that contains the class name to replace the default application component. */
public static final String COMPONENT_OVERRIDE_KEY =
"io.material.catalog.application.componentOverride";
@Inject DispatchingAndroidInjector<Activity> activityInjector;
@Override
public void onCreate() {
super.onCreate();
if (!overrideApplicationComponent(this)) {
DaggerCatalogApplicationComponent.builder().application(this).build().inject(this);
}
}
/**
* Replaces the application component by the one specified in AndroidManifest.xml metadata with
* key {@link #COMPONENT_OVERRIDE_KEY}. Returns {@code true} if the component was properly
* initialized and replaced, otherwise returns {@code false}.
*
* <p>This assumes that the replacement component can be initialized exactly the same way as the
* default component.
*
* <p>Suppressing unchecked warnings because there is no way we have a statically typed class
* argument for instances of Class in this method.
*/
@SuppressWarnings("unchecked")
private boolean overrideApplicationComponent(CatalogApplication catalogApplication) {
try {
ApplicationInfo applicationInfo =
getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
String className = applicationInfo.metaData.getString(COMPONENT_OVERRIDE_KEY);
if (className == null) {
// Fail early
Log.i(TAG, "Component override metadata not found, using default component.");
return false;
}
Log.i(TAG, className);
Object builderObject = Class.forName(className).getMethod("builder").invoke(null);
Class<?> builderClass = builderObject.getClass();
builderClass
.getMethod("application", Application.class)
.invoke(builderObject, catalogApplication);
Object component = builderClass.getMethod("build").invoke(builderObject);
component
.getClass()
.getMethod("inject", CatalogApplication.class)
.invoke(component, catalogApplication);
return true;
} catch (PackageManager.NameNotFoundException
| ClassNotFoundException
| NoSuchMethodException
| InvocationTargetException
| IllegalAccessException e) {
Log.e(TAG, "Component override failed with exception:", e);
}
return false;
}
@Override
public AndroidInjector<Activity> activityInjector() {
return activityInjector;
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright 2017 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 io.material.catalog.application;
import android.app.Application;
import dagger.BindsInstance;
import dagger.android.support.AndroidSupportInjectionModule;
import io.material.catalog.application.scope.ApplicationScope;
import io.material.catalog.main.MainActivity;
/** The Application's root component. */
@ApplicationScope
@dagger.Component(
modules = {
AndroidSupportInjectionModule.class,
MainActivity.Module.class,
}
)
public interface CatalogApplicationComponent {
void inject(CatalogApplication app);
/** The root component's builder. */
@dagger.Component.Builder
interface Builder {
@BindsInstance
CatalogApplicationComponent.Builder application(Application application);
CatalogApplicationComponent build();
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<!-- This purpose of this attr is to allow a different Toolbar style based on the Catalog app.
The reason we can't set toolbarStyle globally in the Catalog's app theme is because the
android:theme attribute, which is in the Toolbar style, does not get applied to the Toolbar
when the style is set globally, due to how ThemeOverlays get created and resolved. So,
instead on each Toolbar we have to explicitly set style="?attr/catalogToolbarStyle" or
style="?attr/catalogToolbarWithCloseButtonStyle" if the toolbar contains a close button. -->
<attr name="catalogToolbarStyle" format="reference"/>
<attr name="catalogToolbarWithCloseButtonStyle" format="reference"/>
</resources>

View File

@ -0,0 +1,33 @@
/*
* Copyright 2017 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 io.material.catalog.application.legacymultidex;
import android.content.Context;
import android.support.multidex.MultiDex;
import io.material.catalog.application.CatalogApplication;
/**
* A version of {@link CatalogApplication} for development builds on older phones that uses the
* multidex support library for allowing multiple dex files.
*/
public class LegacyMultidexCatalogApplication extends CatalogApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2017 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 io.material.catalog.application.scope;
import java.lang.annotation.Documented;
import javax.inject.Scope;
/** Dagger scope for dependencies that should only have a single instance created per activity. */
@Scope
@Documented
public @interface ActivityScope {}

View File

@ -0,0 +1,28 @@
/*
* Copyright 2017 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 io.material.catalog.application.scope;
import java.lang.annotation.Documented;
import javax.inject.Scope;
/**
* Dagger scope for dependencies that should only have a single instance created for the entire
* application.
*/
@Scope
@Documented
public @interface ApplicationScope {}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2017 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 io.material.catalog.application.scope;
import java.lang.annotation.Documented;
import javax.inject.Scope;
/** Dagger scope for dependencies that should only have a single instance created per fragment. */
@Scope
@Documented
public @interface FragmentScope {}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<color name="cat_title_text_color">#FFFFFF</color>
<color name="cat_background_color">#FFFFFF</color>
<color name="cat_color_primary">#212121</color>
<color name="cat_color_primary_light">#535353</color>
<color name="cat_color_primary_dark">#000000</color>
<color name="cat_color_secondary">#30E57E</color>
<color name="cat_color_secondary_light">#33F286</color>
<color name="cat_color_secondary_dark">#25B363</color>
</resources>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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.
-->
<resources>
<string name="toolbar_navigation_close_description">Close demo</string>
</resources>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<style name="Widget.Catalog.Toolbar" parent="Widget.AppCompat.Toolbar">
<item name="android:background">?attr/colorPrimary</item>
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="titleTextAppearance">@style/TextAppearance.Catalog.Title</item>
</style>
<style name="Widget.Catalog.Toolbar.WithCloseButton" parent="Widget.Catalog.Toolbar">
<item name="navigationContentDescription">@string/toolbar_navigation_close_description</item>
<item name="navigationIcon">@drawable/ic_close_vd_theme_24px</item>
</style>
<style name="TextAppearance.Catalog.Title" parent="TextAppearance.AppCompat.Title">
<item name="android:textColor">@color/cat_title_text_color</item>
</style>
<style name="TextAppearance.Catalog.SectionTitle" parent="TextAppearance.AppCompat.Subhead"/>
<style name="TextAppearance.Catalog.Body" parent="TextAppearance.AppCompat.Body1"/>
<style name="TextAppearance.Catalog.ListTitle" parent="TextAppearance.AppCompat.Body1"/>
<style name="TextAppearance.Catalog.ListSubtitle" parent="TextAppearance.AppCompat.Caption"/>
</resources>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<style name="Theme.Catalog" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/cat_color_primary</item>
<item name="colorPrimaryLight">@color/cat_color_primary_light</item>
<item name="colorPrimaryDark">@color/cat_color_primary_dark</item>
<item name="colorSecondary">@color/cat_color_secondary</item>
<item name="colorSecondaryLight">@color/cat_color_secondary_light</item>
<item name="colorSecondaryDark">@color/cat_color_secondary_dark</item>
<item name="android:colorBackground">@color/cat_background_color</item>
<item name="catalogToolbarStyle">@style/Widget.Catalog.Toolbar</item>
<item name="catalogToolbarWithCloseButtonStyle">@style/Widget.Catalog.Toolbar.WithCloseButton</item>
</style>
</resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15,2c-2.71,0 -5.05,1.54 -6.22,3.78 -1.28,0.67 -2.34,1.72 -3,3C3.54,9.95 2,12.29 2,15c0,3.87 3.13,7 7,7 2.71,0 5.05,-1.54 6.22,-3.78 1.28,-0.67 2.34,-1.72 3,-3C20.46,14.05 22,11.71 22,9c0,-3.87 -3.13,-7 -7,-7zM9,20c-2.76,0 -5,-2.24 -5,-5 0,-1.12 0.37,-2.16 1,-3 0,3.87 3.13,7 7,7 -0.84,0.63 -1.88,1 -3,1zM12,17c-2.76,0 -5,-2.24 -5,-5 0,-1.12 0.37,-2.16 1,-3 0,3.86 3.13,6.99 7,7 -0.84,0.63 -1.88,1 -3,1zM16.7,13.7c-0.53,0.19 -1.1,0.3 -1.7,0.3 -2.76,0 -5,-2.24 -5,-5 0,-0.6 0.11,-1.17 0.3,-1.7 0.53,-0.19 1.1,-0.3 1.7,-0.3 2.76,0 5,2.24 5,5 0,0.6 -0.11,1.17 -0.3,1.7zM19,12c0,-3.86 -3.13,-6.99 -7,-7 0.84,-0.63 1.87,-1 3,-1 2.76,0 5,2.24 5,5 0,1.12 -0.37,2.16 -1,3z"/>
</vector>

View File

@ -0,0 +1,28 @@
<!--
Copyright 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,65.83h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M22,22L22,2L2,2v20h20zM20,20L4,20v-3h16v3zM20,4v11L4,15L4,4h16z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,21.83h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,12L4,4h16v8L4,12z"/>
</vector>

View File

@ -0,0 +1,52 @@
<!--
Copyright 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="80dp"
android:height="80dp"
android:viewportWidth="80"
android:viewportHeight="80">
<group
android:translateX="8.000000"
android:translateY="8.000000">
<path
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M 64 64 L 0 64 L 0 51.2 L 8.5801387e-15 0 L 64 9.09494702e-15 L 64 51.2 Z" />
<path
android:fillColor="#000000"
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M 64 64 L 0 64 L 0 51.2 L 8.5801387e-15 0 L 64 9.09494702e-15 L 64 51.2 Z" />
<path
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M20.1659169,44 L0,44 L0,64 L64,64 L64,44 L43.8340831,44 C42.8819269,49.6754267
37.9459926,54 32,54 C26.0540074,54 21.1180731,49.6754267 20.1659169,44 Z" />
<path
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:strokeWidth="1"
android:pathData="M 32 32 C 37.5228474983 32 42 36.4771525017 42 42 C 42 47.5228474983 37.5228474983 52 32 52 C 26.4771525017 52 22 47.5228474983 22 42 C 22 36.4771525017 26.4771525017 32 32 32 Z" />
<path
android:fillType="evenOdd"
android:strokeColor="#000000"
android:strokeWidth="1"
android:pathData="M63.5,63.5 L63.5,0.5 L0.5,0.5 L0.5,63.5 L63.5,63.5 Z" />
</group>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp">
<path
android:fillColor="#FF000000"
android:pathData="M2,9v6c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V9c0,-1.1 -0.9,-2 -2,-2H4C2.9,7 2,7.9 2,9z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6.5,9h1v6h-1z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M4,12.5l0,-1l6,0l-0,1z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-66.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M20,4v16H4V4h16m2,-2H2v20h20V2z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5,12.54h6.46V19H5zM12.54,12.54H19V19h-6.46zM5,5h6.46v6.46H5zM12.54,5H19v6.46h-6.46z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-110.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,20L4,4h16v16L4,20z"/>
<path
android:fillColor="#FF000000"
android:pathData="M16.5,13.5h-9c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5h9c0.83,0 1.5,0.67 1.5,1.5s-0.67,1.5 -1.5,1.5z"/>
</vector>

View File

@ -0,0 +1,25 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-154.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M17.16,11.99L7.17,2 5.59,3.58l2.66,2.66L2.49,12c-0.66,0.66 -0.66,1.72 0,2.37l6.15,6.15c0.33,0.31 0.76,0.48 1.19,0.48s0.86,-0.17 1.18,-0.49l6.15,-6.15c0.66,-0.65 0.66,-1.71 0,-2.37zM4.47,13.18l5.35,-5.35 5.35,5.35H4.47zM19.82,15s-2.18,2.37 -2.18,3.82c0,1.2 0.98,2.18 2.18,2.18S22,20.02 22,18.82c0,-1.45 -2.18,-3.82 -2.18,-3.82z"/>
</vector>

View File

@ -0,0 +1,28 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M-278.33,-154.17h76v76h-76z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M17.16,11.99L7.17,2 5.59,3.58l2.66,2.66L2.49,12c-0.66,0.66 -0.66,1.72 0,2.37l6.15,6.15c0.33,0.31 0.76,0.48 1.19,0.48s0.86,-0.17 1.18,-0.49l6.15,-6.15c0.66,-0.65 0.66,-1.71 0,-2.37zM4.47,13.18l5.35,-5.35 5.35,5.35H4.47zM19.82,15s-2.18,2.37 -2.18,3.82c0,1.2 0.98,2.18 2.18,2.18S22,20.02 22,18.82c0,-1.45 -2.18,-3.82 -2.18,-3.82z"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="#FF000000"
android:pathData="M16,8.1V2H2v14h6.1c0.5,3.4,3.4,6,6.9,6c3.9,0,7-3.1,7-7C22,11.5,19.4,8.6,16,8.1z
M8.1,14H4V4h10v4.1 C10.9,8.5,8.5,10.9,8.1,14z
M14,10.1V14h-3.9C10.5,12,12,10.5,14,10.1z
M15,20c-2.4,0-4.4-1.7-4.9-4H16v-5.9c2.3,0.5,4,2.5,4,4.9 C20,17.8,17.8,20,15,20z"/>
<path
android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-198.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM20,20L4,20v-4h16v4zM20,14L4,14v-4h16v4zM20,8L4,8L4,4h16v4z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5,5h2v2H5zM5,17h2v2H5zM5,11h2v2H5z"/>
</vector>

View File

@ -0,0 +1,32 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="36.0"
android:viewportWidth="36.0">
<path
android:fillColor="@android:color/white"
android:pathData="M14.67,25.5l10,-7.5l-10,-7.5z"
android:strokeColor="@android:color/transparent"
android:strokeWidth="1"/>
<path
android:fillColor="@android:color/transparent"
android:pathData="M18,1.33C8.8,1.33 1.33,8.8 1.33,18C1.33,27.2 8.8,34.67 18,34.67C27.2,34.67 34.67,27.2 34.67,18C34.67,8.8 27.2,1.33 18,1.33Z"
android:strokeColor="@android:color/white"
android:strokeWidth="1"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM20,20L4,20L4,4h2v7l2.5,-1.5L11,11L11,4h9v16z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-242.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M20,4v16H4V4h16m2,-2H2v20h20V2z"/>
<path
android:fillColor="#FF000000"
android:pathData="M7,7h10v10H7z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-286.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M20,4v16H4V4h16m2,-2H2v20h20V2z"/>
<path
android:fillColor="#FF000000"
android:pathData="M15,13l-3,3 -3,-3 -1,1 3,3 1,1 1,-1 3,-3M9,11l3,-3 3,3 1,-1 -3,-3 -1,-1 -1,1 -3,3"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-22.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
<path
android:fillColor="#FF000000"
android:pathData="M13,7h-2v4H7v2h4v4h2v-4h4v-2h-4"/>
</vector>

View File

@ -0,0 +1,25 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-330.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
<path
android:pathData="M12,15.17l3.4,2.06 -0.9,-3.87 3,-2.6 -3.95,-0.34L12,6.78l-1.55,3.64 -3.95,0.34 3,2.6 -0.9,3.87"
android:fillColor="#212121"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.59 2,12.25c0,4.53 2.87,8.37 6.84,9.73 0.5,0.09 0.68,-0.22 0.68,-0.49 0,-0.24 -0.01,-0.89 -0.01,-1.74 -2.78,0.62 -3.37,-1.37 -3.37,-1.37 -0.45,-1.18 -1.11,-1.5 -1.11,-1.5 -0.91,-0.64 0.07,-0.62 0.07,-0.62 1,0.07 1.53,1.06 1.53,1.06 0.89,1.57 2.34,1.11 2.91,0.85 0.09,-0.66 0.35,-1.11 0.63,-1.37 -2.22,-0.26 -4.56,-1.14 -4.56,-5.07 0,-1.12 0.39,-2.03 1.03,-2.75 -0.1,-0.26 -0.45,-1.3 0.1,-2.71 0,0 0.84,-0.28 2.75,1.05 0.8,-0.23 1.65,-0.34 2.5,-0.34 0.85,0 1.7,0.12 2.5,0.34 1.91,-1.33 2.75,-1.05 2.75,-1.05 0.55,1.41 0.2,2.45 0.1,2.71 0.64,0.72 1.03,1.63 1.03,2.75 0,3.94 -2.34,4.81 -4.57,5.06 0.36,0.32 0.68,0.94 0.68,1.9 0,1.37 -0.01,2.48 -0.01,2.81 0,0.27 0.18,0.59 0.69,0.49 3.97,-1.36 6.83,-5.2 6.83,-9.73C22,6.59 17.52,2 12,2"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-374.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,4h4v4H2zM8,4h14v4H8zM2,10h4v4H2zM8,10h14v4H8zM2,16h4v4H2zM8,16h14v4H8z"/>
</vector>

View File

@ -0,0 +1,33 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:viewportHeight="48.0"
android:viewportWidth="48.0"
android:width="48dp">
<path
android:fillColor="#212121"
android:pathData="M7.16,4h33.68C42.59,4 44,5.41 44,7.16v33.68c0,1.74 -1.41,3.16 -3.16,3.16H7.16C5.41,44 4,42.59 4,40.84V7.16C4,5.41 5.41,4 7.16,4z"/>
<path
android:fillColor="#fff"
android:pathData="M9,29h10l10,-10V9H9z"/>
<path
android:fillColor="#00E676"
android:pathData="M29,29m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
<path
android:fillColor="#B2FF59"
android:pathData="M29,19c-5.52,0 -10,4.48 -10,10h10V19z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-418.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,20L4,4h16v16L4,20z"/>
<path
android:fillColor="#FF000000"
android:pathData="M11,5v8h8V5h-8z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-462.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M21,11c-0.55,0 -1,0.45 -1,1 0,4.41 -3.59,8 -8,8s-8,-3.59 -8,-8 3.59,-8 8,-8c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1C6.49,2 2,6.49 2,12s4.49,10 10,10 10,-4.49 10,-10c0,-0.55 -0.45,-1 -1,-1z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-506.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M8,2v6L2,8v14h20L22,2L8,2zM8,20L4,20L4,10h4v10zM20,20h-4L16,8h-6L10,4h10v16z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-550.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,20L4,4h9.76c-0.48,0.72 -0.76,1.57 -0.76,2.5 0,2.49 2.01,4.5 4.5,4.5 0.93,0 1.78,-0.28 2.5,-0.76L20,20L4,20z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-594.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM20,20L4,20v-6h16v6z"/>
</vector>

View File

@ -0,0 +1,25 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-638.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8"/>
<path
android:fillColor="#FF000000"
android:pathData="M20,4v16H4V4h16m2,-2H2v20h20V2z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,2v16h16L22,2L6,2zM20,16L8,16L8,4h12v12z"/>
<path
android:fillColor="#FF000000"
android:pathData="M4,4H2v18h18v-2H4"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-682.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,22h20L22,2L2,2v20zM20,20h-8L12,4h8v16z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-726.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M19,9L5,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3h14c1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3zM19,13h-5v-2h5c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-770.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5,11c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1m0,-2c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3zM12,11c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1m0,-2c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
<path
android:fillColor="#FF000000"
android:pathData="M19,12m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"/>
</vector>

View File

@ -0,0 +1,30 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-814.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,20L4,4h16v16L4,20z"/>
<path
android:fillColor="#FF000000"
android:pathData="M5,6h11v4H5z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-858.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M19,9h-8.02C10.06,7.79 8.63,7 7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5c1.63,0 3.06,-0.79 3.98,-2L19,15c1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3zM19,13h-7.1c0.07,-0.32 0.1,-0.66 0.1,-1s-0.04,-0.68 -0.1,-1L19,11c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M-278.33,-902.17h76v76h-76z"/>
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM20,20L4,20L4,10h16v10zM20,8h-8L12,5h8v3z"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2,19h20v2L2,21zM19,3h1v14h-1zM9.51,3l-5.5,14h2.25l1.12,-3h6.25l1.12,3L17,17L11.51,3h-2zM8.13,12l2.38,-6.33L12.89,12L8.13,12z"/>
</vector>

View File

@ -0,0 +1,27 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,20H4V4h16M2,2v20h20V2"/>
<path
android:fillColor="#FF000000"
android:pathData="M5,17h14v2H5z"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,4v12h-6.4l-0.6,0.89 -1,1.5 -1,-1.5 -0.6,-0.89H4V4h16m2,-2H2v16h7.33L12,22l2.67,-4H22V2z"/>
</vector>

View File

@ -0,0 +1,24 @@
<!--
Copyright 2018 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
https://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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2,2v20h20L22,2L2,2zM4,4h16v3L4,7L4,4zM4,20L4,9h16v11L4,20z"/>
</vector>

View File

@ -0,0 +1,74 @@
/*
* Copyright 2017 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 io.material.catalog.bottomappbar;
import io.material.catalog.R;
import android.support.v4.app.Fragment;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
import io.material.catalog.application.scope.ActivityScope;
import io.material.catalog.application.scope.FragmentScope;
import io.material.catalog.feature.Demo;
import io.material.catalog.feature.DemoLandingFragment;
import io.material.catalog.feature.FeatureDemo;
/** A landing fragment that links to Bottom App Bar demos for the Catalog app. */
public class BottomAppBarFragment extends DemoLandingFragment {
@Override
public int getTitleResId() {
return R.string.cat_bottomappbar_title;
}
@Override
public int getDescriptionResId() {
return R.string.cat_bottomappbar_description;
}
@Override
public Demo getMainDemo() {
return new Demo() {
@Override
public Fragment createFragment() {
return new BottomAppBarMainDemoFragment();
}
};
}
/** The Dagger module for {@link BottomAppBarFragment} dependencies. */
@dagger.Module
public abstract static class Module {
@FragmentScope
@ContributesAndroidInjector
abstract BottomAppBarFragment contributeInjector();
@IntoSet
@Provides
@ActivityScope
static FeatureDemo provideFeatureDemo() {
return new FeatureDemo(R.string.cat_bottomappbar_title, R.drawable.ic_bottomappbar_24px) {
@Override
public Fragment createFragment() {
return new BottomAppBarFragment();
}
};
}
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright 2017 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 io.material.catalog.bottomappbar;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.snackbar.Snackbar;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ToggleButton;
import io.material.catalog.feature.DemoFragment;
import io.material.catalog.feature.OnBackPressedHandler;
import io.material.catalog.themeswitcher.ThemeSwitcherHelper;
/** A fragment that displays the main Bottom App Bar demos for the Catalog app. */
public class BottomAppBarMainDemoFragment extends DemoFragment implements OnBackPressedHandler {
protected BottomAppBar bar;
protected CoordinatorLayout coordinatorLayout;
@Nullable private ThemeSwitcherHelper themeSwitcherHelper;
private BottomSheetBehavior<View> bottomDrawerBehavior;
@Override
public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
setHasOptionsMenu(true);
// The theme switcher helper is used in an adhoc way with the toolbar since the BottomAppBar is
// set as the action bar.
themeSwitcherHelper = new ThemeSwitcherHelper(getFragmentManager());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
menuInflater.inflate(R.menu.demo_primary, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
Snackbar.make(getView(), menuItem.getTitle(), Snackbar.LENGTH_SHORT).show();
return true;
}
@LayoutRes
public int getBottomAppBarContent() {
return R.layout.cat_bottomappbar_fragment;
}
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view = layoutInflater.inflate(getBottomAppBarContent(), viewGroup, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
toolbar.setTitle(getDefaultDemoTitle());
themeSwitcherHelper.onCreateOptionsMenu(toolbar.getMenu(), getActivity().getMenuInflater());
toolbar.setOnMenuItemClickListener(themeSwitcherHelper::onOptionsItemSelected);
toolbar.setNavigationOnClickListener(
v -> {
getActivity().onBackPressed();
});
coordinatorLayout = view.findViewById(R.id.coordinator_layout);
bar = view.findViewById(R.id.bar);
((AppCompatActivity) getActivity()).setSupportActionBar(bar);
setUpBottomDrawer(view);
ImageButton fab = view.findViewById(R.id.fab);
fab.setOnClickListener(
v -> Snackbar.make(getView(), fab.getContentDescription(), Snackbar.LENGTH_SHORT).show());
NavigationView navigationView = view.findViewById(R.id.navigation_view);
navigationView.setNavigationItemSelectedListener(
item -> {
Snackbar.make(getView(), item.getTitle(), Snackbar.LENGTH_SHORT).show();
return false;
});
Button centerButton = view.findViewById(R.id.center);
Button endButton = view.findViewById(R.id.end);
ToggleButton attachToggle = view.findViewById(R.id.attach_toggle);
attachToggle.setChecked(bar.isFabAttached());
centerButton.setOnClickListener(
v -> bar.setFabAlignmentMode(BottomAppBar.FAB_ALIGNMENT_MODE_CENTER));
endButton.setOnClickListener(v -> bar.setFabAlignmentMode(BottomAppBar.FAB_ALIGNMENT_MODE_END));
attachToggle.setOnCheckedChangeListener(
(buttonView, isChecked) -> bar.setFabAttached(isChecked));
return view;
}
@Override
public boolean onBackPressed() {
if (bottomDrawerBehavior.getState() != BottomSheetBehavior.STATE_HIDDEN) {
bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
return true;
}
return false;
}
@Override
public boolean shouldShowDefaultDemoActionBar() {
return false;
}
protected void setUpBottomDrawer(View view) {
View bottomDrawer = coordinatorLayout.findViewById(R.id.bottom_drawer);
bottomDrawerBehavior = BottomSheetBehavior.from(bottomDrawer);
bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
bar.setNavigationOnClickListener(
v -> bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED));
bar.setNavigationIcon(R.drawable.ic_menu_24);
bar.replaceMenu(R.menu.demo_primary);
}
}

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M7.52,21.48C4.25,19.94 1.91,16.76 1.55,13L0.05,13C0.56,19.16 5.71,24 12,24l0.66,-0.03 -3.81,-3.81 -1.33,1.32zM8.41,14.96c-0.19,0 -0.37,-0.03 -0.52,-0.08 -0.16,-0.06 -0.29,-0.13 -0.4,-0.24 -0.11,-0.1 -0.2,-0.22 -0.26,-0.37 -0.06,-0.14 -0.09,-0.3 -0.09,-0.47h-1.3c0,0.36 0.07,0.68 0.21,0.95 0.14,0.27 0.33,0.5 0.56,0.69 0.24,0.18 0.51,0.32 0.82,0.41 0.3,0.1 0.62,0.15 0.96,0.15 0.37,0 0.72,-0.05 1.03,-0.15 0.32,-0.1 0.6,-0.25 0.83,-0.44s0.42,-0.43 0.55,-0.72c0.13,-0.29 0.2,-0.61 0.2,-0.97 0,-0.19 -0.02,-0.38 -0.07,-0.56 -0.05,-0.18 -0.12,-0.35 -0.23,-0.51 -0.1,-0.16 -0.24,-0.3 -0.4,-0.43 -0.17,-0.13 -0.37,-0.23 -0.61,-0.31 0.2,-0.09 0.37,-0.2 0.52,-0.33 0.15,-0.13 0.27,-0.27 0.37,-0.42 0.1,-0.15 0.17,-0.3 0.22,-0.46 0.05,-0.16 0.07,-0.32 0.07,-0.48 0,-0.36 -0.06,-0.68 -0.18,-0.96 -0.12,-0.28 -0.29,-0.51 -0.51,-0.69 -0.2,-0.19 -0.47,-0.33 -0.77,-0.43C9.1,8.05 8.76,8 8.39,8c-0.36,0 -0.69,0.05 -1,0.16 -0.3,0.11 -0.57,0.26 -0.79,0.45 -0.21,0.19 -0.38,0.41 -0.51,0.67 -0.12,0.26 -0.18,0.54 -0.18,0.85h1.3c0,-0.17 0.03,-0.32 0.09,-0.45s0.14,-0.25 0.25,-0.34c0.11,-0.09 0.23,-0.17 0.38,-0.22 0.15,-0.05 0.3,-0.08 0.48,-0.08 0.4,0 0.7,0.1 0.89,0.31 0.19,0.2 0.29,0.49 0.29,0.86 0,0.18 -0.03,0.34 -0.08,0.49 -0.05,0.15 -0.14,0.27 -0.25,0.37 -0.11,0.1 -0.25,0.18 -0.41,0.24 -0.16,0.06 -0.36,0.09 -0.58,0.09L7.5,11.4v1.03h0.77c0.22,0 0.42,0.02 0.6,0.07s0.33,0.13 0.45,0.23c0.12,0.11 0.22,0.24 0.29,0.4 0.07,0.16 0.1,0.35 0.1,0.57 0,0.41 -0.12,0.72 -0.35,0.93 -0.23,0.23 -0.55,0.33 -0.95,0.33zM16.96,9.04c-0.32,-0.33 -0.7,-0.59 -1.14,-0.77 -0.43,-0.18 -0.92,-0.27 -1.46,-0.27L12,8v8h2.3c0.55,0 1.06,-0.09 1.51,-0.27 0.45,-0.18 0.84,-0.43 1.16,-0.76 0.32,-0.33 0.57,-0.73 0.74,-1.19 0.17,-0.47 0.26,-0.99 0.26,-1.57v-0.4c0,-0.58 -0.09,-1.1 -0.26,-1.57 -0.18,-0.47 -0.43,-0.87 -0.75,-1.2zM16.57,12.2c0,0.42 -0.05,0.79 -0.14,1.13 -0.1,0.33 -0.24,0.62 -0.43,0.85 -0.19,0.23 -0.43,0.41 -0.71,0.53 -0.29,0.12 -0.62,0.18 -0.99,0.18h-0.91L13.39,9.12h0.97c0.72,0 1.27,0.23 1.64,0.69 0.38,0.46 0.57,1.12 0.57,1.99v0.4zM12,0l-0.66,0.03 3.81,3.81 1.33,-1.33c3.27,1.55 5.61,4.72 5.96,8.48h1.5C23.44,4.84 18.29,0 12,0z"/>
</vector>

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M12,22l10,-10L12,2 8.67,5.33l6.65,6.65 -6.67,6.67zM5.3,15.32l3.35,-3.34 -3.31,-3.3L2,12.02z"/>
</vector>

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z"/>
</vector>

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="?attr/catalogToolbarWithCloseButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.appbar.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:background="@color/grey50"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<Button
android:id="@+id/center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottomappbar_center"/>
<Button
android:id="@+id/end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottomappbar_end"/>
<ToggleButton
android:id="@+id/attach_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="@string/cat_bottomappbar_detached"
android:textOn="@string/cat_bottomappbar_attached"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/cat_bottomappbar_lorem_ipsum"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</merge>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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.
-->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/cat_bottomappbar_content"/>
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:navigationIcon="@drawable/ic_menu_24"
app:navigationContentDescription="@string/cat_bottomappbar_navigation_button_content_description"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cat_bottomappbar_fab_button_content_description"
app:layout_anchor="@id/bar"
app:srcCompat="@drawable/ic_add_24px"/>
<FrameLayout
android:id="@+id/bottom_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="16dp"
app:behavior_hideable="true"
app:layout_behavior="@string/bottom_sheet_behavior">
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/demo_primary"/>
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:icon="@drawable/ic_search_24"
android:title="@string/cat_bottomappbar_search"
app:showAsAction="ifRoom"/>
<item
android:icon="@drawable/ic_3d_rotation_24"
android:title="@string/cat_bottomappbar_3d"
app:showAsAction="ifRoom"/>
<item
android:icon="@drawable/ic_accelerator_24"
android:title="@string/cat_bottomappbar_accelerator"
app:showAsAction="ifRoom"/>
<item
android:icon="@drawable/ic_dashboard_24"
android:title="@string/cat_bottomappbar_dashboard"
app:showAsAction="ifRoom"/>
</menu>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<color name="grey50">#f8f9fa</color>
</resources>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<string name="cat_bottomappbar_title">Bottom App Bar</string>
<string name="cat_bottomappbar_description">
A bottom app bar provides a docked bar at the bottom of the screen for common application
actions. The bottom app bar includes a floating button for a primary action and a navigation bar
area for secondary actions.
</string>
<string name="cat_bottomappbar_lorem_ipsum" translatable="false">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris volutpat, dolor id interdum ullamcorper, risus dolor egestas lectus, sit amet mattis purus dui nec risus. Maecenas non sodales nisi, vel dictum dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse blandit eleifend diam, vel rutrum tellus vulputate quis. Aliquam eget libero aliquet, imperdiet nisl a, ornare ex. Sed rhoncus est ut libero porta lobortis. Fusce in dictum tellus.\n\n
Suspendisse interdum ornare ante. Aliquam nec cursus lorem. Morbi id magna felis. Vivamus egestas, est a condimentum egestas, turpis nisl iaculis ipsum, in dictum tellus dolor sed neque. Morbi tellus erat, dapibus ut sem a, iaculis tincidunt dui. Interdum et malesuada fames ac ante ipsum primis in faucibus. Curabitur et eros porttitor, ultricies urna vitae, molestie nibh. Phasellus at commodo eros, non aliquet metus. Sed maximus nisl nec dolor bibendum, vel congue leo egestas.\n\n
Sed interdum tortor nibh, in sagittis risus mollis quis. Curabitur mi odio, condimentum sit amet auctor at, mollis non turpis. Nullam pretium libero vestibulum, finibus orci vel, molestie quam. Fusce blandit tincidunt nulla, quis sollicitudin libero facilisis et. Integer interdum nunc ligula, et fermentum metus hendrerit id. Vestibulum lectus felis, dictum at lacinia sit amet, tristique id quam. Cras eu consequat dui. Suspendisse sodales nunc ligula, in lobortis sem porta sed. Integer id ultrices magna, in luctus elit. Sed a pellentesque est.\n\n
Aenean nunc velit, lacinia sed dolor sed, ultrices viverra nulla. Etiam a venenatis nibh. Morbi laoreet, tortor sed facilisis varius, nibh orci rhoncus nulla, id elementum leo dui non lorem. Nam mollis ipsum quis auctor varius. Quisque elementum eu libero sed commodo. In eros nisl, imperdiet vel imperdiet et, scelerisque a mauris. Pellentesque varius ex nunc, quis imperdiet eros placerat ac. Duis finibus orci et est auctor tincidunt. Sed non viverra ipsum. Nunc quis augue egestas, cursus lorem at, molestie sem. Morbi a consectetur ipsum, a placerat diam. Etiam vulputate dignissim convallis. Integer faucibus mauris sit amet finibus convallis.\n\n
Phasellus in aliquet mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In volutpat arcu ut felis sagittis, in finibus massa gravida. Pellentesque id tellus orci. Integer dictum, lorem sed efficitur ullamcorper, libero justo consectetur ipsum, in mollis nisl ex sed nisl. Donec maximus ullamcorper sodales. Praesent bibendum rhoncus tellus nec feugiat. In a ornare nulla. Donec rhoncus libero vel nunc consequat, quis tincidunt nisl eleifend. Cras bibendum enim a justo luctus vestibulum. Fusce dictum libero quis erat maximus, vitae volutpat diam dignissim."</string>
<string name="cat_bottomappbar_center">Center</string>
<string name="cat_bottomappbar_detached">Detached</string>
<string name="cat_bottomappbar_attached">Attached</string>
<string name="cat_bottomappbar_end">End</string>
<string name="cat_bottomappbar_3d">3D</string>
<string name="cat_bottomappbar_accelerator">Accelerator</string>
<string name="cat_bottomappbar_search">Search</string>
<string name="cat_bottomappbar_dashboard">Dashboard</string>
<string name="cat_bottomappbar_navigation_button_content_description">Show navigation drawer</string>
<string name="cat_bottomappbar_fab_button_content_description">FAB</string>
</resources>

View File

@ -0,0 +1,28 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.bottomnav;
import io.material.catalog.R;
/** A fragment that displays bottom navs that are colored by the provided styles. */
public class BottomNavigationColorStylesDemoFragment extends BottomNavigationDemoFragment {
@Override
protected int getBottomNavsContent() {
return R.layout.cat_bottom_nav_color_styles;
}
}

View File

@ -0,0 +1,174 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.bottomnav;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemSelectedListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import io.material.catalog.feature.DemoFragment;
import io.material.catalog.feature.DemoUtils;
import java.util.List;
/** A base class that provides a demo screen structure for a single bottom nav demo. */
public abstract class BottomNavigationDemoFragment extends DemoFragment {
private static final int MAX_BOTTOM_NAV_CHILDREN = 5;
private int numVisibleChildren = 3;
protected List<BottomNavigationView> bottomNavigationViews;
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view =
layoutInflater.inflate(
R.layout.cat_bottom_nav_fragment, viewGroup, false /* attachToRoot */);
initBottomNavs(layoutInflater, view);
initBottomNavDemoControls(view);
OnNavigationItemSelectedListener navigationItemListener =
new OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
handleAllBottomNavSelections(item.getItemId());
TextView page1Text = view.findViewById(R.id.page_1);
TextView page2Text = view.findViewById(R.id.page_2);
TextView page3Text = view.findViewById(R.id.page_3);
TextView page4Text = view.findViewById(R.id.page_4);
TextView page5Text = view.findViewById(R.id.page_5);
int itemId = item.getItemId();
page1Text.setVisibility(itemId == R.id.action_page_1 ? View.VISIBLE : View.GONE);
page2Text.setVisibility(itemId == R.id.action_page_2 ? View.VISIBLE : View.GONE);
page3Text.setVisibility(itemId == R.id.action_page_3 ? View.VISIBLE : View.GONE);
page4Text.setVisibility(itemId == R.id.action_page_4 ? View.VISIBLE : View.GONE);
page5Text.setVisibility(itemId == R.id.action_page_5 ? View.VISIBLE : View.GONE);
return false;
}
};
setBottomNavListeners(navigationItemListener);
return view;
}
private void handleAllBottomNavSelections(int itemId) {
for (BottomNavigationView bn : bottomNavigationViews) {
handleBottomNavItemSelections(bn, itemId);
}
}
private void handleBottomNavItemSelections(BottomNavigationView bn, int itemId) {
bn.getMenu().findItem(itemId).setChecked(true);
}
protected void initBottomNavDemoControls(View view) {
initAddNavItemButton(view.findViewById(R.id.add_button));
initRemoveNavItemButton(view.findViewById(R.id.remove_button));
}
private void initAddNavItemButton(Button addNavItemButton) {
addNavItemButton.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (numVisibleChildren < MAX_BOTTOM_NAV_CHILDREN) {
addNavItemsToBottomNavs();
numVisibleChildren++;
}
}
});
}
private void initRemoveNavItemButton(Button removeNavItemButton) {
removeNavItemButton.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (numVisibleChildren > 0) {
numVisibleChildren--;
removeNavItemsFromBottomNavs();
}
}
});
}
private void setBottomNavListeners(OnNavigationItemSelectedListener listener) {
for (BottomNavigationView bn : bottomNavigationViews) {
bn.setOnNavigationItemSelectedListener(listener);
}
}
private void removeNavItemsFromBottomNavs() {
adjustAllBottomNavItemsVisibilities(false);
}
private void addNavItemsToBottomNavs() {
adjustAllBottomNavItemsVisibilities(true);
}
private void adjustAllBottomNavItemsVisibilities(boolean visibility) {
for (BottomNavigationView bn : bottomNavigationViews) {
adjustBottomNavItemsVisibility(bn, visibility);
}
}
private void adjustBottomNavItemsVisibility(BottomNavigationView bn, boolean visibility) {
bn.getMenu().getItem(numVisibleChildren).setVisible(visibility);
}
private void initBottomNavs(LayoutInflater layoutInflater, View view) {
inflateBottomNavs(layoutInflater, view.findViewById(R.id.content));
inflateBottomNavDemoControls(layoutInflater, view.findViewById(R.id.demo_controls));
addBottomNavsToList(view);
}
private void inflateBottomNavDemoControls(LayoutInflater layoutInflater, ViewGroup content) {
@LayoutRes int demoControls = getBottomNavDemoControlsLayout();
if (demoControls != 0) {
content.addView(layoutInflater.inflate(getBottomNavDemoControlsLayout(), content, false));
}
}
private void inflateBottomNavs(LayoutInflater layoutInflater, ViewGroup content) {
content.addView(layoutInflater.inflate(getBottomNavsContent(), content, false));
}
private void addBottomNavsToList(View view) {
bottomNavigationViews = DemoUtils.findViewsWithType(view, BottomNavigationView.class);
}
@LayoutRes
protected int getBottomNavsContent() {
return R.layout.cat_bottom_nav;
}
@LayoutRes
protected int getBottomNavDemoControlsLayout() {
return 0;
}
}

View File

@ -0,0 +1,95 @@
/*
* Copyright 2017 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 io.material.catalog.bottomnav;
import io.material.catalog.R;
import android.support.v4.app.Fragment;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
import io.material.catalog.application.scope.ActivityScope;
import io.material.catalog.application.scope.FragmentScope;
import io.material.catalog.feature.Demo;
import io.material.catalog.feature.DemoLandingFragment;
import io.material.catalog.feature.FeatureDemo;
import java.util.ArrayList;
import java.util.List;
/** A landing fragment that links to bottom nav demos for the Catalog app. */
public class BottomNavigationFragment extends DemoLandingFragment {
@Override
public int getTitleResId() {
return R.string.cat_bottom_nav_title;
}
@Override
public int getDescriptionResId() {
return R.string.cat_bottom_nav_description;
}
@Override
public Demo getMainDemo() {
return new Demo() {
@Override
public Fragment createFragment() {
return new BottomNavigationMainDemoFragment();
}
};
}
@Override
public List<Demo> getAdditionalDemos() {
List<Demo> additionalDemos = new ArrayList<>();
additionalDemos.add(
new Demo(R.string.cat_bottom_nav_label_visibility_demo_title) {
@Override
public Fragment createFragment() {
return new BottomNavigationLabelVisibilityDemoFragment();
}
});
additionalDemos.add(
new Demo(R.string.cat_bottom_nav_color_styles_demo_title) {
@Override
public Fragment createFragment() {
return new BottomNavigationColorStylesDemoFragment();
}
});
return additionalDemos;
}
/** The Dagger module for {@link BottomNavigationFragment} dependencies. */
@dagger.Module
public abstract static class Module {
@FragmentScope
@ContributesAndroidInjector
abstract BottomNavigationFragment contributeInjector();
@IntoSet
@Provides
@ActivityScope
static FeatureDemo provideFeatureDemo() {
return new FeatureDemo(R.string.cat_bottom_nav_title, R.drawable.ic_bottom_nav_24px) {
@Override
public Fragment createFragment() {
return new BottomNavigationFragment();
}
};
}
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.bottomnav;
import io.material.catalog.R;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
/** A fragment that displays controls for the bottom nav's label visibility. */
public class BottomNavigationLabelVisibilityDemoFragment extends BottomNavigationDemoFragment {
@Override
protected void initBottomNavDemoControls(View view) {
super.initBottomNavDemoControls(view);
initLabelVisibilityModeButtons(view);
initIconSlider(view);
}
@Override
protected int getBottomNavDemoControlsLayout() {
return R.layout.cat_bottom_nav_label_visibility_controls;
}
private void setAllBottomNavsLabelVisibilityMode(@LabelVisibilityMode int labelVisibilityMode) {
for (BottomNavigationView bn : bottomNavigationViews) {
setBottomNavsLabelVisibilityMode(bn, labelVisibilityMode);
}
}
private void setBottomNavsLabelVisibilityMode(
BottomNavigationView bn, @LabelVisibilityMode int labelVisibilityMode) {
bn.setLabelVisibilityMode(labelVisibilityMode);
}
private void setAllBottomNavsIconSize(int size) {
for (BottomNavigationView bn : bottomNavigationViews) {
bn.setItemIconSize(size);
}
}
private void initLabelVisibilityModeButtons(View view) {
initLabelVisibilityModeButton(
view.findViewById(R.id.label_mode_auto_button), LabelVisibilityMode.LABEL_VISIBILITY_AUTO);
initLabelVisibilityModeButton(
view.findViewById(R.id.label_mode_selected_button),
LabelVisibilityMode.LABEL_VISIBILITY_SELECTED);
initLabelVisibilityModeButton(
view.findViewById(R.id.label_mode_labeled_button),
LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
initLabelVisibilityModeButton(
view.findViewById(R.id.label_mode_unlabeled_button),
LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);
}
private void initLabelVisibilityModeButton(
Button labelVisibilityModeButton, @LabelVisibilityMode int labelVisibilityMode) {
labelVisibilityModeButton.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
setAllBottomNavsLabelVisibilityMode(labelVisibilityMode);
}
});
}
private void initIconSlider(View view) {
SeekBar iconSizeSlider = view.findViewById(R.id.icon_size_slider);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
TextView iconSizeTextView = view.findViewById(R.id.icon_size_text_view);
String iconSizeUnit = "dp";
iconSizeSlider.setOnSeekBarChangeListener(
new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
setAllBottomNavsIconSize(
(int)
TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, progress, displayMetrics));
iconSizeTextView.setText(String.valueOf(progress).concat(iconSizeUnit));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
}
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2017 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 io.material.catalog.bottomnav;
/** A fragment that displays the main bottom nav demos for the Catalog app. */
public class BottomNavigationMainDemoFragment extends BottomNavigationDemoFragment {}

View File

@ -0,0 +1,26 @@
<!--
Copyright 2017 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp">
<path
android:fillColor="@android:color/white"
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
</vector>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2017 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
~
~ https://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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_legacy_title"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.Design.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
app:menu="@menu/bottom_nav_menu"/>
<Space
android:layout_width="match_parent"
android:layout_height="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_title"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.MaterialComponents.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_menu"/>
</LinearLayout>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2017 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
~
~ https://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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_legacy_title"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.Design.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_menu"/>
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/cat_bottom_nav_standard_spacing"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_default_colored_title"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.MaterialComponents.BottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_menu"/>
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/cat_bottom_nav_standard_spacing"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_colored_title"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.MaterialComponents.BottomNavigationView.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_menu"/>
</LinearLayout>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/demo_controls"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginBottom="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginLeft="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginRight="@dimen/cat_bottom_nav_standard_spacing"
android:gravity="center_horizontal"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/page_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_page_1_name"/>
<TextView
android:id="@+id/page_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_page_2_name"
android:visibility="gone"/>
<TextView
android:id="@+id/page_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_page_3_name"
android:visibility="gone"/>
<TextView
android:id="@+id/page_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_page_4_name"
android:visibility="gone"/>
<TextView
android:id="@+id/page_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_page_5_name"
android:visibility="gone"/>
</FrameLayout>
<Button
android:id="@+id/add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_add_nav_item"/>
<Button
android:id="@+id/remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_remove_nav_item"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2017 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
~
~ https://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.
-->
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginBottom="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginLeft="@dimen/cat_bottom_nav_standard_spacing"
android:layout_marginRight="@dimen/cat_bottom_nav_standard_spacing"
android:columnCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:padding="2dp"
android:text="@string/cat_bottom_nav_icon_size_slider_title"/>
<TextView
android:id="@+id/icon_size_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:padding="2dp"
android:text="24dp"/>
<SeekBar
android:id="@+id/icon_size_slider"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
android:max="48"
android:progress="24"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:padding="@dimen/cat_bottom_nav_standard_spacing"
android:text="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:padding="@dimen/cat_bottom_nav_standard_spacing"
android:text="48dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/cat_bottom_nav_standard_spacing"
android:text="@string/cat_bottom_nav_label_visibility_mode_title"/>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/cat_bottom_nav_standard_spacing"
android:orientation="vertical">
<RadioButton
android:id="@+id/label_mode_auto_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/cat_bottom_nav_label_visibility_mode_auto"/>
<RadioButton
android:id="@+id/label_mode_selected_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_label_visibility_mode_selected"/>
<RadioButton
android:id="@+id/label_mode_labeled_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_label_visibility_mode_labeled"/>
<RadioButton
android:id="@+id/label_mode_unlabeled_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_bottom_nav_label_visibility_mode_unlabeled"/>
</RadioGroup>
</GridLayout>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_page_1"
android:enabled="true"
android:icon="@drawable/ic_star_vd_theme_24"
android:title="@string/cat_bottom_nav_page_1_name"/>
<item
android:id="@+id/action_page_2"
android:enabled="true"
android:icon="@drawable/ic_star_vd_theme_24"
android:title="@string/cat_bottom_nav_page_2_name"/>
<item
android:id="@+id/action_page_3"
android:enabled="true"
android:icon="@drawable/ic_star_vd_theme_24"
android:title="@string/cat_bottom_nav_page_3_name"/>
<item
android:id="@+id/action_page_4"
android:enabled="true"
android:icon="@drawable/ic_star_vd_theme_24"
android:title="@string/cat_bottom_nav_page_4_name"
android:visible="false"/>
<item
android:id="@+id/action_page_5"
android:enabled="true"
android:icon="@drawable/ic_star_vd_theme_24"
android:title="@string/cat_bottom_nav_page_5_name"
android:visible="false"/>
</menu>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<dimen name="cat_bottom_nav_standard_spacing">16dp</dimen>
</resources>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<string name="cat_bottom_nav_title">Bottom Navigation</string>
<string name="cat_bottom_nav_label_visibility_demo_title">Label Visibility Demo</string>
<string name="cat_bottom_nav_color_styles_demo_title">Color Styles Demo</string>
<string name="cat_bottom_nav_description">
Bottom navigation bars make it easy to explore and switch between top-level views in a single
tap. This navigational element resides at the bottom of the screen, and provides direct access
for three to five destinations within an app.
</string>
<string name="cat_bottom_nav_item_name">Item %1$d</string>
<string name="cat_bottom_nav_page_1_name">Page 1</string>
<string name="cat_bottom_nav_page_2_name">Page 2</string>
<string name="cat_bottom_nav_page_3_name">Page 3</string>
<string name="cat_bottom_nav_page_4_name">Page 4</string>
<string name="cat_bottom_nav_page_5_name">Page 5</string>
<string name="cat_bottom_nav_add_nav_item">Add nav item</string>
<string name="cat_bottom_nav_remove_nav_item">Remove nav item</string>
<string name="cat_bottom_nav_icon_size_slider_title">Icon size: </string>
<string name="cat_bottom_nav_label_visibility_mode_title">Label visibility mode:</string>
<string name="cat_bottom_nav_label_visibility_mode_auto">Auto</string>
<string name="cat_bottom_nav_label_visibility_mode_selected">Selected</string>
<string name="cat_bottom_nav_label_visibility_mode_labeled">Labeled</string>
<string name="cat_bottom_nav_label_visibility_mode_unlabeled">Unlabeled</string>
<string name="cat_bottom_nav_legacy_title">Legacy Bottom Nav</string>
<string name="cat_bottom_nav_default_colored_title">Default Colored Bottom Nav</string>
<string name="cat_bottom_nav_colored_title">Colored Bottom Nav</string>
</resources>

View File

@ -0,0 +1,74 @@
/*
* Copyright 2017 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 io.material.catalog.button;
import io.material.catalog.R;
import android.support.v4.app.Fragment;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
import io.material.catalog.application.scope.ActivityScope;
import io.material.catalog.application.scope.FragmentScope;
import io.material.catalog.feature.Demo;
import io.material.catalog.feature.DemoLandingFragment;
import io.material.catalog.feature.FeatureDemo;
/** A landing fragment that links to button demos for the Catalog app. */
public class ButtonsFragment extends DemoLandingFragment {
@Override
public int getTitleResId() {
return R.string.cat_buttons_title;
}
@Override
public int getDescriptionResId() {
return R.string.cat_buttons_description;
}
@Override
public Demo getMainDemo() {
return new Demo() {
@Override
public Fragment createFragment() {
return new ButtonsMainDemoFragment();
}
};
}
/** The Dagger module for {@link ButtonsFragment} dependencies. */
@dagger.Module
public abstract static class Module {
@FragmentScope
@ContributesAndroidInjector
abstract ButtonsFragment contributeInjector();
@IntoSet
@Provides
@ActivityScope
static FeatureDemo provideFeatureDemo() {
return new FeatureDemo(R.string.cat_buttons_title, R.drawable.ic_buttons_24px) {
@Override
public Fragment createFragment() {
return new ButtonsFragment();
}
};
}
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright 2017 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 io.material.catalog.button;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import io.material.catalog.feature.DemoFragment;
import io.material.catalog.feature.DemoUtils;
import java.util.List;
/** A fragment that displays main button demos for the Catalog app. */
public class ButtonsMainDemoFragment extends DemoFragment {
@Nullable
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view = layoutInflater.inflate(getButtonsContent(), viewGroup, false /* attachToRoot */);
List<MaterialButton> buttons = DemoUtils.findViewsWithType(view, MaterialButton.class);
for (MaterialButton button : buttons) {
button.setOnClickListener(
v -> {
// Show a Snackbar with an action button, which should also have a MaterialButton style
Snackbar snackbar =
Snackbar.make(v, R.string.cat_button_clicked, BaseTransientBottomBar.LENGTH_LONG);
snackbar.setAction(
R.string.cat_snackbar_action_button_text,
new OnClickListener() {
@Override
public void onClick(View v) {}
});
snackbar.show();
});
}
return view;
}
@LayoutRes
protected int getButtonsContent() {
return R.layout.cat_buttons_fragment;
}
}

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="16dp"
android:clipToPadding="false"
android:columnCount="2">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="@string/cat_btn_text"
android:textColor="?attr/colorSecondaryDark"
android:textSize="16sp"/>
<Space/>
<Button
android:id="@+id/material_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_button_label_enabled"/>
<Button
android:id="@+id/disabled_material_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:enabled="false"
android:text="@string/cat_button_label_disabled"/>
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_unelevated_btn_text"
android:textColor="?attr/colorSecondaryDark"
android:textSize="16sp"/>
<Space/>
<Button
android:id="@+id/material_unelevated_button"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_button_label_enabled"/>
<Button
android:id="@+id/disabled_material_unelevated_button"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:enabled="false"
android:text="@string/cat_button_label_disabled"/>
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_icon_btn_text"
android:textColor="?attr/colorSecondaryDark"
android:textSize="16sp"/>
<Space/>
<Button
android:id="@+id/material_icon_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_button_label_enabled"
app:icon="@drawable/ic_dialogs_24px"/>
<Button
android:id="@+id/disabled_material_icon_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:enabled="false"
android:text="@string/cat_button_label_disabled"
app:icon="@drawable/ic_dialogs_24px"/>
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_text_btn_text"
android:textColor="?attr/colorSecondaryDark"
android:textSize="16sp"/>
<Space/>
<Button
android:id="@+id/material_text_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_button_label_enabled"/>
<Button
android:id="@+id/disabled_material_text_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:enabled="false"
android:text="@string/cat_button_label_disabled"/>
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_icon_text_btn_text"
android:textColor="?attr/colorSecondaryDark"
android:textSize="16sp"/>
<Space/>
<Button
android:id="@+id/material_icon_text_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_button_label_enabled"
app:icon="@drawable/ic_dialogs_24px"/>
<Button
android:id="@+id/disabled_material_icon_text_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:enabled="false"
android:text="@string/cat_button_label_disabled"
app:icon="@drawable/ic_dialogs_24px"/>
</GridLayout>
</ScrollView>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<string name="cat_toc_buttons">Buttons</string>
<string name="cat_buttons_title">Buttons</string>
<string name="cat_buttons_description">
Buttons communicate the action that will occur when the user touches them.
They may display text, imagery, or both.
Flat buttons and raised buttons are the most commonly used types.
</string>
<string name="cat_button_label_enabled">Enabled</string>
<string name="cat_button_label_disabled">Disabled</string>
<string name="cat_btn_text">Material button</string>
<string name="cat_unelevated_btn_text">Unelevated button</string>
<string name="cat_text_btn_text">Text button</string>
<string name="cat_stroked_btn_text">Stroked button</string>
<string name="cat_icon_btn_text">Icon button</string>
<string name="cat_icon_text_btn_text">Icon text button</string>
<string name="cat_filled_buttons_section_title">Filled buttons</string>
<string name="cat_unfilled_buttons_section_title">Unfilled buttons</string>
<string name="cat_button_clicked">Button clicked</string>
<string name="cat_snackbar_action_button_text">Done</string>
</resources>

View File

@ -0,0 +1,74 @@
/*
* Copyright 2017 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 io.material.catalog.card;
import io.material.catalog.R;
import android.support.v4.app.Fragment;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
import io.material.catalog.application.scope.ActivityScope;
import io.material.catalog.application.scope.FragmentScope;
import io.material.catalog.feature.Demo;
import io.material.catalog.feature.DemoLandingFragment;
import io.material.catalog.feature.FeatureDemo;
/** A landing fragment that links to card demos for the Catalog app. */
public class CardFragment extends DemoLandingFragment {
@Override
public int getTitleResId() {
return R.string.cat_card_title;
}
@Override
public int getDescriptionResId() {
return R.string.cat_card_description;
}
@Override
public Demo getMainDemo() {
return new Demo() {
@Override
public Fragment createFragment() {
return new CardMainDemoFragment();
}
};
}
/** The Dagger module for {@link CardFragment} dependencies. */
@dagger.Module
public abstract static class Module {
@FragmentScope
@ContributesAndroidInjector
abstract CardFragment contributeInjector();
@IntoSet
@Provides
@ActivityScope
static FeatureDemo provideFeatureDemo() {
return new FeatureDemo(R.string.cat_card_title, R.drawable.ic_card_24px) {
@Override
public Fragment createFragment() {
return new CardFragment();
}
};
}
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright 2017 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 io.material.catalog.card;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import io.material.catalog.feature.DemoFragment;
/** A fragment that displays main card demos for the Catalog app. */
public class CardMainDemoFragment extends DemoFragment {
@Nullable
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view = layoutInflater.inflate(getCardContent(), viewGroup, false /* attachToRoot */);
return view;
}
@LayoutRes
protected int getCardContent() {
return R.layout.cat_card_fragment;
}
}

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/mtrl_card_spacing"
android:layout_marginTop="@dimen/mtrl_card_spacing"
android:layout_marginRight="@dimen/mtrl_card_spacing"
android:minHeight="@dimen/cat_card_demo_min_height">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_card_elevation_desc"/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/mtrl_card_spacing"
android:layout_marginTop="@dimen/mtrl_card_spacing"
android:layout_marginRight="@dimen/mtrl_card_spacing"
android:minHeight="@dimen/cat_card_demo_min_height">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_card_spacing_desc"/>
</com.google.android.material.card.MaterialCardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/cat_card_m1_section_title"
android:textAppearance="@style/TextAppearance.Catalog.SectionTitle"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/mtrl_card_spacing"
android:layout_marginTop="@dimen/mtrl_card_spacing"
android:layout_marginRight="@dimen/mtrl_card_spacing"
android:minHeight="@dimen/cat_card_demo_min_height">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_card_m1_desc"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
style="@style/Widget.MaterialComponents.CardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/mtrl_card_spacing"
android:layout_marginTop="@dimen/mtrl_card_spacing"
android:layout_marginRight="@dimen/mtrl_card_spacing"
android:minHeight="@dimen/cat_card_demo_min_height">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_card_style_only_desc"/>
</android.support.v7.widget.CardView>
<!-- Guarantee space for the shadow on the last card. Depending on non-demo (real-world) uses
of CardView, this may not be necessary. This quick-fix is for purposes of this simple
demo only. -->
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/mtrl_card_spacing"/>
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<dimen name="cat_card_demo_min_height">200dp</dimen>
</resources>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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.
-->
<resources>
<string name="cat_card_title">Cards</string>
<string name="cat_card_m1_section_title">Material 1 CardView</string>
<string name="cat_card_description">
Cards represent entry points into deeper levels of detail or navigation, such as an album in
Music or an upcoming vacation in Trips. They can be used in a grid, carousel, or feed to
contain groups of individual packaged information.
</string>
<string name="cat_card_spacing_desc">
Cards on mobile default to 8dp margins. layout_margin needs to be set directly on a View in its
layout and will not work when included as part of a style.
</string>
<string name="cat_card_elevation_desc">Cards have 1dp elevation.</string>
<string name="cat_card_m1_desc">
CardView from the Support Library works side-by-side with MaterialCardView. These cards default
to Material 1 styles and support fewer style attributes than MaterialCardView.
</string>
<string name="cat_card_style_only_desc">
MaterialCardView uses the correct styles by default and makes use of additional style attributes
that are not provided in CardView. If you do not need to use the new style attributes, you can
use MaterialCardView in your layout, or apply a style tag to a CardView. We recommend using
the MaterialCardView class for the latest Material designs and maximum flexibility in your UI.
</string>
</resources>

View File

@ -0,0 +1,89 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.chip;
import io.material.catalog.R;
import android.support.v4.app.Fragment;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import dagger.multibindings.IntoSet;
import io.material.catalog.application.scope.ActivityScope;
import io.material.catalog.application.scope.FragmentScope;
import io.material.catalog.feature.Demo;
import io.material.catalog.feature.DemoLandingFragment;
import io.material.catalog.feature.FeatureDemo;
import java.util.ArrayList;
import java.util.List;
/** A landing fragment that links to Chip demos for the Catalog app. */
public class ChipFragment extends DemoLandingFragment {
@Override
public int getTitleResId() {
return R.string.cat_chip_title;
}
@Override
public int getDescriptionResId() {
return R.string.cat_chip_description;
}
@Override
public Demo getMainDemo() {
return new Demo() {
@Override
public Fragment createFragment() {
return new ChipMainDemoFragment();
}
};
}
@Override
public List<Demo> getAdditionalDemos() {
List<Demo> additionalDemos = new ArrayList<>();
additionalDemos.add(
new Demo(R.string.cat_chip_group_demo_title) {
@Override
public Fragment createFragment() {
return new ChipGroupDemoFragment();
}
});
return additionalDemos;
}
/** The Dagger module for {@link ChipFragment} dependencies. */
@dagger.Module
public abstract static class Module {
@FragmentScope
@ContributesAndroidInjector
abstract ChipFragment contributeInjector();
@IntoSet
@Provides
@ActivityScope
static FeatureDemo provideFeatureDemo() {
return new FeatureDemo(R.string.cat_chip_title, R.drawable.ic_chips_24px) {
@Override
public Fragment createFragment() {
return new ChipFragment();
}
};
}
}
}

View File

@ -0,0 +1,84 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.chip;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import com.google.android.material.chip.Chip;
import com.google.android.material.chip.ChipGroup;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
import io.material.catalog.feature.DemoFragment;
/** A fragment that displays the ChipGroup demos for the Catalog app. */
public class ChipGroupDemoFragment extends DemoFragment {
private Switch singleSelectionSwitch;
@Nullable
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view =
layoutInflater.inflate(
R.layout.cat_chip_group_fragment, viewGroup, false /* attachToRoot */);
ViewGroup content = view.findViewById(R.id.content);
singleSelectionSwitch = view.findViewById(R.id.single_selection);
ChipGroup reflowGroup = view.findViewById(R.id.reflow_group);
ChipGroup scrollGroup = view.findViewById(R.id.scroll_group);
singleSelectionSwitch.setOnCheckedChangeListener(
(buttonView, isChecked) -> {
reflowGroup.setSingleSelection(isChecked);
scrollGroup.setSingleSelection(isChecked);
initChipGroup(reflowGroup);
initChipGroup(scrollGroup);
});
initChipGroup(reflowGroup);
initChipGroup(scrollGroup);
return view;
}
@LayoutRes
protected int getChipGroupItem(boolean singleSelection) {
return singleSelection
? R.layout.cat_chip_group_item_choice
: R.layout.cat_chip_group_item_filter;
}
private void initChipGroup(ChipGroup chipGroup) {
chipGroup.removeAllViews();
boolean singleSelection = singleSelectionSwitch.isChecked();
String[] textArray = getResources().getStringArray(R.array.cat_chip_group_text_array);
for (String text : textArray) {
Chip chip =
(Chip) getLayoutInflater().inflate(getChipGroupItem(singleSelection), chipGroup, false);
chip.setChipText(text);
chipGroup.addView(chip);
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright 2017 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
*
* https://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 io.material.catalog.chip;
import io.material.catalog.R;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import com.google.android.material.chip.Chip;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import io.material.catalog.feature.DemoFragment;
import io.material.catalog.feature.DemoUtils;
import java.util.List;
/** A fragment that displays the main Chip demos for the Catalog app. */
public class ChipMainDemoFragment extends DemoFragment {
@Nullable
@Override
public View onCreateDemoView(
LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
View view =
layoutInflater.inflate(R.layout.cat_chip_fragment, viewGroup, false /* attachToRoot */);
ViewGroup content = view.findViewById(R.id.content);
View.inflate(getContext(), getChipContent(), content);
List<Chip> chips = DemoUtils.findViewsWithType(view, Chip.class);
for (Chip chip : chips) {
chip.setOnCloseIconClickListener(
v -> {
Snackbar.make(view, "Clicked close icon.", BaseTransientBottomBar.LENGTH_SHORT).show();
});
}
return view;
}
@LayoutRes
protected int getChipContent() {
return R.layout.cat_chip_content;
}
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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
https://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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#8a000000" android:state_pressed="true"/>
<item android:color="#8a000000" android:state_focused="true" android:state_hovered="true"/>
<item android:color="#8a000000" android:state_hovered="true"/>
<item android:color="#8a000000" android:state_focused="true"/>
<item android:color="#61000000"/>
</selector>

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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
https://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.
-->
<GridLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="2"
tools:showIn="@layout/cat_chip_fragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:text="@string/cat_chip_entry_label"/>
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Entry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="center_vertical|start"
app:chipIcon="@drawable/ic_placeholder_circle_24"
app:chipText="@string/cat_chip_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:text="@string/cat_chip_filter_label"/>
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="center_vertical|start"
app:chipText="@string/cat_chip_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:text="@string/cat_chip_choice_label"/>
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="center_vertical|start"
app:chipText="@string/cat_chip_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:text="@string/cat_chip_action_label"/>
<com.google.android.material.chip.Chip
style="@style/Widget.MaterialComponents.Chip.Action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="center_vertical|start"
app:chipIcon="@drawable/ic_placeholder_circle_24"
app:chipText="@string/cat_chip_text"/>
</GridLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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
https://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.
-->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<!-- Chip styles. -->
<FrameLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"/>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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
https://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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<Switch
android:id="@+id/single_selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/cat_chip_group_single_selection_text"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<!-- Reflow chip group. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_chip_reflow_group"/>
<com.google.android.material.chip.ChipGroup
android:id="@+id/reflow_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"/>
<!-- Scrolling chip group. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cat_chip_scroll_group"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<com.google.android.material.chip.ChipGroup
android:id="@+id/scroll_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:singleLine="true"/>
</HorizontalScrollView>
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 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
https://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.
-->
<com.google.android.material.chip.Chip
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Some files were not shown because too many files have changed in this diff Show More