Guruh: 314-17 Bajardi: Ne’matjonov A


var data = DataItem() data.listData = sliderListData this


Download 1.68 Mb.
bet18/22
Sana08.01.2022
Hajmi1.68 Mb.
#247739
1   ...   14   15   16   17   18   19   20   21   22
Bog'liq
Ne'matjonov Abduvohid

var data = DataItem()
data.listData = sliderListData
this.data.add(data)
// adapter.notifyDataSetChanged()
// adapter.notifyItemInserted(this.data.size)
}
override fun onItemClick(view: View, data: Any) {
if (data is CategoryData) {
Log.i("TTTT", data.title)
title_page.text=data.title
adapter.clearData()
loadData()
}

if (data is NewsData) {
Log.i("TTTT", data.title)
var intent = Intent(this, DetailActivity::class.java)
intent.putExtra("title",title_page.text.toString())
intent.putExtra("image", data.image)
intent.putExtra("title_d",data.title)
intent.putExtra("description",data.description)
startActivity(intent)
}
if (data is SliderData) {
Log.i("TTTT", data.title)
var intent = Intent(this, DetailActivity::class.java)
intent.putExtra("title",title_page.text.toString())
intent.putExtra("image", data.image)
intent.putExtra("title_d",data.title)
intent.putExtra("description", data.description)
startActivity(intent)
}
}

}
package com.example.newsapp

import android.os.Bundle

import androidx.appcompat.app.AppCompatActivity

import kotlinx.android.synthetic.main.activity_detail.*

class DetailActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {



super.onCreate(savedInstanceState)

setContentView(R.layout.activity_detail)



var bundle = intent.extras

bundle?.let {

title_page.text = it.getString("title")

image.setImageResource(it.getInt("image"))

title_d.text = it.getString("title_d")

description.text = it.getString("description")

}

}

}


package com.example.newsapp.adapters

import android.view.LayoutInflater

import android.view.View

import android.view.ViewGroup

import android.widget.ImageView

import android.widget.TextView

import androidx.recyclerview.widget.RecyclerView

import com.example.newsapp.R

import com.example.newsapp.models.BaseData

import com.example.newsapp.models.CategoryData

import kotlinx.android.synthetic.main.item_category.view.*


Download 1.68 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   22




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling