Skip to content

Instantly share code, notes, and snippets.

View b95505017's full-sized avatar
🌴
On vacation

Yu-Hsuan Lin b95505017

🌴
On vacation
View GitHub Profile
@rodrigomartind
rodrigomartind / ImageVectorAnimationStepByStep.MD
Last active January 30, 2023 01:50
Animating ImageVector in JetpackCompose

Step by step of ImageVector animation in Jetpack Compose

Step 1

screen-recording-1671473917341.mp4

Step 1

screen-recording-1671473945880.mp4

Step 3

screen-recording-1671473974142.mp4
@Marlinski
Marlinski / BottomSheetScaffold.kt
Created October 23, 2022 21:48
port of BottomSheetScaffold for Material3
/*
* Copyright 2020 The Android Open Source Project
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@meyusufdemirci
meyusufdemirci / CompressImage.swift
Last active April 16, 2022 09:04
Compress Image By Max Kb
import UIKit
extension UIImage {
func compress(maxKb: Double) -> Data? {
let quality: CGFloat = maxKb / self.sizeAsKb()
let compressedData: Data? = self.jpegData(compressionQuality: quality)
return compressedData
}
@vganin
vganin / ComposeNumberPicker.kt
Last active January 14, 2024 11:53
Jetpack Compose simple number picker
@Composable
fun NumberPicker(
state: MutableState<Int>,
modifier: Modifier = Modifier,
range: IntRange? = null,
textStyle: TextStyle = LocalTextStyle.current,
onStateChanged: (Int) -> Unit = {},
) {
val coroutineScope = rememberCoroutineScope()
val numbersColumnHeight = 36.dp
#!/bin/bash
ID=`curl -s "https://ci.android.com/builds/branches/aosp-androidx-master-dev/status.json" | jq ".targets[] | select(.ID==\"aosp-androidx-master-dev.androidx_snapshot\") | .last_known_good_build"` && echo https://ci.android.com/builds/submitted/"${ID:1:-1}"/androidx_snapshot/latest/repository/
@alexjlockwood
alexjlockwood / TypedArrayUtils.kt
Created August 13, 2019 16:51
Kotlin helper functions for extracting ColorStateLists and Drawables from a TypedArray using AppCompatResources.
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].
@walteranyika
walteranyika / Updates.java
Last active January 22, 2023 04:43
The check for updates function used to do in app updates from google play store
//Add this to gradle
// implementation 'com.google.android.play:core:1.5.0'
private static final int MY_REQUEST_CODE = 2399;
private void checkForUpdates() {
final AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(this);
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
#!/usr/bin/env bash
set -euo pipefail
##########
# Config #
##########
readonly GIT_BRANCH='android-8.0.0_r4'
readonly API_LEVEL='26'
@lopspower
lopspower / README.md
Last active January 20, 2024 09:18
Publish AAR to jCenter and Maven Central

Publish AAR to jCenter and Maven Central

Twitter

EDIT: You can find this same updated tutorial here -> Medium

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
@Mariovc
Mariovc / ImagePicker.java
Last active February 7, 2024 23:33
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;