Skip to content

Instantly share code, notes, and snippets.

View ravisorathiya's full-sized avatar

Ravi Sorathiya ravisorathiya

  • Surat Gujarat India
View GitHub Profile
@ravisorathiya
ravisorathiya / FFMpegConfig.kt
Created November 25, 2021 09:40
FFmpeg Congiration checking compatabilty of device
package com.example.fastsaveapp.ffmpeg
import android.content.Context
import com.example.fastsaveapp.logger
import com.github.hiteshsondhi88.libffmpeg.FFmpeg
import com.github.hiteshsondhi88.libffmpeg.LoadBinaryResponseHandler
import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegNotSupportedException
object FFMpegConfig {
import android.app.Application
import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainCoroutineDispatcher
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
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()
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="external"
path="." />
<external-files-path
name="external_files"
path="." />
<cache-path
name="cache"
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()
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
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))
@ravisorathiya
ravisorathiya / base-module.gradle
Last active February 24, 2024 05:16
multi module project gradle file
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
@ravisorathiya
ravisorathiya / EasyAdapter.kt
Last active May 8, 2024 07:04
BaseAdapter.kt
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,