当前位置: 首页>>代码示例>>Java>>正文


Java View.performHapticFeedback方法代码示例

本文整理汇总了Java中android.view.View.performHapticFeedback方法的典型用法代码示例。如果您正苦于以下问题:Java View.performHapticFeedback方法的具体用法?Java View.performHapticFeedback怎么用?Java View.performHapticFeedback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.performHapticFeedback方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hapticFeedbackPerform

import android.view.View; //导入方法依赖的package包/类
private void hapticFeedbackPerform(Map data) {

                final Activity activity = QtNative.activity();
                final Map messageData = data;
                Runnable runnable = new Runnable () {
                    public void run() {
                        int feedbackConstant = (Integer) messageData.get("feedbackConstant");
                        int flags = (Integer) messageData.get("flags");

                        Log.d("",String.format("hapticFeedbackPerform(%d,%d)",feedbackConstant,flags));

                        View rootView = activity.getWindow().getDecorView().getRootView();
                        rootView.performHapticFeedback(feedbackConstant, flags);

                        // Test function. Remove it later.
                        SystemDispatcher.dispatch("hapticFeedbackPerformFinished");
                    };
                };
                activity.runOnUiThread(runnable);
            }
 
开发者ID:benlau,项目名称:androidnative.pri,代码行数:21,代码来源:ExampleService.java

示例2: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {

		v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
				HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

		switch (v.getId()) {

		case R.id.fragment_new_tree_save:

			saveToDb();

			Toast.makeText(getActivity(), "Tree saved", Toast.LENGTH_SHORT).show();
			getActivity().getSupportFragmentManager().popBackStack();
			break;
		case R.id.fragment_new_tree_take_photo:
			takePicture();
			break;
		}

	}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:21,代码来源:NewTreeFragment.java

示例3: onClick

import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    String userId = mSharedPreferences.getString(ValueHelper.MAIN_DB_USER_ID, "-1");
    switch (v.getId()) {
        case R.id.fragment_data_sync:
            Toast.makeText(getActivity(), "Start syncing", Toast.LENGTH_SHORT).show();
            syncTask = new SyncTask(getActivity(), this, Integer.parseInt(userId)).execute();
            break;
        case R.id.fragment_data_pause:
            if (syncTask != null) {
                syncTask.cancel(true);
            }
            Toast.makeText(getActivity(), "Pause syncing", Toast.LENGTH_SHORT).show();
            break;
        case R.id.fragment_data_resume:
            Toast.makeText(getActivity(), "Resume syncing", Toast.LENGTH_SHORT).show();
            syncTask = new SyncTask(getActivity(), this, Integer.parseInt(userId)).execute();
            break;

    }
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:23,代码来源:DataFragment.java

示例4: showPopupMenu

import android.view.View; //导入方法依赖的package包/类
private void showPopupMenu(View view) {
    final CharSequence[] items = {"Edit", "Delete"};
    view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

    builder.setTitle(mTextName.getText());
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            int position = getAdapterPosition();
            switch (which){
                case 0://Edit
                    listener.editTask(position);
                    break;
                case 1://Delete
                    listener.deleteTask(position);
                    break;
            }
        }
    });
    builder.show();
}
 
开发者ID:swapyx,项目名称:Channelize,代码行数:23,代码来源:ToDoListAdapter.java

示例5: performHapticFeedback

import android.view.View; //导入方法依赖的package包/类
public void performHapticFeedback(final View viewToPerformHapticFeedbackOn) {
    if (!mSettingsValues.mVibrateOn) {
        return;
    }
    if (mSettingsValues.mKeypressVibrationDuration >= 0) {
        vibrate(mSettingsValues.mKeypressVibrationDuration);
        return;
    }
    // Go ahead with the system default
    if (viewToPerformHapticFeedbackOn != null) {
        viewToPerformHapticFeedbackOn.performHapticFeedback(
                HapticFeedbackConstants.KEYBOARD_TAP,
                HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:16,代码来源:AudioAndHapticFeedbackManager.java

示例6: navigateTo

import android.view.View; //导入方法依赖的package包/类
private void navigateTo(int frame, View view) {
    view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
    navigateTo(frame);
}
 
开发者ID:sovteam,项目名称:buddybox,代码行数:5,代码来源:MainActivity.java

示例7: RecyclerListViewItemClickListener

import android.view.View; //导入方法依赖的package包/类
public RecyclerListViewItemClickListener(Context context) {
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            if (currentChildView != null && onItemClickListener != null) {
                currentChildView.setPressed(true);
                final View view = currentChildView;
                if (instantClick) {
                    view.playSoundEffect(SoundEffectConstants.CLICK);
                    onItemClickListener.onItemClick(view, currentChildPosition);
                }
                AndroidUtilities.runOnUIThread(clickRunnable = new Runnable() {
                    @Override
                    public void run() {
                        if (this == clickRunnable) {
                            clickRunnable = null;
                        }
                        if (view != null) {
                            view.setPressed(false);
                            if (!instantClick) {
                                view.playSoundEffect(SoundEffectConstants.CLICK);
                                if (onItemClickListener != null) {
                                    onItemClickListener.onItemClick(view, currentChildPosition);
                                }
                            }
                        }
                    }
                }, ViewConfiguration.getPressedStateDuration());

                if (selectChildRunnable != null) {
                    AndroidUtilities.cancelRunOnUIThread(selectChildRunnable);
                    selectChildRunnable = null;
                    currentChildView = null;
                    interceptedByChild = false;
                }
            }
            return true;
        }

        @Override
        public void onLongPress(MotionEvent event) {
            if (currentChildView != null) {
                View child = currentChildView;
                if (onItemLongClickListener != null) {
                    if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) {
                        child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                    }
                }
            }
        }
    });
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:RecyclerListView.java

