android:excludeFromRecents="true"
android:icon="@mipmap/ic_launcher_camera"
android:label="@string/app_name"
+ android:logo="@mipmap/ic_launcher_gallery"
android:taskAffinity="com.android.camera.SecureCameraActivity"
android:theme="@style/Theme.Camera"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" >
import com.android.camera.util.ApiHelper;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.GcamHelper;
+import com.android.camera.util.IntentHelper;
import com.android.camera.util.PhotoSphereHelper;
import com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper;
import com.android.camera2.R;
case android.R.id.home:
// ActionBar's Up/Home button was clicked
try {
- if (!CameraUtil.launchGallery(CameraActivity.this)) {
- mFilmStripView.getController().goToFirstItem();
- }
+ startActivity(IntentHelper.getGalleryIntent(this));
return true;
} catch (ActivityNotFoundException e) {
- Log.w(TAG, "No activity found to handle APP_GALLERY category!");
+ Log.w(TAG, "Failed to launch gallery activity, closing");
finish();
}
case R.id.action_delete:
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- CameraUtil.launchGallery(CameraActivity.this);
+ try {
+ startActivity(IntentHelper.getGalleryIntent(CameraActivity.this));
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Failed to launch gallery activity, closing");
+ }
finish();
}
});
}
return ret;
}
-
- /**
- * Launches apps supporting action {@link Intent.ACTION_MAIN} of category
- * {@link Intent.CATEGORY_APP_GALLERY}. Note that
- * {@link Intent.CATEGORY_APP_GALLERY} is only available on API level 15+.
- *
- * @param ctx The {@link android.content.Context} to launch the app.
- * @return {@code true} on success.
- */
- public static boolean launchGallery(Context ctx) {
- if (ApiHelper.HAS_APP_GALLERY) {
- ctx.startActivity(IntentHelper.getGalleryIntent(ctx));
- return true;
- }
- return false;
- }
}
public static Intent getVideoPlayerIntent(Context context, Uri uri) {
return new Intent(Intent.ACTION_VIEW)
- .setPackage(GALLERY_PACKAGE_NAME)
.setDataAndType(uri, "video/*");
}
}