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.download.ui; | 5 package org.chromium.chrome.browser.download.ui; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ComponentName; | 8 import android.content.ComponentName; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
11 import android.os.AsyncTask; | 11 import android.os.AsyncTask; |
| 12 import android.support.graphics.drawable.VectorDrawableCompat; |
12 import android.support.v4.view.GravityCompat; | 13 import android.support.v4.view.GravityCompat; |
13 import android.support.v4.widget.DrawerLayout; | 14 import android.support.v4.widget.DrawerLayout; |
14 import android.support.v4.widget.DrawerLayout.DrawerListener; | 15 import android.support.v4.widget.DrawerLayout.DrawerListener; |
15 import android.support.v7.widget.RecyclerView; | 16 import android.support.v7.widget.RecyclerView; |
16 import android.support.v7.widget.Toolbar.OnMenuItemClickListener; | 17 import android.support.v7.widget.Toolbar.OnMenuItemClickListener; |
17 import android.view.Gravity; | 18 import android.view.Gravity; |
18 import android.view.LayoutInflater; | 19 import android.view.LayoutInflater; |
19 import android.view.MenuItem; | 20 import android.view.MenuItem; |
20 import android.view.View; | 21 import android.view.View; |
21 import android.view.ViewGroup; | 22 import android.view.ViewGroup; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 188 |
188 DrawerLayout drawerLayout = null; | 189 DrawerLayout drawerLayout = null; |
189 if (!DeviceFormFactor.isLargeTablet(activity)) { | 190 if (!DeviceFormFactor.isLargeTablet(activity)) { |
190 drawerLayout = (DrawerLayout) mMainView; | 191 drawerLayout = (DrawerLayout) mMainView; |
191 addDrawerListener(drawerLayout); | 192 addDrawerListener(drawerLayout); |
192 } | 193 } |
193 | 194 |
194 mSelectableListLayout = | 195 mSelectableListLayout = |
195 (SelectableListLayout) mMainView.findViewById(R.id.selectable_li
st); | 196 (SelectableListLayout) mMainView.findViewById(R.id.selectable_li
st); |
196 | 197 |
197 mSelectableListLayout.initializeEmptyView(R.drawable.downloads_big, | 198 mSelectableListLayout.initializeEmptyView( |
| 199 VectorDrawableCompat.create(mActivity.getResources(), |
| 200 R.drawable.downloads_big, mActivity.getTheme()), |
198 R.string.download_manager_ui_empty); | 201 R.string.download_manager_ui_empty); |
199 | 202 |
200 mHistoryAdapter = new DownloadHistoryAdapter(isOffTheRecord, parentCompo
nent); | 203 mHistoryAdapter = new DownloadHistoryAdapter(isOffTheRecord, parentCompo
nent); |
201 RecyclerView recyclerView = mSelectableListLayout.initializeRecyclerView
(mHistoryAdapter); | 204 RecyclerView recyclerView = mSelectableListLayout.initializeRecyclerView
(mHistoryAdapter); |
202 | 205 |
203 // Prevent every progress update from causing a transition animation. | 206 // Prevent every progress update from causing a transition animation. |
204 recyclerView.getItemAnimator().setChangeDuration(0); | 207 recyclerView.getItemAnimator().setChangeDuration(0); |
205 | 208 |
206 mHistoryAdapter.initialize(mBackendProvider); | 209 mHistoryAdapter.initialize(mBackendProvider); |
207 addObserver(mHistoryAdapter); | 210 addObserver(mHistoryAdapter); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 public SpaceDisplay getSpaceDisplayForTests() { | 487 public SpaceDisplay getSpaceDisplayForTests() { |
485 return mSpaceDisplay; | 488 return mSpaceDisplay; |
486 } | 489 } |
487 | 490 |
488 /** Sets a BackendProvider that is used in place of a real one. */ | 491 /** Sets a BackendProvider that is used in place of a real one. */ |
489 @VisibleForTesting | 492 @VisibleForTesting |
490 public static void setProviderForTests(BackendProvider provider) { | 493 public static void setProviderForTests(BackendProvider provider) { |
491 sProviderForTests = provider; | 494 sProviderForTests = provider; |
492 } | 495 } |
493 } | 496 } |
OLD | NEW |