This file contains 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 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 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 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 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 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 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 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 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() |
This file contains 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.google.gson.Gson | |
import com.google.gson.GsonBuilder | |
import com.huawei.hms.mlsdk.MLAnalyzerFactory | |
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationAnalyzer | |
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationScene | |
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationSetting | |
import com.wondersoftware.mastapp.MastApplication |
NewerOlder