Browse Source

Implement options menu.

Miku AuahDark 3 years ago
parent
commit
4848d7f712

+ 0 - 3
app/src/main/res/values-night/themes.xml

@@ -1,3 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
-    <!-- Base application theme. -->
-</resources>

+ 0 - 2
app/src/main/res/values/colors.xml

@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources></resources>

+ 0 - 1
app/src/main/res/values/dimens.xml

@@ -1 +0,0 @@
-<resources></resources>

+ 0 - 4
app/src/main/res/values/strings.xml

@@ -1,4 +0,0 @@
-<resources>
-    <!-- Strings used for fragments for navigation -->
-
-</resources>

+ 0 - 4
app/src/main/res/values/themes.xml

@@ -1,4 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
-    <!-- Base application theme. -->
-
-</resources>

+ 26 - 1
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);
     }
-}
+
+    @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);
+        }
+    }
+}

+ 13 - 0
app/src/normal/res/menu/options_menu.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:id="@+id/optionItem"
+        android:title="Launch No-Game" />
+    <item
+        android:id="@+id/optionItem2"
+        android:title="Game Folder" />
+    <item
+        android:id="@+id/optionItem3"
+        android:title="About" />
+</menu>

+ 1 - 1
app/src/normal/res/values/strings.xml

@@ -4,5 +4,5 @@
     <string name="disclaimer">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.</string>
     <string name="official_website">Official Website</string>
     <string name="no_games">No Games :(</string>
-    <string name="no_games_info">Looks like there are no LÖVE games found in the games folder. See the &quot;Game Folder&quot; in the options menu for more information.</string>
+    <string name="no_games_info">Looks like there are no LÖVE games found in the games folder. See the \"Game Folder\" in the options menu for more information.</string>
 </resources>