com.android.internal.util.Predicate Java Examples
The following examples show how to use
com.android.internal.util.Predicate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactTestHelper.java From react-native-GPay with MIT License | 6 votes |
private static View findChild(View root, Predicate<View> predicate) { if (predicate.apply(root)) { return root; } if (root instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) root; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); View result = findChild(child, predicate); if (result != null) { return result; } } } return null; }
Example #2
Source File: DigestCatalogFragment.java From 4pdaClient-plus with Apache License 2.0 | 6 votes |
@Override protected boolean inBackground(boolean isRefresh, final ICatalogItem catalogItem) throws Throwable { if (mCatalogData.size() == 0) mCatalogData = DigestApi.getCatalog(Client.getInstance(), (DigestCatalog) m_CurrentCatalogItem); if (((DigestCatalog) catalogItem).getLevel() == DigestCatalog.LEVEL_TOPICS_NEXT) return false; mLoadResultList = getFilteredList(new Predicate<DigestCatalog>() { @Override public boolean apply(DigestCatalog catalog) { return catalog.getParent() != null && catalog.getParent().getId().equals(catalogItem.getId()); } }); if (mCatalogData.size() > 0 && mLoadResultList.size() == 0) return false; return true; }
Example #3
Source File: ReactTestHelper.java From react-native-GPay with MIT License | 5 votes |
private static Predicate<View> hasTagValue(final String tagValue) { return new Predicate<View>() { @Override public boolean apply(View view) { Object tag = getTestId(view); return tag != null && tag.equals(tagValue); } }; }
Example #4
Source File: Lists.java From lockit with Apache License 2.0 | 5 votes |
public static <T> List<T> filter(List<T> list, Predicate<T> predicate) { List<T> filteredList = new ArrayList<>(); for (T t : list) if (predicate.apply(t)) filteredList.add(t); return filteredList; }
Example #5
Source File: MutableArrayList.java From narrate-android with Apache License 2.0 | 5 votes |
public T find(Predicate<T> predicate) { for (T element : this) { if (predicate.apply(element)) { return element; } } return null; }
Example #6
Source File: MutableArrayList.java From narrate-android with Apache License 2.0 | 5 votes |
public List<T> findAll(Predicate<T> predicate) { List<T> results = new ArrayList<>(size()); for (T element : this) { if (predicate.apply(element)) { results.add(element); } } return results; }
Example #7
Source File: MutableArrayList.java From narrate-android with Apache License 2.0 | 5 votes |
public void filter(Predicate<T> predicate) { this.mFilter = predicate; super.clear(); if ( predicate == null ) { super.clear(); super.addAll(mOriginalList); } else { for (T element : mOriginalList) { if (predicate.apply(element)) { super.add(element); } } } }
Example #8
Source File: AppsGamesCatalogFragment.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
private ArrayList<AppGameCatalog> getFilteredList(Predicate<AppGameCatalog> predicate) { ArrayList<AppGameCatalog> res = new ArrayList<>(); for (AppGameCatalog item : mCatalogData) { if (!predicate.apply(item)) continue; res.add(item); } return res; }
Example #9
Source File: DigestCatalogFragment.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
private ArrayList<DigestCatalog> getFilteredList(Predicate<DigestCatalog> predicate) { ArrayList<DigestCatalog> res = new ArrayList<>(); for (DigestCatalog item : mCatalogData) { if (!predicate.apply(item)) continue; res.add(item); } return res; }
Example #10
Source File: Map.java From Tanks with MIT License | 5 votes |
private static <T> T find(Collection<T> collection, Predicate<T> predicate) { for (T current : collection) if (predicate.apply(current)) return current; return null; }
Example #11
Source File: ListingFragment.java From conference-app with Apache License 2.0 | 5 votes |
private static ArrayList<Conference> filterList(ArrayList<Conference> list, final ConferenceDay day) { Predicate<Conference> aDay = new Predicate<Conference>() { public boolean apply(Conference conference) { return conference.getStartDate().startsWith(day.getDay()); } }; return Utils.filter(list, aDay); }
Example #12
Source File: Utils.java From conference-app with Apache License 2.0 | 5 votes |
public static <T> ArrayList<T> filter(Collection<T> target, Predicate<T> predicate) { ArrayList<T> result = new ArrayList<T>(); for (T element: target) { if (predicate.apply(element)) { result.add(element); } } return result; }
Example #13
Source File: BaseEntryFragment.java From narrate-android with Apache License 2.0 | 4 votes |
public void filter(Predicate<Entry> predicate) { mainActivity.entries.filter(predicate); }
Example #14
Source File: Map.java From Tanks with MIT License | 4 votes |
private static <T> boolean any(Collection<T> collection, Predicate<T> predicate) { return find(collection, predicate) != null; }