[UI/Settings] Fix picking images from camera app.

This commit is contained in:
Kuba Szczodrzyński 2021-03-25 16:36:38 +01:00
parent 0f84732f80
commit 549a542879
4 changed files with 10 additions and 7 deletions

View File

@ -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"

View File

@ -144,7 +144,7 @@
android:configChanges="orientation|keyboardHidden"
android:theme="@style/AppTheme" />
<activity android:name=".ui.modules.webpush.QrScannerActivity" />
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
<activity android:name="com.canhub.cropper.CropImageActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/Base.Theme.AppCompat" />

View File

@ -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<String, String?> {
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)

View File

@ -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;