Created
March 28, 2021 22:42
-
-
Save rohitjakhar/1c414ea1a66c99689536d6ffaa6d9f61 to your computer and use it in GitHub Desktop.
Home
Home
Home
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
package com.rohitjakhar.blogx.ui.home | |
import android.os.Bundle | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.ViewModelProvider | |
import androidx.lifecycle.lifecycleScope | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import com.rohitjakhar.blogx.adapters.HomePostAdapter | |
import com.rohitjakhar.blogx.databinding.FragmentHomeBinding | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.launch | |
class HomeFragment : Fragment() { | |
private var _binding: FragmentHomeBinding? = null | |
private val binding get() = _binding!! | |
private lateinit var homeViewModel: HomeViewModel | |
private lateinit var homePostAdapter: HomePostAdapter | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View { | |
homeViewModel = ViewModelProvider(requireActivity()).get(HomeViewModel::class.java) | |
_binding = FragmentHomeBinding.inflate(inflater, container, false) | |
homePostAdapter = HomePostAdapter() | |
binding.rvPost.apply { | |
layoutManager = LinearLayoutManager(requireContext()) | |
adapter = homePostAdapter | |
} | |
lifecycleScope.launch { | |
homeViewModel.listData.collect { | |
homePostAdapter.submitData(it) | |
} | |
} | |
return binding.root | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
_binding = null | |
} | |
} |
From timeless hardwood to durable laminate, each option offers unique benefits to suit various preferences and lifestyles. Consider factors such as durability, maintenance requirements, and aesthetic appeal when selecting the perfect flooring for different areas of your home. With a wide range of materials available, you can create distinct atmospheres throughout your living space. Great post
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i want to hack can you show me how to hack
please PLZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZzz