Skip to content

Instantly share code, notes, and snippets.

View alexzaitsev's full-sized avatar
:octocat:

Alex Zaitsev alexzaitsev

:octocat:
View GitHub Profile
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
public static void loadAndCropImage(Context context, @DrawableRes int resourceId, final int smallerSize, ImageView imageView) {
RequestOptions transformation = RequestOptions.bitmapTransform(new Transformation<Bitmap>() {
@Override
public Resource<Bitmap> transform(Context context, Resource<Bitmap> resource, int outWidth, int outHeight) {
BitmapPool bitmapPool = Glide.get(context).getBitmapPool();
Bitmap toTransform = resource.get();
Bitmap transformed = TransformationUtils.centerCrop(bitmapPool, toTransform, smallerSize, smallerSize);
final Resource<Bitmap> result;
if (toTransform.equals(transformed)) {
@alexzaitsev
alexzaitsev / BindingAdapters.kt
Last active December 6, 2018 13:29
AppBarLayout custom shadow
@JvmStatic
@BindingAdapter("isCustomShadowEnabled")
fun setAppBarDefaultShadowEnabled(appBarLayout: AppBarLayout, isCustomShadowEnabled: Boolean) {
if (isCustomShadowEnabled) {
appBarLayout.outlineProvider = null // removes the shadow below the AppBar without affecting elevation
// add the shadow
val inflater = LayoutInflater.from(appBarLayout.context)
val shadowView = inflater.inflate(R.layout.view_shadow, appBarLayout, false)
appBarLayout.addView(shadowView)
}
@alexzaitsev
alexzaitsev / DefaultLinkMovementMethod.java
Last active January 17, 2024 08:45
How to display HTML using Android Compose
/**
* Set this on a textview and then you can potentially open links locally if applicable
*/
public class DefaultLinkMovementMethod extends LinkMovementMethod {
private OnLinkClickedListener mOnLinkClickedListener;
public DefaultLinkMovementMethod(OnLinkClickedListener onLinkClickedListener) {
mOnLinkClickedListener = onLinkClickedListener;
}
@alexzaitsev
alexzaitsev / Contract.kt
Created January 23, 2023 16:25
Song Details screen
package com.example.view.screen.song.details
data class SongDetailsViewState(
val author: Author,
val song: Song,
val loading: Boolean
)
sealed class SongDetailsSideEffect {
object ShowNetworkError : SongDetailsSideEffect()
@alexzaitsev
alexzaitsev / DummyTest.kt
Created January 27, 2023 15:00
Dummy test to demonstrate Flow testing
package com.example.domain.usecase
import app.cash.turbine.test
import com.natpryce.hamkrest.assertion.assertThat
import com.natpryce.hamkrest.equalTo
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest
import org.junit.Test
class DummyTest {

Successful tests

p3ngu1n@p3ngu1n bitcoin % python3 test/functional/feature_fee_estimation.py
2023-12-18T23:37:21.120000Z TestFramework (INFO): PRNG seed is: 1889367143121386098
2023-12-18T23:37:21.120000Z TestFramework (INFO): Initializing test directory /var/folders/q6/qjgkk7jn6kj_0tyhxx_dlk0m0000gp/T/bitcoin_func_test_srkyz249
2023-12-18T23:37:21.139000Z TestFramework (INFO): This test is time consuming, please be patient
2023-12-18T23:37:21.139000Z TestFramework (INFO): Splitting inputs so we can generate tx's
2023-12-18T23:37:21.751000Z TestFramework (INFO): Finished splitting
2023-12-18T23:37:22.516000Z TestFramework (INFO): Testing estimates with single transactions.