Skip to content

Instantly share code, notes, and snippets.

View Axrorxoja's full-sized avatar
🏠
Working from home

Axrorxoja

🏠
Working from home
View GitHub Profile
@Composable
fun ListItems(
modifier: Modifier = Modifier,
fastFiltersSelectDelegate: ItemsDelegate,
isAutoScroll: Boolean = false,
) {
val items by fastFiltersSelectDelegate.filterItems.collectAsStateWithLifecycle()
val listState = rememberLazyListState()
LazyRow(
modifier = Modifier
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitWrapper {
private Retrofit retrofit;
private String baseUrl;
public RetrofitWrapper(String baseUrl) {
this.baseUrl = baseUrl;
@Axrorxoja
Axrorxoja / VinValidator2.kt
Created January 28, 2021 12:10
VinValidator2
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
@Axrorxoja
Axrorxoja / Main.kt
Created December 27, 2020 16:53
Coroutine parallel launch
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() }
@Axrorxoja
Axrorxoja / Main.kt
Created December 27, 2020 16:49
Coroutine sequence launch
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
fun main() {
runBlocking {
launch {
val result1 = fun1()
println(result1)
val result2 = fun2()
@Axrorxoja
Axrorxoja / gist:f72c7a46e570081f63bd8be912fd9a51
Created December 1, 2020 14:00 — forked from mediavrog/gist:5625602
Filter out Intents you don"t want to show from a IntentChooser dialog. For example your own app, competing apps or just apps you have a share integration by SDK already :) Based on http://stackoverflow.com/questions/5734678/custom-filtering-of-intent-chooser-based-on-installed-android-package-name/8550043#8550043
// 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
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:
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>
}
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> {
@Axrorxoja
Axrorxoja / ItemClickSupport.java
Created May 19, 2019 07:49 — forked from nesquena/ItemClickSupport.java
Click handling for RecyclerView
/*
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
}
});