summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-07-05 12:16:40 +0800
committerOwen Lin <owenlin@google.com>2012-07-05 15:24:07 +0800
commit4de3fa9d07bc7a8fdf8089a26badf38d8d2d8a3a (patch)
treee126be770f97096747a4c2b99eef42df32507b71 /src
parentcdb3717c706421fbf392b5da8018c5a029c59324 (diff)
downloadandroid_packages_apps_Snap-4de3fa9d07bc7a8fdf8089a26badf38d8d2d8a3a.tar.gz
android_packages_apps_Snap-4de3fa9d07bc7a8fdf8089a26badf38d8d2d8a3a.tar.bz2
android_packages_apps_Snap-4de3fa9d07bc7a8fdf8089a26badf38d8d2d8a3a.zip
Use different back algorithm for Gallery's widget after JB.
Change-Id: I1c3c6eea4e5794555a36179b295b15d9dba6de74
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/gadget/WidgetClickHandler.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/gadget/WidgetClickHandler.java b/src/com/android/gallery3d/gadget/WidgetClickHandler.java
index 35f9bec36..37ee1a651 100644
--- a/src/com/android/gallery3d/gadget/WidgetClickHandler.java
+++ b/src/com/android/gallery3d/gadget/WidgetClickHandler.java
@@ -16,10 +16,12 @@
package com.android.gallery3d.gadget;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
@@ -27,6 +29,7 @@ import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.app.Gallery;
import com.android.gallery3d.app.PhotoPage;
+import com.android.gallery3d.common.ApiHelper;
public class WidgetClickHandler extends Activity {
private static final String TAG = "PhotoAppWidgetClickHandler";
@@ -45,20 +48,29 @@ public class WidgetClickHandler extends Activity {
}
@Override
+ @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB)
protected void onCreate(Bundle savedState) {
super.onCreate(savedState);
+ // The behavior is changed in JB, refer to b/6384492 for more details
+ boolean tediousBack = Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.JELLY_BEAN;
Uri uri = getIntent().getData();
Intent intent;
if (isValidDataUri(uri)) {
intent = new Intent(Intent.ACTION_VIEW, uri);
- intent.putExtra(PhotoPage.KEY_TREAT_BACK_AS_UP, true);
+ if (tediousBack) {
+ intent.putExtra(PhotoPage.KEY_TREAT_BACK_AS_UP, true);
+ }
} else {
Toast.makeText(this,
R.string.no_such_item, Toast.LENGTH_LONG).show();
intent = new Intent(this, Gallery.class);
}
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |
- Intent.FLAG_ACTIVITY_TASK_ON_HOME);
+ if (tediousBack) {
+ intent.setFlags(
+ Intent.FLAG_ACTIVITY_NEW_TASK |
+ Intent.FLAG_ACTIVITY_CLEAR_TASK |
+ Intent.FLAG_ACTIVITY_TASK_ON_HOME);
+ }
startActivity(intent);
finish();
}