Skip to content

Instantly share code, notes, and snippets.

package com.chen.myapplication.ui
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.chen.myapplication.utils.implicit.ImplicitLaunchBridgeHelper
import com.chen.myapplication.utils.startActivity
import kotlinx.coroutines.launch
/**
@DonkiChen
DonkiChen / OneShotLifecycleCallbacks.java
Created May 19, 2020 09:25
一次性Activity生命周期Callback
package com.chen.test.util;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import androidx.annotation.CallSuper;
import androidx.annotation.IntDef;
import org.jetbrains.annotations.NotNull;
@DonkiChen
DonkiChen / BankCardTextWatcherImpl.java
Created May 19, 2020 09:21
银行卡号TextWatcher
package com.chen.test.ui.bankcard;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
/**
* 银行卡号TextWatcher, 模仿微信添加银行卡
* Feature:
* 1. 每四位之间加空格
package com.chen.test.ui.digit;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.EditText;
/**
* Created by Fanlin on 2020/5/19.
*/
@DonkiChen
DonkiChen / Main.java
Last active January 11, 2019 06:46
Java中的Type
package com.chen;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Arrays;
@DonkiChen
DonkiChen / RoundConstraintLayout.java
Last active January 4, 2019 04:14
RoundConstraintLayout
public class RoundConstraintLayout extends ConstraintLayout {
private Paint mCornerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private int mCornerRadius = 0;
private RectF mRectF = new RectF();
private PorterDuffXfermode mPorterDuffXfermodeDstIn = new PorterDuffXfermode(PorterDuff.Mode.DST_IN);
private Path mPath = new Path();
private boolean mClipCircle = false;
public RoundConstraintLayout(Context context) {
this(context, null);