mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 17:38:55 +03:00
Merge pull request #2578 from nextcloud/bugfix/2511/can-not-pick-avatar-froml-local-gallery
Update dependency ImagePicker
This commit is contained in:
commit
59ceb4f24a
3 changed files with 18 additions and 13 deletions
|
@ -280,8 +280,7 @@ dependencies {
|
||||||
|
|
||||||
implementation "io.noties.markwon:core:$markwonVersion"
|
implementation "io.noties.markwon:core:$markwonVersion"
|
||||||
|
|
||||||
//implementation 'com.github.dhaval2404:imagepicker:1.8'
|
implementation 'com.github.nextcloud-deps:ImagePicker:2.1.0.2'
|
||||||
implementation 'com.github.nextcloud-deps:ImagePicker:1.8.0.2'
|
|
||||||
implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0'
|
implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0'
|
||||||
|
|
||||||
implementation 'org.osmdroid:osmdroid-android:6.1.14'
|
implementation 'org.osmdroid:osmdroid-android:6.1.14'
|
||||||
|
|
|
@ -40,13 +40,14 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.core.net.toFile
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import com.github.dhaval2404.imagepicker.ImagePicker
|
import com.github.dhaval2404.imagepicker.ImagePicker
|
||||||
import com.github.dhaval2404.imagepicker.ImagePicker.Companion.getError
|
import com.github.dhaval2404.imagepicker.ImagePicker.Companion.getError
|
||||||
import com.github.dhaval2404.imagepicker.ImagePicker.Companion.getFile
|
|
||||||
import com.github.dhaval2404.imagepicker.ImagePicker.Companion.with
|
import com.github.dhaval2404.imagepicker.ImagePicker.Companion.with
|
||||||
|
import com.github.dhaval2404.imagepicker.constant.ImageProvider
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.activities.TakePhotoActivity
|
import com.nextcloud.talk.activities.TakePhotoActivity
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
|
@ -486,14 +487,13 @@ class ProfileController : BaseController(R.layout.controller_profile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendSelectLocalFileIntent() {
|
private fun sendSelectLocalFileIntent() {
|
||||||
val intent = with(activity!!)
|
with(activity!!)
|
||||||
.galleryOnly()
|
.provider(ImageProvider.GALLERY)
|
||||||
.crop()
|
.crop()
|
||||||
.cropSquare()
|
.cropSquare()
|
||||||
.compress(MAX_SIZE)
|
.compress(MAX_SIZE)
|
||||||
.maxResultSize(MAX_SIZE, MAX_SIZE)
|
.maxResultSize(MAX_SIZE, MAX_SIZE)
|
||||||
.prepareIntent()
|
.createIntent { intent -> startActivityForResult(intent, REQUEST_CODE_IMAGE_PICKER) }
|
||||||
startActivityForResult(intent, 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showBrowserScreen() {
|
private fun showBrowserScreen() {
|
||||||
|
@ -584,21 +584,21 @@ class ProfileController : BaseController(R.layout.controller_profile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openImageWithPicker(file: File) {
|
private fun openImageWithPicker(file: File) {
|
||||||
val intent = with(activity!!)
|
with(activity!!)
|
||||||
.fileOnly()
|
.provider(ImageProvider.URI)
|
||||||
.crop()
|
.crop()
|
||||||
.cropSquare()
|
.cropSquare()
|
||||||
.compress(MAX_SIZE)
|
.compress(MAX_SIZE)
|
||||||
.maxResultSize(MAX_SIZE, MAX_SIZE)
|
.maxResultSize(MAX_SIZE, MAX_SIZE)
|
||||||
.prepareIntent()
|
.setUri(Uri.fromFile(file))
|
||||||
intent.putExtra("extra.file", file)
|
.createIntent { intent -> startActivityForResult(intent, REQUEST_CODE_IMAGE_PICKER) }
|
||||||
startActivityForResult(intent, REQUEST_CODE_IMAGE_PICKER)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
if (requestCode == REQUEST_CODE_IMAGE_PICKER) {
|
if (requestCode == REQUEST_CODE_IMAGE_PICKER) {
|
||||||
uploadAvatar(getFile(data))
|
val uri: Uri = data?.data!!
|
||||||
|
uploadAvatar(uri.toFile())
|
||||||
} else if (requestCode == REQUEST_CODE_SELECT_REMOTE_FILES) {
|
} else if (requestCode == REQUEST_CODE_SELECT_REMOTE_FILES) {
|
||||||
val pathList = data?.getStringArrayListExtra(RemoteFileBrowserActivity.EXTRA_SELECTED_PATHS)
|
val pathList = data?.getStringArrayListExtra(RemoteFileBrowserActivity.EXTRA_SELECTED_PATHS)
|
||||||
if (pathList?.size!! >= 1) {
|
if (pathList?.size!! >= 1) {
|
||||||
|
|
|
@ -26,3 +26,9 @@ include ':app'
|
||||||
// substitute module('com.github.nextcloud.android-common:ui') using project(':ui')
|
// substitute module('com.github.nextcloud.android-common:ui') using project(':ui')
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//includeBuild('../../../deps/ImagePicker') {
|
||||||
|
// dependencySubstitution {
|
||||||
|
// substitute module('com.github.nextcloud-deps:ImagePicker') using project(':imagepicker')
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
Loading…
Reference in a new issue