Change crop feature

This commit is contained in:
tom79 2019-08-24 16:39:53 +02:00
parent b32183668e
commit eb81adc512
3 changed files with 9 additions and 12 deletions

View File

@ -105,7 +105,7 @@ dependencies {
implementation 'jp.wasabeef:glide-transformations:4.0.0' implementation 'jp.wasabeef:glide-transformations:4.0.0'
playstoreImplementation "io.github.kobakei:ratethisapp:$ratethisappLibraryVersion" playstoreImplementation "io.github.kobakei:ratethisapp:$ratethisappLibraryVersion"
implementation 'ja.burhanrashid52:photoeditor:0.4.0' implementation 'ja.burhanrashid52:photoeditor:0.4.0'
implementation 'com.github.yalantis:ucrop:2.2.3' api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation "net.gotev:uploadservice:$uploadServiceVersion" implementation "net.gotev:uploadservice:$uploadServiceVersion"
implementation "net.gotev:uploadservice-okhttp:$uploadServiceVersion" implementation "net.gotev:uploadservice-okhttp:$uploadServiceVersion"

View File

@ -194,10 +194,8 @@
android:label="@string/app_name" android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
/> />
<activity <activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:name="com.yalantis.ucrop.UCropActivity" android:theme="@style/Base.Theme.AppCompat"/>
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<activity android:name="app.fedilab.android.activities.WebviewActivity" <activity android:name="app.fedilab.android.activities.WebviewActivity"
android:label="@string/app_name" android:label="@string/app_name"

View File

@ -60,7 +60,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.yalantis.ucrop.UCrop; import com.theartofdev.edmodo.cropper.CropImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -380,8 +380,9 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
e.printStackTrace(); e.printStackTrace();
} }
break; break;
case UCrop.REQUEST_CROP: case CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE:
final Uri resultUri = UCrop.getOutput(data); CropImage.ActivityResult result = CropImage.getActivityResult(data);
Uri resultUri = result.getUri();
if( resultUri != null) { if( resultUri != null) {
mPhotoEditorView.getSource().setImageURI(resultUri); mPhotoEditorView.getSource().setImageURI(resultUri);
mPhotoEditorView.getSource().setRotation(rotationInDegrees); mPhotoEditorView.getSource().setRotation(rotationInDegrees);
@ -511,10 +512,8 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorL
mStickerBSFragment.show(getSupportFragmentManager(), mStickerBSFragment.getTag()); mStickerBSFragment.show(getSupportFragmentManager(), mStickerBSFragment.getTag());
break; break;
case CROP: case CROP:
String filename = System.currentTimeMillis()+"_"+Helper.getFileName(PhotoEditorActivity.this, uri); CropImage.activity(uri)
tempname = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).format(new Date()) + filename; .start(this);
UCrop.of(uri, Uri.fromFile(new File(getCacheDir(),tempname)))
.start(PhotoEditorActivity.this);
break; break;
} }
} }