Java Code Examples for android.view.View#performClick()
The following examples show how to use
android.view.View#performClick() .
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: MessageListActivity.java From aurora-imui with MIT License | 6 votes |
@Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: ChatInputView chatInputView = mChatView.getChatInputView(); if (chatInputView.getMenuState() == View.VISIBLE) { chatInputView.dismissMenuLayout(); } mChatView.setMsgListHeight(true); try { View v = getCurrentFocus(); if (mImm != null && v != null) { mImm.hideSoftInputFromWindow(v.getWindowToken(), 0); mWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); view.clearFocus(); } } catch (Exception e) { e.printStackTrace(); } break; case MotionEvent.ACTION_UP: view.performClick(); break; } return false; }
Example 2
Source File: StepperNavigationActions.java From android-material-stepper with Apache License 2.0 | 6 votes |
/** * Clicks the Complete button. */ public static ViewAction clickComplete() { return new AbstractStepperNavigationAction() { @Override public String getDescription() { return "Click on the Complete button"; } @Override protected void performAction(StepperLayout stepperLayout) { View completeButton = stepperLayout.findViewById(com.stepstone.stepper.R.id.ms_stepCompleteButton); completeButton.performClick(); } }; }
Example 3
Source File: StepListFragmentTest.java From friendly-plans with GNU General Public License v3.0 | 6 votes |
public static ViewAction clickChildViewWithId(final int id) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return null; } @Override public String getDescription() { return null; } @Override public void perform(UiController uiController, View view) { View v = view.findViewById(id); v.performClick(); } }; }
Example 4
Source File: StepperNavigationActions.java From android-material-stepper with Apache License 2.0 | 6 votes |
/** * Clicks the Next button. */ public static ViewAction clickNext() { return new AbstractStepperNavigationAction() { @Override public String getDescription() { return "Click on the Next button"; } @Override protected void performAction(StepperLayout stepperLayout) { View nextButton = stepperLayout.findViewById(com.stepstone.stepper.R.id.ms_stepNextButton); nextButton.performClick(); } }; }
Example 5
Source File: BottomSheet.java From AndroidBottomSheet with Apache License 2.0 | 6 votes |
/** * Creates and returns a listener, which allows to cancel the bottom sheet, when the decor view * is touched. * * @return The listener, which has been created, as an instance of the type {@link * View.OnTouchListener} */ private View.OnTouchListener createCancelOnTouchListener() { return new View.OnTouchListener() { @Override public boolean onTouch(final View v, final MotionEvent event) { if (cancelable && canceledOnTouchOutside) { cancel(); v.performClick(); return true; } return false; } }; }
Example 6
Source File: DingDingHandler.java From xposed-rimet with Apache License 2.0 | 5 votes |
@Override public void onHandlerFestivalRedPacketsPick(Activity activity) { if (!mEnableFastLucky) return; View view = activity.findViewById(ResourceUtil.getId(activity, getXString(M.res.res_iv_pick))); if (view != null && view.isClickable()) view.performClick(); }
Example 7
Source File: DingDingHandler.java From xposed-rimet with Apache License 2.0 | 5 votes |
@Override public void onHandlerPickRedPackets(Activity activity) { if (!mEnableFastLucky) return; View view = activity.findViewById(ResourceUtil.getId(activity, getXString(M.res.res_btn_pick))); if (view != null && view.isClickable()) view.performClick(); }
Example 8
Source File: BaseHandler.java From xposed-rimet with Apache License 2.0 | 5 votes |
public void performClick(View view) { if (view != null && view.isShown()) { // 点击 view.performClick(); } }
Example 9
Source File: QuestionFragment.java From Alibaba-Android-Certification with MIT License | 5 votes |
@Override public void devModel() { if(DevToolsAct.DEV_AUTO_ANSWER){ for (int i = 0; i < mGiftModel.choose.size(); i++) { AnswerModel bean=mGiftModel.choose.get(i); if(bean.result){ View v=mRecycler.getChildAt(i); v.performClick(); } } ((StudyAct) getActivity()).next(DevToolsAct.DEV_AUTO_ANSWER?100:500); } }
Example 10
Source File: BrowserWindow.java From Beedio with GNU General Public License v2.0 | 5 votes |
@Override public boolean onTouch(View v, MotionEvent event) { if (v == videosFoundHUD) { gesture.onTouchEvent(event); switch (event.getAction()) { case MotionEvent.ACTION_UP: if (!moved) v.performClick(); moved = false; break; case MotionEvent.ACTION_DOWN: prevX = event.getRawX(); prevY = event.getRawY(); break; case MotionEvent.ACTION_MOVE: moved = true; float moveX = event.getRawX() - prevX; videosFoundHUD.setX(videosFoundHUD.getX() + moveX); prevX = event.getRawX(); float moveY = event.getRawY() - prevY; videosFoundHUD.setY(videosFoundHUD.getY() + moveY); prevY = event.getRawY(); float width = getResources().getDisplayMetrics().widthPixels; float height = getResources().getDisplayMetrics().heightPixels; if ((videosFoundHUD.getX() + videosFoundHUD.getWidth()) >= width || videosFoundHUD.getX() <= 0) { videosFoundHUD.setX(videosFoundHUD.getX() - moveX); } if ((videosFoundHUD.getY() + videosFoundHUD.getHeight()) >= height || videosFoundHUD.getY() <= 0) { videosFoundHUD.setY(videosFoundHUD.getY() - moveY); } break; } } return true; }
Example 11
Source File: SideBar.java From FantasySlide with Apache License 2.0 | 5 votes |
void onMotionEventUp() { for (int i = 0; opened && i < getChildCount(); i++) { View child = getChildAt(i); if (child.isPressed()) { if (fantasyListener == null || !fantasyListener.onSelect(child, i)) { child.performClick(); } return; } } if (fantasyListener != null) { fantasyListener.onCancel(); } }
Example 12
Source File: ChipGroupTest.java From material-components-android with Apache License 2.0 | 5 votes |
@Test public void singleSelection_withSelectionRequired_doesNotUnSelect() { chipgroup.setSelectionRequired(true); chipgroup.setSingleSelection(true); View chip = chipgroup.getChildAt(0); chip.performClick(); chip.performClick(); assertThat(((Chip) chip).isChecked()).isTrue(); }
Example 13
Source File: MainActivity.java From ToDay with MIT License | 5 votes |
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mCoordinator.restoreState(savedInstanceState); if (savedInstanceState.getBoolean(STATE_TOOLBAR_TOGGLE, false)) { View toggleButton = findViewById(R.id.toolbar_toggle_frame); if (toggleButton != null) { // can be null as disabled in landscape toggleButton.performClick(); } } }
Example 14
Source File: AudioNotePopup.java From CameraV with GNU General Public License v3.0 | 4 votes |
@Override public void onClick(View v) { if(v == actionToggle) { switch(state) { case RecorderState.IS_IDLE: if(progress.rawAudioData == null) { // record progress.record(); setState(RecorderState.IS_RECORDING); } else { if(state != RecorderState.IS_IDLE) { if(state == RecorderState.IS_RECORDING) { progress.stop(); } else if(state == RecorderState.IS_PLAYING) { progress.pause(); } setState(RecorderState.IS_IDLE); } res = pauseRes; progress.play(); setState(RecorderState.IS_PLAYING); } break; case RecorderState.IS_RECORDING: progress.stop(); setState(RecorderState.IS_IDLE); res = recordRes; form.answer(Forms.FreeAudio.PROMPT); break; case RecorderState.IS_PLAYING: res = recordRes; progress.pause(); setState(RecorderState.IS_IDLE); v.performClick(); break; } } else if(v == actionDone) { if(state == RecorderState.IS_PLAYING) { progress.pause(); } else if(state == RecorderState.IS_RECORDING) { progress.stop(); } setState(RecorderState.IS_IDLE); form.answer(Forms.FreeAudio.PROMPT); cancel(); return; } else if(v == actionRedo) { if(state == RecorderState.IS_PLAYING) { progress.pause(); } else if(state == RecorderState.IS_RECORDING) { progress.stop(); } form.getQuestionDefByTitleId(Forms.FreeAudio.PROMPT).clear(); progress.reInit(new java.io.File(Storage.EXTERNAL_DIR, "tmprecord_" + System.currentTimeMillis() + ".3gp"), this); updateLayout(false); return; } updateLayout(); }
Example 15
Source File: VideoCaptureViewTest.java From LandscapeVideoCamera with Apache License 2.0 | 4 votes |
private void performClickOnButton(int btnResourceId, final RecordingButtonInterface mockBtnInterface) { final VideoCaptureView videoCaptureView = new VideoCaptureView(InstrumentationRegistry.getTargetContext()); videoCaptureView.setRecordingButtonInterface(mockBtnInterface); final View btn = videoCaptureView.findViewById(btnResourceId); btn.performClick(); }
Example 16
Source File: CashierAcitivity.java From letv with Apache License 2.0 | 4 votes |
private View inflaterOthersView() { final View othersView = View.inflate(this.context, ResourceUtil.getLayoutResource(this.context, "lepay_cashier_paychannel_other"), null); ImageView itemIcon = (ImageView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_paychannel_item_icon")); TextView itemTitle = (TextView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_paychannel_item_title")); final ImageView arrawicon = (ImageView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_cashier_paytype_other_selector_icon")); arrawicon.setImageResource(ResourceUtil.getDrawableResource(this.context, "icon_down")); itemIcon.setImageResource(ResourceUtil.getDrawableResource(this.context, "lepay_icon_more")); itemTitle.setText(ResourceUtil.getStringResource(this.context, "lepay_ohters_paytype")); othersView.setTag(Boolean.FALSE); othersView.setOnClickListener(new OnClickListener() { public void onClick(View view) { int count; int i; if (((Boolean) view.getTag()).booleanValue()) { arrawicon.setImageResource(ResourceUtil.getDrawableResource(CashierAcitivity.this.context, "icon_down")); count = CashierAcitivity.this.lepay_cashier_paytype_list.getChildCount(); for (i = 0; i < count; i++) { View v = CashierAcitivity.this.lepay_cashier_paytype_list.getChildAt(i); CheckBox checkBox = (CheckBox) v.findViewById(ResourceUtil.getIdResource(CashierAcitivity.this, "lepay_paychannel_item_checkbox")); if (checkBox != null) { if (((Boolean) checkBox.getTag()).booleanValue()) { v.setVisibility(8); } else { v.setVisibility(0); } } } othersView.setTag(Boolean.FALSE); return; } arrawicon.setImageResource(ResourceUtil.getDrawableResource(CashierAcitivity.this.context, "icon_up")); count = CashierAcitivity.this.lepay_cashier_paytype_list.getChildCount(); for (i = 0; i < count; i++) { CashierAcitivity.this.lepay_cashier_paytype_list.getChildAt(i).setVisibility(0); } othersView.setTag(Boolean.TRUE); } }); othersView.performClick(); othersView.performClick(); return othersView; }
Example 17
Source File: ViewTransformDelegater.java From libcommon with Apache License 2.0 | 4 votes |
/** * View#onTouchEventの処理 * falseを返したときにはView#super.onTouchEventでデフォルトの処理をすること * @param event * @return */ @SuppressLint("SwitchIntDef") public boolean onTouchEvent(final MotionEvent event) { // if (DEBUG) Log.v(TAG, "onTouchEvent:"); if (mHandleTouchEvent == TOUCH_DISABLED) { return false; } final View view = getTargetView(); final int actionCode = event.getActionMasked(); // >= API8 switch (actionCode) { case MotionEvent.ACTION_DOWN: // single touch startWaiting(event); return true; case MotionEvent.ACTION_POINTER_DOWN: { // マルチタッチ時の処理 switch (mState) { case STATE_WAITING: // 最初のマルチタッチ → 拡大縮小・回転操作待機開始 view.removeCallbacks(mWaitImageReset); // pass through case STATE_DRAGGING: if (event.getPointerCount() > 1) { startCheck(event); return true; } break; } break; } case MotionEvent.ACTION_MOVE: { // moving with single and multi touch switch (mState) { case STATE_WAITING: if (((mHandleTouchEvent & TOUCH_ENABLED_MOVE) == TOUCH_ENABLED_MOVE) && checkTouchMoved(event)) { view.removeCallbacks(mWaitImageReset); setState(STATE_DRAGGING); return true; } break; case STATE_DRAGGING: if (processDrag(event)) return true; break; case STATE_CHECKING: if (checkTouchMoved(event) && ((mHandleTouchEvent & TOUCH_ENABLED_ZOOM) == TOUCH_ENABLED_ZOOM)) { startZoom(event); return true; } break; case STATE_ZOOMING: if (processZoom(event)) return true; break; case STATE_ROTATING: if (processRotate(event)) return true; break; } break; } case MotionEvent.ACTION_CANCEL: // pass through case MotionEvent.ACTION_UP: view.removeCallbacks(mWaitImageReset); view.removeCallbacks(mStartCheckRotate); if ((actionCode == MotionEvent.ACTION_UP) && (mState == STATE_WAITING)) { final long downTime = SystemClock.uptimeMillis() - event.getDownTime(); if (downTime > LONG_PRESS_TIMEOUT) { view.performLongClick(); } else if (downTime < TAP_TIMEOUT) { view.performClick(); } } // pass through case MotionEvent.ACTION_POINTER_UP: setState(STATE_NON); break; } return false; }
Example 18
Source File: ClickGuardTest.java From clickguard with Apache License 2.0 | 4 votes |
private static void clickView(View view, int count) { for (int i = 0; i < count; i++) { view.performClick(); } }
Example 19
Source File: VideoCaptureViewTest.java From VideoCamera with Apache License 2.0 | 4 votes |
private void performClickOnButton(int btnResourceId, final RecordingButtonInterface mockBtnInterface) { final VideoCaptureView videoCaptureView = new VideoCaptureView(InstrumentationRegistry.getTargetContext()); videoCaptureView.setRecordingButtonInterface(mockBtnInterface); final View btn = videoCaptureView.findViewById(btnResourceId); btn.performClick(); }
Example 20
Source File: AndroidTester.java From aedict with GNU General Public License v3.0 | 2 votes |
/** * Clicks on given {@link View}. * * @param buttonId * the button id */ public void click(final int buttonId) { final View view = get(buttonId); view.performClick(); }