Launcher activity: Don't consume events in text field

Allow the keybindings to have an effect in the "Try here" text field.
This commit is contained in:
Jules Aguillon 2024-06-16 20:05:31 +02:00
parent bad2e8c237
commit a7b79022e5

View File

@ -28,7 +28,6 @@ public class LauncherActivity extends Activity
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.launcher_activity); setContentView(R.layout.launcher_activity);
_intro_video = (VideoView)findViewById(R.id.launcher_intro_video); _intro_video = (VideoView)findViewById(R.id.launcher_intro_video);
@ -39,21 +38,26 @@ public class LauncherActivity extends Activity
this.new Tryhere_OnUnhandledKeyEventListener()); this.new Tryhere_OnUnhandledKeyEventListener());
setup_intro_video(_intro_video); setup_intro_video(_intro_video);
} }
@Override @Override
public final boolean onCreateOptionsMenu(Menu menu) { public final boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.launcher_menu, menu); getMenuInflater().inflate(R.menu.launcher_menu, menu);
return true; return true;
} }
@Override @Override
public final boolean onOptionsItemSelected(MenuItem item) { public final boolean onOptionsItemSelected(MenuItem item)
if (item.getItemId() == R.id.btnLaunchSettingsActivity) { {
if (item.getItemId() == R.id.btnLaunchSettingsActivity)
{
Intent intent = new Intent(LauncherActivity.this, SettingsActivity.class); Intent intent = new Intent(LauncherActivity.this, SettingsActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent); startActivity(intent);
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
public void launch_imesettings(View _btn) public void launch_imesettings(View _btn)
{ {
startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)); startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS));
@ -113,7 +117,7 @@ public class LauncherActivity extends Activity
String kc = KeyEvent.keyCodeToString(ev.getKeyCode()); String kc = KeyEvent.keyCodeToString(ev.getKeyCode());
s.append(kc.replaceFirst("^KEYCODE_", "")); s.append(kc.replaceFirst("^KEYCODE_", ""));
_tryhere_text.setText(s.toString()); _tryhere_text.setText(s.toString());
return true; return false;
} }
} }
} }