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.content.Context | |
| import android.os.RemoteException | |
| import com.android.installreferrer.api.InstallReferrerClient | |
| import com.android.installreferrer.api.InstallReferrerStateListener | |
| import com.android.installreferrer.api.ReferrerDetails | |
| import kotlinx.coroutines.CompletableDeferred | |
| /** | |
| * https://developer.android.com/google/play/installreferrer/library | |
| * |
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
| override fun enqueue(callback: Callback<Result<T>>) { | |
| delegate.enqueue( | |
| object : Callback<T> { | |
| override fun onResponse(call: Call<T>, response: Response<T>) { | |
| if (response.isSuccessful) { | |
| callback.onResponse( | |
| this@ResultCall, | |
| Response.success( | |
| response.code(), | |
| Result.success(response.body()!!) |
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.view.View | |
| import androidx.recyclerview.widget.RecyclerView | |
| import androidx.recyclerview.widget.RecyclerView.* | |
| import timber.log.Timber | |
| import java.util.HashSet | |
| import java.util.concurrent.ConcurrentHashMap | |
| /** | |
| * Created by Sumeet on 24,January,2022 |
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.example.myapplication | |
| import android.content.pm.PackageManager | |
| import androidx.activity.result.ActivityResultLauncher | |
| import androidx.activity.result.contract.ActivityResultContracts | |
| import androidx.core.app.ActivityCompat | |
| import androidx.core.content.ContextCompat | |
| import androidx.fragment.app.Fragment | |
| import androidx.lifecycle.Lifecycle | |
| import androidx.lifecycle.LifecycleObserver |
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
| @Composable | |
| fun DragDropList( | |
| items: List<ReorderItem>, | |
| onMove: (Int, Int) -> Unit, | |
| modifier: Modifier = Modifier | |
| ) { | |
| val scope = rememberCoroutineScope() | |
| var overscrollJob by remember { mutableStateOf<Job?>(null) } |
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
| 1. hiltvm (applicable in top-level) | |
| @dagger.hilt.android.lifecycle.HiltViewModel | |
| class $NAME$ @javax.inject.Inject constructor( | |
| $PARAM$ | |
| ) : androidx.lifecycle.ViewModel() { | |
| $END$ | |
| } | |
| 2. vmstatefunc (applicable in class) | |
| private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$) |
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 eu.anifantakis.composeapp | |
| import android.os.Bundle | |
| import android.widget.Toast | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.foundation.* | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.foundation.lazy.LazyColumn | |
| import androidx.compose.foundation.lazy.items |
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
| typealias ViewHolderProducer = (parent: ViewGroup, viewType: Int) -> RecyclerView.ViewHolder | |
| typealias ViewHolderConsumer = (viewHolder: RecyclerView.ViewHolder, creationTimeNanos: Long) -> Unit | |
| abstract class ViewHolderSupplier( | |
| context: Context, | |
| private val viewHolderProducer: ViewHolderProducer | |
| ) { | |
| internal lateinit var viewHolderConsumer: ViewHolderConsumer |
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
| apply plugin: 'com.android.application' | |
| ext.versionMajor = 1 | |
| ext.versionMinor = 2 | |
| ext.versionPatch = 3 | |
| ext.versionClassifier = null | |
| ext.isSnapshot = true | |
| android { | |
| defaultConfig { |
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.aqua30.learningproject | |
| import android.content.Context | |
| import android.util.AttributeSet | |
| import android.util.Log | |
| import android.view.View | |
| import android.view.View.MeasureSpec | |
| import androidx.viewpager.widget.ViewPager | |
| class AdjustingViewPager: ViewPager { |