Implement options menu.

This commit is contained in:
Miku AuahDark
2022-05-15 00:34:28 +08:00
parent 39da32d7c5
commit 4848d7f712
8 changed files with 40 additions and 16 deletions
-3
View File
@@ -1,3 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
</resources>
-2
View File
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
-1
View File
@@ -1 +0,0 @@
<resources></resources>
-4
View File
@@ -1,4 +0,0 @@
<resources>
<!-- Strings used for fragments for navigation -->
</resources>
-4
View File
@@ -1,4 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
</resources>
@@ -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
View File
@@ -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
View File
@@ -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>