I wanted my listitems to be swipeabel in order to delete them and I found this code through a video and it works for me if i comment out some stuff and dont't pass a context to the abstract class. now the thing is that I can't get the delete icon to work and the problem seems to be that by the time i call this abstract class i don't yet have usable context i can pass on.
abstract class SwipeToDeleteCallback(context: Context) : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {
private val deleteIcon = ContextCompat.getDrawable(context, R.drawable.ic_delete)
private val intrinsicWidth = deleteIcon!!.intrinsicHeight
private val intrinsicHeight = deleteIcon!!.intrinsicHeight
private val background = ColorDrawable()
private val backgroundColor = Color.parseColor("#f44336")
private val clearPaint = Paint().apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR) }
override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
return false
}
override fun onChildDraw(
c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder,
dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean
) {
val itemView = viewHolder.itemView
val itemHeight = itemView.bottom - itemView.top
val isCanceled = dX == 0f && !isCurrentlyActive
if (isCanceled) {
clearCanvas(c, itemView.right + dX, itemView.top.toFloat(), itemView.right.toFloat(), itemView.bottom.toFloat())
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
return
}
// Draw the red delete background
background.color = backgroundColor
background.setBounds(itemView.right + dX.toInt(), itemView.top, itemView.right, itemView.bottom)
background.draw(c)
// Calculate position of delete icon
val deleteIconTop = itemView.top + (itemHeight - intrinsicHeight) / 2
val deleteIconMargin = (itemHeight - intrinsicHeight) / 2
val deleteIconLeft = itemView.right - deleteIconMargin - intrinsicWidth
val deleteIconRight = itemView.right - deleteIconMargin
val deleteIconBottom = deleteIconTop + intrinsicHeight
// Draw the delete icon
deleteIcon!!.setBounds(deleteIconLeft, deleteIconTop, deleteIconRight, deleteIconBottom)
deleteIcon.draw(c)
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
}
private fun clearCanvas(c: Canvas?, left: Float, top: Float, right: Float, bottom: Float) {
c?.drawRect(left, top, right, bottom, clearPaint)
}
}
This is the fragment i use that class in (i didn't put all the code in here because most of it has nothing to do with the question):
class HomeFragment : Fragment() {
private lateinit var adapter: ListAdapter
private lateinit var recyclerView: RecyclerView
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentHomeBinding.inflate(inflater, container, false)
adapter = ListAdapter()
recyclerView = binding.recyclerView
recyclerView.adapter = adapter
recyclerView.layoutManager = LinearLayoutManager(requireActivity())
recyclerView.apply {
ItemTouchHelper(deleteSwipeHandler).attachToRecyclerView(this)
}
mItemViewModel = ViewModelProvider(this)[ItemViewModel::class.java]
mItemViewModel.fetchAllItems.observe(viewLifecycleOwner) { item ->
adapter.setData(item)
binding.tvHelp.isInvisible = adapter.itemCount > 0
}
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.fab.setOnClickListener {
if (ContextCompat.checkSelfPermission(
requireActivity(),
Manifest.permission.CAMERA
) == PERMISSION_GRANTED
) {
intentAndFileProvider()
} else {
requestPermissions(arrayOf(Manifest.permission.CAMERA), CAMERA_PERMISSION_CODE)
}
}
}
private val deleteSwipeHandler = object : SwipeToDeleteCallback(context) {
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
val pos = viewHolder.layoutPosition
val item = adapter.itemList[pos]
mItemViewModel.deleteItem(item)
Snackbar.make(requireView(), "Successfully deleted!", Snackbar.LENGTH_LONG).apply {
setAction("Undo") {
mItemViewModel.addItem(item)
}
}.show()
}
}
}
Pls help me out here! I appreciate every answer & comment!
Related
How can I change the background color of the selected item in RecyclerView Kotlin
Thank you from now
How to change the background color of only selected view in my recycle view example?only the background color of clicked itemview needs to be changed
OutTimeActiviyt
val linearLayoutManager = LinearLayoutManager(this)
layoutBnd.outRecylerView.layoutManager = linearLayoutManager
layoutBnd.outRecylerView.setHasFixedSize(false)
//IN RECYCLERVIEW
out_TimeList.clear()
val out_DataBase = this.openOrCreateDatabase("Park", Context.MODE_PRIVATE, null)
val recyclerCursor = out_DataBase.rawQuery("SELECT * FROM Money", null)
val listTimeIndex = recyclerCursor.getColumnIndex("MoneyListName")
while (recyclerCursor.moveToNext()) {
out_TimeList.add(recyclerCursor.getString(listTimeIndex))
}
recyclerCursor.close()
val recyclerMoneyListName = Out_Recyler_Adapter(out_TimeList)
layoutBnd.outRecylerView.adapter = recyclerMoneyListName
recyclerMoneyListName.setOnItemClickListener(object : Out_Recyler_Adapter.onItemClickListener{
override fun onItemClick(position: Int) {
Toast.makeText(this#OutTimeActivity, "Selected item:${position}", Toast.LENGTH_SHORT).show()
}
})
Out_TimeAdapter
class Out_Recyler_Adapter(private val out_TimeList: ArrayList<String>) :
RecyclerView.Adapter<Out_Recyler_Adapter.ViewHolder>() {
private lateinit var out_ClickListener: onItemClickListener
interface onItemClickListener {
fun onItemClick(position: Int)
}
fun setOnItemClickListener(listener: onItemClickListener) {
out_ClickListener = listener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.recyler_style, parent, false)
return ViewHolder(view, out_ClickListener)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val ItemsViewModel = out_TimeList[position]
holder.textView.text = ItemsViewModel
}
override fun getItemCount(): Int {
return out_TimeList.size
}
class ViewHolder(ItemView: View, listener: onItemClickListener) : RecyclerView.ViewHolder(ItemView) {
val textView: TextView = itemView.findViewById(R.id.style_txtParkingInfo)
init {
itemView.setOnClickListener {
listener.onItemClick(adapterPosition)
}
}
}
}
So I tried to create multi views recyclerview in kotlin, but sadly it did not work.The recyclerview does not display on the screen. It worth to mention that I tried to set the orientation as vertical in my layout files, also added all the dependencies and things needed. Can anyone please help me with that?
My MainActivity.class
#AndroidEntryPoint
class MainActivity : AppCompatActivity() {
lateinit var binding: ActivityMainBinding
lateinit var adapter: NumbersAdapter
lateinit var recyclerView: RecyclerView
var list: List<Nums> = listOf(Nums(1,false))
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
updateAll()
}
fun updateAll(){
binding.recyclerview.apply {
val layoutManager = LinearLayoutManager(this#MainActivity)
adapter = NumbersAdapter(list)
adapter = adapter
}}}
My Adapter
class NumbersAdapter(
var list: List<Nums>,
): RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class RedViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val name = itemView.findViewById<TextView>(R.id.red_number)
fun bindRed(number: Nums) {
name.text = number.nums.toString()
}
}
class OrangeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val name = itemView.findViewById<TextView>(R.id.orange_number)
fun bindOrange(number: Nums) {
name.text = number.nums.toString()
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == 0) {
val redvView =
LayoutInflater.from(parent.context).inflate(R.layout.red_item, parent, false)
return RedViewHolder(redvView)
}
else {
val orangeView =
LayoutInflater.from(parent.context).inflate(R.layout.orange_item, parent, false)
return OrangeViewHolder(orangeView)
}
}
override fun getItemCount(): Int {
return list.size
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(getItemViewType(position)==0){
(holder as RedViewHolder).bindRed(list[position])
}
else{
(holder as OrangeViewHolder).bindOrange(list[position])
}
}
override fun getItemViewType(position: Int): Int {
checkItem()
if(list[position].flag)
return 0
return 1
}
fun checkItem(){
for (i in list.indices) {
for (k in i + 1 until list.size) {
if (list[i].nums + list[k].nums == 0) {
list[i].flag = true
list[k].flag = true
}}}}}
in MainActivity.class change code in updateAll() function
fun updateAll(){
binding.recyclerView.apply {
adapter = NumbersAdapter(list)
layoutManager = LinearLayoutManager(this#MainActivity)
}
}
I want to make Home screen like Instagram where video will play/pause on horizontal and vertical scrolling.
For that I am using fragment inside viewpager and viewpager inside recyclerview for achieving horizontal and vertical scrolling.
Issue is that for second item of recyclerview view of fragment is not created.
can anyone help me to achieve this functionality.
Thanks in advance.
Below is the adapter class of recyclerview.
class DashboardFeedsAdapterNew(
private val mContext: Context, var mList: ArrayList<PostListModel.PostListData>,
private val viewHolderClicks: ViewHolderClicks,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var mInflater: LayoutInflater =
mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE) as LayoutInflater
var mActivePage = 0
private var isLoadingAdded = false
val LOADING_TYPE = 0
val POST_TYPE = 1
val STORY_TYPE = 2
fun getList(): ArrayList<PostListModel.PostListData> {
return mList
}
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): RecyclerView.ViewHolder {
when (viewType) {
POST_TYPE -> {
val v = LayoutInflater.from(parent.context)
.inflate(R.layout.raw_feed, parent, false)
return PostViewHolder(v)
}
}
val v =
mInflater.inflate(R.layout.raw_feed, parent, false)
return PostViewHolder(
v
)
}
override fun getItemViewType(position: Int): Int {
if(position == mList.size -1 && isLoadingAdded) {
return LOADING_TYPE
} else {
/*if ((position + 1) % 5 == 0) {
return STORY_TYPE
}*/
return POST_TYPE
}
}
override fun onBindViewHolder(
holder: RecyclerView.ViewHolder,
position: Int
) {
val model = mList[holder.adapterPosition]
if (holder is PostViewHolder) {
//post type
try {
if (model.files.isNotEmpty()) {
setupViewpager(holder, model)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
private fun setupViewpager(binding: PostViewHolder, model: PostListModel.PostListData) {
binding.vpAttachment.adapter = ViewPagerAdapter((activityContext() as AppCompatActivity).supportFragmentManager,model)
binding.vpAttachment.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
mActivePage = binding.vpAttachment.currentItem
}
override fun onPageSelected(position: Int) {
}
override fun onPageScrollStateChanged(state: Int) {}
})
}
inner class ViewPagerAdapter(fm: FragmentManager, val mData: PostListModel.PostListData) :
FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT ) { //FragmentPagerAdapter
private val mFragmentList = java.util.ArrayList<Fragment>()
private val mFragmentTitleList = java.util.ArrayList<String>()
fun addFragment(fragment: Fragment, title: String) {
mFragmentList.add(fragment)
mFragmentTitleList.add(title)
}
//added this metod to update fragment after edit post
override fun getItemPosition(`object`: Any): Int {
return POSITION_NONE
}
override fun getItem(position: Int): Fragment {
mData.files[position].position = position
return PostMediaPreviewPageFragment.newInstance(position,mData.id, mData.files[position])
}
override fun getCount(): Int {
return mData.files.size
}
override fun getPageTitle(position: Int): CharSequence? {
return mFragmentTitleList[position]
}
}
private fun activityContext(): Context {
val context = mContext
return context
}
override fun getItemCount(): Int {
return mList.size
}
inner class ViewMoreViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val progressBar: ProgressBar = itemView.findViewById(R.id.progressBar)
}
inner class PostViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val imgAvatar: ImageView = itemView.findViewById(R.id.imgAvatar)
val tvUserName: TextView = itemView.findViewById(R.id.tvUserName)
val vpAttachment: ViewPager = itemView.findViewById(R.id.vpAttachment)
// val indicator: IndicatorView = itemView.findViewById(R.id.indicator)
val imgFeed: ImageView = itemView.findViewById(R.id.imgFeed)
val imgPlay: ImageView = itemView.findViewById(R.id.imgPlay)
val tvAttachmentCount: TextView = itemView.findViewById(R.id.tvAttachmentCount)
val tvFeedTitle: TextView = itemView.findViewById(R.id.tvFeedTitle)
val tvLocation: TextView = itemView.findViewById(R.id.tvLocation)
val tvViewCount: TextView = itemView.findViewById(R.id.tvViewCount)
val imgLike: ImageView = itemView.findViewById(R.id.imgLike)
val tvLikeCount: TextView = itemView.findViewById(R.id.tvLikeCount)
val lnComment: LinearLayout = itemView.findViewById(R.id.lnComment)
val tvCommentCount: TextView = itemView.findViewById(R.id.tvCommentCount)
val btnTakeAction: Button = itemView.findViewById(R.id.btnTakeAction)
}
inner class StoryViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val rvStory: RecyclerView = itemView.findViewById(R.id.rvStory)
val viewPager: ViewPager2 = itemView.findViewById(R.id.vpStory)
val indicator: CircleIndicator2 = itemView.findViewById(R.id.indicator)
}
interface ViewHolderClicks {
fun onUserClick(model: PostListModel.PostListData, position: Int)
fun onImageClick(model: PostListModel.PostListData, position: Int)
fun onLikeClick(model: PostListModel.PostListData, position: Int)
fun onLikeCountClick(model: PostListModel.PostListData, position: Int)
fun onCommentClick(model: PostListModel.PostListData, position: Int)
fun onTakeActionClick(model: PostListModel.PostListData, position: Int)
}
}
I am making a simple application. There are 2 screens in the application: List screen, Add screen.
Scenario: When the application is opened, there is a list page on the screen. The user goes to the Adding page with the help of the Floating Action Button on the list page. Here, he enters the items with the help of Edit Text and comes to the List page by pressing the Add Button.
I am using MVVM in this application and I am a beginner. So I can't find the problem. Here is the problem: I am adding new elements to my list in the Add Fragment, but these elements are not seems in the List Fragment.
Thanks in advance.
Model Class
data class Movie(
val movieName: String,
val releaseDate: String
)
ViewModel class
class MovieViewModel : ViewModel() {
val movies = MutableLiveData<ArrayList<Movie>>()
var movieList = arrayListOf<Movie>()
fun addMovie(movie: Movie) {
movieList.add(movie)
movies.value = movieList
}
}
Adapter Class
class MovieAdapter : RecyclerView.Adapter<MovieAdapter.MyViewHolder>() {
private var movieList = emptyList<Movie>()
class MyViewHolder(private val binding: RowItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(movie: Movie) {
binding.textViewMovieName.text = movie.movieName
binding.textViewReleaseDate.text = movie.releaseDate
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val binding = RowItemBinding.inflate(layoutInflater, parent, false)
return MyViewHolder(binding)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
val currentItem = movieList[position]
holder.bind(currentItem)
}
override fun getItemCount(): Int {
return movieList.size
}
fun setData(movie: List<Movie>) {
val movieDiffUtil = MovieDiffUtil(movieList, movie)
val movieDiffResult = DiffUtil.calculateDiff(movieDiffUtil)
this.movieList = movie
movieDiffResult.dispatchUpdatesTo(this)
}
}
Add Fragment
class AddFragment : Fragment() {
private var _binding: FragmentAddBinding? = null
private val binding get() = _binding!!
private val movieViewModel: MovieViewModel by viewModels<MovieViewModel>()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentAddBinding.inflate(inflater, container, false)
binding.buttonAdd.setOnClickListener {
insertData()
}
return binding.root
}
private fun insertData() {
val movieName = binding.editTextMovieName.text.toString()
val releaseDate = binding.editTextReleaseDate.text.toString()
val movie = Movie(movieName, releaseDate)
movieViewModel.addMovie(movie)
findNavController().navigate(R.id.action_addFragment_to_listFragment)
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
List Fragment
class ListFragment : Fragment() {
private var _binding: FragmentListBinding? = null
private val binding get() = _binding!!
private val adapter: MovieAdapter by lazy { MovieAdapter() }
private val movieViewModel: MovieViewModel by viewModels<MovieViewModel>()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentListBinding.inflate(inflater, container, false)
setAdapter()
movieViewModel.movies.observe(viewLifecycleOwner, { data ->
adapter.setData(data)
binding.textView.setText(data.get(0).movieName)
})
binding.floatingActionButton.setOnClickListener {
findNavController().navigate(R.id.action_listFragment_to_addFragment)
}
return binding.root
}
private fun setAdapter() {
val recyclerView = binding.recyclerView
recyclerView.adapter = adapter
recyclerView.layoutManager = LinearLayoutManager(requireActivity())
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
After adding an item to a List<> you need to notify the Adapter that the data has changed.
You can do so by calling adapter.notifyDataSetChanged().
I added my List directly into the Adapter but you can create a function like in the following stackoverflow post.
How to update my Recyclerview using kotlin android?
i have problem with adding simple Spiner to RecyclerView item. I saw a lot of examples but i cannot add it to my project. All i want is the same Spiner with list of Strings in every item of RecyclerView. I have no problem with implement this without RecycylerView, but with it, i dont know where to pass Adapter for Spiner.
RecyclerViewAdapter:
class MealPlanerAdapter(val mealList: MutableList<String>) : RecyclerView.Adapter<CustomViewHolder>() {
val mealCalories = mutableListOf<Int>()
override fun getItemCount(): Int {
return mealList.size
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val cellForRow = layoutInflater.inflate(R.layout.meal_row, parent, false)
mealList.forEach {
mealCalories.add(100 / mealList.size)
}
return CustomViewHolder(cellForRow)
}
#SuppressLint("SetTextI18n", "CutPasteId", "ClickableViewAccessibility")
override fun onBindViewHolder(holder: CustomViewHolder, position: Int) {
holder.view.findViewById<TextView>(R.id.meal_name_text_view).text = "Meal name"
holder.view.findViewById<TextView>(R.id.calosies_slider_name_text_view).text = "Daily calories: "
holder.view.findViewById<TextView>(R.id.calories_value_text_view).text = holder.view.findViewById<SeekBar>(
R.id.calories_seek_bar
).progress.toString()+"%"
holder.view.findViewById<TextView>(R.id.protein_value_text_view).text = holder.view.findViewById<SeekBar>(
R.id.protein_seek_bar
).progress.toString()+"%"
holder.view.findViewById<TextView>(R.id.fat_value_text_view).text = holder.view.findViewById<SeekBar>(
R.id.fat_seek_bar
).progress.toString()+"%"
holder.view.findViewById<TextView>(R.id.carbs_value_text_view).text = holder.view.findViewById<SeekBar>(
R.id.calories_seek_bar
).progress.toString()+"%"
holder.view.findViewById<SeekBar>(R.id.calories_seek_bar).progress = mealCalories[position]
var proteinValue: Int = 20
var fatValue: Int = 25
holder.view.findViewById<SeekBar>(R.id.calories_seek_bar).setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(
seekBar: SeekBar?,
progress: Int,
fromUser: Boolean
) {
holder.view.findViewById<TextView>(R.id.calories_value_text_view).text =
"$progress%"
println(position)
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
}
})
holder.view.findViewById<SeekBar>(R.id.protein_seek_bar).setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
holder.view.findViewById<TextView>(R.id.protein_value_text_view).text = "$progress%"
proteinValue = progress
holder.view.findViewById<SeekBar>(R.id.carbs_seek_bar).progress =
100 - proteinValue - fatValue
holder.view.findViewById<SeekBar>(R.id.carbs_seek_bar).refreshDrawableState()
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
}
})
holder.view.findViewById<SeekBar>(R.id.fat_seek_bar).setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
#SuppressLint("ResourceType")
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
holder.view.findViewById<TextView>(R.id.fat_value_text_view).text = "$progress%"
fatValue = progress
holder.view.findViewById<SeekBar>(R.id.carbs_seek_bar).progress =
100 - proteinValue - fatValue
holder.view.findViewById<View>(R.id.carbs_seek_bar).refreshDrawableState()
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
}
})
holder.view.findViewById<SeekBar>(R.id.carbs_seek_bar).setOnTouchListener { v, event -> true }
}
}
class CustomViewHolder(val view: View): RecyclerView.ViewHolder(view) {
}
Fragment:
class MealPlanerFragment : Fragment(R.layout.fragment_meal_planer) {
private var param1: String? = null
private var param2: String? = null
private val mealList = mutableListOf<String>("1", "2", "3")
private lateinit var mAdapter: MealPlanerAdapter
private lateinit var mLinearLayoutManager: LinearLayoutManager
private lateinit var mRecyclerView: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
mAdapter = MealPlanerAdapter(mealList)
}
#SuppressLint("CutPasteId", "ResourceType")
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val inflater = inflater.inflate(R.layout.fragment_meal_planer, container, false)
mLinearLayoutManager = LinearLayoutManager(activity)
mRecyclerView = inflater.findViewById(recycler_view_meal_planer)
mRecyclerView.layoutManager = mLinearLayoutManager
mRecyclerView.adapter = mAdapter
return inflater
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}