當前位置: 首頁>>代碼示例>>Java>>正文


Java View.performClick方法代碼示例

本文整理匯總了Java中android.view.View.performClick方法的典型用法代碼示例。如果您正苦於以下問題:Java View.performClick方法的具體用法?Java View.performClick怎麽用?Java View.performClick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.performClick方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clickNoConstraints

import android.view.View; //導入方法依賴的package包/類
static ViewAction clickNoConstraints() {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isEnabled(); // No constraints, isEnabled and isClickable are checked
        }

        @Override
        public String getDescription() {
            return "Click a view with no constraints.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            view.performClick();
        }
    };
}
 
開發者ID:dev-labs-bg,項目名稱:fullscreen-video-view,代碼行數:19,代碼來源:CustomChecks.java

示例2: clickChildViewWithId

import android.view.View; //導入方法依賴的package包/類
public static ViewAction clickChildViewWithId(final int id) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return null;
        }

        @Override
        public String getDescription() {
            return "Click on a child view with specified id.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            View v = view.findViewById(id);
            v.performClick();
        }
    };
}
 
開發者ID:hernandazevedo,項目名稱:starwarsshop,代碼行數:20,代碼來源:MyViewAction.java

示例3: onTouch

import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    switch (motionEvent.getAction()) {
        case MotionEvent.ACTION_DOWN:
            ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20);
            animator.setDuration(200);
            animator.setInterpolator(new DecelerateInterpolator());
            animator.start();
            view.performClick();
            return true;
        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
            ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationZ", 0);
            animator2.setDuration(200);
            animator2.setInterpolator(new AccelerateInterpolator());
            animator2.start();
            return true;
        default:
            return false;
    }
}
 
開發者ID:coder3101,項目名稱:Matrix-Calculator-for-Android,代碼行數:22,代碼來源:faqs.java

示例4: onTouch

import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onTouch(View v, MotionEvent e) {
	int action = e.getAction() & 255;
	switch (action){
		case MotionEvent.ACTION_DOWN:
			x = e.getX();
			return true;
		case MotionEvent.ACTION_UP:
			if (e.getX()-x > 30.0 * density) {
				LauncherApp.getInstance().getCategoryManager().setCurCategory(LauncherApp.getInstance().getCategoryManager().getPrevCategory());
				appsRef.get().loadFilteredApps();
				appsRef.get().setSpinner();
				return true;
			} else if (x-e.getX() > 30.0 * density) {
				LauncherApp.getInstance().getCategoryManager().setCurCategory(LauncherApp.getInstance().getCategoryManager().getNextCategory());
				appsRef.get().loadFilteredApps();
				appsRef.get().setSpinner();
				return true;
			} else v.performClick();
		default:
			return false;
	}
}
 
開發者ID:HenriDellal,項目名稱:emerald,代碼行數:24,代碼來源:SwipeListener.java

示例5: getMessageLongClickListener

import android.view.View; //導入方法依賴的package包/類
private View.OnLongClickListener getMessageLongClickListener(final Wrapper<MESSAGE> wrapper) {
    return new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            if (selectionListener == null) {
                notifyMessageLongClicked(wrapper.item);
                notifyMessageViewLongClicked(view, wrapper.item);
                return true;
            } else {
                isSelectionModeEnabled = true;
                view.performClick();
                return true;
            }
        }
    };
}
 
開發者ID:sciage,項目名稱:FinalProject,代碼行數:17,代碼來源:MessagesListAdapter.java

示例6: onTouch

import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onTouch(final View view, MotionEvent event) {
	if (event.getAction() == MotionEvent.ACTION_UP) {
		view.requestFocus();
		//MyApplication.hideSoftInputFrom(context, view);
		view.performClick();
	}
	return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:SimpleOnTouchListener.java

示例7: selectTab

import android.view.View; //導入方法依賴的package包/類
public void selectTab(int num) {
    if (num < 0 || num >= tabCount) {
        return;
    }
    View tab = tabsContainer.getChildAt(num);
    if (Build.VERSION.SDK_INT >= 15) {
        tab.callOnClick();
    } else {
        tab.performClick();
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:12,代碼來源:ScrollSlidingTabStrip.java

示例8: onTouch

import android.view.View; //導入方法依賴的package包/類
private boolean onTouch(View v, MotionEvent event) {
    if (parent.isEmpty()) {
        return false;
    }

    animator.cancel();

    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            initialTouchX = event.getRawX();
            initialTouchY = event.getRawY();
            startTimeMS = event.getEventTime();
            onMoveStart(v);
            v.setPressed(true);
            return true;
        case MotionEvent.ACTION_MOVE:
            animator.cancel();
            onMove(v, event.getRawX() - initialTouchX, event.getRawY() - initialTouchY);
            return true;
        case MotionEvent.ACTION_UP:
            v.setPressed(false);
            onMoveEnd(v);
            final long downTimeMS = event.getEventTime() - startTimeMS;
            final float halfButtonSize = Math.min(v.getHeight(), v.getWidth()) / 2f;
            final boolean wasClicked = downTimeMS < CLICK_MAX_DURATION_MS
                    && ViewUtil.distance(initialTouchX, initialTouchY, event.getRawX(), event.getRawY()) < halfButtonSize;
            if (wasClicked) {
                v.performClick();
            }
            return true;
        default:
            return true;
    }
}
 
開發者ID:roshakorost,項目名稱:Phial,代碼行數:35,代碼來源:DragHelper.java

示例9: onTouch

import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onTouch(final View view, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {
        view.requestFocus();
        Utils.hideSoftInputFrom(context, view);
        view.performClick();
    }
    return true;
}
 
開發者ID:davideas,項目名稱:AndroidBlueprints,代碼行數:10,代碼來源:SimpleOnTouchListener.java

示例10: performClick

import android.view.View; //導入方法依賴的package包/類
public void performClick(int adapterPosition) {
    if (listView != null) {
        RecyclerView.ViewHolder holder =
                listView.findViewHolderForLayoutPosition(adapterPosition);
        if (holder != null) {
            View view = holder.itemView;
            if (view != null) {
                view.performClick();
            }
        }
    }
}
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:13,代碼來源:FeedAdapter.java

示例11: onTouch

import android.view.View; //導入方法依賴的package包/類
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    view.performClick();
    controller.show();
    return false;
}
 
開發者ID:dev-labs-bg,項目名稱:fullscreen-video-view,代碼行數:7,代碼來源:FullscreenVideoView.java

示例12: perform

import android.view.View; //導入方法依賴的package包/類
@Override
public void perform(UiController uiController, View view) {
    view.performClick();
}
 
開發者ID:jaysondc,項目名稱:TripleTap,代碼行數:5,代碼來源:MultiplayerGameFragmentAndroidTests.java

示例13: performItemClick

import android.view.View; //導入方法依賴的package包/類
public boolean performItemClick(int position){
    View holderView = holders.get(position).itemView;
    return holderView.performClick();
}
 
開發者ID:micromasterandroid,項目名稱:androidadvanced,代碼行數:5,代碼來源:ShadowRecyclerViewAdapter.java

示例14: clickView

import android.view.View; //導入方法依賴的package包/類
/**
 * 單擊某個View
 */
public void clickView(View view) {
    if (view != null) {
        view.performClick();
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:9,代碼來源:RBaseViewHolder.java

示例15: inflaterOthersView

import android.view.View; //導入方法依賴的package包/類
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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:43,代碼來源:CashierAcitivity.java


注:本文中的android.view.View.performClick方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。