List of usage examples for android.inputmethodservice Keyboard KEYCODE_DELETE
int KEYCODE_DELETE
To view the source code for android.inputmethodservice Keyboard KEYCODE_DELETE.
Click Source Link
From source file:com.strathclyde.highlightingkeyboard.SoftKeyboardService.java
/** * Finish the current session//from w ww . j av a 2 s. com * Set session end time * Record high, low errors, suggestions picked * Dump session data to db */ public void endSession() { long endtime = System.currentTimeMillis(); //Log.i("Session End", ""+endtime/1000); if (currentSession != null) { currentSession.end_time = endtime; currentSession.user = userid; if (currentSession.events.size() <= 0) { //Log.i("Session End","No Events\n Event Dump follows"); //currentSession.printall(); currentSession = null; return; } //if the last event was a backspace add the deleted char to the suspects if (currentSession.events.size() > 0 && currentSession.events .get(currentSession.events.size() - 1).keyCode == Keyboard.KEYCODE_DELETE) { currentSession.suspects.add(lastDeleted); //System.out.println("Suspect = "+lastDeleted); } try { if (!firstWordSet) currentSession.getFirstWord((String) extr.text, composition); } catch (Exception e) { System.out.println("Error getting current text"); } //clear out all the characters SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (sp.getBoolean("fullLogging", false) == false) { for (int x = 0; x < currentSession.events.size(); x++) { //don't record anything but backspaces if (currentSession.events.get(x).keyCode != -5) { currentSession.events.get(x).keyCode = -400; currentSession.events.get(x).keyChar = '$'; } } } //Log.i("Session End","Event Dump follows"); currentSession.end_time = endtime; //currentSession.nHighErrors=nHighErrors; //currentSession.nLowErrors=nLowErrors; //currentSession.nSuggestionsPicked=nSuggestionsPicked; //currentSession.nInjections=nInjections; currentSession.printall(); dbm.insert(currentSession); //Log.i("Session End",""+currentSession.end_time); currentSession = null; extr = null; firstWordSet = false; composition = null; if (coreEngine != null) coreEngine.resetCoreString(); dbm.close(); if (ic != null) ic.finishComposingText(); } }
From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java
/** * Use this to monitor key events being delivered to the application. * We get first crack at them, and can either resume them or let them * continue to the app.// w ww. ja v a2s. c om */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { String s = "" + event.getUnicodeChar(); Log.d("CAME HERE", "CAME HERE"); switch (keyCode) { case KeyEvent.KEYCODE_BACK: // The InputMethodService already takes care of the back // key for us, to dismiss the input method if it is shown. // However, our keyboard could be showing a pop-up window // that back should dismiss, so we first allow it to do that. if (event.getRepeatCount() == 0 && mInputView != null) { if (mInputView.handleBack()) { return true; } } break; case KeyEvent.KEYCODE_DEL: // Special handling of the delete key: if we currently are // composing text for the user, we want to modify that instead // of let the application to the delete itself. if (mComposing.length() > 0) { onKey(Keyboard.KEYCODE_DELETE, null); return true; } break; case KeyEvent.KEYCODE_ENTER: // Let the underlying text editor always handle these. return false; default: // For all other keys, if we want to do transformations on // text being entered with a hard keyboard, we need to process // it and do the appropriate action. if (PROCESS_HARD_KEYS) { //*********added changes here if (event.getAction() == KeyEvent.ACTION_DOWN) { swipe += (char) event.getUnicodeChar(); Log.d("msg", swipe); System.out.println(swipe); // keyDownUp(keyCode); // return true; } //*********done if (keyCode == KeyEvent.KEYCODE_SPACE && (event.getMetaState() & KeyEvent.META_ALT_ON) != 0) { // A silly example: in our input method, Alt+Space // is a shortcut for 'android' in lower case. InputConnection ic = getCurrentInputConnection(); if (ic != null) { // First, tell the editor that it is no longer in the // shift state, since we are consuming this. ic.clearMetaKeyStates(KeyEvent.META_ALT_ON); keyDownUp(KeyEvent.KEYCODE_A); keyDownUp(KeyEvent.KEYCODE_N); keyDownUp(KeyEvent.KEYCODE_D); keyDownUp(KeyEvent.KEYCODE_R); keyDownUp(KeyEvent.KEYCODE_O); keyDownUp(KeyEvent.KEYCODE_I); keyDownUp(KeyEvent.KEYCODE_D); // And we consume this event. return true; } } if (mPredictionOn && translateKeyDown(keyCode, event)) { return true; } } } return super.onKeyDown(keyCode, event); }
From source file:com.strathclyde.highlightingkeyboard.SoftKeyboardService.java
/** * Use this to monitor key events being delivered to the application. * We get first crack at them, and can either resume them or let them * continue to the app./*from w ww . j a v a 2 s. co m*/ */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { //event. //Log.i("OnKeyDown", "Keycode: "+keyCode); switch (keyCode) { case KeyEvent.KEYCODE_BACK: // The InputMethodService already takes care of the back // key for us, to dismiss the input method if it is shown. // However, our keyboard could be showing a pop-up window // that back should dismiss, so we first allow it to do that. if (event.getRepeatCount() == 0 && mInputView != null) { if (mInputView.handleBack()) { return true; } } break; case KeyEvent.KEYCODE_DEL: // Special handling of the delete key: if we currently are // composing text for the user, we want to modify that instead // of let the application to the delete itself. if (mComposing.length() > 0) { onKey(Keyboard.KEYCODE_DELETE, null); return true; } break; case -2: //123 button //Log.i("KeyDown", "Keycode: "+keyCode); event.startTracking(); return true; case KeyEvent.KEYCODE_ENTER: // Let the underlying text editor always handle these. return false; default: // For all other keys, if we want to do transformations on // text being entered with a hard keyboard, we need to process // it and do the appropriate action. if (PROCESS_HARD_KEYS) { if (keyCode == KeyEvent.KEYCODE_SPACE && (event.getMetaState() & KeyEvent.META_ALT_ON) != 0) { // A silly example: in our input method, Alt+Space // is a shortcut for 'android' in lower case. //InputConnection ic = ic; if (ic != null) { // First, tell the editor that it is no longer in the // shift state, since we are consuming this. ic.clearMetaKeyStates(KeyEvent.META_ALT_ON); keyDownUp(KeyEvent.KEYCODE_A); keyDownUp(KeyEvent.KEYCODE_N); keyDownUp(KeyEvent.KEYCODE_D); keyDownUp(KeyEvent.KEYCODE_R); keyDownUp(KeyEvent.KEYCODE_O); keyDownUp(KeyEvent.KEYCODE_I); keyDownUp(KeyEvent.KEYCODE_D); // And we consume this event. return true; } } if (mPredictionOn && translateKeyDown(keyCode, event)) { return true; } } } return super.onKeyDown(keyCode, event); }
From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java
public void onKey(int primaryCode, int[] keyCodes) { /*String tap_file_name; String currentmood = "-99";/*from ww w. ja v a2 s . c om*/ boolean esm_event=false,esm_signal=false,esm_time=false; //SimpleDateFormat sdf = new SimpleDateFormat("yyyy:MM:dd__HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat(getResources().getString(R.string.time_format)); String currentDateandTime = sdf.format(new Date()); //boolean mood_rdy_to_record; //Store the timestamp in SharedPref //SharedPreferences prefs = getApplicationContext().getSharedPreferences(getResources().getString(R.string.sharedpref_file), Context.MODE_WORLD_READABLE); SharedPreferences prefs = getApplicationContext().getSharedPreferences(getApplicationContext().getResources().getString(R.string.sharedpref_file), Context.MODE_WORLD_READABLE); //currentDateandTime1=prefs.getString("TimeStamp", "No Data"); //System.out.println("[TimeStamp:"+currentDateandTime1+"]"); //SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor seditor =prefs.edit(); seditor.putString(getResources().getString(R.string.sharedpref_tstamp), currentDateandTime); seditor.putString(getResources().getString(R.string.sharedpref_last_app_name), getAppName()); seditor.putBoolean(getResources().getString(R.string.sharedpref_mood_rdy_to_record), true); //seditor.putString(getResources().getString(R.string.sharedpref_last_app_name), getAppName()); //editor.apply(); seditor.apply(); seditor.commit(); //System.out.println("Current Mood to Record:"+prefs.getBoolean(getResources().getString(R.string.sharedpref_mood_rdy_to_record),false)); //Retrieve current mood from sharedpref try { Context con = getApplicationContext().createPackageContext(getResources().getString(R.string.moodrecorder_pkg), Context.CONTEXT_IGNORE_SECURITY); SharedPreferences mood_pref = con.getSharedPreferences(getResources().getString(R.string.tap_mood_sharedpref_file), Context.MODE_MULTI_PROCESS); currentmood = mood_pref.getString(getResources().getString(R.string.sharedpref_current_mood), "-99"); esm_event = mood_pref.getBoolean(getResources().getString(R.string.sharedpref_esm_event),false); esm_signal = mood_pref.getBoolean(getResources().getString(R.string.sharedpref_esm_signal),false); esm_time = mood_pref.getBoolean(getResources().getString(R.string.sharedpref_esm_time),false); System.out.println("Current Mood:" + currentmood); } catch (Exception e) { e.printStackTrace(); }*/ SimpleDateFormat sdf = new SimpleDateFormat(getResources().getString(R.string.time_format)); String currentDateandTime = sdf.format(new Date()); ContentValues values = new ContentValues(); values.put(KbTouchEvent.TouchEntry.TE_APP_NAME, getAppName()); values.put(KbTouchEvent.TouchEntry.TE_TIMESTAMP, currentDateandTime); //values.put(TouchEvent.TouchEntry.TE_KEY, String.valueOf((char)primaryCode)); values.put(KbTouchEvent.TouchEntry.TE_KEY, primaryCode); Uri uri = getContentResolver().insert(KbContentProvider.CONTENT_URI, values); //End of retrieving current mood from sharedpref //currentDateandTime1=prefs.getString("TimeStamp", "No Data"); //System.out.println("[TimeStamp:"+currentDateandTime1+"]"); String keypress = String.valueOf((char) primaryCode); Log.d("Key Pressed", keypress); System.out.println("Ascii value:" + (int) keypress.charAt(0)); /*if(Character.va >=){ }*/ //System.out.println("Alternate way key pressed:"+Character.toChars(primaryCode)[0]); /*String string_t; //string_t = currentDateandTime+ " ----> " + "X = " + x_Coordinate + ", Y = "+y_Coordinate+ "\n"; //string_t = getAppName() + "," + currentDateandTime+ "," + keypress + "\n"; string_t = getAppName() + "," + currentDateandTime + "," + currentmood + "," + esm_event + "," + esm_signal + "," + esm_time + "\n"; //tap_file_name = imei_no + getResources().getString(R.string.tap_file_postfix); tap_file_name = imei_no + "_" + tap_ctr + getResources().getString(R.string.tap_file_postfix); File tap_file = new File(dataDir, tap_file_name); try{ //String SDCARD = Environment.getExternalStorageDirectory().getAbsolutePath(); //String FILENAME = "keylogger.txt"; //File outfile = new File(SDCARD+File.separator+FILENAME); FileOutputStream fos = new FileOutputStream(tap_file,true); fos.write(string_t.getBytes()); fos.close(); }catch(Exception e) { Log.d("EXCEPTION",e.getMessage()); } //Checks file size and move to ToBeUploaded folder int tap_file_size = Integer.parseInt(String.valueOf(tap_file.length() / 1024)); //mood_file_size = mood_file_size /4; int tap_file_size_threshold = Integer.parseInt(getResources().getString(R.string.tap_file_size_limit)); System.out.println("Tap File Size:" + tap_file_size + ", Tap File Threshold:" + tap_file_size_threshold ); if (tap_file_size > tap_file_size_threshold) { int ctr = Integer.parseInt(tap_ctr) + 1; tap_ctr=String.valueOf(ctr); tap_ctr=String.format("%06d", Integer.parseInt(tap_ctr)); //String.format("%05d", Integer.parseInt(mood_ctr)); move_file(tap_file_name); }*/ /********************************************************important edit edit 6****************************************/ InputConnection ic = getCurrentInputConnection(); // playClick(primaryCode) String suggested_string = ""; /***********************************************************check edit***********************************************/ if (isWordSeparator(primaryCode)) { // Handle separator if (mComposing.length() > 0) { commitTyped(getCurrentInputConnection()); swipe = ""; } sendKey(primaryCode); updateShiftKeyState(getCurrentInputEditorInfo()); } else if (primaryCode == Keyboard.KEYCODE_DELETE) { handleBackspace(); } else if (primaryCode == Keyboard.KEYCODE_SHIFT) { handleShift(); } else if (primaryCode == Keyboard.KEYCODE_CANCEL) { handleClose(); return; } else if (primaryCode == KbLatinKeyboardView.KEYCODE_OPTIONS) { // Show a menu or somethin' } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE && mInputView != null) { Keyboard current = mInputView.getKeyboard(); if (current == mSymbolsKeyboard || current == mSymbolsShiftedKeyboard) { current = mQwertyKeyboard; } else { current = mSymbolsKeyboard; } mInputView.setKeyboard(current); if (current == mSymbolsKeyboard) { current.setShifted(false); } } else { /****************************************************************8default handling******************************************/ char code = (char) primaryCode; if (swipe2.length() != 0 && code != swipe2.charAt(swipe2.length() - 1)) { swipe2 += "+" + code; } if (frequent_char == 0 || frequent_char == code || frequent_char == test.charAt(0)) test += ".*" + code; else test += ".*" + frequent_char + ".*" + code; Log.d("Pattern", test); if (Character.isLetter(code) && mCapsLock) { code = Character.toUpperCase(code); } if (swipe2.length() < 3) { ic.commitText(String.valueOf(code), 1); swipe = ""; swipe2 = ""; } else { suggested_string = strings_matched(test); suggested_string += " "; if (suggested_string.length() <= 1) { ic.commitText(String.valueOf(code), 1); } else ic.commitText(suggested_string, suggested_string.length()); //handleCharacter(primaryCode, keyCodes); } } }
From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java
/******************************************************edit5 ended**************************************************************/ public void onRelease(int primaryCode) { /*********************************************edit3************************************************************/ if (!(primaryCode == Keyboard.KEYCODE_DELETE || primaryCode == Keyboard.KEYCODE_SHIFT || (char) primaryCode == ' ')) {//record time when finger lifted up end = System.currentTimeMillis(); //calculate duration duration = (end - start) / 1000; //pressure is pressure/nt pressure = pressure / np_event;//w w w.j av a 2 s . c o m Log.d("ans", "X velocity: " + x_vel / n_event); Log.d("ans", "Y velocity: " + y_vel / n_event); //save into database sf.set_duration(duration); sf.set_pressure(pressure); sf.set_speed(velocity); featuredb.add_feature(sf, this); // featuredb.databasetoString(); } //end saving start = 0; end = 0; pressure = 0; np_event = 1; x_vel = 0; y_vel = 0; n_event = 1; swipe = ""; test = ""; /****************************edit3 ended*************************************************************************/ }
From source file:com.strathclyde.highlightingkeyboard.SoftKeyboardService.java
/** * Manages actual input into the editor. Here we: * implement our injection algorithm as required * store data relating to the key press/*from ww w . j a v a2 s. com*/ * initiate any spell checking as required */ public void onKey(int primaryCode, int[] keyCodes) { // touches all done, add the chars to the event and then the event to the session currentEvent.keyCode = primaryCode; if (errorInjection && primaryCode >= 32) { //give a n% chance of the key being modified Random r = new Random(); int res = r.nextInt(100); if (res <= errorInjectionThreshold) //%n chance of key being modified { //Log.i("OnKey", "Will modify"); try { //for each combination in the model, find the eucleidian distance and the replacement freq JSONObject targetObj = suspectReplacementDistribution .getJSONObject(Integer.toString(primaryCode)); Iterator<?> keys = targetObj.keys(); ArrayList<Character> list = new ArrayList(); while (keys.hasNext()) { String key = (String) keys.next(); int freq = targetObj.getInt(key); //if the frequency is 0, add the suspect as a replacement candidate double dist = keyModel.distance2(primaryCode, Integer.parseInt(key)); if (dist > 0) { if (dist > 2.0) //fix it so that only nearby keys have a chance of being elected dist = 100; //add to the list of candidates as many times as required if specific freq>0; int sfreq = (int) Math.round(freq / dist); //Log.i("Test", "Freq/Dist to "+key+": "+freq+"/"+dist+" final prob: "+sfreq); if (sfreq == 0) //add the suspect as a replacement candidate { list.add(Character.toChars(primaryCode)[0]); } else //add the other replacement candidates as required { for (int x = 0; x < targetObj.getInt(key); x++) { list.add(Character.toChars(Integer.parseInt(key))[0]); } } } } //Log.i("OnKey", "Replace list size: "+list.size()); Random x = new Random(); int sel = x.nextInt(list.size()); //if the replacement eventually happens if ((int) list.get(sel) != primaryCode) { if (errorInjectionSound) { final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); tg.startTone(ToneGenerator.TONE_CDMA_SOFT_ERROR_LITE); } //primaryCode = (int)list.get(sel); //Log.w("OnKey", "Replace "+Character.toChars(primaryCode)[0]+" with "+list.get(sel)); errorMap.put(mComposing.length(), (char) (int) list.get(sel)); //put in our current position and the replacement //nInjections++; } else Log.i("OnKey", "Replacement will not happen, same key selected"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { //Log.i("OnKey", "Will not modify, r="+res); } } //switch adaptxt language if necessary if (coreEngine != null) { switch (mInputView.currentKeyboard) { case KeyboardViews.QWERTY_EL: coreEngine.activateLanguageKeymap(131092, null); coreEngine.setDictionaryPriority(131092, 0); break; case KeyboardViews.QWERTY_EN: coreEngine.activateLanguageKeymap(131081, null); coreEngine.setDictionaryPriority(131092, 1); break; } } //get the full inputted text extr = ic.getExtractedText(new ExtractedTextRequest(), 0); if (currentEvent != null && captureData == true) { //Log.i("OnKey", "OK to capture data!"); currentEvent.user = userid; if (primaryCode > 0) currentEvent.keyChar = (char) primaryCode; //handle the booleans if (currentSession.events.get(currentSession.events.size() - 1).keyChar == ' ') //space { currentEvent.followsSpace = true; } if (currentEvent.keyCode == Keyboard.KEYCODE_DELETE) { System.out.println("Backspace Pressed!"); //if a delete is pressed after another delete //and its cursor position is not -1 from the previous delete //we must commit the previous deletion as a suspect character. if (currentSession.events.get(currentSession.events.size() - 1).keyCode == Keyboard.KEYCODE_DELETE && extr.selectionStart != lastDeletedPos - 1) { currentSession.suspects.add(lastDeleted); //System.out.println("Suspect = "+lastDeleted); } //get all the text before the backspace press and the current cursor position if (extr.selectionStart > 0) { lastDeleted = extr.text.charAt(extr.selectionStart - 1); lastDeletedPos = extr.selectionStart; //System.out.println("Deleted = "+lastDeleted+"\nCursor Position = "+extr.selectionStart); } } //if the current key is NOT a backspace but the previous one was if (currentEvent.keyCode != Keyboard.KEYCODE_DELETE && currentSession.events .get(currentSession.events.size() - 1).keyCode == Keyboard.KEYCODE_DELETE) { currentSession.suspects.add(lastDeleted); //System.out.println("Suspect = "+lastDeleted); } } //do the handling if (isWordSeparator(primaryCode)) { // Handle separator //System.out.println("Detected a word separator \""+primaryCode+"\""); if (primaryCode != 32) { shouldInsertSpace = false; if (extr.text.length() > 0) { //Log.i("On Key ", "last letter after separator was ["+extr.text.charAt(extr.selectionStart-1)+"]"); //check if the previous char was a space, if so delete it. if (extr.text.charAt(extr.selectionStart - 1) == ' ' && !isSpecialSeparator(primaryCode)) //detecting if the current char is not part of a smiley face { onKey(-5, null); } } } //clear the touch history clearDots(); //ensure spell checker is using correct language SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); Editor ed = prefs.edit(); if (captureData) { if (mInputView.currentLang == 1) //english { ed.putString("available_dicts", "en"); ed.commit(); if (mScs != null) mScs.close(); String lang = prefs.getString("available_dicts", "jam"); Log.i("OnKey", "Spellcheck lang set to " + lang); Locale english = new Locale("en", "GB"); mScs = tsm.newSpellCheckerSession(null, english, this, false); if (mScs == null) Log.e("OnKey", "Failed to obtain spell-checker session"); } else { ed.putString("available_dicts", "el"); ed.commit(); if (mScs != null) mScs.close(); String lang = prefs.getString("available_dicts", "jam"); Log.i("OnKey", "Spellcheck lang set to " + lang); Locale greek = new Locale("el", "GR"); mScs = tsm.newSpellCheckerSession(null, greek, this, false); if (mScs == null) Log.e("OnKey", "Failed to obtain spell-checker session"); } } //handle space for Adaptxt if (Character.isSpaceChar(primaryCode)) { if (coreEngine != null) { //Log.i("Handle Character", "Space pressed"); coreEngine.resetCoreString(); //Log.i("Space Pressed", "Word is "+mComposing+" "); coreEngine.insertText(mComposing.toString() + " "); updateCandidates(); } } if (!firstWordSet && mComposing.length() > 1) { if (captureData) currentSession.firstWord = mComposing.toString(); else currentSession.firstWord = "$$$$"; firstWordSet = true; //System.out.println("First Word\""+mComposing.toString()+"\""); } //effect any injections as required if (mComposing.length() > 0) { //commitTyped(getCurrentInputConnection()); //check the errormap for any replacements if (errorMap.size() > 0) { //restrict the errormap to the 25% of word length cap int replacementstodelete = errorMap.size() - (int) Math.round(mComposing.length() * 0.25); //total replacements - those to keep if (replacementstodelete < 0) replacementstodelete = 0; //allow at least one if (errorMap.size() == replacementstodelete) replacementstodelete = errorMap.size() - 1; if (replacementstodelete > 0) { List<Integer> keys = new ArrayList<Integer>(errorMap.keySet()); for (int z = 0; z < replacementstodelete; z++) { Random random = new Random(); int listposition = random.nextInt(keys.size()); int randomKey = keys.get(listposition); //remove this from the error map and the list errorMap.remove(randomKey); keys.remove(listposition); } } //effect the injections String oldmComposing = mComposing.toString(); Iterator it = errorMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); mComposing.replace((Integer) pair.getKey(), (Integer) pair.getKey() + 1, "" + (Character) pair.getValue()); //it.remove(); // avoids a ConcurrentModificationException } nInjections += errorMap.size(); currentSession.nInjections = nInjections; //Log.i("Injections", "Will replace "+oldmComposing+" with "+mComposing+", nInjections="+nInjections); errorMap.clear(); } wordSeparatorKeyCode = primaryCode; if (captureData) commitTyped(ic, isWordSeparator(primaryCode)); else { if (primaryCode != Keyboard.KEYCODE_DONE && primaryCode != 10) //done and go/enter handleCharacter(primaryCode, keyCodes); else sendKey(primaryCode); commitTyped(ic); } } else { sendKey(primaryCode); } updateShiftKeyState(getCurrentInputEditorInfo()); } else if (primaryCode == Keyboard.KEYCODE_DELETE) { if (errorMap.get(mComposing.length() - 1) != null) { //Log.i("Injection", "Delete from map pos="+(mComposing.length()-1)+", char="+errorMap.get(mComposing.length()-1)); errorMap.remove(mComposing.length() - 1); } handleBackspace(); } else if (primaryCode == Keyboard.KEYCODE_SHIFT) { handleShift(); } else if (primaryCode == Keyboard.KEYCODE_CANCEL) { //keyboard hiding button //override this for settings activity //handleClose(); Intent intent = new Intent(this, LoggingIMESettings.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return; } else if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) { // Show a menu or somethin' } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE && mInputView != null) { //Keyboard current = mInputView.getKeyboard(); if (mInputView.currentKeyboard == KeyboardViews.SYMBOLS || mInputView.currentKeyboard == KeyboardViews.SYMBOLS_SHIFTED) { //mInputView.currentKeyboard = KeyboardViews.QWERTY_EN; mInputView.currentKeyboard = lastKeyboardView; } else { //about to change to symbols lastKeyboardView = mInputView.currentKeyboard; //keep track of where we came from mInputView.currentKeyboard = KeyboardViews.SYMBOLS; } mInputView.switchKeyboard(); if (mInputView.currentKeyboard == KeyboardViews.SYMBOLS) { mInputView.getKeyboard().setShifted(false); } } else { handleCharacter(primaryCode, keyCodes); } }