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.ytapps.myapplication | |
import android.Manifest | |
import android.app.Notification | |
import android.app.NotificationChannel | |
import android.app.NotificationManager | |
import android.content.Context | |
import android.content.pm.PackageManager | |
import android.os.Build | |
import android.os.Bundle |
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() | |
} | |
} |
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' | |
} |
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' } | |
} | |
} |
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) | |
} |
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 | |
} |
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) { |
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 | |
) { |
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 |
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"> |
NewerOlder