private Android.Glass.Touchpad.GestureDetector createGestureDetector(Context context) { //Set up and add a listener for the double-tap gesture GestureListener listener = new GestureListener(); listener.OnUpdateStatus += listener_OnUpdateStatus; var gestureDetector = new Android.Glass.Touchpad.GestureDetector(context); gestureDetector.SetBaseListener(listener); return(gestureDetector); }
protected async override void OnCreate(Bundle bundle) { //Generic onCreate for the activity base.OnCreate(bundle); //Gesture management gestureDetector = createGestureDetector(this); //Stops Glass from turning the screen off Window.AddFlags(WindowManagerFlags.KeepScreenOn); //Creates the AudioManager for the tap responses audioManager = (AudioManager)GetSystemService(Context.AudioService); //Load hashtag history using preferences prefs = GetSharedPreferences("tweets", 0); HashSet <String> defaultPrefs = new HashSet <String>(); defaultPrefs.Add("YOlO"); var tempHashtagPrefs = prefs.GetStringSet("hashtags", defaultPrefs); foreach (var x in tempHashtagPrefs) { hashtagPrefs.Add(x); } //Create title card cards = new List <Card>(); AddCard("YOLO (for Glass", "Tap to load cards"); //Set up card scroller scroller = new CardScrollView(this); scroller.Adapter = adapter; //Handles touchpad tap scroller.ItemClick += (system, e) => tweetRefresh(); //Twitter auth and setup var tht = new TwitterHashtags.TwitterHashtags(); auth = await tht.doAuth(); //Activate the view SetContentView(scroller); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Log.Info("GlassPrompter", "boot"); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); scroller = FindViewById <ScrollView>(Resource.Id.scroller); listLayout = FindViewById <LinearLayout>(Resource.Id.listLayout); layoutRoot = FindViewById <LinearLayout>(Resource.Id.layoutRoot); indicator = FindViewById <GridView>(Resource.Id.gridView1); scriptLines = getLinesFromScript(fullScript); lineCount = scriptLines.Count; scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); scriptLines.Add(""); //figure out recognizer IList <ResolveInfo> services = this.ApplicationContext.PackageManager.QueryIntentServices( new Intent(RecognitionService.ServiceInterface), 0); if (services.Count == 0) { return; } ResolveInfo ri = services[0]; var pkg = ri.ServiceInfo.PackageName; var cls = ri.ServiceInfo.Name; speechComp = new ComponentName(pkg, cls); CreateLines(); SetLines(); mGestureDetector = createGestureDetector(this); SetupSpeechReco(); startReco(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); try { SetContentView(Resource.Layout.activity_discrete_gestures); _lastGesture = (TextView)FindViewById(Resource.Id.last_gesture); _fingerCount = (TextView)FindViewById(Resource.Id.finger_count); _swipeAgainTip = (TextView)FindViewById(Resource.Id.swipe_again_tip); // Initialize the gesture detector and set the activity to listen to discrete gestures. _gestureDetector = new Android.Glass.Touchpad.GestureDetector(this).SetBaseListener(this).SetFingerListener(this); } catch (Exception ex) { } }
private Android.Glass.Touchpad.GestureDetector createGestureDetector(Context context) { Android.Glass.Touchpad.GestureDetector gestureDetector = new Android.Glass.Touchpad.GestureDetector(context); gestureDetector.SetBaseListener(new GestureDetectorImpl(this)); return(gestureDetector); }