Package com example computergraphics import android os. Bundle


} binding.continue1.setOnClickListener {



Download 200,3 Kb.
bet3/20
Sana08.01.2022
Hajmi200,3 Kb.
#331779
1   2   3   4   5   6   7   8   9   ...   20
Bog'liq
Kompyuter Grafikasi

}
binding.continue1.setOnClickListener {
onMyClickListener.onClick(adapterPosition, lectures)
}
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Vh {


return Vh(ItemRvBinding.inflate(LayoutInflater.from(parent.context), parent, false))
}

override fun onBindViewHolder(holder: Vh, position: Int) {


holder.onBind(list[position])
if (position % 2 == 0) {
holder.binding.item.animation = AnimationUtils.loadAnimation(
holder.binding.root.context,
R.anim.anim_slide_in_right
)
} else {
holder.binding.item.animation =
AnimationUtils.loadAnimation(holder.binding.root.context, R.anim.anim_slide_in_left)

}
}


override fun getItemCount(): Int = list.size

}

interface OnMyClickListener {


fun onMyClick(position: Int, lectures: Lectures)
fun onClick(position: Int, lectures: Lectures)
}

package com.example.computergraphics.adapters

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

class ViewPagerAdapter(supportFragmentManager: FragmentManager) :


FragmentPagerAdapter(supportFragmentManager) {

private val fragmentList = ArrayList()


private val titleList = ArrayList()
override fun getCount(): Int {
return fragmentList.size
}

override fun getItem(position: Int): Fragment {


return fragmentList[position]
}

override fun getPageTitle(position: Int): CharSequence? {


return titleList[position]
}
fun addFragment(fragment: Fragment,title:String){
fragmentList.add(fragment)
titleList.add(title)
}
}
package com.example.computergraphics.db

import com.example.computergraphics.utils.Info

interface DatabaseService {

fun addMovie(info: Info)


fun getAllMovies():ArrayList
fun deleteMovie(info: Info)
fun getMovieById(id: Int?):Info
}

package com.example.computergraphics.db

import android.annotation.SuppressLint
import android.content.ContentValues
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import com.example.computergraphics.utils.Constant
import com.example.computergraphics.utils.Info

class MyDbHelper(context: Context) :


SQLiteOpenHelper(context, Constant.DB_NAME, null, Constant.DB_VERSION), DatabaseService {
override fun onCreate(db: SQLiteDatabase?) {
val query =
"create table contact (${Constant.ID} integer not null primary key autoincrement unique,${Constant.NAME} text not null,${Constant.NUMBER} text not null,${Constant.READ} text not null,${Constant.IMAGE} text not null,${Constant.PDF_NAME} text not null,${Constant.POSITION} text not null)"

db?.execSQL(query)


}

override fun onUpgrade(db: SQLiteDatabase?, p1: Int, p2: Int) {


db?.execSQL("drop table if exists ${Constant.TABLE_NAME}")
}

override fun addMovie(info: Info) {


val database = this.writableDatabase
val contentValues = ContentValues()
contentValues.put(Constant.NAME, info.name)
contentValues.put(Constant.NUMBER, info.number)
contentValues.put(Constant.READ, info.read)
contentValues.put(Constant.IMAGE, info.image)
contentValues.put(Constant.PDF_NAME, info.pdfName)
contentValues.put(Constant.POSITION,info.position)
database.insert(Constant.TABLE_NAME, null, contentValues)
database.close()
}

override fun getAllMovies(): ArrayList {


val movieList = ArrayList()
val query = "select * from ${Constant.TABLE_NAME}"
val database = this.readableDatabase
val cursor = database.rawQuery(query, null)
if (cursor.moveToFirst()) {
do {
val movie = Info(
cursor.getInt(0),
cursor.getString(1),
cursor.getInt(2),
cursor.getString(3),
cursor.getInt(4),
cursor.getString(5),
cursor.getInt(6)
)
movieList.add(movie)
} while (cursor.moveToNext())
}
return movieList
}

override fun deleteMovie(info: Info) {


val database = this.writableDatabase
database.delete(Constant.TABLE_NAME, "${Constant.ID}=?", arrayOf("${info.id}"))
database.close()
}

@SuppressLint("Recycle")


override fun getMovieById(id: Int?): Info {
val database = this.readableDatabase

val cursor = database.query(
Constant.TABLE_NAME,
arrayOf(
Constant.ID,
Constant.NAME,
Constant.NUMBER,
Constant.READ,
Constant.IMAGE,
Constant.PDF_NAME,
Constant.POSITION
),
"${Constant.ID}",
arrayOf("$id"),
null,
null,
null
)
cursor?.moveToFirst()
return Info(
cursor.getInt(0),
cursor.getString(1),
cursor.getInt(2),
cursor.getString(3),
cursor.getInt(4),
cursor.getString(5),
cursor.getInt(6)
)

}

}



