This file contains 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 ListItems( | |
modifier: Modifier = Modifier, | |
fastFiltersSelectDelegate: ItemsDelegate, | |
isAutoScroll: Boolean = false, | |
) { | |
val items by fastFiltersSelectDelegate.filterItems.collectAsStateWithLifecycle() | |
val listState = rememberLazyListState() | |
LazyRow( | |
modifier = Modifier |
This file contains 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 retrofit2.Retrofit; | |
import retrofit2.converter.gson.GsonConverterFactory; | |
public class RetrofitWrapper { | |
private Retrofit retrofit; | |
private String baseUrl; | |
public RetrofitWrapper(String baseUrl) { | |
this.baseUrl = baseUrl; |
This file contains 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
object VinValidator2 { | |
private val values = intArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 0, 1, | |
2, 3, 4, 5, 0, 7, 0, 9, 2, 3, | |
4, 5, 6, 7, 8, 9) | |
private val weights = intArrayOf(8, 7, 6, 5, 4, 3, 2, 10, 0, 9, | |
8, 7, 6, 5, 4, 3, 2) | |
fun isValid(vin: String): Boolean { | |
var s = vin |
This file contains 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 kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
fun main() { | |
runBlocking { | |
launch { | |
val resultDeferred1 = async { fun1() } | |
val resultDeferred2 = async { fun2() } |
This file contains 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 kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
fun main() { | |
runBlocking { | |
launch { | |
val result1 = fun1() | |
println(result1) | |
val result2 = fun2() |
This file contains 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
// Usage: | |
// blacklist | |
String[] blacklist = new String[]{"com.any.package", "net.other.package"}; | |
// your share intent | |
Intent intent = new Intent(Intent.ACTION_SEND); | |
intent.setType("text/plain"); | |
intent.putExtra(Intent.EXTRA_TEXT, "some text"); | |
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject"); | |
// ... anything else you want to add | |
// invoke custom chooser |
This file contains 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
name: Release Action | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: |
This file contains 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
interface NominationService { | |
// https://nominatim.openstreetmap.org/reverse.php?format=html&lat=41.318479&lon=69.294924&zoom=18 | |
@GET("reverse.php") | |
fun loadAddress( | |
@Query("lat") lat: Double, | |
@Query("lon") lon: Double, | |
@Query("format") format: String = "json", | |
@Query("accept-language") lang: String = "en" | |
): Call<NominationResponse> | |
} |
This file contains 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.SharedPreferences | |
import uz.avtobio.app.extension.edit | |
import kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KProperty | |
class BooleanPreference( | |
private val pref: SharedPreferences, | |
private val key: String, | |
private val defValue: Boolean = false | |
) : ReadWriteProperty<Any, Boolean> { |
This file contains 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
/* | |
Source: http://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/ | |
USAGE: | |
ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() { | |
@Override | |
public void onItemClicked(RecyclerView recyclerView, int position, View v) { | |
// do it | |
} | |
}); |
NewerOlder