From d28a6e308d40a1535cf27f17060c362a5797202e Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 22 Dec 2011 15:27:46 +0300 Subject: [PATCH] [android] Added about dialog --- android/res/layout/about.xml | 10 ++++++++ android/res/menu/main.xml | 3 +++ android/res/values/strings.xml | 1 + .../src/com/mapswithme/maps/MWMActivity.java | 23 +++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 android/res/layout/about.xml diff --git a/android/res/layout/about.xml b/android/res/layout/about.xml new file mode 100644 index 0000000000..6348d19b8f --- /dev/null +++ b/android/res/layout/about.xml @@ -0,0 +1,10 @@ + + + + diff --git a/android/res/menu/main.xml b/android/res/menu/main.xml index e6ba3e33de..19166bca54 100644 --- a/android/res/menu/main.xml +++ b/android/res/menu/main.xml @@ -7,4 +7,7 @@ + + diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index ba32a35824..f80bab2dd8 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -4,4 +4,5 @@ My Position Travel Guide MapsWithMe + About MapsWithMe diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 8774add7b6..ac1748422e 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -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;