Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ dependencies {
// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

implementation 'com.github.bumptech.glide:glide:4.13.0'

// swipe refresh layout
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.plcoding.androidstorage">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--Write storage permission required only for the devices running on API level 28 & below-->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/java/com/plcoding/androidstorage/BaseViewHolder.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.plcoding.androidstorage

import android.util.Log
import androidx.constraintlayout.widget.ConstraintSet
import androidx.recyclerview.widget.RecyclerView
import androidx.viewbinding.ViewBinding
import com.plcoding.androidstorage.databinding.ItemLoadingBinding
import com.plcoding.androidstorage.databinding.ItemPhotoBinding

/**
* Created By Dhruv Limbachiya on 04-03-2022 12:05 PM.
*/
sealed class BaseViewHolder(binding:ViewBinding) : RecyclerView.ViewHolder(binding.root) {

class ImageViewHolder(private val binding: ItemPhotoBinding) : BaseViewHolder(binding) {
fun bind (item: SharedStoragePhoto,onPhotoClick: (SharedStoragePhoto) -> Unit) {

binding.ivPhoto.setImageURI(item.contentUri)

// val aspectRatio = binding.ivPhoto.width.toFloat() / binding.ivPhoto.height.toFloat()
//
// ConstraintSet().apply {
// clone(binding.root)
// setDimensionRatio(binding.ivPhoto.id, aspectRatio.toString())
// applyTo(binding.root)
// }

binding.ivPhoto.setOnLongClickListener {
onPhotoClick(item)
true
}

Log.i("BaseViewHolder", "bind: ")
}
}

class ProgressViewHolder(binding:ItemLoadingBinding) : BaseViewHolder(binding) {}
}
Loading