Taken from StackExchange
Thanks to LangLangC
For temperature and other improvements see https://gist.github.com/cdleon/d16e7743e6f056fedbebc329333d79df
| // | |
| // SpinlockTestTests.swift | |
| // SpinlockTestTests | |
| // | |
| // Created by Peter Steinberger on 04/10/2016. | |
| // Copyright © 2016 PSPDFKit GmbH. All rights reserved. | |
| // | |
| import XCTest |
| public class MaxHeightLinearLayout extends LinearLayout { | |
| private int maxHeightDp; | |
| public MaxHeightLinearLayout(Context context) { | |
| super(context); | |
| } | |
| public MaxHeightLinearLayout(Context context, AttributeSet attrs) { | |
| super(context, attrs); |
| public class CustomLayout extends LinearLayout { | |
| @SuppressWarnings("unchecked") @Override public Parcelable onSaveInstanceState() { | |
| Parcelable saveInstanceState = super.onSaveInstanceState(); | |
| SavedState savedState = new SavedState(saveInstanceState); | |
| savedState.childrenStates = new SparseArray(); | |
| for (int i = 0; i < getChildCount(); i++) { | |
| getChildAt(i).saveHierarchyState(savedState.childrenStates); | |
| } | |
| return savedState; |
| class Number /* class cluser */ { | |
| class Int8: Number { | |
| var value: Swift.Int8 | |
| init(_ value: Swift.Int8) { self.value = value } | |
| } | |
| class Int: Number { | |
| var value: Swift.Int | |
| init(_ value: Swift.Int) { self.value = value } | |
| } |
| <application | |
| android:allowBackup="true" | |
| android:icon="@mipmap/ic_launcher" | |
| android:label="@string/app_name" | |
| android:roundIcon="@mipmap/ic_launcher_round" | |
| android:supportsRtl="true" | |
| android:theme="@style/AppTheme" | |
| android:networkSecurityConfig="@xml/network_security_config"> |
| protocol DogBreed { | |
| typealias Level = Int | |
| var breedName: String { get set } | |
| var size: Level { get set } | |
| var health: Level { get set } | |
| var adaptability: Level { get set } | |
| var intelligence: Level { get set } | |
| var dogType: DogType { get set } |
Taken from StackExchange
Thanks to LangLangC
For temperature and other improvements see https://gist.github.com/cdleon/d16e7743e6f056fedbebc329333d79df
| class ApiClientServiceImpl( | |
| client: HttpClient, parser: JsonParser | |
| ) : BaseApiClientService(client, parser) { | |
| override suspend fun getCategories() = | |
| requestCatching(Category.serializer().list) { | |
| get() | |
| apiUrl("/api/product/live/category/list") | |
| accessHeaders() |
| import kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.Job | |
| import kotlinx.coroutines.delay | |
| import kotlinx.coroutines.launch | |
| /* | |
| This is free and unencumbered software released into the public domain. | |
| Anyone is free to copy, modify, publish, use, compile, sell, or | |
| distribute this software, either in source code form or as a compiled |
| import com.google.gson.Gson | |
| import com.google.gson.GsonBuilder | |
| import com.google.gson.TypeAdapter | |
| import com.google.gson.TypeAdapterFactory | |
| import com.google.gson.reflect.TypeToken | |
| import com.google.gson.stream.JsonReader | |
| import com.google.gson.stream.JsonWriter | |
| import kotlin.jvm.internal.Reflection | |
| import kotlin.reflect.KClass |