From c7d33356bca0ba39fca84c213b51199916f58c25 Mon Sep 17 00:00:00 2001
From: alotbsol555 <159767443+alotbsol555@users.noreply.github.com>
Date: Sun, 5 May 2024 11:22:34 +0200
Subject: [PATCH] Add settings button to launcher app (#629)
---
res/drawable/cog_outline.xml | 1 +
res/menu/launcher_menu.xml | 10 ++++++++++
srcs/juloo.keyboard2/LauncherActivity.java | 16 ++++++++++++++++
3 files changed, 27 insertions(+)
create mode 100644 res/drawable/cog_outline.xml
create mode 100644 res/menu/launcher_menu.xml
diff --git a/res/drawable/cog_outline.xml b/res/drawable/cog_outline.xml
new file mode 100644
index 0000000..c910a9e
--- /dev/null
+++ b/res/drawable/cog_outline.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/res/menu/launcher_menu.xml b/res/menu/launcher_menu.xml
new file mode 100644
index 0000000..69cf9f1
--- /dev/null
+++ b/res/menu/launcher_menu.xml
@@ -0,0 +1,10 @@
+
diff --git a/srcs/juloo.keyboard2/LauncherActivity.java b/srcs/juloo.keyboard2/LauncherActivity.java
index 7b82d21..7063d93 100644
--- a/srcs/juloo.keyboard2/LauncherActivity.java
+++ b/srcs/juloo.keyboard2/LauncherActivity.java
@@ -10,6 +10,8 @@ import android.os.Build.VERSION;
import android.os.Bundle;
import android.provider.Settings;
import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
@@ -37,7 +39,21 @@ public class LauncherActivity extends Activity
this.new Tryhere_OnUnhandledKeyEventListener());
setup_intro_video(_intro_video);
}
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.launcher_menu, menu);
+ return true;
+ }
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.btnLaunchSettingsActivity) {
+ Intent intent = new Intent(LauncherActivity.this, SettingsActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ }
+ return super.onOptionsItemSelected(item);
+ }
public void launch_imesettings(View _btn)
{
startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS));