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
<declare-styleable name="CustomSwitch"> | |
<attr name="textOn" format="string|reference" /> | |
<attr name="textOff" format="string|reference" /> | |
<attr name="backColorGroundShip" format="reference" /> | |
<attr name="backColorGroundSwitch" format="reference" /> | |
</declare-styleable> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | |
<solid android:color="#FAFAFA"/> | |
<corners android:radius="40dp"/> | |
</shape> |
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
sealed class BaseUiModel<out T> { | |
object Loading : BaseUiModel<Nothing>() | |
class Success<T>(val data: T) : BaseUiModel<T>() | |
class Error(val error: String) : BaseUiModel<Nothing>() | |
class ErrorEx(val data: Exception) : BaseUiModel<Nothing>() | |
} |
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 com.google.android.gms.location.sample.locationupdates | |
import android.annotation.SuppressLint | |
import android.app.Application | |
import android.location.Location | |
import android.os.Looper | |
import android.util.Log | |
import androidx.appcompat.app.AppCompatActivity | |
import com.google.android.gms.location.* | |
import com.google.android.gms.tasks.OnCompleteListener |
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
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. | |
*/ | |
fun getContentIfNotHandled(): T? { | |
return if (hasBeenHandled) { |
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
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. | |
*/ | |
fun getContentIfNotHandled(): T? { | |
return if (hasBeenHandled) { |
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
object Aes256 { | |
private fun cipher(operationMode: Int, secretKey: String = BuildConfig.KEY_ENCRYPT): Cipher { | |
if (secretKey.length != 32) throw RuntimeException("SecretKey length is not 32 chars") | |
val c = Cipher.getInstance("AES/CBC/PKCS5Padding") | |
val sk = SecretKeySpec(secretKey.toByteArray(Charsets.UTF_8), "AES") | |
val iv = IvParameterSpec(secretKey.substring(0, 16).toByteArray(Charsets.UTF_8)) | |
c.init(operationMode, sk, iv) | |
return c | |
} |
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 md5(input:String): String { | |
val md = MessageDigest.getInstance("MD5") | |
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0') | |
} |
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 RemoteDataSourceImpl : RemoteDataSource { | |
private val db = FirebaseFirestore.getInstance().apply { | |
this.firestoreSettings = FirebaseFirestoreSettings | |
.Builder() | |
.setPersistenceEnabled(true) | |
.build() | |
} | |
companion object { |
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
abstract class BaseFullFragment: DialogFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setStyle(STYLE_NORMAL, R.style.AppTheme) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle? |