summaryrefslogtreecommitdiffstats
path: root/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2011-01-04 23:11:37 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2011-01-04 23:11:37 (GMT)
commit27e58b98fa26d9f9986d9421bec61e0eb837fc07 (patch)
tree2861f5147ce8b697cbad417fc22f08605a131869 /src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
parentc8c2f024a5fd55cb570d744f965f23acc5744ced (diff)
downloadSoftKeys-27e58b98fa26d9f9986d9421bec61e0eb837fc07.zip
SoftKeys-27e58b98fa26d9f9986d9421bec61e0eb837fc07.tar.gz
SoftKeys-27e58b98fa26d9f9986d9421bec61e0eb837fc07.tar.bz2
Moved main key sending stuff in to globals, added new smaller activity to
receive the intents, intents are generic now allowing sending any keycode once the extras are set
Diffstat (limited to 'src/net/hoopajoo/android/SoftKeys/SoftKeysService.java')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/SoftKeysService.java93
1 files changed, 56 insertions, 37 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
index 1118406..bdfe63e 100644
--- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
+++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java
@@ -71,43 +71,14 @@ public class SoftKeysService extends Service {
OnClickListener c = new OnClickListener() {
@Override
public void onClick( View v ) {
- // send an intent to the main window
- Intent i = null;
- boolean hide = auto_hide;
- switch( v.getId() ) {
- case R.id.home:
- i = new Intent( Keys.ACTION_HOME );
- break;
-
- case R.id.back:
- i = new Intent( Keys.ACTION_BACK );
- if( hide ) {
- hide = auto_hide_after_back;
- }
- break;
-
- case R.id.menu:
- i = new Intent( Keys.ACTION_MENU );
- break;
-
- case R.id.search:
- i = new Intent( Keys.ACTION_SEARCH );
- break;
-
- case R.id.exit:
- hide = true;
- break;
- }
-
- if( i != null ) {
- i.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
- i.setClass( v.getContext(), Keys.class );
- v.getContext().startActivity( i );
- }
-
- if( hide ) {
- toggle_bar();
- }
+ genericClick( v, false );
+ }
+ };
+
+ OnLongClickListener lc = new OnLongClickListener() {
+ @Override
+ public boolean onLongClick( View v ) {
+ return genericClick( v, true );
}
};
@@ -416,6 +387,54 @@ public class SoftKeysService extends Service {
}
+ private boolean genericClick( View v, boolean longclick) {
+ // send an intent to the main window
+ Intent i = null;
+ boolean hide = auto_hide;
+ switch( v.getId() ) {
+ case R.id.home:
+ i = new Intent( SendInput.ACTION_CODE );
+ i.putExtra( "keyname", "home" );
+ break;
+
+ case R.id.back:
+ i = new Intent( SendInput.ACTION_CODE );
+ i.putExtra( "keyname", "back" );
+ if( hide ) {
+ hide = auto_hide_after_back;
+ }
+ break;
+
+ case R.id.menu:
+ i = new Intent( SendInput.ACTION_CODE );
+ i.putExtra( "keyname", "menu" );
+ break;
+
+ case R.id.search:
+ i = new Intent( SendInput.ACTION_CODE );
+ i.putExtra( "keyname", "search" );
+ break;
+
+ case R.id.exit:
+ hide = true;
+ break;
+ }
+
+ if( i != null ) {
+ i.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
+ i.putExtra( "long", longclick );
+
+ //i.setClass( v.getContext(), Keys.class );
+ v.getContext().startActivity( i );
+ }
+
+ if( hide ) {
+ toggle_bar();
+ }
+
+ return true;
+ }
+
@Override
public void onDestroy() {
super.onDestroy();