[android] Added basic menu support

This commit is contained in:
Alex Zolotarev 2011-06-26 02:02:06 +03:00 committed by Alex Zolotarev
parent 67e72bc2d4
commit 3041d7336e
8 changed files with 34 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

10
android/res/menu/main.xml Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/my_position"
android:icon="@drawable/my_position"
android:title="@string/my_position" />
<item android:id="@+id/download_maps"
android:icon="@drawable/download_maps"
android:title="@string/download_maps" />
</menu>

View file

@ -1,9 +1,13 @@
package com.mapswithme.maps;
import com.mapswithme.maps.MainGLView;
import com.mapswithme.maps.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class MWMActivity extends Activity
{
@ -40,6 +44,26 @@ public class MWMActivity extends Activity
m_view.onResume();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.my_position:
return true;
case R.id.download_maps:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
static
{
System.loadLibrary("mapswithme");