Ejemplo n.º 1
0
 private boolean walkTree(View view, Condition<TextView> condition) {
   if (view instanceof TextView) {
     if (condition.matches((TextView) view)) {
       return true;
     }
   } else if (view instanceof AdapterView) {
     Adapter adapter = ((AdapterView) view).getAdapter();
     for (int i = 0; i < adapter.getCount(); i++) {
       View adapterView = adapter.getView(i, null, null);
       if (walkTree(adapterView, condition)) {
         return true;
       }
     }
   } else if (view instanceof ViewGroup) {
     ViewGroup viewGroup = (ViewGroup) view;
     for (int i = 0; i < viewGroup.getChildCount(); i++) {
       View childView = viewGroup.getChildAt(i);
       if (childView instanceof ViewGroup) {
         if (walkTree(childView, condition)) {
           return true;
         }
       }
     }
   }
   return false;
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public boolean matches(T value) {
   for (Condition<? super T> condition : conditions) if (condition.matches(value)) return true;
   return false;
 }