示例8: keyboardCallback

import android.view.View; //导入方法依赖的package包/类
/**
 * CallBack of the keyboard buttons
 * @param v
 */
public void keyboardCallback(View v){
    int maxValue;
    switch (v.getId()){
        case R.id.btn1:
            maxValue=1;
            break;
        case R.id.btn2:
            maxValue=2;
            break;
        case R.id.btn3:
            maxValue=3;
            break;
        case R.id.btn4:
            maxValue=4;
            break;
        case R.id.btn5:
            maxValue=5;
            break;
        case R.id.btn6:
            maxValue=6;
            break;
        case R.id.btn7:
            maxValue=7;
            break;
        case R.id.btn8:
            maxValue=8;
            break;
        case R.id.btn9:
            maxValue=9;
            break;
        default:
            maxValue=10;
    }
    MyApplication.ins().setMaxMultiplicationValue(maxValue);
    btnStart.setEnabled(true);
    //changing background color
    v.setBackgroundResource(R.drawable.btn_keyboard_shape_selected);
    if(lastSelected!=v) {
        if (lastSelected != null) {
            lastSelected.setBackgroundResource(R.drawable.btn_keyboard_shape);
        }
        lastSelected = v;
    }

    v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
}
 
开发者ID:MathiasSeguy-Android2EE,项目名称:MultiplicationBasile,代码行数:51,代码来源:MainActivity.java

示例9: keyboardCallback

import android.view.View; //导入方法依赖的package包/类
/**
 * Keyboard call back
 * @param v
 */
public void keyboardCallback(View v){
    int maxValue=0;
    v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
    switch (v.getId()){
        case R.id.btn1:
            maxValue=1;
            break;
        case R.id.btn2:
            maxValue=2;
            break;
        case R.id.btn3:
            maxValue=3;
            break;
        case R.id.btn4:
            maxValue=4;
            break;
        case R.id.btn5:
            maxValue=5;
            break;
        case R.id.btn6:
            maxValue=6;
            break;
        case R.id.btn7:
            maxValue=7;
            break;
        case R.id.btn8:
            maxValue=8;
            break;
        case R.id.btn9:
            maxValue=9;
            break;
        case R.id.btn0:
            maxValue=0;
            break;
        case R.id.btnOk:
            questionAnswered();
            return;
        case R.id.btnDelete:
            userAnswer = userAnswer /10;
            txvQuestion.setText(AssesmentService.getInstance().getQuestion(userAnswer));
            return;
        default:
            return;
    }

    userAnswer = userAnswer *10+maxValue;
    txvQuestion.setText(AssesmentService.getInstance().getQuestion(userAnswer));
}
 
开发者ID:MathiasSeguy-Android2EE,项目名称:MultiplicationBasile,代码行数:53,代码来源:AssessmentActivity.java

