From 92394b58029f924c5e15f488020ce31a8e793b81 Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Mon, 10 Jan 2011 13:30:31 -0800 Subject: Handle long-press search action diff --git a/src/net/hoopajoo/android/SoftKeys/Globals.java b/src/net/hoopajoo/android/SoftKeys/Globals.java index d715e30..703b32c 100644 --- a/src/net/hoopajoo/android/SoftKeys/Globals.java +++ b/src/net/hoopajoo/android/SoftKeys/Globals.java @@ -225,6 +225,12 @@ public class Globals extends Application { startActivity( ni ); } + public void doLongSearchAction() { + Intent ni = new Intent( Intent.ACTION_SEARCH_LONG_PRESS ); + ni.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity( ni ); + } + private String getDefaultLauncher() { // Set default launcher to the first launcher we find so we don't freak out if it's not // set and there is no com.android.launcher diff --git a/src/net/hoopajoo/android/SoftKeys/Keys.java b/src/net/hoopajoo/android/SoftKeys/Keys.java index c2a4a8c..8312317 100644 --- a/src/net/hoopajoo/android/SoftKeys/Keys.java +++ b/src/net/hoopajoo/android/SoftKeys/Keys.java @@ -515,7 +515,12 @@ public class Keys extends Activity implements OnClickListener, OnLongClickListen break; case R.id.search: - keyids.add( K.KEYID_SEARCH ); + if( longClick ) { + ((Globals)getApplication()).doLongSearchAction(); + return true; + }else{ + keyids.add( K.KEYID_SEARCH ); + } break; case R.id.exit: diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java index c9e19ca..4c9b265 100644 --- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java +++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java @@ -556,7 +556,11 @@ public class SoftKeysService extends Service { break; case R.id.search: - keyid = K.KEYID_SEARCH; + if( longClick ) { + app.doLongSearchAction(); + }else{ + keyid = K.KEYID_SEARCH; + } break; case R.id.exit: -- cgit v0.10.2