OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.widget.selection; | 5 package org.chromium.chrome.browser.widget.selection; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.support.graphics.drawable.VectorDrawableCompat; | 8 import android.graphics.drawable.Drawable; |
9 import android.support.v4.widget.DrawerLayout; | 9 import android.support.v4.widget.DrawerLayout; |
10 import android.support.v7.widget.LinearLayoutManager; | 10 import android.support.v7.widget.LinearLayoutManager; |
11 import android.support.v7.widget.RecyclerView; | 11 import android.support.v7.widget.RecyclerView; |
12 import android.support.v7.widget.RecyclerView.Adapter; | 12 import android.support.v7.widget.RecyclerView.Adapter; |
13 import android.support.v7.widget.RecyclerView.AdapterDataObserver; | 13 import android.support.v7.widget.RecyclerView.AdapterDataObserver; |
14 import android.support.v7.widget.Toolbar.OnMenuItemClickListener; | 14 import android.support.v7.widget.Toolbar.OnMenuItemClickListener; |
15 import android.util.AttributeSet; | 15 import android.util.AttributeSet; |
16 import android.view.LayoutInflater; | 16 import android.view.LayoutInflater; |
17 import android.view.View; | 17 import android.view.View; |
18 import android.view.ViewStub; | 18 import android.view.ViewStub; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 SelectionToolbar<E> toolbar = (SelectionToolbar<E>) mToolbarStub.inflate
(); | 124 SelectionToolbar<E> toolbar = (SelectionToolbar<E>) mToolbarStub.inflate
(); |
125 toolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId, | 125 toolbar.initialize(delegate, titleResId, drawerLayout, normalGroupResId, |
126 selectedGroupResId); | 126 selectedGroupResId); |
127 toolbar.setOnMenuItemClickListener(listener); | 127 toolbar.setOnMenuItemClickListener(listener); |
128 return toolbar; | 128 return toolbar; |
129 } | 129 } |
130 | 130 |
131 /** | 131 /** |
132 * Initializes the view shown when the selectable list is empty. | 132 * Initializes the view shown when the selectable list is empty. |
133 * | 133 * |
134 * @param emptyIconResId The icon to show when the selectable list is empty. | 134 * @param emptyDrawable The Drawable to show when the selectable list is emp
ty. |
135 * @param emptyStringResId The string to show when the selectable list is em
pty. | 135 * @param emptyStringResId The string to show when the selectable list is em
pty. |
136 */ | 136 */ |
137 public void initializeEmptyView(int emptyIconResId, int emptyStringResId) { | 137 public void initializeEmptyView(Drawable emptyDrawable, int emptyStringResId
) { |
138 mEmptyView.setCompoundDrawablesWithIntrinsicBounds(null, | 138 mEmptyView.setCompoundDrawablesWithIntrinsicBounds(null, emptyDrawable,
null, null); |
139 VectorDrawableCompat.create(getResources(), emptyIconResId, | |
140 getContext().getTheme()), | |
141 null, null); | |
142 mEmptyView.setText(emptyStringResId); | 139 mEmptyView.setText(emptyStringResId); |
143 } | 140 } |
144 | 141 |
145 /** | 142 /** |
146 * Called when the view that owns the SelectableListLayout is destroyed. | 143 * Called when the view that owns the SelectableListLayout is destroyed. |
147 */ | 144 */ |
148 public void onDestroyed() { | 145 public void onDestroyed() { |
149 mAdapter.unregisterAdapterDataObserver(mAdapterObserver); | 146 mAdapter.unregisterAdapterDataObserver(mAdapterObserver); |
150 } | 147 } |
151 } | 148 } |
OLD | NEW |