165ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley/* 265ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * Copyright (C) 2017 The Android Open Source Project 365ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * 465ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * Licensed under the Apache License, Version 2.0 (the "License"); 565ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * you may not use this file except in compliance with the License. 665ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * You may obtain a copy of the License at 765ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * 865ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * http://www.apache.org/licenses/LICENSE-2.0 965ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * 1065ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * Unless required by applicable law or agreed to in writing, software 1165ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * distributed under the License is distributed on an "AS IS" BASIS, 1265ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1365ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * See the License for the specific language governing permissions and 1465ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley * limitations under the License. 1565ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley */ 1665ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 1765ab191c2a396a77d24227719c7c1e7656b48084Sean Kelleypackage com.example.android.support.wear.app.drawers; 1865ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 1965ab191c2a396a77d24227719c7c1e7656b48084Sean Kelleyimport android.graphics.drawable.Drawable; 20def582a5836579a3fadabfdbe4413cb1652bf098Aurimas Liutikas 21ac5fe7c617c66850fff75a9fce9979c6e5674b0fAurimas Liutikasimport androidx.wear.widget.drawer.WearableNavigationDrawerView.WearableNavigationDrawerAdapter; 2265ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 2365ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley/** Simple and declarative {@link WearableNavigationDrawerAdapter}. */ 2465ab191c2a396a77d24227719c7c1e7656b48084Sean Kelleypublic class DemoNavDrawerAdapter extends WearableNavigationDrawerAdapter { 2565ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 2665ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley private final NavItem[] mNavItems; 2765ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 2865ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley public DemoNavDrawerAdapter(NavItem[] navItems) { 2965ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley mNavItems = navItems; 3065ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley } 3165ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 3265ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley @Override 3365ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley public CharSequence getItemText(int pos) { 3465ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley return mNavItems[pos].getTitle(); 3565ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley } 3665ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 3765ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley @Override 3865ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley public Drawable getItemDrawable(int pos) { 3965ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley return mNavItems[pos].getDrawable(); 4065ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley } 4165ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley 4265ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley @Override 4365ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley public int getCount() { 4465ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley return mNavItems.length; 4565ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley } 4665ab191c2a396a77d24227719c7c1e7656b48084Sean Kelley} 47