Java Code Examples for android.view.View.equals()

The following are Jave code examples for showing how to use equals() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SimpleMarkdown   File: AutosaveTest.java   View Source Code Vote up 8 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 2
Project: TurboChat   File: ProfileActivityNavigationTest.java   View Source Code Vote up 8 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 3
Project: android-testing-sample   File: MainActivityTest2.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 4
Project: AssistantBySDK   File: LingjuSwipeRefreshLayout.java   View Source Code Vote up 6 votes
private void ensureTarget() {
    // Don't bother getting the parent height if the parent hasn't been laid
    // out yet.
    if (mTarget == null) {
        for (int i = 0; i < getChildCount(); i++) {
            View child = getChildAt(i);
            if (!child.equals(tCircleView) && !child.equals(bCircleView)) {
                mTarget = child;
                break;
            }
        }
    }
}
 
Example 5
Project: trust-wallet-android   File: ScreengrabTest.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 6
Project: frogment   File: KeepingFragmentStateTest.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 7
Project: LQRWeChat   File: EditPage.java   View Source Code Vote up 6 votes
public void onClick(View v) {
	if (v.equals(tvCancel)) {
		cancelAndFinish();
	} else if (v.equals(tvShare)) {
		sp.setText(etContent.getText().toString().trim());
		shareAndFinish();
	} else if (v.equals(aivThumb)) {
		showThumb(thumb);
	} else if (v.equals(xvRemove)) {
		maxBodyHeight = 0;
		rlThumb.setVisibility(View.GONE);
		llPage.measure(0, 0);
		onTextChanged(etContent.getText(), 0, 0, 0);
		removeThumb();
	} else if (v.equals(tvAt)) {
		showFriendList();
	}
}
 
Example 8
Project: frogment   File: FragmentSwitchingFromActivityTest.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 9
Project: androidgithub   File: FriendListPage.java   View Source Code Vote up 6 votes
public void onClick(View v) {
	if (v.equals(tvCancel)) {
		finish();
	} else {
		ArrayList<String> selected = new ArrayList<String>();
		for (int i = 0, size = adapter.getCount(); i < size; i++) {
			if (adapter.getItem(i).checked) {
				selected.add(adapter.getItem(i).atName);
			}
		}

		HashMap<String, Object> res = new HashMap<String, Object>();
		res.put("selected", selected);
		res.put("platform", platform);
		setResult(res);
		finish();
	}
}
 
Example 10
Project: espresso-sample-for-droidkaigi2017   File: Step3.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 11
Project: OpenHomeAnalysis   File: OhaMainActivity.java   View Source Code Vote up 6 votes
@Override
public void onClick(View view) {
    if (view.equals(this.floatingActionButton)) {
        MenuItem menuItem = parseMenuItem(this.navigationView);
        switch (menuItem.getItemId()) {
            case R.id.nav_energy_use_day:
                addAlert();
                return;
            case R.id.nav_energy_use_bill:
                addBill();
                return;
        }
    }
}
 
Example 12
Project: RestaurantApp   File: UserActivity.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
    if (v.equals(imCart)){
        startFragment(new BasketFragment());
        tvActionBar.setText("SEPETİM");
    }else if (v.equals(imBack)){
        startFragment(new CategoryFragment());
        imBack.setVisibility(View.GONE);
    }
}
 
Example 13
Project: FinalProject   File: CommunityGroupFragment.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
    if (v.equals(mButtonLeft)) {
        mSwipeStack.swipeTopViewToLeft();
    } else if (v.equals(mButtonRight)) {
        mSwipeStack.swipeTopViewToRight();
    }
}
 
Example 14
Project: mongol-library   File: MainActivityTest.java   View Source Code Vote up 6 votes
private static Matcher<View> childAtPosition(
        final Matcher<View> parentMatcher, final int position) {

    return new TypeSafeMatcher<View>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("Child at position " + position + " in parent ");
            parentMatcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            ViewParent parent = view.getParent();
            return parent instanceof ViewGroup && parentMatcher.matches(parent)
                    && view.equals(((ViewGroup) parent).getChildAt(position));
        }
    };
}
 
Example 15
Project: letv   File: SwipeRefreshLayout.java   View Source Code Vote up 6 votes
private void ensureTarget() {
    if (this.mTarget == null) {
        int i = 0;
        while (i < getChildCount()) {
            View child = getChildAt(i);
            if (child.equals(this.mCircleView)) {
                i++;
            } else {
                this.mTarget = child;
                return;
            }
        }
    }
}
 
Example 16
Project: Nimbus   File: SlidingImageAdapter.java   View Source Code Vote up 5 votes
@Override
public boolean isViewFromObject(View view, Object object) {
    return view.equals(object);
}
 
Example 17
Project: TestChat   File: DragLayout.java   View Source Code Vote up 5 votes
/**
                 * 子view拖拽过程中位置改变的回调
                 *
                 * @param changedView 被拖拽的子view
                 * @param left        距离父布局左边的距离
                 * @param top         距离父布局上面的距离
                 * @param dx          x方向的偏移量
                 * @param dy          y方向的偏移量
                 */
                @Override
                public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
                        if (dx == 0) {
                                return;
                        }
                        if (changedView.equals(menu)) {
//                                如果拖拽的是menu,布局不变
                                menu.layout(0, 0, width, height);
//                                content.layout(marginLeft, 0, marginLeft + width, height);
//                                这里如果在屏幕上手指按定,就会出现dx=0,dy=1的情况
                                content.layout(left, 0, left + width, height);
                        }
//                                如果是内容布局,就随拖拽位移而变化,因为在smoothSlideViewTo中会进行控件边缘和内容边缘之间的移动,所以这里content要随时改变布局
//                                content.layout(marginLeft, 0, marginLeft + width, height);
//                        0~~1之间
                        float percent = left / (float) range;
                        float desWidth = (float) (width / 4.0 * (percent - 1));
//                        进行内容移动,本身控件位置不变
                        ViewHelper.setTranslationX(menu, desWidth);
                        if (SHADOW) {
//                                ivShadow.layout(marginLeft, 0, marginLeft + width, height);
                                ivShadow.layout(left, 0, left + width, height);
//                                ivShadow.setAlpha(percent * 225);
//                                ViewHelper.setAlpha(ivShadow, percent * 255);
//                                阴影效果
                                float f1 = 1 - percent * 0.5f;
                                ViewHelper.setScaleX(ivShadow, f1 * 1.2f * (1 - percent * 0.10f));
                                ViewHelper.setScaleY(ivShadow, f1 * 1.85f * (1 - percent * 0.10f));
                        }
                        int dragState = getCurrentState();
                        if (dragState == DRAG_STATE_OPEN) {
                                if (mListener != null) {
                                        mListener.onOpenMenu();
                                }
                        } else if (dragState == DRAG_STATE_CLOSE) {
                                if (mListener != null) {
                                        mListener.onCloseMenu();
                                }
                        } else {
                                if (mListener != null) {
                                        mListener.onDrag(changedView, percent);
                                }
                        }
                }
 
Example 18
Project: Appmatic-Android   File: ImagePreviewAdapter.java   View Source Code Vote up 5 votes
@Override
public boolean isViewFromObject(View view, Object object) {
    return object instanceof ViewHolder
            && view.equals(((ViewHolder) object).itemView);
}
 
Example 19
Project: ThunderMusic   File: TouchInterceptor.java   View Source Code Vote up 5 votes
private void doExpansion() {
    int childnum = mDragPos - getFirstVisiblePosition();
    if (mDragPos > mSrcDragPos) {
        childnum++;
    }
    int numheaders = getHeaderViewsCount();

    View first = getChildAt(mSrcDragPos - getFirstVisiblePosition());
    for (int i = 0; ; i++) {
        View vv = getChildAt(i);
        if (vv == null) {
            break;
        }

        int height = mItemHeightNormal;
        int visibility = View.VISIBLE;
        if (mDragPos < numheaders && i == numheaders) {
            // dragging on top of the header item, so adjust the item below
            // instead
            if (vv.equals(first)) {
                visibility = View.INVISIBLE;
            } else {
                height = mItemHeightExpanded;
            }
        } else if (vv.equals(first)) {
            // processing the item that is being dragged
            if (mDragPos == mSrcDragPos
                    || getPositionForView(vv) == getCount() - 1) {
                // hovering over the original location
                visibility = View.INVISIBLE;
            } else {
                // not hovering over it
                // Ideally the item would be completely gone, but neither
                // setting its size to 0 nor settings visibility to GONE
                // has the desired effect.
                height = 1;
            }
        } else if (i == childnum) {
            if (mDragPos >= numheaders && mDragPos < getCount() - 1) {
                height = mItemHeightExpanded;
            }
        }
        ViewGroup.LayoutParams params = vv.getLayoutParams();
        params.height = height;
        vv.setLayoutParams(params);
        vv.setVisibility(visibility);
    }
}
 
Example 20
Project: andswipeframework   File: LeftDragViewEngine.java   View Source Code Vote up 4 votes
@Override
public int clampViewPositionHorizontal(View child, int left) {

    if (mDragView != null && child.equals(mDragView)) {


        if (left > 0 && !mDragView.isBouncePossible()) {
            return 0;
        }

        return left;
    }

    return 0;
}