@Override
public void onGallery() {
- // TODO: Implement.
+ startGallery();
}
private int getCurrentDataId() {
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- try {
- UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
- UsageStatistics.ACTION_GALLERY, null);
- startActivity(IntentHelper.getGalleryIntent(CameraActivity.this));
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Failed to launch gallery activity, closing");
- }
+ startGallery();
finish();
}
});
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
+ private void startGallery() {
+ try {
+ UsageStatistics.onEvent(UsageStatistics.COMPONENT_CAMERA,
+ UsageStatistics.ACTION_GALLERY, null);
+ startActivityForResult(IntentHelper.getGalleryIntent(CameraActivity.this),
+ REQ_CODE_DONT_SWITCH_TO_PREVIEW);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Failed to launch gallery activity, closing");
+ }
+ }
+
private void setNfcBeamPushUriFromData(LocalData data) {
final Uri uri = data.getContentUri();
if (uri != Uri.EMPTY) {
import android.view.ViewGroup;
import android.widget.ImageButton;
+import com.android.camera.util.IntentHelper;
import com.android.camera2.R;
/**
private void setupGalleryButton() {
mGalleryButton = (ImageButton) mLayout.findViewById(R.id.filmstrip_bottom_control_gallery);
+ mGalleryButton.setImageResource(IntentHelper.getGalleryIntentIcon());
mGalleryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
import android.content.Intent;
import android.net.Uri;
+import com.android.camera2.R;
+
public class IntentHelper {
private static final String GALLERY_PACKAGE_NAME = "com.android.gallery3d";
private static final String GALLERY_ACTIVITY_CLASS =
"com.android.gallery3d.app.GalleryActivity";
+ public static int getGalleryIntentIcon() {
+ return R.mipmap.ic_launcher_gallery;
+ }
+
public static Intent getGalleryIntent(Context context) {
return new Intent(Intent.ACTION_MAIN)
.setClassName(GALLERY_PACKAGE_NAME, GALLERY_ACTIVITY_CLASS);