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
class MaskTextWatcher(private val mask: String) : TextWatcher { | |
private var isRunning = false | |
private var isDeleting = false | |
override fun beforeTextChanged(charSequence: CharSequence, start: Int, count: Int, after: Int) { | |
isDeleting = count > after | |
} | |
override fun onTextChanged(charSequence: CharSequence, start: Int, before: Int, count: Int) {} |
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
fun String.doubleSpacing(): String { | |
var self = "" | |
this.forEachIndexed { index, character -> | |
self = if (index == 0) "$character" else "$self $character" | |
} | |
return self | |
} |
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
boolean exit; | |
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { | |
@Override | |
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { | |
Log.d("onOffsetChanged", "appbar verticalOffset: " + verticalOffset); | |
if (verticalOffset == 0 && !exit) { | |
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) collapsingToolbar.getLayoutParams(); |
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
open class DeactivatedViewPager( | |
context: Context, | |
attrs: AttributeSet? = null | |
) : ViewPager(context, attrs) { | |
var isPagingEnabled = false | |
override fun onTouchEvent(ev: MotionEvent?): Boolean { | |
if (ev?.action == MotionEvent.ACTION_UP) performClick() | |
return isPagingEnabled && super.onTouchEvent(ev) |
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
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.Observer | |
infix fun <T : Any?> LifecycleOwner.lazyObserver(func: (T) -> Unit): Lazy<Observer<T>> { | |
return lazyOf(Observer(func)) | |
} |
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.mynuapp; | |
import android.app.AlertDialog; | |
import android.app.Service; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.location.Address; | |
import android.location.Geocoder; |
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
import java.util.Timer | |
import java.util.TimerTask | |
import kotlin.concurrent.timerTask | |
private const val DEFAULT_EXECUTION_RATE = 6000L | |
class SimpleTimer { | |
var executionRate = DEFAULT_EXECUTION_RATE | |
private var mTrigger: (() -> Unit)? = null |