author | Chenxia Liu <liuche@mozilla.com> |
Thu, 07 Apr 2016 15:14:54 -0700 | |
changeset 292796 | 922682fb9d2af91a2eaea50c65a6fabfd716a56c |
parent 292795 | 039b504d1161b427ab475451bc805da8cd014b4c |
child 292797 | 9fb7908df083b09946413585d48d02bba09de934 |
push id | 74979 |
push user | cbook@mozilla.com |
push date | Tue, 12 Apr 2016 11:53:25 +0000 |
treeherder | mozilla-inbound@cb2b8b7bc47f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sebastian |
bugs | 1262600 |
milestone | 48.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java @@ -117,17 +117,17 @@ public class CombinedHistoryAdapter exte sState.setClientHidden(client.guid, true); hiddenClients.add(client); if (!hadHiddenClients) { // Add item for unhiding clients; remoteClients.add(null); } else { // Update "hidden clients" item because number of hidden clients changed. - notifyItemChanged(getRemoteClientsHiddenItemsIndex()); + notifyItemChanged(remoteClients.size() - 1); } break; case HISTORY: notifyItemRemoved(position); break; } } @@ -136,46 +136,30 @@ public class CombinedHistoryAdapter exte return; } for (RemoteClient client : selectedClients) { sState.setClientHidden(client.guid, false); hiddenClients.remove(client); } - final int insertIndex = getRemoteClientsHiddenItemsIndex(); + final int insertIndex = remoteClients.size() - 1; remoteClients.addAll(insertIndex, selectedClients); notifyItemRangeInserted(insertIndex, selectedClients.size()); if (hiddenClients.isEmpty()) { // No more hidden clients, remove "unhide" item. - remoteClients.remove(getRemoteClientsHiddenItemsIndex()); + remoteClients.remove(remoteClients.size() - 1); } else { // Update "hidden clients" item because number of hidden clients changed. - notifyItemChanged(getRemoteClientsHiddenItemsIndex()); + notifyItemChanged(remoteClients.size() - 1); } } - /** - * Get the position of the "N devices hidden" item in the remoteClients List. - * - * This is the last item in the remoteClients list, if any items are hidden. - * <code>hiddenClients</code> must be in a consistent state with <code>remoteClients</code> - * (e.g. each client should be in exactly one of the two lists). - * - * @return index of the "N devices hidden" item, or -1 if it doesn't exist. - */ - private int getRemoteClientsHiddenItemsIndex() { - if (hiddenClients.isEmpty()) { - return -1; - } - return remoteClients.size() - 1; - } - public List<RemoteClient> getHiddenClients() { return hiddenClients; } public JSONArray getCurrentChildTabs() { if (clientChildren != null) { final JSONArray urls = new JSONArray(); for (int i = 1; i < clientChildren.size(); i++) {