package com.example.computergraphics.ui.home

import android.os.Bundle


import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.example.computergraphics.BookmarksFragment
import com.example.computergraphics.HelpCenterFragment
import com.example.computergraphics.IndexFragment
import com.example.computergraphics.R
import com.example.computergraphics.adapters.ViewPagerAdapter
import com.example.computergraphics.databinding.FragmentHomeBinding

class HomeFragment : Fragment() {


private var _binding: FragmentHomeBinding? = null

// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!

override fun onCreateView(


inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {

_binding = FragmentHomeBinding.inflate(inflater, container, false)


setUpTabs()
val root: View = binding.root


return root
}

private fun setUpTabs() {


val adapter = ViewPagerAdapter(childFragmentManager)
adapter.addFragment(IndexFragment(), "Bosh sahifa")
adapter.addFragment(BookmarksFragment(), "Saqlanganlar")
adapter.addFragment(HelpCenterFragment(), "Bog`lanish")
binding.viewPager.adapter = adapter
binding.tabs.setupWithViewPager(binding.viewPager)
}

override fun onDestroyView() {


super.onDestroyView()
_binding = null
}
}

package com.example.computergraphics.utils

object Constant {

const val DB_NAME = "info_db"


const val DB_VERSION = 1

const val TABLE_NAME = "contact"


const val ID="id"
const val NAME = "name"
const val NUMBER = "number"
const val READ = "read"
const val IMAGE = "image"
const val PDF_NAME="pdf_name"
const val POSITION="position"
}

package com.example.computergraphics.utils

object Constants {
const val username: String = "user_name"
const val Total_Questions: String = "total_questions"
const val correct_Questions: String = "correct_answers"

fun getQuestion(): ArrayList {


val questionsList = ArrayList()
val que1 = Questions(
1,
"\"Kompyuter grafikasi\" ni qanday tasvirli ko`rinishda tasvirlash mumkin?",
"belgilar->tasvir",
"tasvir->belgilar",
"belgilar ->belgilash",
"tasvir ->tasvir ",
1
)
questionsList.add(que1)
val que2 = Questions(
1, "Qaysi almashtirishlar matritsalari simmetrik?", "ko`chish, masshtablash",
"masshtablash, akslantirish", "masshtablash, burish", "burish, akslantirish ", 2
)
questionsList.add(que2)
val que3 = Questions(
1, "Qaysi almashtirishlarda matritsalar simmetrik emas?", "akslantirish, burish",
"masshtablash, akslantirish", "masshtablash, burish", "ko`chish, burish", 3
)
questionsList.add(que3)
val que4 = Questions(
1, "Qaysi Platon jismining 12 ta yoki, 30 ta kirrasi, 20 ta uchi mavjud?", "ikosaedr",
"geksaedr", "oktaedr", "dodekaedr", 1
)
questionsList.add(que4)
val que5 = Questions(
1, "Qaysi Platon jismining 8 ta yoki, 12 ta kirrasi, 6 ta uchi mavjud?", "oktaedr",
"geksaedr", "tetraedr", "dodekaedr", 1
)
questionsList.add(que5)
val que6 = Questions(
1,
"Keltirilgan proyeksiyalardan qaysilari markaziy proyeksiyalash hisoblanadi?",
"aksonometrik proyeksiyalash",
"ortografik proyeksiyalash",
"kavale proyeksiyalash",
"bir nuqtali proyeksiyalash",
4
)
questionsList.add(que6)
val que7 = Questions(
1, "Proyeksiyalash matritsasi qanday bo`ladi?", "simmetrik",
"determinanti 0ga teng", "determinanti 0ga teng emas", "nosimmetrik", 3
)
questionsList.add(que7)
val que8 = Questions(
1,
"Keltirilgan algoritmlardan qaysi biri kesmani o`turtburchak bilan kesishga kiradi?",
"Sazerland-Xogdman algoritmi",
"Sazerland-Koxen algoritmi",
"Brezenxeym algoritmi",
"Roberts algoritmi ",
2
)
questionsList.add(que8)
val que9 = Questions(
1, "Kesmani rastr algoritmi orqali chizuvchi algoritmni aniqlang", "Roberts algoritmi",
"Brezenxeym algoritmi ", "Sazerland-Koxen algoritmi", "Appel algoritmi ", 2
)
questionsList.add(que9)
val que10 = Questions(
1,
"Qaysi splayn egri chizigi ikki tayanuvchi nuqta va shu nuqtalardagi urunuvchi vektorlar bilan beriladi?",
"Ermit egri chizigi",
"Beze egri chizigi",
"V-splayn egri chizigi",
"Beta-splayn egri chizigi",
1
)
questionsList.add(que10)
val que11 = Questions(
1,
"Qaysi splayn egri chiziqlari 4 ta tayanuvchi nuqtalar bilan beriladi?",
"V-splayn, Ermit, Beta-splayn",
"Ermit, Beze, V-splayn",
"Beze, V-splayn, Veta-splayn",
"Beze, Ermit, Beta-splayn",
2
)
questionsList.add(que11)
val que12 = Questions(
1,
"Keltirilgan olib tashlash algoritmlardan qaysi birida ob’ekt nuqtasidan chizma tekisligigacha bo`lgan masofa haqida ma’lumot har bir piksel uchun hisobga olinadi?",
"Appelya algoritmi",
"Varnok algoritmi",
"z-bufer usuli",
"Roberts algoritmi",
3
)
questionsList.add(que12)
val que13 = Questions(
1,
"Keltirilgan qaysi olib tashlash qavariq ko‘pburchaklardan tuzilgan obyektning ko‘rinmas qirralarinini olib tashlash?",
"Varnok algoritmi",
"Appel algoritmi",
"z-bufer usuli ",
"Roberts algoritmi",
4
)
val que14 = Questions(
1,
"Keltirilgan qaysi uzoklashtirish algoritmida maydonni to`g`ri burchakli 4 kismga bulish ishlatiladi?",
"Appelya algoritmi",
"Varnok algoritmi",
"z-bufer usuli",
"Roberts algoritmi",
2
)
val que15 = Questions(
1,
"Poligonal setkani qaysi bo`yash metodida tasvir realroq bo`ladi?",
"aks",
"Guro metodi",
"Fong metodi",
"diffuzion akslantirish",
2
)
val que16 = Questions(
1,
"Keltirilgan rang modellaridan qaysi oddiy foydalanuvchilar uchun muljallangan?",
"CMY",
"CMYK",
"RGB",
"HSV",
3
)
val que17 = Questions(
1,
"Keltirilgan rang modellaridan qaysilari apparatli ta’minotlar uchun muljallangan?",
"RGB, HSV",
"CMY, HLS",
"HSV, HLS",
"RGB, CMY",
1
)
val que18 = Questions(
1,
"Beze va B-splayn tekisligining elementar bo`lagi nechta tayanuvchi nuqtalar bilan beriladi?",
"20",
"10",
"4",
"16",
4
)
val que19 = Questions(
1,
"RGB rang modeli qayerda ishlatiladi",
"kompyuter ekranida",
"Rangli bosmaga chiqaruvchi qurilmalarda",
"televidenieda",
"bunday rang modeli yo’q",
1
)
val que20 = Questions(
1,
"Axborotlarni kompyuterning diskiga grafikli axborot sifatida ko’chiradigan qurilmaning nomini aniqlang ",
"Klaviatura",
"Skaner",
"Monitor",
"Sichqoncha",
2
)
val que21 = Questions(
1,
"Monitor qurilmasining grafikli rejimdagi koordinata nuqtalar soni qaysi javobda to`g’ri ko’rsatilgan?",
"800õ600",
"1024õ768",
"barcha javoblar to’g’ri",
"640õ480",
3
)
val que22 = Questions(
1,
"Qaysi operatsion tizimni grafikli operatsion tizim deb atash mumkin?",
"WINDOWS operatsion tizimi",
"OS/2 operatsion tizimi",
"DOS operatsion tizimi",
"Barcha javoblar to’g’ri",
4
)
val que23 = Questions(
1,
"“Ruxsat” turlari",
"Îriginalga ruhsat, ekran tasviriga ruhsat",
"qog’ozga chiqarishga ruhsat",
"a,b javob to’g’ri",
"to’g’ri javob yo’q",
1
)
val que24 = Questions(
1,
"Windows operatsion tizimining standart dasturlaridan Qaysi bir dastur grafiklar bilan ishlash imkoniyatini beradi?",
"Kalkulyator dasturi",
"Paint dasturi",
"Notebook dasturi",
"Barcha javoblar tug’ri",
2
)
val que25 = Questions(
1,
"Nechanchi yilda kim tomonidan birinchi kompyuter uchun displey yaratilgan",
"1952 yilda V. Zvorkin tomonidan",
"1950 yilda Paskal tomonidan",
"1951 yilda . Forrester tomonidan",
"1851 yilda Forrester tomonidan",
3
)
val que26 = Questions(
1,
"Kompyuter grafikasining qo’llanilish sohalari qaysi bandda to’liq ko’rsatilgan",
"meditsina, dizayn",
"ekologiya, arxitektura",
"matematika, informatika",
"arxitektura, meditsina, dizayn",
4
)
val que27 = Questions(
1,
"Grafik interfeys-",
"kompyuter va foydalanuvchi o’rtasida muloqot o’rnatuvchi vosita",
"kompyuterni ishlashini taminlaydi",
"kompyuterlarni tuzilishi",
"kompyuter va foydalanuvchi o’rtasida muloqot o’rnatuvchi qurilma",
1
)
val que28 = Questions(
1,
"Kompyuter grafikasi necha turga bo’linadi",
"2 turga",
"3 turga",
"8 turga",
"turga ajratilmaydi",
2
)
val que29 = Questions(
1,
"Rastrli grafikada tasvirlar-",
"vergullar yordamida tashkil etiladi",
"nukta va vergullar yordamida tashkil etiladi",
"nuqta(piksel)lar yordamida tashkil etildai",
"chiziqlardan yordamida tashkil topadi",
3
)
val que30 = Questions(
1,
"Vektorli grafikada tasvirlar-",
"nukta(piksel)lar yordamida tashkil etildai",
"nukta va vergullar yordamida tashkil etiladi",
"vergullar yordamida tashkil etiladi",
"chiziqlardan yordamida tashkil topadi",
4
)
val que31 = Questions(
1,
"Raqamli tasvirlarning ko’rinishlari berilgan javobni aniqlang?",
"rastrli, vektorli",
"rastrli, static",
"vektorli, static",
"rastrli, vektorli, static",
1
)
val que32 = Questions(
1,
"Rastrli grafikada tasvir tashkil etuvchilari berilgan javobni aniqlang?",
"chiziq",
"nuqta",
"to’g’ri chiziq",
"to’rtburchak",
2
)
val que33 = Questions(
1,
"Vektorli grafikada tasvir tashkil etuvchilari berilgan javoni aniqlang?",
"egri chiziq",
"to’g’ri chiziq",
"barcha javoblar to’g’ri",
"elementar geometrik figuralar",
3
)
val que34 = Questions(
1,
"Grafik fayllarning formatlari berilgan javobni aniqlang ?",
"bmp, gif, jpg, tif, dpr",
"bmp, gif, jpg, tif, c",
"gif, jpeg,tiff, rtf",
"gif, jpeg, bmp, eps, psd",
4
)
val que35 = Questions(
1,
"O’zida 256 xil rangni jamlovchi animasion grafik tasvirlarni saqlovchi format ko’rsatilgan javobni aniqlang?",
"gif",
"jpg",
"swf",
"to’g’ri javob berilmagan",
1
)
val que36 = Questions(
1,
"O’zida milliondan ortiq rangni jamlovchi grafik tasvirlarni saqlovchi format ko’rsatilgan javobni aniqlang?",
"gif",
"jpg",
"swf",
"to’g’ri javob berilmagan",
2
)
val que37 = Questions(
1,
"Animatsiya tasvirlarni saqlovchi format ko’rsatilgan javobni aniqlang?",
"gif",
"jpg",
"swf",
"to’g’ri javob berilmagan",
3
)
val que38 = Questions(
1,
"Photoshop hujjati formati ko’rsatilgan javobni aniqlang?",
"gif",
"jpg",
"swf",
"to’g’ri javob berilmagan",
4
)
val que39 = Questions(
1,
"O`lchovli grafika yaratish dasturlari berilgan javobni aniqlang?",
"3D Studio Max, Maya",
"Adobe Photoshop, Maya",
"3D Studio Max, Corel Draw",
"3D Studio Max, Adobe Photoshop, Corel Draw",
1
)
val que40 = Questions(
1,
"Quyidagi ranglardan qaysi biri oq rang tarkibida yo’q?",
"zarg’aldoq",
"qora",
"yashil",
"binafsha",
2
)
val que41 = Questions(
1,
"Ranglarning xarakterlovchi parametrlar qaysi javobda berilgan?",
"yorug’lik to’lqin uzunligi va enrgiyasi",
"yorug’lik chastotasi va amplitudasi",
"yorug’lik to’lqin uzunligi va chastotasi",
"to’g’ri javob berilmagan",
3
)
val que42 = Questions(
1,
"Ranglarni nazariy va miqdoriy tavsiflash tizimiga nima deb ataladi?",
"rang modellari",
"rang rejimlari",
"rangning moslik tizimlari",
"ranglarni boshqarish tizimlari",
4
)
val que43 = Questions(
1,
"Rang modellari berilgan javobni aniqlang?",
"additiv, subtraktiv, persepsion, kolorimetrik",
"additiv, sub’ektiv, persepsion, kolorimetrik, originalga ruhsat, ekran tasviriga ruhsat",
"additiv, subtraktiv, ob’ektiv, kolorimetrik",
"additiv, sub’ektiv, ob’ektiv, kolorimetrik",
1
)
val que44 = Questions(
1,
"Additiv rang modelida qaysi ranglar asosiy ranglar sifatida ishlatiladi?",
"oq,qora, qizil",
"qizil, yashil, ko’k",
"qora, ko’k, qizil, sariq",
"qizil, yashil, ko’k, oq",
2
)
val que45 = Questions(
1,
"RGB rang modelida qaysi ranglar asosiy ranglar sifatida ishlatiladi?",
"oq,qora, qizil",
"qora, ko’k, qizil, sariq",
" qizil, yashil, ko’k",
"qizil, yashil, ko’k, oq",
3
)
val que46 = Questions(
1,
"Subtraktiv rang modelida qaysi ranglar asosiy ranglar sifatida ishlatiladi?",
"oq,qora, qizil",
"qora, ko’k, zangori, sariq",
"qizil, yashil, zangori",
"zangori, qirmizi, sariq, qora",
4
)
val que47 = Questions(
1,
"CMYK subtraktiv rang modelida qaysi ranglar asosiy ranglar sifatida ishlatiladi?",
"qirmizi, sariq, zangori, qora",
"oq,qora, qizil",
"qora, ko’k, zangori, sariq",
"zangori, qirmizi, sariq",
1
)
val que48 = Questions(
1,
"Ravshanlik va ranglilikka qarab ranglarni aniqlash modellari berilgan javobni aniqlang?",
"RGB",
"HSB",
"CMY",
"CMYK",
2
)
val que49 = Questions(
1,
"Ravshanlik va ranglilikni ikki o’lchovi asosida ranglarni aniqlash modellari berilgan javobni aniqlang?",
"RGB",
"HSB",
"Lab",
"CMYK",
3
)
val que50 = Questions(
1,
"RGB rang modelida necha xil rangni hosil qilish mumkin?",
"aniq javob yo’q",
"256",
"256^2",
"256^3",
4
)
val que51 = Questions(
1,
"Tasvirni ekranda aks ettirish imkoniyati yoki qog’ozda bosmalashda sifatini aniqlovchi ko’rsatgichga nima deyiladi?",
"tasvirlash imkoniyati",
"tasvirlash rangi",
"piksel",
"Pantone",
1
)
val que52 = Questions(
1,
"Tasvirning o’lchamini o’zgartirish uchun qanday almashtirishlar amalga oshiriladi?",
"tasvirning tasvirlash imkoniyati o’zgarmaydi, piksellar miqdori o’zgaradi",
"tasvirning tasvirlash imkoniyati o’zgarib, piksellar miqdori o’zgarmaydi",
"a va b jaboblar to’gri",
"to’g’ri javob berilmagan",
2
)
val que53 = Questions(
1,
"Rasmni kattalashtirganda ham uning sifati o’zgarmaydigan grafika turiga …grafika deyiladi?",
"Rastrli",
"3D",
"Vektorli",
"Fractal",
3
)
val que54 = Questions(
1,
"Rasmni kattalashtirganda zinapoyasimon qirralar paydo bo’lishi bilan farqlanadigan grafika turiga …grafika deyiladi?",
"Rastrli",
"3D",
"Vektorli",
"Fractal",
1
)
questionsList.add(que13)
questionsList.add(que14)
questionsList.add(que15)
questionsList.add(que16)
questionsList.add(que17)
questionsList.add(que18)
questionsList.add(que19)
questionsList.add(que20)
questionsList.add(que21)
questionsList.add(que22)
questionsList.add(que23)
questionsList.add(que24)
questionsList.add(que25)
questionsList.add(que26)
questionsList.add(que27)
questionsList.add(que28)
questionsList.add(que29)
questionsList.add(que30)
questionsList.add(que31)
questionsList.add(que32)
questionsList.add(que33)
questionsList.add(que34)
questionsList.add(que35)
questionsList.add(que36)
questionsList.add(que37)
questionsList.add(que38)
questionsList.add(que39)
questionsList.add(que40)
questionsList.add(que41)
questionsList.add(que42)
questionsList.add(que43)
questionsList.add(que44)
questionsList.add(que45)
questionsList.add(que46)
questionsList.add(que47)
questionsList.add(que48)
questionsList.add(que49)
questionsList.add(que50)
questionsList.add(que51)
questionsList.add(que52)
questionsList.add(que53)
questionsList.add(que54)
questionsList.shuffle()
return questionsList
}

}

package com.example.computergraphics.utils



class Count {
var count:Int?=null

constructor(count: Int?) {


this.count = count
}
}

package com.example.computergraphics.utils

import java.io.Serializable

class Info : Serializable {


var id: Int? = null
var name: String? = null
var number: Int? = null
var read: String? = null
var image: Int? = null
var pdfName: String? = null
var position:Int?=null

constructor(


id: Int?,
name: String?,
number: Int?,
read: String?,
image: Int?,
pdfName: String?,
position: Int?
) {
this.id = id
this.name = name
this.number = number
this.read = read
this.image = image
this.pdfName = pdfName
this.position = position
}

constructor(


name: String?,
number: Int?,
read: String?,
image: Int?,
pdfName: String?,
position: Int?
) {
this.name = name
this.number = number
this.read = read
this.image = image
this.pdfName = pdfName
this.position = position
}

constructor()

}

package com.example.computergraphics.utils



class Lectures {
var name:String?=null
var image:Int?=null
var countLectures:String?=null
var progressCount:Int?=null

constructor(name: String?, image: Int?, countLectures: String?, progressCount: Int?) {


this.name = name
this.image = image
this.countLectures = countLectures
this.progressCount = progressCount
}
}

package com.example.computergraphics.utils

import android.content.Context
import android.content.SharedPreferences
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

object MySharedPreferences {

private const val NAME = "akbarali"
private const val MODE = Context.MODE_PRIVATE
private lateinit var preferences: SharedPreferences

fun init(context: Context) {


preferences = context.getSharedPreferences(NAME, MODE)
}

private inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {


val editor = edit()
operation(editor)
editor.apply()
}

fun save(key: String, value: Int) {


val editor = preferences.edit()
editor.putInt(key, value)
editor.apply()
}

fun loadData(key: String): Int {


return preferences.getInt(key, 0)
}

fun save1(key: String, list: ArrayList) {


val editor: SharedPreferences.Editor = preferences.edit()
val gson = Gson()
val json = gson.toJson(list)
editor.putString(key, json)
editor.apply()
}

fun loadData1(key: String): ArrayList {


val emptyList = Gson().toJson(ArrayList())
return Gson().fromJson(
preferences.getString(key, emptyList), object : TypeToken>() {}.type
)
}

fun save2(key: String, info: Info) {


val editor = preferences.edit()
val gson = Gson()
val json = gson.toJson(info)
editor.putString(key, json)
editor.apply()
}

fun loadData2(key: String): Info {


val gson = Gson()
val json = preferences.getString(key, null)
return if (json!=null){
gson.fromJson(json, Info::class.java)
}else{
Info()
}

}

}



package com.example.computergraphics.utils

data class Questions (


val id:Int ,
val question: String,
val op1:String,
val op2:String,
val op3:String,
val op4:String,
val correct:Int
)

package com.example.computergraphics.utils

import android.content.Context
import android.os.Handler
import android.util.AttributeSet

class Typewriter : androidx.appcompat.widget.AppCompatTextView {


private var mText: CharSequence? = null
private var mIndex = 0
private var mDelay: Long = 500 //Default 500ms delay

constructor(context: Context?) : super(context!!) {}


constructor(context: Context?, attrs: AttributeSet?) : super(context!!, attrs) {}

private val mHandler: Handler = Handler()


private val characterAdder: Runnable = object : Runnable {
override fun run() {
text = mText!!.subSequence(0, mIndex++)
if (mIndex <= mText!!.length) {
mHandler.postDelayed(this, mDelay)
}
}
}

fun animateText(text: CharSequence?) {


mText = text
mIndex = 0
setText("")
mHandler.removeCallbacks(characterAdder)
mHandler.postDelayed(characterAdder, mDelay)
}

fun setCharacterDelay(millis: Long) {


mDelay = millis
}
}

package com.example.computergraphics

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

// TODO: Rename parameter arguments, choose names that match


// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
* A simple [Fragment] subclass.
* Use the [AboutFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class AboutFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null

override fun onCreate(savedInstanceState: Bundle?) {


super.onCreate(savedInstanceState)

Download 200,3 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   20




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish