From 4848d7f7122fe4b6f139f25dde9eccc12c4cf55f Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Sun, 15 May 2022 00:34:28 +0800 Subject: [PATCH] Implement options menu. --- app/src/main/res/values-night/themes.xml | 3 --- app/src/main/res/values/colors.xml | 2 -- app/src/main/res/values/dimens.xml | 1 - app/src/main/res/values/strings.xml | 4 --- app/src/main/res/values/themes.xml | 4 --- .../java/org/love2d/android/MainActivity.java | 27 ++++++++++++++++++- app/src/normal/res/menu/options_menu.xml | 13 +++++++++ app/src/normal/res/values/strings.xml | 2 +- 8 files changed, 40 insertions(+), 16 deletions(-) delete mode 100644 app/src/main/res/values-night/themes.xml delete mode 100644 app/src/main/res/values/colors.xml delete mode 100644 app/src/main/res/values/dimens.xml delete mode 100644 app/src/main/res/values/strings.xml delete mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/normal/res/menu/options_menu.xml diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml deleted file mode 100644 index 69a9dc49..00000000 --- a/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index a6b3daec..00000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index 73862c41..00000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index 2dcef4a2..00000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml deleted file mode 100644 index fb883f9c..00000000 --- a/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/normal/java/org/love2d/android/MainActivity.java b/app/src/normal/java/org/love2d/android/MainActivity.java index 1a0deb88..e3ced115 100644 --- a/app/src/normal/java/org/love2d/android/MainActivity.java +++ b/app/src/normal/java/org/love2d/android/MainActivity.java @@ -2,7 +2,11 @@ package org.love2d.android; import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @@ -11,4 +15,25 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } -} \ No newline at end of file + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.options_menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + int itemId = item.getItemId(); + + if (itemId == R.id.optionItem3) { + Intent intent = new Intent(this, AboutActivity.class); + startActivity(intent); + return true; + } else { + return super.onOptionsItemSelected(item); + } + } +} diff --git a/app/src/normal/res/menu/options_menu.xml b/app/src/normal/res/menu/options_menu.xml new file mode 100644 index 00000000..f9019c7c --- /dev/null +++ b/app/src/normal/res/menu/options_menu.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/app/src/normal/res/values/strings.xml b/app/src/normal/res/values/strings.xml index 52f3ad98..ed7a6d13 100644 --- a/app/src/normal/res/values/strings.xml +++ b/app/src/normal/res/values/strings.xml @@ -4,5 +4,5 @@ This software is provided \'as-is\', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Official Website No Games :( - Looks like there are no LÖVE games found in the games folder. See the "Game Folder" in the options menu for more information. + Looks like there are no LÖVE games found in the games folder. See the \"Game Folder\" in the options menu for more information.