-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename .java to .kt * Migrated library to Kotlin, support api 33 * Implemented custom gallery selector * Update README.md * Fixed bugs * Cleanup * Added javaDoc to non-internal classes * Added javaDoc to non-internal classes * Introduce image picker delegate * Update gradle wrapper * Refactor rotation feature * Finalize release v2.0 * Resolve conflicts * Fix naming
- Loading branch information
1 parent
d0901dd
commit a3a8ca7
Showing
57 changed files
with
2,236 additions
and
940 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/shz/imagepicker/imagepickerapp/ImagesDemoAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.shz.imagepicker.imagepickerapp | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.DiffUtil | ||
import androidx.recyclerview.widget.ListAdapter | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import com.shz.imagepicker.imagepicker.model.PickedImage | ||
import com.shz.imagepicker.imagepickerapp.databinding.ItemDemoImageBinding | ||
|
||
class ImagesDemoAdapter : ListAdapter<PickedImage, ImagesDemoAdapter.ViewHolder>(diff) { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder( | ||
ItemDemoImageBinding.inflate(LayoutInflater.from(parent.context), parent, false) | ||
) | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
holder.bind(getItem(position)) | ||
} | ||
|
||
inner class ViewHolder( | ||
private val binding: ItemDemoImageBinding, | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(item: PickedImage) { | ||
Glide.with(binding.image) | ||
.load(item.file) | ||
.centerCrop() | ||
.into(binding.image) | ||
} | ||
} | ||
|
||
companion object { | ||
private val diff = object : DiffUtil.ItemCallback<PickedImage>() { | ||
override fun areItemsTheSame( | ||
oldItem: PickedImage, | ||
newItem: PickedImage | ||
): Boolean = oldItem == newItem | ||
|
||
override fun areContentsTheSame( | ||
oldItem: PickedImage, | ||
newItem: PickedImage | ||
): Boolean = oldItem == newItem | ||
} | ||
} | ||
} |
105 changes: 0 additions & 105 deletions
105
app/src/main/java/com/shz/imagepicker/imagepickerapp/MainActivity.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.