OLD | NEW |
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- | 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
2 * This Source Code Form is subject to the terms of the Mozilla Public | 2 * This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 package org.mozilla.gecko.home; | 5 package org.mozilla.gecko.home; |
6 | 6 |
7 import android.content.res.Resources; | 7 import android.content.res.Resources; |
8 import android.support.annotation.UiThread; | 8 import android.support.annotation.UiThread; |
9 import android.support.v7.widget.LinearLayoutManager; | 9 import android.support.v7.widget.LinearLayoutManager; |
10 import android.support.v7.widget.RecyclerView; | 10 import android.support.v7.widget.RecyclerView; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 public interface DevicesUpdateHandler { | 79 public interface DevicesUpdateHandler { |
80 void onDeviceCountUpdated(int count); | 80 void onDeviceCountUpdated(int count); |
81 } | 81 } |
82 | 82 |
83 public DevicesUpdateHandler getDeviceUpdateHandler() { | 83 public DevicesUpdateHandler getDeviceUpdateHandler() { |
84 if (devicesUpdateHandler == null) { | 84 if (devicesUpdateHandler == null) { |
85 devicesUpdateHandler = new DevicesUpdateHandler() { | 85 devicesUpdateHandler = new DevicesUpdateHandler() { |
86 @Override | 86 @Override |
87 public void onDeviceCountUpdated(int count) { | 87 public void onDeviceCountUpdated(int count) { |
88 deviceCount = count; | 88 deviceCount = count; |
89 notifyItemChanged(getSyncedDevicesSmartFolderIndex()); | 89 // Removed notifyItemChanged call. See https://issues.adbloc
kplus.org/ticket/5592 |
90 } | 90 } |
91 }; | 91 }; |
92 } | 92 } |
93 return devicesUpdateHandler; | 93 return devicesUpdateHandler; |
94 } | 94 } |
95 | 95 |
96 public interface RecentTabsUpdateHandler { | 96 public interface RecentTabsUpdateHandler { |
97 void onRecentTabsCountUpdated(int count, boolean countReliable); | 97 void onRecentTabsCountUpdated(int count, boolean countReliable); |
98 } | 98 } |
99 | 99 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 @UiThread | 167 @UiThread |
168 private boolean isRecentTabsFolderVisible() { | 168 private boolean isRecentTabsFolderVisible() { |
169 return recentTabsCount > 0; | 169 return recentTabsCount > 0; |
170 } | 170 } |
171 | 171 |
172 @UiThread | 172 @UiThread |
173 // Number of smart folders for determining practical empty state. | 173 // Number of smart folders for determining practical empty state. |
174 public int getNumVisibleSmartFolders() { | 174 public int getNumVisibleSmartFolders() { |
175 int visibleFolders = 1; // Synced devices folder is always visible. | 175 // Synced devices folder is always hidden. See https://issues.adblockplu
s.org/ticket/5592 |
| 176 int visibleFolders = 0; |
176 | 177 |
177 if (isRecentTabsFolderVisible()) { | 178 if (isRecentTabsFolderVisible()) { |
178 visibleFolders += 1; | 179 visibleFolders += 1; |
179 } | 180 } |
180 | 181 |
181 return visibleFolders; | 182 return visibleFolders; |
182 } | 183 } |
183 | 184 |
184 @UiThread | 185 @UiThread |
185 private int getSyncedDevicesSmartFolderIndex() { | 186 private int getSyncedDevicesSmartFolderIndex() { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } else { | 260 } else { |
260 return position; | 261 return position; |
261 } | 262 } |
262 } | 263 } |
263 | 264 |
264 @UiThread | 265 @UiThread |
265 private CombinedHistoryItem.ItemType getItemTypeForPosition(int position) { | 266 private CombinedHistoryItem.ItemType getItemTypeForPosition(int position) { |
266 if (position == RECENT_TABS_SMARTFOLDER_INDEX && isRecentTabsFolderVisib
le()) { | 267 if (position == RECENT_TABS_SMARTFOLDER_INDEX && isRecentTabsFolderVisib
le()) { |
267 return CombinedHistoryItem.ItemType.RECENT_TABS; | 268 return CombinedHistoryItem.ItemType.RECENT_TABS; |
268 } | 269 } |
269 if (position == getSyncedDevicesSmartFolderIndex()) { | 270 // We never show the synced devices item. See https://issues.adblockplus
.org/ticket/5592 |
| 271 if (false) { |
270 return CombinedHistoryItem.ItemType.SYNCED_DEVICES; | 272 return CombinedHistoryItem.ItemType.SYNCED_DEVICES; |
271 } | 273 } |
272 final int sectionPosition = transformAdapterPositionForDataStructure(Com
binedHistoryItem.ItemType.SECTION_HEADER, position); | 274 final int sectionPosition = transformAdapterPositionForDataStructure(Com
binedHistoryItem.ItemType.SECTION_HEADER, position); |
273 if (sectionHeaders.get(sectionPosition) != null) { | 275 if (sectionHeaders.get(sectionPosition) != null) { |
274 return CombinedHistoryItem.ItemType.SECTION_HEADER; | 276 return CombinedHistoryItem.ItemType.SECTION_HEADER; |
275 } | 277 } |
276 return CombinedHistoryItem.ItemType.HISTORY; | 278 return CombinedHistoryItem.ItemType.HISTORY; |
277 } | 279 } |
278 | 280 |
279 @UiThread | 281 @UiThread |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // If this is a combined cursor, we may get a history item without a | 426 // If this is a combined cursor, we may get a history item without a |
425 // bookmark, in which case the bookmarks ID column value will be nul
l. | 427 // bookmark, in which case the bookmarks ID column value will be nul
l. |
426 info.bookmarkId = -1; | 428 info.bookmarkId = -1; |
427 } else { | 429 } else { |
428 info.bookmarkId = cursor.getInt(bookmarkIdCol); | 430 info.bookmarkId = cursor.getInt(bookmarkIdCol); |
429 } | 431 } |
430 return info; | 432 return info; |
431 } | 433 } |
432 | 434 |
433 } | 435 } |
OLD | NEW |