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
<service | |
android:name=".ui.home.GCAccessibilityService" | |
android:exported="false" | |
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" | |
> | |
<intent-filter> | |
<action android:name="android.accessibilityservice.AccessibilityService" /> | |
</intent-filter> | |
<meta-data |
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 CharterChallenge.Order.OrderItem.SizePrice | |
import com.google.gson.Gson | |
import com.google.gson.annotations.SerializedName | |
import java.net.URL | |
class CharterChallenge { | |
companion object { | |
private const val GET_ORDER_URL = "https://raw.githubusercontent.com/pgiani/KotlinTask/main/order.json" |
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 java.io.BufferedReader | |
import java.io.FileReader | |
fun main() { | |
getRepeatedCode(fileName = "data.txt") | |
} | |
private fun getRepeatedCode(fileName: String) { | |
var line: 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
@ExperimentalCoroutinesApi | |
@RunWith(JUnit4::class) | |
class CurrenciesRepositoryImplTest { | |
private val restApi = mock<ForeignExchangeApiService>() | |
private val mapper = mock<CurrenciesUiMapper>() | |
private val testDispatcher = TestCoroutineDispatcher() | |
private val currenciesRemoteImpl = CurrenciesRepositoryImpl(restApi, mapper) | |
private val managedCoroutineScope: ManagedCoroutineScope = |
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
@BindingAdapter( | |
value = ["loadAdapterData", "loadAdapterLayout", "loadAdapterListener", "filter"], | |
requireAll = false | |
) | |
fun <T> RecyclerView.loadAdapterData( | |
list: MutableList<T>?, | |
layout: Int?, | |
callback: BaseBindClickHandler<T>? = null, | |
filter: FilterWordListener<T>? = 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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:bind="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<import type="android.view.View" /> |
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
private fun initViewModel() { | |
// Fetch Latest Currencies | |
with(currenciesViewModel) { | |
observe(getLatestCurrenciesLiveData(), ::observeCurrencies) | |
fetchCurrencies() | |
} | |
} | |
private fun observeCurrencies(result: Result<UiCurrencies>?) { | |
when (result) { |
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
open class CurrenciesViewModel @Inject constructor( | |
private val getLatestCurrenciesUseCase: GetLatestCurrenciesUseCase | |
) : BaseViewModel() { | |
//region Observables | |
var isLoading: ObservableBoolean = ObservableBoolean(false) | |
//endregion | |
//region Live Data | |
typealias LiveResult<T> = MutableLiveData<Result<T>> |
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
sealed class Result<T> { | |
data class OnSuccess<T>( val value: T) : Result<T>() | |
data class OnError<T>(val throwable: Throwable) : Result<T>() | |
class OnLoading<T> : Result<T>() | |
class OnCancel<T> : Result<T>() | |
class OnEmpty<T> : Result<T>() | |
} |
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
open class GetLatestCurrenciesUseCase @Inject constructor(private val currenciesRepository: ICurrenciesRepository) : | |
ResultUseCase<String, UiCurrencies>( | |
backgroundContext = Dispatchers.IO, | |
foregroundContext = Dispatchers.Main | |
) { | |
override suspend fun executeOnBackground(params: String): UiCurrencies? = | |
currenciesRepository.getLatestCurrencies(params) | |
} |
NewerOlder