Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Block long press to avoid accidentally launching Google Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Sundin committed Nov 7, 2013
1 parent 5379654 commit 4325f05
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
46 changes: 26 additions & 20 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stefansundin.glass.movies"
android:versionCode="1"
android:versionName="1.0" >
package="com.stefansundin.glass.movies"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15"/>

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<application
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<receiver android:name="com.stefansundin.glass.BlockLongTapReceiver">
<intent-filter android:priority="1000">
<action android:name="com.google.glass.action.LONG_PRESS"/>
</intent-filter>
</receiver>
</application>

</manifest>
17 changes: 17 additions & 0 deletions src/com/stefansundin/glass/BlockLongTapReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.stefansundin.glass;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BlockLongTapReceiver extends BroadcastReceiver {

public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.google.glass.action.LONG_PRESS")) {
abortBroadcast();
Log.d("stefan", "Blocking long press.");
}
}

}
3 changes: 2 additions & 1 deletion src/com/stefansundin/glass/movies/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.stefansundin.glass.movies;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
Expand Down Expand Up @@ -35,7 +36,7 @@ protected void onCreate(Bundle savedInstanceState) {
mListView.setAdapter(mMovieList);

mMovieDirectory = Environment.getExternalStorageDirectory()+"/"+Environment.DIRECTORY_MOVIES;
//Log.d("stefan", "Movie directory: "+mMovieDirectory);
Log.d("stefan", "Movie directory: "+mMovieDirectory);

ArrayList<String> filenames = new ArrayList<String>();
File dir = new File(mMovieDirectory);
Expand Down

0 comments on commit 4325f05

Please sign in to comment.