OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.emptybackground; | 5 package org.chromium.chrome.browser.widget.emptybackground; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.os.Build; |
| 9 import android.view.PointerIcon; |
8 import android.view.View; | 10 import android.view.View; |
9 import android.view.View.OnAttachStateChangeListener; | 11 import android.view.View.OnAttachStateChangeListener; |
10 import android.view.ViewStub; | 12 import android.view.ViewStub; |
11 | 13 |
12 import org.chromium.chrome.R; | 14 import org.chromium.chrome.R; |
13 import org.chromium.chrome.browser.appmenu.AppMenuHandler; | 15 import org.chromium.chrome.browser.appmenu.AppMenuHandler; |
14 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; | 16 import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; |
15 import org.chromium.chrome.browser.snackbar.SnackbarManager; | 17 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
16 import org.chromium.chrome.browser.tab.Tab; | 18 import org.chromium.chrome.browser.tab.Tab; |
17 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; | 19 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 mBackgroundView.addOnAttachStateChangeListener(new OnAttachStateChangeLi
stener() { | 132 mBackgroundView.addOnAttachStateChangeListener(new OnAttachStateChangeLi
stener() { |
131 @Override | 133 @Override |
132 public void onViewDetachedFromWindow(View v) { | 134 public void onViewDetachedFromWindow(View v) { |
133 uninitialize(); | 135 uninitialize(); |
134 } | 136 } |
135 | 137 |
136 @Override | 138 @Override |
137 public void onViewAttachedToWindow(View v) { | 139 public void onViewAttachedToWindow(View v) { |
138 } | 140 } |
139 }); | 141 }); |
| 142 |
| 143 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| 144 PointerIcon icon = |
| 145 PointerIcon.getSystemIcon(mBackgroundView.getContext(), Poin
terIcon.TYPE_ARROW); |
| 146 mBackgroundView.setPointerIcon(icon); |
| 147 } |
140 } | 148 } |
141 | 149 |
142 private void updateEmptyContainerState() { | 150 private void updateEmptyContainerState() { |
143 boolean showEmptyBackground = shouldShowEmptyContainer(); | 151 boolean showEmptyBackground = shouldShowEmptyContainer(); |
144 if (showEmptyBackground) { | 152 if (showEmptyBackground) { |
145 inflateViewIfNecessary(); | 153 inflateViewIfNecessary(); |
146 } | 154 } |
147 | 155 |
148 if (mBackgroundView != null) { | 156 if (mBackgroundView != null) { |
149 mBackgroundView.setEmptyContainerState(showEmptyBackground); | 157 mBackgroundView.setEmptyContainerState(showEmptyBackground); |
(...skipping 10 matching lines...) Expand all Loading... |
160 boolean incognitoSelected = mTabModelSelector.isIncognitoSelected(); | 168 boolean incognitoSelected = mTabModelSelector.isIncognitoSelected(); |
161 | 169 |
162 // Only show the empty container if: | 170 // Only show the empty container if: |
163 // 1. There are no tabs in the normal TabModel AND | 171 // 1. There are no tabs in the normal TabModel AND |
164 // 2. Overview mode is not showing AND | 172 // 2. Overview mode is not showing AND |
165 // 3. We're in the normal TabModel OR there are no tabs present in eithe
r model | 173 // 3. We're in the normal TabModel OR there are no tabs present in eithe
r model |
166 return model.getCount() == 0 && !mOverviewModeBehavior.overviewVisible() | 174 return model.getCount() == 0 && !mOverviewModeBehavior.overviewVisible() |
167 && (!incognitoSelected || isIncognitoEmpty); | 175 && (!incognitoSelected || isIncognitoEmpty); |
168 } | 176 } |
169 } | 177 } |
OLD | NEW |