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
| package br.com.juno.data.repository.preferences | |
| import android.annotation.SuppressLint | |
| import android.content.Context | |
| import android.content.SharedPreferences | |
| import android.security.KeyChain | |
| import android.security.keystore.KeyGenParameterSpec | |
| import android.security.keystore.KeyInfo | |
| import android.security.keystore.KeyProperties | |
| import android.util.Base64 |
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 Activity:AppCompatActivity{ | |
| val actionsAdapter:MyListAdapter by lifecycleSafe(this){ | |
| MyListAdapter() | |
| } | |
| } |
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
| package br.com.example.domain.interactor.base | |
| import br.com.exmaple.domain.exception.ErrorHandler | |
| import br.com.exmaple.domain.exception.MyCustomException | |
| import kotlinx.coroutines.* | |
| import org.koin.core.KoinComponent | |
| import org.koin.core.inject | |
| class ResultAsync<T> private constructor( | |
| scope: CoroutineScope, val action: suspend () -> T) : KoinComponent { |
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.content.Context | |
| import android.util.DisplayMetrics | |
| fun linearMap(source: Float, sourceMin: Float, sourceMax: Float, targetMin: Float, targetMax: Float): Float { | |
| return ((source - sourceMin) / (sourceMax - sourceMin)) * (targetMax - targetMin) + targetMin | |
| } | |
| fun clampedLinearPercent(percent: Float, expandAnchor: Float, collapseAnchor: Float) : Float { | |
| return ((Math.max(percent, collapseAnchor) - collapseAnchor) / (expandAnchor - collapseAnchor)) * expandAnchor | |
| } |
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 Authenticate(private val userRepository: UserRepository) :UseCase<Boolean, Authenticate.Params>(){ | |
| override suspend fun run(params: Params): Boolean { | |
| return userRepository.authenticate(params.username, params.password) | |
| } | |
| class Params(val username:String, val password:String) | |
| } |
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
| data class Address internal constructor( | |
| val addressLine1: String, | |
| val addressLine2: String = "", | |
| val city: String, | |
| val state: String = "", | |
| val province: String = "", | |
| val zip: String, | |
| val country: String = "USA") { | |
| class Builder { |
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
| <activity | |
| android:name=".ui.settings.help.AboutActivity" | |
| android:label="@string/app_name" | |
| android:theme="@style/AppTheme.TranslucentStatusBar"/> |
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
| /* | |
| Status dos jogos | |
| aberto - entre 1 e 36 horas | |
| fechando - entre 60 e 15 minutos | |
| nao palpitou - menos de 15 minutos - | |
| fechado - mais que 36 horas de diferença | |
| nao craque - para jogos marcados como craque |
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 kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.launch | |
| class ResultAsync<T> private constructor(action: suspend () -> T, scope: CoroutineScope) { | |
| internal var onSuccess : (T) -> Unit = {} | |
| internal var onError : (e: Throwable) -> Unit = {} | |
| companion object { | |
| fun <T> with(action: suspend () -> T, scope: CoroutineScope) :ResultAsync<T>{ |
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 startService(context: Context){ | |
| try { | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
| context.startForegroundService(Intent(context, MyService::class.java)) | |
| } else { | |
| context.startService(Intent(context, MyService::class.java)) | |
| } | |
| }catch (e :Exception){ | |
| e.stackTrace | |
| } |