OSDN Git Service

Fix b/6213053 Add Help entry point to Gallery (targeted for J release)
authorRay Chen <raychen@google.com>
Mon, 16 Apr 2012 08:18:47 +0000 (16:18 +0800)
committerRay Chen <raychen@google.com>
Tue, 17 Apr 2012 09:25:06 +0000 (17:25 +0800)
b:6213053

Change-Id: Ib9d9c5e69f09d6c2fffb4e6ecb09b2c3ae700365

res/menu/albumset.xml
res/values/strings.xml
src/com/android/gallery3d/app/AlbumSetPage.java
src/com/android/gallery3d/util/GalleryUtils.java

index 3bb46f7..749b7f9 100644 (file)
@@ -30,4 +30,7 @@
     <item android:id="@+id/action_settings"
             android:title="@string/settings"
             android:showAsAction="never" />
+    <item android:id="@+id/action_general_help"
+            android:title="@string/help"
+            android:showAsAction="never" />
 </menu>
index d4bf759..b0a01ee 100644 (file)
     <!-- The label for the folder contains screenshot images. [CHAR LIMIT=20]-->
     <string name="folder_screenshot">Screenshot</string>
 
+    <!-- The title of the menu item which display online help in browser. [CHAR LIMIT=20]-->
+    <string name="help">Help</string>
+
+    <!-- Web address for gallery help.  DO NOT TRANSLATE -->
+    <string name="general_help_link" translatable="false">http://support.google.com/mobile/?p=gallery_top</string>
 </resources>
index 60de019..c66f538 100644 (file)
@@ -477,6 +477,11 @@ public class AlbumSetPage extends ActivityState implements
                 activity.startActivity(new Intent(activity, GallerySettings.class));
                 return true;
             }
+            case R.id.action_general_help: {
+                activity.startActivity(
+                        GalleryUtils.getHelpIntent(R.string.general_help_link, activity));
+                return true;
+            }
             default:
                 return false;
         }
index fa9c97c..13e08f9 100644 (file)
@@ -24,6 +24,7 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
 import android.net.Uri;
 import android.os.ConditionVariable;
 import android.os.Environment;
@@ -330,4 +331,17 @@ public class GalleryUtils {
         int h = item.getHeight();
         return (h > 0 && w / h >= 2);
     }
+
+    public static Intent getHelpIntent(int helpUrlResId, Context context) {
+        Resources res = context.getResources();
+        String url = res.getString(helpUrlResId)
+                + "&hl=" + res.getConfiguration().locale.getLanguage();
+
+        Intent i = new Intent(Intent.ACTION_VIEW);
+        i.setData(Uri.parse(url));
+        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+        return i;
+    }
 }