Skip to content

Instantly share code, notes, and snippets.

View VincentJian's full-sized avatar

Vincent Jian VincentJian

View GitHub Profile
public class DynamicFragmentPagerAdapter extends PagerAdapter {
private static final String TAG = "DynamicFragmentPagerAdapter";
private final FragmentManager fragmentManager;
public static abstract class FragmentIdentifier implements Parcelable {
private final String fragmentTag;
private final Bundle args;
public FragmentIdentifier(@NonNull String fragmentTag, @Nullable Bundle args) {
@VincentJian
VincentJian / Backgrounds.kt
Created December 19, 2019 01:51
Kotlin extensions for drawing rounded background/border on android view
import android.graphics.Paint
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.PaintDrawable
import android.graphics.drawable.shapes.OvalShape
import android.view.View
import android.widget.ImageView
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
enum class Corner {
@VincentJian
VincentJian / README.md
Created December 3, 2019 04:47 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@VincentJian
VincentJian / CameraToMpegTest.java
Created January 12, 2018 10:02 — forked from tachang/CameraToMpegTest.java
CameraToMpegTest.java
/*
* Copyright 2013 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
@VincentJian
VincentJian / DrawableTextView.java
Last active May 23, 2017 04:45
Enhanced TextView for Android
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;