open the image editor at pressing Rotate / crop

This commit is contained in:
tibbi 2016-10-06 18:51:16 +02:00
parent c433c897b5
commit cae7b9458a

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.gallery.activities; package com.simplemobiletools.gallery.activities;
import android.app.WallpaperManager; import android.app.WallpaperManager;
import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.database.Cursor; import android.database.Cursor;
@ -46,6 +47,7 @@ public class ViewPagerActivity extends SimpleActivity
@BindView(R.id.undo_delete) View mUndoBtn; @BindView(R.id.undo_delete) View mUndoBtn;
@BindView(R.id.view_pager) MyViewPager mPager; @BindView(R.id.view_pager) MyViewPager mPager;
private static final int EDIT_IMAGE = 1;
private static ActionBar mActionbar; private static ActionBar mActionbar;
private static List<Medium> mMedia; private static List<Medium> mMedia;
private static String mPath; private static String mPath;
@ -161,6 +163,7 @@ public class ViewPagerActivity extends SimpleActivity
editMedium(); editMedium();
return true; return true;
case R.id.menu_crop_rotate: case R.id.menu_crop_rotate:
openEditor();
return true; return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
@ -174,6 +177,12 @@ public class ViewPagerActivity extends SimpleActivity
adapter.confChanged(mPos); adapter.confChanged(mPos);
} }
private void openEditor() {
final Intent intent = new Intent(getApplicationContext(), EditActivity.class);
intent.setData(Uri.fromFile(getCurrentFile()));
startActivityForResult(intent, EDIT_IMAGE);
}
private void setAsWallpaper() { private void setAsWallpaper() {
final Bitmap bitmap = BitmapFactory.decodeFile(getCurrentFile().getAbsolutePath()); final Bitmap bitmap = BitmapFactory.decodeFile(getCurrentFile().getAbsolutePath());
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext()); final WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());