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 | 5 |
6 package org.mozilla.gecko.activitystream.homepanel; | 6 package org.mozilla.gecko.activitystream.homepanel; |
7 | 7 |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
10 import android.database.Cursor; | 10 import android.database.Cursor; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 context.getResources().getBoolean(R.bool.pref_activitystream
_recentbookmarks_enabled_default)); | 208 context.getResources().getBoolean(R.bool.pref_activitystream
_recentbookmarks_enabled_default)); |
209 final boolean visitedEnabled = sharedPreferences.getBoolean(Activity
StreamPanel.PREF_VISITED_ENABLED, | 209 final boolean visitedEnabled = sharedPreferences.getBoolean(Activity
StreamPanel.PREF_VISITED_ENABLED, |
210 context.getResources().getBoolean(R.bool.pref_activitystream
_visited_enabled_default)); | 210 context.getResources().getBoolean(R.bool.pref_activitystream
_visited_enabled_default)); |
211 setViewVisible(bookmarksEnabled || visitedEnabled, holder.itemView); | 211 setViewVisible(bookmarksEnabled || visitedEnabled, holder.itemView); |
212 } else if (type == RowItemType.TOP_STORIES_TITLE.getViewType()) { | 212 } else if (type == RowItemType.TOP_STORIES_TITLE.getViewType()) { |
213 final Context context = holder.itemView.getContext(); | 213 final Context context = holder.itemView.getContext(); |
214 final boolean pocketEnabled = ActivityStreamConfiguration.isPocketEn
abledByLocale(context) && | 214 final boolean pocketEnabled = ActivityStreamConfiguration.isPocketEn
abledByLocale(context) && |
215 GeckoSharedPrefs.forProfile(context).getBoolean(ActivityStre
amPanel.PREF_POCKET_ENABLED, | 215 GeckoSharedPrefs.forProfile(context).getBoolean(ActivityStre
amPanel.PREF_POCKET_ENABLED, |
216 context.getResources().getBoolean(R.bool.pref_activitystream
_pocket_enabled_default)); | 216 context.getResources().getBoolean(R.bool.pref_activitystream
_pocket_enabled_default)); |
217 setViewVisible(pocketEnabled, holder.itemView); | 217 setViewVisible(pocketEnabled, holder.itemView); |
| 218 } else if (type == RowItemType.LEARN_MORE_LINK.getViewType()) { |
| 219 // We always hide the learn more link |
| 220 // See https://issues.adblockplus.org/ticket/7213 |
| 221 setViewVisible(false, holder.itemView); |
218 } | 222 } |
219 } | 223 } |
220 | 224 |
221 /** | 225 /** |
222 * This sets a child view of the adapter visible or hidden. | 226 * This sets a child view of the adapter visible or hidden. |
223 * | 227 * |
224 * This only applies to children whose height and width are WRAP_CONTENT and
MATCH_PARENT | 228 * This only applies to children whose height and width are WRAP_CONTENT and
MATCH_PARENT |
225 * respectively. | 229 * respectively. |
226 * | 230 * |
227 * NB: This is a hack for the views that are included in the RecyclerView ad
apter even if | 231 * NB: This is a hack for the views that are included in the RecyclerView ad
apter even if |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 || viewType == RowItemType.TOP_STORIES_ITEM.getViewType()) { | 491 || viewType == RowItemType.TOP_STORIES_ITEM.getViewType()) { |
488 // Highlights are always picked from recent history - So using the h
istory id should | 492 // Highlights are always picked from recent history - So using the h
istory id should |
489 // give us a unique (positive) id. | 493 // give us a unique (positive) id. |
490 final WebpageRowModel model = (WebpageRowModel) recyclerViewModel.ge
t(position); | 494 final WebpageRowModel model = (WebpageRowModel) recyclerViewModel.ge
t(position); |
491 return model.getUniqueId(); | 495 return model.getUniqueId(); |
492 } else { | 496 } else { |
493 return recyclerViewModel.get(position).getRowItemType().stableId; | 497 return recyclerViewModel.get(position).getRowItemType().stableId; |
494 } | 498 } |
495 } | 499 } |
496 } | 500 } |
OLD | NEW |