mirror of
https://github.com/imcarlost/Friendlists.git
synced 2026-04-10 02:46:54 -04:00
add navigation framework and implement it
This commit is contained in:
@@ -18,6 +18,8 @@ import kotlinx.android.synthetic.main.fragment_photolist.*
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import timber.log.Timber
|
||||
|
||||
const val PHOTOLIST_FRAGMENT_BUNDLE_ALBUM_ID = "PHOTOLIST_FRAGMENT_BUNDLE_ALBUM_ID"
|
||||
|
||||
class PhotolistFragment : Fragment() {
|
||||
|
||||
private val viewModel: PhotolistViewmodel by viewModel()
|
||||
@@ -31,8 +33,12 @@ class PhotolistFragment : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setRecycler()
|
||||
setObservers()
|
||||
// TODO: Get album by bundle
|
||||
viewModel.fetchPhotos(1)
|
||||
doRequest()
|
||||
}
|
||||
|
||||
private fun doRequest() {
|
||||
arguments?.getInt(PHOTOLIST_FRAGMENT_BUNDLE_ALBUM_ID)?.let { viewModel.fetchPhotos(it) } ?:
|
||||
throw UninitializedPropertyAccessException("The AlbumId is expected but it wasn't provided")
|
||||
}
|
||||
|
||||
private fun setObservers() {
|
||||
|
||||
@@ -47,10 +47,6 @@ class PhotoViewHolder(private val view: View) :
|
||||
|
||||
private val picasso: Picasso by inject()
|
||||
|
||||
init {
|
||||
picasso.setIndicatorsEnabled(true)
|
||||
}
|
||||
|
||||
fun bind(photo: PhotoViewable) = with(view) {
|
||||
picasso.load(photo.photoUrl)
|
||||
.placeholder(R.drawable.img_photo_placeholder)
|
||||
|
||||
@@ -35,9 +35,11 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="2"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user