示例10: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {


		v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

		Cursor photoCursor;
		switch (v.getId()) {
            case R.id.fab:
            	Log.d(TAG, "fab click");
                if (MainActivity.mAllowNewTreeOrUpdate || BuildConfig.GPS_ACCURACY.equals("off")) {
					fragment = new NewTreeFragment();
					bundle = getActivity().getIntent().getExtras();
					fragment.setArguments(bundle);

					fragmentTransaction = getActivity().getSupportFragmentManager()
							.beginTransaction();
					fragmentTransaction.replace(R.id.container_fragment, fragment).addToBackStack(ValueHelper.NEW_TREE_FRAGMENT).commit();
				} else {
					Toast.makeText(getActivity(), "Insufficient GPS accuracy.", Toast.LENGTH_SHORT).show();
				}
				break;
//			case R.id.fragment_map_update_tree:
//
//				if (MainActivity.mAllowNewTreeOrUpdate) {
//					SQLiteDatabase db = MainActivity.dbHelper.getReadableDatabase();
//
////					String query = "select * from tree_photo " +
////							"left outer join tree on tree._id = tree_id " +
////							"left outer join photo on photo._id = photo_id " +
////							"left outer join location on location._id = photo.location_id " +
////							"where is_outdated = 'N'";
//
//					String query = "select * from tree " +
//							"left outer join location on location._id = tree.location_id " +
//							"left outer join tree_photo on tree._id = tree_id " +
//							"left outer join photo on photo._id = photo_id ";
//
//					Log.e("query", query);
//
//					photoCursor = db.rawQuery(query, null);
//
//					if (photoCursor.getCount() <= 0) {
//						Toast.makeText(getActivity(), "No trees to update", Toast.LENGTH_SHORT).show();
//						db.close();
//						return;
//					}
//
//					db.close();
//
//					fragment = new UpdateTreeFragment();
//					bundle = getActivity().getIntent().getExtras();
//					fragment.setArguments(bundle);
//
//					fragmentTransaction = getActivity().getSupportFragmentManager()
//							.beginTransaction();
//					fragmentTransaction.replace(R.id.container_fragment, fragment).addToBackStack(ValueHelper.UPDATE_TREE_FRAGMENT).commit();
//				} else {
//					Toast.makeText(getActivity(), "Insufficient GPS accuracy.", Toast.LENGTH_SHORT).show();
//				}
//
//				break;
		}


	}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:66,代码来源:MapsFragment.java

示例11: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_exit_yes:

			MainActivity.syncDataFromExitScreen = true;
			
			fragment = new DataFragment();
			bundle = getActivity().getIntent().getExtras();
			fragment.setArguments(bundle);
			
			fragmentTransaction = getActivity().getSupportFragmentManager()
					.beginTransaction();
			fragmentTransaction.replace(R.id.container_fragment, fragment).addToBackStack(ValueHelper.DATA_FRAGMENT).commit();
			
			FragmentManager manager = getActivity().getSupportFragmentManager();
			FragmentManager.BackStackEntry first = manager.getBackStackEntryAt(0);
			manager.popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
			
			break;		
		case R.id.fragment_exit_no:
			getActivity().finish();
			break;					
	}

	
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:31,代码来源:ExitFragment.java

示例12: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_forgot_password_submit:
			
		boolean validForm = true;
		TextView forgotEmail = (TextView) getActivity().findViewById(R.id.fragment_forgot_password_email_address);
		
		if (forgotEmail .getText().length() == 0) {
			forgotEmail.setError("Please enter your e-mail address.");
			forgotEmail.requestFocus();
			validForm  = false;
		} else if (!android.util.Patterns.EMAIL_ADDRESS.matcher(forgotEmail.getText()).matches()) {
			forgotEmail.setError("Please enter valid e-mail address.");
			forgotEmail.requestFocus();
			validForm = false;
		}
		
		
		if (validForm) {
			InputMethodManager inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
			inputManager.hideSoftInputFromWindow(forgotEmail.getWindowToken(), 0);

			mResetPassTask = new ResetPasswordTask().execute(new String[]{forgotEmail.getText().toString()});
		}
			
			
		break;

	}
	
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:36,代码来源:ForgotPasswordFragment.java

示例13: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

	
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:8,代码来源:AboutFragment.java

示例14: onClick

import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_data_sync:
			Toast.makeText(getActivity(), "Start syncing", Toast.LENGTH_SHORT).show();
			
			syncTreesTask = new SyncTreesTask().execute(new String[]{});
			break;
		case R.id.fragment_data_pause:
			if (clearPendingUpdate != null) {
				clearPendingUpdate.cancel(true);
			}
			
			if (getSettingUpdate != null) {
				getSettingUpdate.cancel(true);
			}
			
			if (getPendingUpdates != null) {
				getPendingUpdates.cancel(true);
			}
			
			
			if (getTreeUpdate != null) {
				getTreeUpdate.cancel(true);
			}

			
			if (syncTreesTask != null) {
				syncTreesTask.cancel(true);
				
			}
			
			Toast.makeText(getActivity(), "Pause syncing", Toast.LENGTH_SHORT).show();
			
			break;				
		case R.id.fragment_data_resume:
			Toast.makeText(getActivity(), "Resume syncing", Toast.LENGTH_SHORT).show();
			
			syncTreesTask = new SyncTreesTask().execute(new String[]{});
			break;				
	}

	
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:48,代码来源:DataFragmentBK.java


注:本文中的android.view.View.performHapticFeedback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。