Skip to content

Instantly share code, notes, and snippets.

Avatar

Yodgorbek Komilov kyodgorbek

View GitHub Profile
View CurrenciesAdapter.kt
class CurrenciesAdapter(private val context: Context) : RecyclerView.Adapter<CurrenciesAdapter.MyViewHolder>() {
var list: List<CurrencyResponse> = listOf()
set(value) {
field = value
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val inflater = LayoutInflater.from(context)
View CurrenciesAdapter.kt
class CurrenciesAdapter(private val context: Context, private var list: MutableList<CurrencyResponse>) : RecyclerView.Adapter<CurrenciesAdapter.MyViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val inflater = LayoutInflater.from(context)
val view: View = inflater.inflate(R.layout.currency_layout,parent,false)
return MyViewHolder(view)
}
override fun getItemCount(): Int {
View MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val firstName = inputFirstName.text.toString()
val secondName = inputLastName.text.toString()
saveButton.setOnClickListener{
saveFireStore(firstName, secondName)
View MainActivity.kt
import android.os.Build
import android.os.Bundle
import android.os.StrictMode
import androidx.appcompat.app.AppCompatActivity
import io.ktor.network.selector.ActorSelectorManager
import io.ktor.network.sockets.aSocket
import io.ktor.network.sockets.openReadChannel
import io.ktor.network.sockets.openWriteChannel
import io.ktor.util.cio.write
import io.ktor.utils.io.readUTF8Line
View MemberActivity.kt
class MemberActivity : AppCompatActivity() {
private var memberAdapter: MemberAdapter? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_member)
val compositeDisposable = CompositeDisposable()
compositeDisposable.add(
View Member.kt
data class Member(
@SerializedName("age")
val age: Int,
@SerializedName("email")
val email: String,
@SerializedName("_id")
val id: String,
@SerializedName("name")
val name: Name,
@SerializedName("phone")
View names.json
[
{
"_id":"5c5bb5ce54a9c166bf1c5b82",
"company":"GYNKO",
"website":"www.gynko.co.uk",
"logo":"http://placehold.it/32x32",
"about":"Veniam sit ex ex esse pariatur proident non aute sunt. Aute id eiusmod aute incididunt sint est ullamco eiusmod adipisicing aliqua est. Velit aliqua occaecat enim pariatur laboris deserunt aliqua dolore fugiat dolor consequat sit occaecat pariatur. Ullamco velit laborum cillum reprehenderit Lorem magna exercitation laboris qui et aute nulla veniam. Reprehenderit nulla culpa elit ad ex ex sunt nisi eiusmod. Non officia ea est exercitation ut Lorem aute nulla.",
"members":[
{
"_id":"5c5bb5ce9ea1ae34c3d4f0c7",
View gist:75253fb2ac20093954c7c485f5323f70
[{"_id":"5c5bb5ce54a9c166bf1c5b82","company":"GYNKO","website":"www.gynko.co.uk","logo":"http://placehold.it/32x32","about":"Veniam sit ex ex esse pariatur proident non aute sunt. Aute id eiusmod aute incididunt sint est ullamco eiusmod adipisicing aliqua est. Velit aliqua occaecat enim pariatur laboris deserunt aliqua dolore fugiat dolor consequat sit occaecat pariatur. Ullamco velit laborum cillum reprehenderit Lorem magna exercitation laboris qui et aute nulla veniam. Reprehenderit nulla culpa elit ad ex ex sunt nisi eiusmod. Non officia ea est exercitation ut Lorem aute nulla.","members":[{"_id":"5c5bb5ce9ea1ae34c3d4f0c7","age":26,"name":{"first":"Heather","last":"Russell"},"email":"heather.russell@undefined.info","phone":"+1 (827) 549-3643"},{"_id":"5c5bb5ce591915de62e56bb2","age":30,"name":{"first":"Velma","last":"Hayden"},"email":"velma.hayden@undefined.me","phone":"+1 (989) 537-3158"},{"_id":"5c5bb5cee24406f77af3c0d1","age":30,"name":{"first":"Solomon","last":"Griffith"},"email":"solomon.griffith@unde
View introduction.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/apk/res-auto"
>
View BBCSportAdapter.kt
class BBCSportAdapter :
RecyclerView.Adapter<BBCSportAdapter.MyViewHolder>() {
companion object {
const val urlKey = "urlKey"
}
lateinit var articleList: List<Article>