public S isNotPressed() { isNotNull(); assertThat(actual.isPressed()) // .overridingErrorMessage("Expected to not be pressed but was") // .isFalse(); return myself; }
public S isPressed() { isNotNull(); assertThat(actual.isPressed()) // .overridingErrorMessage("Expected to be pressed but was not") // .isTrue(); return myself; }
final boolean isPressed = mode > TOUCH_MODE_DOWN && mode < TOUCH_MODE_SCROLL && mMotionPosition == position; final boolean updateChildPressed = isPressed != child.isPressed(); final boolean needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();
@Override public void onClick(View v) { // TODO Auto-generated method stub if(v.isPressed()){ //do sth. } else{ //do sth. else } }
view.setClickable(true); view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!v.isPressed()) { Log.e("onTouch", "Moved outside view!"); } return false; } });
Button myBu= (Button) findViewById(R.id.button); myBu.isPressed();// example how to use it Log.d("is pressed?", "" + myBu.isPressed());//false, not pressed myBu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d("is pressed", "" + v.isPressed());//true,pressed } });
@Override public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { if (currStickyView != null && currStickyView.isPressed() && e.getAction() == MotionEvent.ACTION_UP) { currStickyView.setPressed(false); } return gestureDetector.onTouchEvent(e); }
@Override public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { super.onTouchEvent(rv, e); if (currStickyView != null && currStickyView.isPressed() && e.getAction() == MotionEvent.ACTION_UP) { currStickyView.setPressed(false); } } });
public S isNotPressed() { isNotNull(); assertThat(actual.isPressed()) // .overridingErrorMessage("Expected to not be pressed but was") // .isFalse(); return myself; }
public S isPressed() { isNotNull(); assertThat(actual.isPressed()) // .overridingErrorMessage("Expected to be pressed but was not") // .isTrue(); return myself; }
@Override public boolean onTouch(View view, MotionEvent event) { if (view.isPressed() && event.getAction() == MotionEvent.ACTION_UP) { long eventDuration = event.getEventTime() - event.getDownTime(); if (eventDuration > ViewConfiguration.getLongPressTimeout()) { onLongClick(view); } else { onClick(view); } } return false; }
/** * Sets the attached view frozen/un-frozen so it cannot to respond to user touches while the pull * is being performed. * * @param frozen {@code True} to froze (disable, set un-pressed) the view, {@code false} otherwise. */ protected void setViewFrozen(boolean frozen) { if (frozen && mView.isPressed()) { mView.setPressed(false); } if (mView.isEnabled() == frozen) { mView.setEnabled(!frozen); } }
findViewById(R.id.buttonX).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ViewGroup group = (ViewGroup)findViewById(R.id.container); for (View touchable : group.getTouchables()) { if (touchable != view && touchable.isPressed()) { Log.d("...", "skip"); } } } });
@Override public void setPressed(boolean pressed) { if (pressed && getParent() instanceof View && ((View) getParent()).isPressed()) { return; } super.setPressed(pressed); } }
@Override public void onTimerSelected(View v) { v.setPressed(true); delayedConfirmationView.reset(); // Prevent onTimerFinished from being heard. ((DelayedConfirmationView) v).setListener(null); hideConfirm(); Log.d(Constants.TAG, "WearMenuFragment onTimerSelected v.isPressed: " + v.isPressed()); }
@Override public void setPressed(boolean pressed) { if (pressed && getParent() instanceof View && ((View) getParent()).isPressed()) { return; } super.setPressed(pressed); } }
private int getTextColor(int color) { if (color != Integer.MAX_VALUE) return color; if (mView.isSelected()) { color = mTextSelectedColor; } else if (mView instanceof CompoundButton) { if (((CompoundButton) mView).isChecked()) { color = mTextCheckedColor; } } color = color != Integer.MAX_VALUE ? color : mTextColor == Integer.MAX_VALUE ? Color.WHITE : mTextColor; return mView.isPressed() && !mRippleEnable ? calculateColor(color, mBackgroundPressedAlpha) : color; }
@Override public void onTimerSelected(View v) { v.setPressed(true); delayedConfirmationView.reset(); // Prevent onTimerFinished from being heard. ((DelayedConfirmationView) v).setListener(null); hideConfirm(); Log.d(Constants.TAG, "WearActivity onTimerSelected v.isPressed: " + v.isPressed()); }
@Override public void onTimerSelected(View v) { v.setPressed(true); delayedConfirmationView.reset(); // Prevent onTimerFinished from being heard. ((DelayedConfirmationView) v).setListener(null); ((NotificationWearActivity)getActivity()).startTimerFinish(); delayedConfirmationView.setVisibility(View.GONE); imageView.setVisibility(View.VISIBLE); Log.i(Constants.TAG, "DeleteFragment onTimerSelected isPressed: " + v.isPressed()); }