This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HeaderRoundDrawable extends Drawable { | |
private static final float ROUND_RADIUS = ScreenUtil.dip2px(AppApplication.getContext(), 6); | |
private final RectF mRect = new RectF(), mBitmapRect; | |
private final BitmapShader mBitmapShader; | |
private final Paint mPaint; | |
private Path mPath = new Path(); | |
private float[] mRadius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by chensuilun on 16-9-20. | |
*/ | |
public abstract class ViewStubWidget { | |
private ViewGroup mParent; | |
private int mStubId; | |
private ViewStub mViewStub; | |
private View mRoot; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseFragment extends Fragment { | |
public static final String IS_SHOW = "is_show"; | |
protected View mRootView; | |
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
if (BuildConfig.DEBUG) { | |
Log.d(getClass().getSimpleName(), "onCreate:"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# power button | |
adb shell input keyevent 26 && | |
adb shell sleep 0.1 && | |
# swipe to unlock | |
adb shell input swipe 655 1774 655 874 && | |
adb shell sleep 0.1 && | |
# input 2 | |
adb shell input tap 612 726 && | |
adb shell sleep 0.1 && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ColorStateGenerate{ | |
// 灰度 | |
public static int greyer(int color) { | |
int blue = (color & 0x000000FF) >> 0; | |
int green = (color & 0x0000FF00) >> 8; | |
int red = (color & 0x00FF0000) >> 16; | |
int grey = Math.round(red * 0.299f + green * 0.587f + blue * 0.114f); | |
return Color.argb(0xff, grey, grey, grey); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def supportLibraryVersion = '24.2.1' | |
ext.deps = [ | |
supportCompat: "com.android.support:support-compat:$supportLibraryVersion", | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int lighten(int color, double fraction) { | |
int red = Color.red(color); | |
int green = Color.green(color); | |
int blue = Color.blue(color); | |
red = lightenColor(red, fraction); | |
green = lightenColor(green, fraction); | |
blue = lightenColor(blue, fraction); | |
int alpha = Color.alpha(color); | |
return Color.argb(alpha, red, green, blue); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 在内存重启的时候自动恢复可见状态的Fragment,避免重叠现象 | |
* 但同时不要忘了在Activity中判断`savedInstanceState`为null的时候才操作Fragment | |
* Created by chensuilun on 16-8-9. | |
*/ | |
public abstract class BaseRestoreFragment extends Fragment { | |
public static final String IS_SHOW = "is_show"; | |
protected View mRootView; | |
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xinghui.notificationlistenerservicedemo; | |
import android.app.ActivityManager; | |
import android.app.Service; | |
import android.content.ComponentName; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.os.IBinder; | |
import android.os.Process; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.content.ContextWrapper; | |
import android.os.Bundle; | |
import android.os.Looper; | |
import android.os.MessageQueue; | |
import android.util.Log; | |
import android.view.View; | |
import android.view.ViewTreeObserver; |