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
implementation "com.google.dagger:hilt-android:$hilt-latest-version" | |
kapt "com.google.dagger:hilt-android-compiler:$hilt-latest-version" |
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.datastore.core.DataStore | |
import androidx.datastore.preferences.core.Preferences | |
import androidx.datastore.preferences.core.edit | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.DelicateCoroutinesApi | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.flow.first | |
import kotlinx.coroutines.flow.map | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking |
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.content.Context | |
import android.os.Bundle | |
import android.os.Handler | |
import android.os.HandlerThread | |
import android.os.Message | |
import android.view.WindowManager | |
import android.widget.ImageView | |
import androidx.appcompat.app.AppCompatActivity | |
class MainActivity : AppCompatActivity() { |
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
%kotlinc% -script DeleteBuildFolders.kts -- -dir . | |
:: "." is default path you can change it to any folder you want to work on that folder ^ | |
:: (script workes on current folder without "-dir" argument)" | |
:: "^" can be used for multiline commands |
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 Theme : BaseObservable() { | |
@Bindable val colorPrimary: String = "colorPrimary" | |
@Bindable val colorPrimaryDark: String = "colorPrimaryDark" | |
... | |
} |
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.content.SharedPreferences | |
import kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KProperty | |
abstract class BasePreferencesDataSource { | |
protected abstract val preferences : SharedPreferences | |
protected class StringPrefProperty(private val key: String) : ReadWriteProperty<BasePreferencesDataSource, String> { |
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
public class FileUtils { | |
/** | |
* @return The MIME type for the given file. | |
*/ | |
public static String getMimeType(File file) { | |
String extension = getExtension(file.getName()).toLowerCase(); | |
if (!TextUtils.isEmpty(extension) && extension.length() > 1) |
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 PreferenceRepositoryTest { | |
@get:Rule | |
var instantExecutorRule = InstantTaskExecutorRule() | |
@Mock | |
private lateinit var connectionApiServices: ConnectionApiServices | |
private lateinit var preferenceRepository: PrefrenceRepository |
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 com.example.db.ConversationDao.Properties.Mid | |
import com.example.db.UserDao.Properties.Username | |
fun UserDao.getByUsername(username: String): User = | |
queryBuilder().where(Username.eq(username)).unique() | |
fun MessageDao.getMessage(mid: Long): Message = | |
queryBuilder().where(Mid.eq(mid)).unique() |
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
package com.izigzag.messenger.model.db | |
import com.izigzag.messenger.model.db.ConversationDao.Properties.Mid | |
import com.izigzag.messenger.model.db.UserDao.Properties.Username | |
fun UserDao.getByUsername(username: String): User = | |
queryBuilder().where(Username.eq(username)).unique() | |
fun MessageDao.getMessage(mid: Long): Message = | |
queryBuilder().where(Mid.eq(mid)).unique() |