View Validator.kt
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
Validator.Builder() | |
.addRules( | |
ValidatableRule.Email("Enter valid mail address"), | |
ValidatableRule.Required("Input is required"), | |
) | |
.addCollector { | |
mBinding.editText.doOnTextChanged { text, _, _, _ -> | |
inputValidator.input = text.toString() | |
} | |
} |
View build.gradle
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
dependencies { | |
implementation 'com.github.mustafayigitt:validator:Tag' | |
} |
View build.gradle
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
allprojects { | |
repositories { | |
maven { url 'https://jitpack.io' } | |
} | |
} |
View BaseDiffCallback.kt
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.recyclerview.widget.DiffUtil | |
class BaseDiffCallback<T : BaseComparable> : DiffUtil.ItemCallback<T>() { | |
override fun areItemsTheSame(oldItem: T, newItem: T) = | |
oldItem.id == newItem.id | |
override fun areContentsTheSame(oldItem: T, newItem: T) = | |
oldItem.equals(newItem) | |
} |
View BaseComparable.kt
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
interface BaseComparable{ | |
val id: String | |
} |
View GenericBaseRecyclerviewAdapter.kt
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
abstract class BaseRecyclerAdapter<T : BaseComparable, VB : ViewBinding>( | |
private inline val bindingInflater: (LayoutInflater, ViewGroup, Boolean) -> VB, | |
private inline val onBind: (item: T, binding: VB) -> Unit, | |
private inline val actions: (VB) -> List<Pair<View, (T) -> Unit>>, | |
) : ListAdapter<T, BaseRecyclerAdapter<T, VB>.BaseViewHolder>(BaseDiffCallback<T>()) { | |
inner class BaseViewHolder( | |
val binding: VB | |
) : RecyclerView.ViewHolder(binding.root) { |
View MainActivity.kt
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
val context = LocalContext.current | |
LazyColumn( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding(horizontal = 24.dp), | |
verticalArrangement = Arrangement.spacedBy(20.dp), | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { |
View MainActivity.kt
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
val scrollState = rememberScrollState() | |
val scope = rememberCoroutineScope() | |
var selectedAnimal by remember { mutableStateOf<Animal?>(null) } | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.verticalScroll(scrollState), | |
verticalArrangement = Arrangement.spacedBy(20.dp), | |
horizontalAlignment = Alignment.CenterHorizontally |
View activity_main.xml
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"?> | |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:gravity="center" | |
android:orientation="vertical"> |
View AuthRepositoryTest.kt
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.packagename.data.repository | |
import com.google.android.gms.auth.api.signin.GoogleSignInClient | |
import com.packagename.BuildConfig | |
import com.packagename.R | |
import com.packagename.data.local.AppDatabase | |
import com.packagename.data.model.AuthModel | |
import com.packagename.data.preferences.PreferencesManager | |
import com.packagename.data.remote.response.ResponseRegister | |
import com.packagename.data.remote.service.AuthService |
NewerOlder