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.os.Bundle | |
import androidx.activity.ComponentActivity | |
import androidx.activity.compose.setContent | |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.VectorConverter | |
import androidx.compose.animation.core.spring | |
import androidx.compose.foundation.BorderStroke | |
import androidx.compose.foundation.gestures.awaitFirstDown | |
import androidx.compose.foundation.gestures.forEachGesture |
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 androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.spring | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.gestures.detectDragGestures | |
import androidx.compose.foundation.layout.aspectRatio | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.wrapContentSize | |
import androidx.compose.integration.demos.BlockFilter.Companion.Lighting |
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
// Enable TLS v1.1 and TLS v1.2 on older platforms <APIv20. | |
// NOTE: Internally supported just not enabled. | |
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){ | |
try{ | |
X509TrustManager trustManager = systemDefaultTrustManager(); | |
okHttpBuilder.sslSocketFactory(new TLSSocketFactory(), trustManager); | |
} | |
catch(GeneralSecurityException e){ | |
Log.e(TAG, "API security", e); | |
} |
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
#!/bin/bash | |
sp="/-\|" | |
sc=0 | |
spin() { | |
printf "\b${sp:sc++:1}" | |
((sc==${#sp})) && sc=0 | |
} | |
endspin() { | |
printf "\r" | |
} |
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"?> | |
<!-- | |
Copyright 2016 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
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
package com.xwray.vectorbinding; | |
import android.databinding.BindingAdapter; | |
import android.databinding.DataBindingUtil; | |
import android.graphics.drawable.Drawable; | |
import android.os.Bundle; | |
import android.support.graphics.drawable.VectorDrawableCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.widget.TextView; |
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"?> | |
<!-- | |
Copyright 2016 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
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.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.view.Gravity; | |
import android.widget.TextView; | |
/** | |
* Simple version used in the article: |
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 MyFragment { | |
boolean loaded; | |
private void maybeLoad() { | |
if (!loaded && getUserVisibleHint()) { | |
loaded = true; | |
loadMyData(); | |
} | |
} | |
@Override |
NewerOlder