diff --git a/app/build.gradle b/app/build.gradle index 15d7cdff..8586b655 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -139,6 +139,7 @@ dependencies { implementation "com.daimajia.swipelayout:library:1.2.0@aar" implementation "com.github.antonKozyriatskyi:CircularProgressIndicator:1.2.2" implementation "com.github.bassaer:chatmessageview:2.0.1" + implementation "com.github.CanHub:Android-Image-Cropper:2.2.2" implementation "com.github.ChuckerTeam.Chucker:library:3.0.1" implementation "com.github.jetradarmobile:android-snowfall:1.2.0" implementation "com.github.wulkanowy.uonet-request-signer:hebe-jvm:a99ca50a31" @@ -147,7 +148,6 @@ dependencies { implementation "com.jaredrummler:colorpicker:1.1.0" implementation "com.qifan.powerpermission:powerpermission-coroutines:1.3.0" implementation "com.qifan.powerpermission:powerpermission:1.3.0" - implementation "com.theartofdev.edmodo:android-image-cropper:2.8.0" implementation "com.wdullaer:materialdatetimepicker:4.2.3" implementation "com.yuyh.json:jsonviewer:1.0.6" implementation "io.coil-kt:coil:1.1.1" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6e8fc491..39704c99 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -144,7 +144,7 @@ android:configChanges="orientation|keyboardHidden" android:theme="@style/AppTheme" /> - diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt index 3f086a44..a54641b8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/MainActivityRequestHandler.kt @@ -8,8 +8,8 @@ import android.app.Activity import android.content.Intent import android.net.Uri import android.provider.OpenableColumns -import com.theartofdev.edmodo.cropper.CropImage -import com.theartofdev.edmodo.cropper.CropImageView +import com.canhub.cropper.CropImage +import com.canhub.cropper.CropImageView import pl.szczodrzynski.edziennik.data.db.entity.Profile import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity import java.io.File @@ -76,6 +76,9 @@ class MainActivityRequestHandler(val activity: MainActivity) { } private fun getFileInfo(uri: Uri): Pair { + if (uri.scheme == "file") { + return (uri.lastPathSegment ?: "unknown") to null + } val cursor = activity.contentResolver.query( uri, null, @@ -118,7 +121,7 @@ class MainActivityRequestHandler(val activity: MainActivity) { fun handleResult(requestCode: Int, resultCode: Int, data: Intent?) { if (resultCode != Activity.RESULT_OK) return - var uri = data?.data + var uri = CropImage.getPickImageResultUri(activity, data) when (requestCode) { REQUEST_LOGIN_ACTIVITY -> { if (!app.config.loginFinished) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java index a3018097..c9a550bd 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/SettingsNewFragment.java @@ -15,6 +15,8 @@ import android.provider.Settings; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; +import com.canhub.cropper.CropImage; +import com.canhub.cropper.CropImageView; import com.danielstone.materialaboutlibrary.ConvenienceBuilder; import com.danielstone.materialaboutlibrary.MaterialAboutFragment; import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem; @@ -30,8 +32,6 @@ import com.mikepenz.iconics.typeface.IIcon; import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial; import com.mikepenz.iconics.utils.IconicsConvertersKt; import com.mikepenz.iconics.utils.IconicsDrawableExtensionsKt; -import com.theartofdev.edmodo.cropper.CropImage; -import com.theartofdev.edmodo.cropper.CropImageView; import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; import java.io.File;