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 { |
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
val showDialogButton = findViewById<Button>(R.id.show_dialog_button) | |
showDialogButton?.let { | |
it.setOnClickListener { | |
dialog { | |
title = resources.getString(R.string.custom_dialog_title) | |
contentText = resources.getString(R.string.custom_dialog_body) | |
negativeText = resources.getString(R.string.custom_dialog_negative_text) | |
positiveText = resources.getString(R.string.custom_dialog_positive_text) | |
positiveAction = { toast("Positive Action!!!") } | |
negativeAction = { toast("Negative Action!!!") } |