Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mustafa Yiğit mustafayigitt

🎯
Focusing
View GitHub Profile
View AuthRepositoryTest.kt
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
View Increment version gradle task
+import org.gradle.api.DefaultTask
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.TaskAction
+import org.gradle.api.tasks.options.Option
+
@mustafayigitt
mustafayigitt / Increment version lane
Created Aug 13, 2021
Increment version with gradle task using fastlane
View Increment version lane
# Increment Version
desc "Increment Build Version"
lane:increment_version do |options|
versionCode = options[:versionCode]
versionName = options[:versionName]
println(message:"Version name: " + versionName + " Version Code: " + versionCode)
gradle(task:"increment_version --versionName=#{versionName} --versionCode=#{versionCode}")
@mustafayigitt
mustafayigitt / MainActivity.kt
Last active Mar 28, 2021
form validation with kotlin flow, stateflow
View MainActivity.kt
package com.mustafayigit.formvalidationwithkotlinflow
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doOnTextChanged
import androidx.lifecycle.lifecycleScope
import com.google.android.material.snackbar.Snackbar
import com.mustafayigit.formvalidationwithkotlinflow.databinding.ActivityMainBinding
@mustafayigitt
mustafayigitt / activity_main.xml
Last active Mar 28, 2021
form validation with kotlin flow,stateFlow
View activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/txtErrorMessage"
@mustafayigitt
mustafayigitt / MainActivity.kt
Created Oct 24, 2020
generic adapter usage
View MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val recyclerViewText = findViewById<RecyclerView>(R.id.recyclerText)
val recyclerViewImage = findViewById<RecyclerView>(R.id.recyclerImage)
recyclerViewText.adapter = object : GenericListAdapter<String>(
R.layout.adapter_item_text,
@mustafayigitt
mustafayigitt / GenericListAdapter.kt
Last active Oct 24, 2020
Generic ListAdapter with Kotlin
View GenericListAdapter.kt
abstract class GenericListAdapter<T : Any>(
@IdRes val layoutId: Int,
inline val bind: (item: T, holder: BaseViewHolder, itemCount: Int) -> Unit
) : ListAdapter<T, BaseViewHolder>(BaseItemCallback<T>()) {
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
bind(getItem(position), holder, itemCount)
}
override fun getItemViewType(position: Int) = layoutId
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
@mustafayigitt
mustafayigitt / GenericListAdapter.kt
Created Oct 24, 2020
Base viewholder and Itemcallback
View GenericListAdapter.kt
class BaseViewHolder(container: ViewGroup) : RecyclerView.ViewHolder(container)
class BaseItemCallback<T : Any> : DiffUtil.ItemCallback<T>() {
override fun areItemsTheSame(oldItem: T, newItem: T) = oldItem.toString() == newItem.toString()
override fun areContentsTheSame(oldItem: T, newItem: T) = oldItem == newItem
}
@mustafayigitt
mustafayigitt / fragment_user_detail_scene.xml
Created Aug 8, 2020
Recyclerview Swipe Animation with MotionLayout
View fragment_user_detail_scene.xml
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:duration="1000">
<KeyFrameSet></KeyFrameSet>
<OnSwipe motion:touchAnchorId="@+id/frameLayout" />
@mustafayigitt
mustafayigitt / BindingAdapter.kt
Created Jun 6, 2020
Binding Adapters for Imageview with Glide
View BindingAdapter.kt
@BindingAdapter("loadImage")
fun loadImage(imageView: ImageView, imageUrl: String) {
Glide.with(imageView.context)
.load(imageUrl)
.into(imageView)
}