mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 00:20:57 +02:00
Implement options menu.
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
</resources>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -1 +0,0 @@
|
||||
<resources></resources>
|
||||
@@ -1,4 +0,0 @@
|
||||
<resources>
|
||||
<!-- Strings used for fragments for navigation -->
|
||||
|
||||
</resources>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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 "Game Folder" 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>
|
||||
|
||||
Reference in New Issue
Block a user