本文整理汇总了Java中com.google.android.glass.touchpad.GestureDetector类的典型用法代码示例。如果您正苦于以下问题:Java GestureDetector类的具体用法?Java GestureDetector怎么用?Java GestureDetector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GestureDetector类属于com.google.android.glass.touchpad包,在下文中一共展示了GestureDetector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
private GestureDetector createGestureDetector(final Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
//Create a base listener for generic gestures
gestureDetector.setBaseListener(new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP) {
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.DISALLOWED);
}
return false;
}
});
return gestureDetector;
}
示例2: createGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
private GestureDetector createGestureDetector(Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
gestureDetector.setBaseListener(new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if(cameraView != null) {
if(gesture == Gesture.TAP){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if(intent != null) {
startActivityForResult(intent, TAKE_PICTURE_REQUEST);
}
return true;
}
}
return false;
}
});
return gestureDetector;
}
示例3: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// ask for 'ok glass' prompt to accept commands
getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
_mode = OPERATION_MODE.MODE_PREVIEW;
// setup the layout
setupLayout();
// set the overlay labels if we're in overlay mode
setupOverlay();
// set touch/gestures detector, will be catched in onGenericMotionEvent() which, in turn,
// will use the gesture detector's listener logic to react.
_gestureDetector = new GestureDetector(this);
_gestureDetector.setBaseListener(this);
}
示例4: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_upload);
imageView = (ImageView) findViewById(R.id.imageView);
textView = (TextView) findViewById(R.id.textView);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.uploading);
imageView.startAnimation(animation);
gestureDetector = new GestureDetector(this);
gestureDetector.setBaseListener(baseListener);
task = new UploadTask(getPrefDeviceId(), getPrefTimestamp());
task.execute();
}
示例5: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
View view = getLayoutInflater().inflate(R.layout.activity_game, null);
setContentView(view);
sessionColorView = view;
sessionTextView = (TextView) view.findViewById(R.id.sessionTextView);
statusView = view.findViewById(R.id.statusView);
imageView = (ImageView) view.findViewById(R.id.imageView);
textView = (TextView) view.findViewById(R.id.textView);
gestureDetector = new GestureDetector(this);
gestureDetector.setBaseListener(baseListener);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.uploading);
imageView.startAnimation(animation);
server = new ServerConnect(ADDRESS, this);
server.connect();
}
示例6: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_main);
// Save the TextViews for updating later
_titleTextView = (TextView)findViewById(R.id.title);
_titleTextView.setText(R.string.gesture_input);
_instructionsTextView = (TextView)findViewById(R.id.status);
_instructionsTextView.setText(R.string.gesture_instructions);
// Initialze the GestureDetector
_gestureDetector = new GestureDetector(this);
_gestureDetector.setBaseListener(new GestureListener());
_gestureDetector.setFingerListener(new FingerGestureListener());
_gestureDetector.setTwoFingerScrollListener(new TwoFingerGestureListener());
_gestureDetector.setScrollListener(new ScrollListener());
}
示例7: createGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
private GestureDetector createGestureDetector(Context context){
GestureDetector gestureDetector = new GestureDetector(context);
//Create a base listener for generic gestures
gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
Log.d(TAG,"gesture = " + gesture);
switch (gesture) {
case TAP:
Log.d(TAG,"TAP called.");
if(id != 0){
timerHandler.removeCallbacks(timerRunnable);
createCards("��leminiz yap�l�yor...","L�tfen Bekleyin...",R.drawable.refresh);
String addToChartUrl = "http://54.72.214.188:3101/glass/order/"+id+"?token=" + token;
id = 0;
remainingTime = 10;
new HttpAsyncTask().execute(addToChartUrl);
}
return true;
}
return false;
}
});
return gestureDetector;
}
示例8: createGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
private GestureDetector createGestureDetector(Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
//Create a base listener for generic gestures
gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP) {
//On tap, play tap sound and open menu
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.TAP);
openOptionsMenu();
return true;
}
return false;
}
});
return gestureDetector;
}
示例9: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gameplay);
setGesturesEnabled(true);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mGestureDetector = new GestureDetector(this).setBaseListener(mBaseListener);
mPhraseFlipper = (ViewFlipper) findViewById(R.id.phrase_flipper);
mGameState = (TextView) findViewById(R.id.game_state);
mTugRightAnimation = AnimationUtils.loadAnimation(this, R.anim.tug_right);
mModel = createCharadesModel();
updateDisplay();
}
示例10: loadUI
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
/**
* Load UI according to the settings provided by calling activity
*/
private void loadUI() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
previewCameraLayout = new RelativeLayout(this);
previewCameraLayout.setLayoutParams(new LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
// Create an instance of Camera
mCamera = getCameraInstance();
// Create our Preview view and set it as the content of our activity.
mPreview = new CameraPreview(this, mCamera, cameraMode, new Handler());
mPreview.setCameraListener(this);
mOverlay = new CameraOverlay(this);
previewCameraLayout.addView(mPreview);
previewCameraLayout.addView(mOverlay);
setContentView(previewCameraLayout);
tv_recordingDuration = new TextView(this);
mGestureDetector = new GestureDetector(this);
mGestureDetector.setBaseListener(this);
}
示例11: AlertDialog
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
public AlertDialog(Context context, int iconResId,
int textResId, int footnoteResId,
DialogInterface.OnClickListener onClickListener) {
super(context);
mOnClickListener = onClickListener;
mAudioManager =
(AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
mGestureDetector =
new GestureDetector(context).setBaseListener(mBaseListener);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(new CardBuilder(context, CardBuilder.Layout.ALERT)
.setIcon(iconResId)
.setText(textResId)
.setFootnote(footnoteResId)
.getView());
}
示例12: createGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
private GestureDetector createGestureDetector(Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
gestureDetector.setBaseListener(new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP || gesture == Gesture.LONG_PRESS) {
return onTap();
} else if (gesture == Gesture.TWO_TAP) {
return onTwoTap();
} else if (gesture == Gesture.SWIPE_RIGHT) {
return onSwipeRight();
} else if (gesture == Gesture.SWIPE_LEFT) {
return onSwipeLeft();
} else if (gesture == Gesture.SWIPE_DOWN) {
return onSwipeDown();
}
return false;
}
});
return gestureDetector;
}
示例13: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_continuous_gestures);
mScrollType = (TextView) findViewById(R.id.scroll_type);
mDisplacement = (TextView) findViewById(R.id.displacement);
mDelta = (TextView) findViewById(R.id.delta);
mVelocity = (TextView) findViewById(R.id.velocity);
// Initialize the gesture detector and set the activity to listen to the continuous
// gestures.
mGestureDetector = new GestureDetector(this)
.setOneFingerScrollListener(this).setTwoFingerScrollListener(this);
}
示例14: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_continuous_gestures);
mScrollType = (TextView) findViewById(R.id.scroll_type);
mDisplacement = (TextView) findViewById(R.id.displacement);
mDelta = (TextView) findViewById(R.id.delta);
mVelocity = (TextView) findViewById(R.id.velocity);
// Initialize the gesture detector and set the activity to listen to the continuous
// gestures.
mGestureDetector = new GestureDetector(this)
.setScrollListener(this).setTwoFingerScrollListener(this);
}
示例15: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mView = new CardScrollView(this) {
@Override
public final boolean dispatchGenericFocusedEvent(MotionEvent event) {
if (mDetector.onMotionEvent(event)) {
return true;
}
return super.dispatchGenericFocusedEvent(event);
}
};
mView.setHorizontalScrollBarEnabled(true);
setAdapter(mView);
setContentView(mView);
mDetector = new GestureDetector(this).setBaseListener(this);
}