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
| implementation 'com.google.android.material:material:1.3.0-alpha01' | |
| <CoordinatorLayout | |
| <AppBarLayout | |
| style="@style/Widget.MaterialComponents.AppBarLayout.Surface" | |
| app:liftOnScroll="true"/> | |
| <RecyclerView | |
| app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> |
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.skyyo.ext | |
| import android.util.Log | |
| import android.view.View | |
| fun hideViews(vararg views: View) = views.forEach { it.visibility = View.GONE } | |
| fun showViews(vararg views: View) = views.forEach { it.visibility = View.VISIBLE } | |
| fun Any.log(message: String) = Log.d("vv", message) |
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.skyyo.ext | |
| inline val CharSequence?.isEmail: Boolean get() = isMatch(REGEX_EMAIL) | |
| fun CharSequence?.isMatch(regex: String): Boolean = | |
| !this.isNullOrEmpty() && Regex(regex).matches(this) | |
| const val REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$" |
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.skyyo.ext | |
| import android.animation.AnimatorSet | |
| import android.animation.ObjectAnimator | |
| import android.view.View | |
| fun View.attentionBounce(): AnimatorSet { | |
| val animatorSet = AnimatorSet() | |
| val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "translationY", 0f, 0f, -30f, 0f, -15f, 0f, 0f) |
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.skyyo.ext | |
| import android.animation.AnimatorSet | |
| import android.animation.ObjectAnimator | |
| import android.view.View | |
| fun View.flipInX(): AnimatorSet { | |
| val animatorSet = AnimatorSet() | |
| val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.25f, 0.5f, 0.75f, 1f) |
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.skyyo.ext | |
| import android.animation.AnimatorSet | |
| import android.animation.ObjectAnimator | |
| import android.view.View | |
| import android.view.ViewGroup | |
| fun View.slideInDown(): AnimatorSet { | |
| val animatorSet = AnimatorSet() | |
| val distance = (top + height).toFloat() |
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.skyyo.ext | |
| import android.animation.AnimatorSet | |
| import android.animation.ObjectAnimator | |
| import android.view.View | |
| fun View.bounceIn(): AnimatorSet { | |
| val animatorSet = AnimatorSet() | |
| val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0f, 1f, 1f, 1f) |
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.skyyo.ext | |
| import android.animation.AnimatorSet | |
| import android.animation.ObjectAnimator | |
| import android.view.View | |
| fun View.fadeIn(): AnimatorSet { | |
| val animatorSet = AnimatorSet() | |
| val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0f, 1f) |
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
| <View | |
| android:id="@+id/view" | |
| android:background="@color/colorAccent" | |
| android:stateListAnimator="@animator/toolbar_elevator"/> | |
| <-- res/animator/toolbar_elevator.xml --> | |
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <item android:state_selected="true"> | |
| <objectAnimator | |
| android:duration="350" |
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.skyyo.ext | |
| import android.app.Activity | |
| import android.content.Context | |
| import android.view.inputmethod.InputMethodManager | |
| import androidx.fragment.app.Fragment | |
| fun Fragment?.hideKeyboard() = | |
| (this?.activity?.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?)?.let { |
OlderNewer