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


Java GestureDetector类代码示例

本文整理汇总了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;
}
 
开发者ID:chenkel,项目名称:Lokalisierung-mit-Wearables,代码行数:17,代码来源:BaseGlassActivity.java

示例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;
}
 
开发者ID:akashlevy,项目名称:WhoDatFace,代码行数:20,代码来源:whodatcamera.java

示例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);
}
 
开发者ID:valerino,项目名称:VGCamera,代码行数:20,代码来源:MainActivity.java

示例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();
}
 
开发者ID:a-paxton,项目名称:PsyGlass,代码行数:18,代码来源:UploadActivity.java

示例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();
}
 
开发者ID:a-paxton,项目名称:PsyGlass,代码行数:23,代码来源:GameActivity.java

示例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());
}
 
开发者ID:Mobilevangelist,项目名称:google-glass-kitchen-sink,代码行数:21,代码来源:GestureInputActivity.java

示例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;
}
 
开发者ID:CagataySonmez,项目名称:MobilHackathon2014,代码行数:27,代码来源:ResultsActivity.java

示例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;
}
 
开发者ID:RIVeR-Lab,项目名称:google_glass_driver,代码行数:19,代码来源:MainActivity.java

示例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();
}
 
开发者ID:locateflow,项目名称:gdk-charades-sample-master,代码行数:17,代码来源:BaseGameActivity.java

示例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);

}
 
开发者ID:krazykira,项目名称:CuXtomCam,代码行数:25,代码来源:CuxtomCamActivity.java

示例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());
}
 
开发者ID:GlassTune,项目名称:GlassTune,代码行数:20,代码来源:AlertDialog.java

示例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;
}
 
开发者ID:pt2121,项目名称:NYC-Glass-Challenge-Oct2014,代码行数:23,代码来源:BaseGlassActivity.java

示例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);
}
 
开发者ID:googleglass,项目名称:gdk-apidemo-sample,代码行数:17,代码来源:ContinuousGesturesActivity.java

示例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);
}
 
开发者ID:longzheng,项目名称:PTVGlass,代码行数:17,代码来源:ContinuousGesturesActivity.java

示例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);
}
 
开发者ID:longzheng,项目名称:PTVGlass,代码行数:22,代码来源:BaseScrollActivity.java


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