This file contains hidden or 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
| fun boxesList(nummm : Int): List<Box> { | |
| var intRange = nummm * nummm | |
| val list = (1..intRange).mapIndexed { index, i -> | |
| Box( | |
| index / nummm, | |
| index % nummm, | |
| false | |
| ) | |
| } | |
| return list |
This file contains hidden or 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
| class AppDataStoreManager private constructor(val context: Application) : AppDataStore { | |
| private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings") | |
| companion object { | |
| @Volatile | |
| private var INSTANCE: AppDataStoreManager? = null | |
This file contains hidden or 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
| class ActivityTracker private constructor(private val context: Application) { | |
| private val runningActivities = LinkedHashSet<Activity>() | |
| private val exceptActivity = LinkedHashSet<Class<*>>() | |
| private val trackOnlyActivities = LinkedHashSet<Class<*>>() | |
| private var trackRegisterOnly = false | |
| companion object { |
This file contains hidden or 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
| class EasyAdapter<T : Any> private constructor( | |
| private val layoutResId: Int, | |
| areContentsTheSame: (T, T) -> Boolean = { old, new -> old == new }, | |
| areItemsTheSame: (T, T) -> Boolean = { old, new -> old == new }, | |
| private val onBind: (View, T) -> Unit, | |
| private val onViewCreated: (View, position: () -> Pair<Int, T>) -> Unit, | |
| ) : ListAdapter<T, RecyclerView.ViewHolder>( | |
| GenericDiffCallback( | |
| areContentsTheSame, | |
| areItemsTheSame, |
This file contains hidden or 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
| apply plugin: 'com.android.library' | |
| apply plugin: 'kotlin-android' | |
| //apply plugin: 'kotlin-kapt' | |
| apply plugin: 'kotlin-parcelize' | |
| apply plugin: 'com.google.devtools.ksp' | |
| android { | |
| namespace = "com.ravisorathiya.dailyandroid" | |
| compileSdk ProjectConfig.compileSdk |
This file contains hidden or 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
| object MyApi { | |
| private const val BASE_URL = " https://www.MYAPI.com/" | |
| private val moshi = Moshi.Builder() | |
| .add(KotlinJsonAdapterFactory()) | |
| .build() | |
| private val retrofit = Retrofit.Builder() | |
| .addConverterFactory(MoshiConverterFactory.create(moshi)) |
This file contains hidden or 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
| import android.app.Application | |
| import android.content.Context | |
| import androidx.room.Room | |
| import com.example.galleryapp.MyApplication | |
| import com.example.galleryapp.core.data.AppDatabase | |
| import com.squareup.moshi.Moshi | |
| import dagger.Module | |
| import dagger.Provides | |
| import dagger.hilt.InstallIn |
This file contains hidden or 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
| import android.annotation.SuppressLint | |
| import android.view.LayoutInflater | |
| import android.view.ViewGroup | |
| import androidx.recyclerview.widget.DiffUtil | |
| import androidx.recyclerview.widget.ListAdapter | |
| import androidx.recyclerview.widget.RecyclerView | |
| class MyAdapter( | |
| ) : ListAdapter<Any, MyAdapter.MyViewHolder>( | |
| DiffCallBack() |
This file contains hidden or 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
| <?xml version="1.0" encoding="utf-8"?> | |
| <paths> | |
| <external-path | |
| name="external" | |
| path="." /> | |
| <external-files-path | |
| name="external_files" | |
| path="." /> | |
| <cache-path | |
| name="cache" |
This file contains hidden or 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
| import androidx.room.TypeConverter | |
| import com.google.gson.Gson | |
| import com.google.gson.reflect.TypeToken | |
| import com.wondersoftware.mastapp.business.datasource.cache.theme.ThemeEntity | |
| import java.lang.reflect.Type | |
| import java.util.* | |
| class DataTypeConverter { | |
| private val gson = Gson() |
NewerOlder