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
| <application | |
| android:name=".di.Application" | |
| android:icon="${appIcon}" | |
| android:roundIcon="${appIcon}" | |
| .... | |
| </aplication> |
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
| buildTypes { | |
| release { | |
| minifyEnabled false | |
| shrinkResources false | |
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
| testCoverageEnabled false | |
| manifestPlaceholders = [ | |
| appIcon: "@mipmap/ic_release" | |
| ] | |
| } |
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 android.graphics.Matrix | |
| import android.os.Bundle | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.animation.core.LinearEasing | |
| import androidx.compose.animation.core.RepeatMode | |
| import androidx.compose.animation.core.animateFloat | |
| import androidx.compose.animation.core.infiniteRepeatable | |
| import androidx.compose.animation.core.rememberInfiniteTransition | |
| import androidx.compose.animation.core.tween |
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.ercnksgl.testapp.util | |
| import android.view.MotionEvent | |
| import androidx.recyclerview.widget.RecyclerView | |
| import kotlin.math.abs | |
| class DisallowParentSwipeOnItemTouchListener : RecyclerView.OnItemTouchListener { | |
| var startPoint = 0f | |
| override fun onInterceptTouchEvent( | |
| rv: RecyclerView, |
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
| /** Making this extension function cleans out the code a lot by removing the repetitive | |
| flowWithLifecycle() or repeatOnLifecycle() | |
| **/ | |
| fun <T> Flow<T>.safeCollect( | |
| owner: LifecycleOwner, | |
| block: (T.() -> Unit)? = null | |
| ) = owner.lifecycleScope.launch { | |
| flowWithLifecycle(owner.lifecycle).collectLatest { block?.invoke(it) } | |
| } |
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
| // Coil | |
| // implementation("io.coil-kt:coil-compose:2.2.2") | |
| import android.util.Log | |
| import android.widget.Toast | |
| import androidx.activity.compose.rememberLauncherForActivityResult | |
| import androidx.activity.result.PickVisualMediaRequest | |
| import androidx.activity.result.contract.ActivityResultContracts | |
| import androidx.compose.foundation.clickable | |
| import androidx.compose.foundation.layout.* |
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
| suspend fun LazyListState.getFirstVisibleAsState(index: (Int) -> Unit) { | |
| this.interactionSource.interactions.collectLatest { | |
| index(this.firstVisibleItemIndex) | |
| } | |
| } | |
| data class WeeklyStat( | |
| val earning: Float = 0.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
| private fun setTextWatcher(editText: EditText?) { | |
| editText?.addTextChangedListener(object : TextWatcher { | |
| override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} | |
| override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { | |
| if (s.toString() != "") { | |
| mTextMap[editText.id] = TextMapModel(s.toString(), editText) | |
| val indexOfNext = mTextIdArray.indexOf(editText.id) + 1 |
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
| private val mTextMap: HashMap<Int, TextMapModel> = HashMap() | |
| private val mTextIdArray: ArrayList<Int> = ArrayList() | |
| private fun createInputFieldsInInputBox(actualText: String) { | |
| val textLength = actualText.length | |
| val flexboxLayout = mBinding.flexboxLayoutInput | |
| flexboxLayout.flexDirection = FlexDirection.ROW | |
| val filterArray = arrayOfNulls<InputFilter>(1) | |
| filterArray[0] = InputFilter.LengthFilter(1) |
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
| /* | |
| finds and colors all urls contained in a string | |
| @param linkColor color for the url default is blue | |
| @param linkClickAction action to perform when user click that link | |
| */ | |
| fun String.linkify(linkColor:Int = Color.BLUE,linkClickAction:((link:String) -> Unit)? = null): SpannableStringBuilder { | |
| val builder = SpannableStringBuilder(this) | |
| val matcher = Patterns.WEB_URL.matcher(this) | |
| while(matcher.find()){ |