Skip to content

Instantly share code, notes, and snippets.

@mennwebs
mennwebs / th-address.json
Created November 20, 2023 02:16
Thai Address from Postal Code - JSON
This file has been truncated, but you can view the full file.
[
{
"zipCode": "10100",
"subDistrictList": [
{
"subDistrictId": "100801",
"districtId": "1008",
"provinceId": "10",
"subDistrictName": "ป้อมปราบ"
},
@karangoel16
karangoel16 / colorUtils.kt
Last active October 15, 2022 02:57
ColorWithTransparency
fun String.toTransparentColor(num: Int): String {
return "#" + when (num) {
100 -> "FF"
99 -> "FC"
98 -> "FA"
97 -> "F7"
96 -> "F5"
95 -> "F2"
94 -> "F0"
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active May 1, 2024 21:12
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@Ahmed-Abdelmeged
Ahmed-Abdelmeged / MainActivity.java
Last active July 13, 2023 05:46
Rounded Layout with specific corners rounded
package com.abdelmeged.ahmed.roundedlayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
public class MainActivity extends AppCompatActivity {
@tmtrademarked
tmtrademarked / FontTabLayout.java
Created January 5, 2017 00:10
SImple wrapper class to support fonts in TabLayout
/**
* Simple helper class which extends a TabLayout to allow us to customize the font of the tab.
*/
public final class FontTabLayout extends TabLayout {
// TODO - support customizing via XML rather than hardcoding.
private static final String FONT_PATH = "fonts/Roboto.ttf";
private Typeface mTypeface;
public FontTabLayout(Context context) {
@henriquemenezes
henriquemenezes / android-generate-keystores.md
Last active May 2, 2024 21:33
Android: Generate Release/Debug Keystores

Android: Generate Release/Debug Keystores

Generate Keystores

Debug Keystore

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "C=US, O=Android, CN=Android Debug"
@mcxiaoke
mcxiaoke / KotlinParcelable
Created January 28, 2016 02:57 — forked from juanchosaravia/KotlinParcelable
How to use Parcelable in Kotlin v1.0.0-beta-4589
// ------------ Helper extension functions:
// Inline function to create Parcel Creator
inline fun <reified T : Parcelable> createParcel(crossinline createFromParcel: (Parcel) -> T?): Parcelable.Creator<T> =
object : Parcelable.Creator<T> {
override fun createFromParcel(source: Parcel): T? = createFromParcel(source)
override fun newArray(size: Int): Array<out T?> = arrayOfNulls(size)
}
// custom readParcelable to avoid reflection
@DiegoBravoF
DiegoBravoF / PicassoImp.java
Created January 21, 2016 16:18
Picasso Implement
import android.content.Context;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Transformation;
/**
* Created by Diego on 21/01/2016.
*/
public class PicassoImp implements PicassoWrapper {
@DiegoBravoF
DiegoBravoF / PicassoWrapper.java
Created January 21, 2016 16:17
Picasso Wrapper
import android.widget.ImageView;
import com.squareup.picasso.Transformation;
/**
* Created by Diego on 21/01/2016.
*/
public interface PicassoWrapper {
void loadfromUrl(String url, ImageView imageView);
@lsurvila
lsurvila / DownloadFileWithRetrofit2RxJava.java
Last active December 22, 2021 15:36
Download file with Retrofit 2, OkHttp, Okio and RxJava
import com.squareup.okhttp.ResponseBody;
import okio.BufferedSink;
import okio.Okio;
import retrofit.Response;
import retrofit.http.GET;
import retrofit.http.Query;
import rx.Observable;
interface ApiService {