[android] Added about dialog

This commit is contained in:
Alex Zolotarev 2011-12-22 15:27:46 +03:00 committed by Alex Zolotarev
parent f4a05e9af3
commit d28a6e308d
4 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<WebView
android:id="@+id/webview_about"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View file

@ -7,4 +7,7 @@
<item android:id="@+id/download_maps"
android:icon="@drawable/ic_menu_download"
android:title="@string/download_maps" />
<item android:id="@+id/about_dialog"
android:title="@string/about"/>
</menu>

View file

@ -4,4 +4,5 @@
<string name="my_position">My Position</string>
<string name="travel_guide">Travel Guide</string>
<string name="app_name">MapsWithMe</string>
<string name="about">About MapsWithMe</string>
</resources>

View file

@ -19,10 +19,12 @@ import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
@ -364,11 +366,32 @@ public class MWMActivity extends NvEventQueueActivity implements
onDownloadMapsClicked();
return true;
case R.id.about_dialog:
onAboutDialogClicked();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void onAboutDialogClicked()
{
LayoutInflater inflater = LayoutInflater.from(this);
View alertDialogView = inflater.inflate(R.layout.about, null);
WebView myWebView = (WebView) alertDialogView.findViewById(R.id.webview_about);
myWebView.loadUrl("file:///android_asset/about-travelguide-iphone.html");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(alertDialogView);
builder.setTitle(R.string.about);
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).show();
}
// Initialized to invalid combination to force update on the first check
private boolean m_storageAvailable = false;
private boolean m_storageWriteable = true;