本文整理汇总了Java中com.google.android.glass.touchpad.GestureDetector.setFingerListener方法的典型用法代码示例。如果您正苦于以下问题:Java GestureDetector.setFingerListener方法的具体用法?Java GestureDetector.setFingerListener怎么用?Java GestureDetector.setFingerListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.glass.touchpad.GestureDetector
的用法示例。
在下文中一共展示了GestureDetector.setFingerListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recognition);
readBundle(savedInstanceState);
mListView = (ListView) findViewById(R.id.list);
mAdapter = new SpeechAdapter(this, mSpeechDatas);
mListView.setAdapter(mAdapter);
mListView.setOnTouchListener(mOnTouchListener);
findViewById(R.id.container).setOnTouchListener(mOnTouchListener);
mStatusText = (TextView) findViewById(R.id.lbl_status);
mSliderView = (SliderView) findViewById(R.id.indeterm_slider);
if (App.runningOnGoogleGlass()) {
mGestureDetector = new GestureDetector(this);
mGestureDetector.setAlwaysConsumeEvents(true);
mGestureDetector.setBaseListener(mBaseListener);
mGestureDetector.setScrollListener(mScrollListener);
mGestureDetector.setFingerListener(mFingerListener);
}
setStatus(R.string.recog_tap_and_hold);
}
示例3: 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) {
Log.v(TAG, "onSwipeTap");
return onTap();
} else if (gesture == Gesture.TWO_TAP) {
Log.v(TAG, "onSwipeTwoTap");
return onTwoTap();
} else if (gesture == Gesture.SWIPE_RIGHT) {
Log.v(TAG, "onSwipeRight");
return onSwipeRight();
} else if (gesture == Gesture.SWIPE_LEFT) {
Log.v(TAG, "onSwipeLeft");
return onSwipeLeft();
}
return false;
}
});
gestureDetector.setFingerListener(this);
gestureDetector.setScrollListener(this);
return gestureDetector;
}
示例4: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_volume);
mVolumeIcon = (ImageView)findViewById(R.id.volume_icon);
mVolumeSeek = (SeekBar)findViewById(R.id.volume_seek);
mVolumeHelper = new VolumeHelper(mContext);
int headsetState = VolumeHelper.getHeadsetState(mContext);
mNumVolumeValues = VolumeHelper.getNumVolumeValues(headsetState);
mVolumeSeek.setMax(mNumVolumeValues - 1);
mVolumeSeek.setOnSeekBarChangeListener(mSeekBarChangeListener);
mVolume = mVolumeHelper.readAudioVolume();
updateVolumeDrawable(mVolume);
mVolumeSeek.setProgress(mVolume);
mSoundManager = new SoundManager(mContext);
// used to move the seekbar. temporary solution until
// the GDK improves
mGestureDetector = new GestureDetector(mContext);
mGestureDetector.setBaseListener(mBaseListener);
mGestureDetector.setFingerListener(mFingerListener);
mGestureDetector.setScrollListener(mScrollListener);
mHandler = new Handler();
}
示例5: 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.SWIPE_RIGHT) {
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.SELECTED);
return true;
}
else if (gesture == Gesture.SWIPE_LEFT){
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.SELECTED);
}
else if (gesture == Gesture.TWO_SWIPE_RIGHT){
}
else if (gesture == Gesture.TWO_SWIPE_LEFT){
}
else if (gesture == Gesture.TAP){
}
return false;
}
});*/
gestureDetector.setFingerListener(new GestureDetector.FingerListener() {
//ScrollView mScrollBody = (ScrollView)findViewById(R.id.scrollBody);
@Override
public void onFingerCountChanged(int previousCount, int currentCount) {
if(currentCount == 2){
mCardScrollView.deactivate();
}else{
mCardScrollView.activate();
mCardScrollView.requestFocus();
}
}
});
return gestureDetector;
}
示例6: initGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入方法依赖的package包/类
private void initGestureDetector(Context context) {
mGestureDetector = new GestureDetector(context);
mGestureDetector.setBaseListener(new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if(gesture == Gesture.TAP) {
startActivityForResult(new Intent(MapActivity.this, MenuActivity.class), 1);
return true;
} else if(gesture == Gesture.TWO_TAP) {
return true;
} else if(gesture == Gesture.SWIPE_RIGHT) {
return true;
} else if(gesture == Gesture.SWIPE_LEFT) {
return true;
} else if(gesture == Gesture.TWO_LONG_PRESS) {
// toggleMotionControl();
// enableMyo();
}
// else if(gesture == Gesture.SWIPE_DOWN) {
// Log.d("ArcGIS", "Received swipe down, about to finish");
// finish();
// return true;
// }
return false;
}
});
mGestureDetector.setFingerListener(new GestureDetector.FingerListener() {
@Override
public void onFingerCountChanged(int previousCount, int currentCount) {
}
});
mGestureDetector.setTwoFingerScrollListener( new GestureDetector.TwoFingerScrollListener() {
@Override
public boolean onTwoFingerScroll(float displacement, float delta, float velocity) {
if((displacement > 0 && delta < 0) || (displacement < 0 && delta > 0)) { delta = -delta;}
float factor = 1.0f + (delta/100.0f);
// mMapView.zoomTo(mMapView.getCenter(), factor);
// mMapView.doubleTapZoom(factor);
return true;
}
});
}
示例7: onCreate
import com.google.android.glass.touchpad.GestureDetector; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
mSpeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
public void onInit(int status) {
// Must be declared for TTS
}
});
// Block wink gesture
mIntentBlocker = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
abortBroadcast();
Log.d("stefan", "Blocking intent.");
}
};
IntentFilter filter = new IntentFilter();
filter.addAction("com.google.glass.action.EYE_GESTURE");
registerReceiver(mIntentBlocker, filter);
ArrayAdapter<String> movieList = new ArrayAdapter<String>(this, android.R.layout.test_list_item);
ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(movieList);
mMovieDirectory = Environment.getExternalStorageDirectory()+"/"+Environment.DIRECTORY_MOVIES;
Log.d("stefan", "Movie directory: "+mMovieDirectory);
File dir = new File(mMovieDirectory);
File[] files = dir.listFiles();
if (files.length == 0) {
String error = "Yo, get some video files first";
movieList.add(error);
say(error);
}
else {
ArrayList<String> filenames = new ArrayList<String>();
for (File file : files) {
filenames.add(file.getName());
}
java.util.Collections.sort(filenames);
for (String filename : filenames) {
movieList.add(filename);
}
listView.setSelection(0);
}
Touchpad touchpad = new Touchpad(listView, this);
mGestureDetector = new GestureDetector(this);
mGestureDetector.setBaseListener(touchpad);
mGestureDetector.setFingerListener(touchpad);
mGestureDetector.setScrollListener(touchpad);
}
示例8: initGestureDetector
import com.google.android.glass.touchpad.GestureDetector; //导入方法依赖的package包/类
private void initGestureDetector() {
mTouchDetector = new GestureDetector(this);
mTouchDetector.setBaseListener(mBaseListener);
mTouchDetector.setFingerListener(mFingerListener);
mTouchDetector.setScrollListener(mScrollListener);
}