Skip to content

Instantly share code, notes, and snippets.

View muhammad-farhan-bakht's full-sized avatar
💻
Working Remotely

Muhammad Farhan muhammad-farhan-bakht

💻
Working Remotely
View GitHub Profile
@muhammad-farhan-bakht
muhammad-farhan-bakht / ViewVisibilityExtensions.kt
Created September 22, 2021 05:51 — forked from brescia123/ViewVisibilityExtensions.kt
Useful Android Kotlin Extension functions to easily change the visibility of a View
/** Set the View visibility to VISIBLE and eventually animate the View alpha till 100% */
fun View.visible(animate: Boolean = true) {
if (animate) {
animate().alpha(1f).setDuration(300).setListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
super.onAnimationStart(animation)
visibility = View.VISIBLE
}
})
} else {
@muhammad-farhan-bakht
muhammad-farhan-bakht / WebAccess.kt
Created December 17, 2019 11:07 — forked from andijakl/WebAccess.kt
Retrofit instance created through Singleton pattern in Kotlin using lazy initialization
package com.andresjakl.partslist
import android.util.Log
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
// Singleton pattern in Kotlin: https://kotlinlang.org/docs/reference/object-declarations.html#object-declarations
object WebAccess {
val partsApi : PartsApiClient by lazy {