Function | Function type | Target passed as | Returns |
---|---|---|---|
also |
Extension | it |
Target |
apply |
Extension | this |
Target |
let |
Extension | it |
Block return value |
run |
Extension | this |
Block return value |
with |
Regular | this |
Block return value |
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
@Preview() | |
@Composable | |
fun Card() { | |
var rotationX by remember { mutableStateOf(0f) } | |
var rotationY by remember { mutableStateOf(0f) } | |
Box( | |
Modifier | |
.fillMaxSize() | |
.background(Color.Black)) { | |
Box( |
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.app.Activity | |
import android.content.Context | |
import android.content.ContextWrapper | |
import android.graphics.Bitmap | |
import android.os.Handler | |
import android.os.Looper | |
import android.view.PixelCopy | |
import android.view.View | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.background |
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.Context | |
import android.content.res.ColorStateList | |
import android.content.res.TypedArray | |
import android.graphics.drawable.Drawable | |
import androidx.annotation.StyleableRes | |
import androidx.appcompat.content.res.AppCompatResources | |
/** | |
* Utility methods for extracting [ColorStateList]s and [Drawable]s from a [TypedArray]. |
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
public class AndroidWorkerInjection { | |
public static void inject(Worker worker) { | |
checkNotNull(worker, "worker"); | |
Object application = worker.getApplicationContext(); | |
if (!(application instanceof HasWorkerInjector)) { | |
throw new RuntimeException( | |
String.format( | |
"%s does not implement %s", | |
application.getClass().getCanonicalName(), |
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
inline fun <reified F : Fragment> createFakeFragmentInjector(crossinline block : F.() -> Unit) | |
: DispatchingAndroidInjector<Any> { | |
val myApp = InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as MyApp | |
val originalDispatchingActivityInjector = myApp.dispatchingActivityInjector | |
var originalFragmentInjector: AndroidInjector<Any>? = null | |
val fragmentInjector = AndroidInjector<Fragment> { fragment -> | |
originalFragmentInjector?.inject(fragment) | |
if (fragment is F) { | |
fragment.block() | |
} |
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
public class ReactiveTextViewHolder<T> extends ReactiveViewHolder<T> { | |
private TextView label; | |
private T currentItem; | |
public ReactiveTextViewHolder(View itemView) { | |
super(itemView); | |
label = (TextView) itemView.findViewById(android.R.id.text1); | |
} |
One of the best ways to investigate a problematic Xamarin.Android Binding is to first ensure you have the proper tooling available:
- Diagnostic MSBuild Output Enabled(Instructions)
- Java Decompiler(http://jd.benow.ca/)
- .NET Decompiler(https://www.jetbrains.com/decompiler/)
- Binding SDK Documentation
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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- This file should be outside of release manifest (in this case app/src/mock/Manifest.xml --> | |
<manifest | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.tests"> | |
<!-- For espresso testing purposes, this is removed in live builds, but not in dev builds --> | |
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE" /> | |
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> |
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
String apiKey = BuildConfig.API_KEY |
NewerOlder