Skip to content

Instantly share code, notes, and snippets.

View kylin17's full-sized avatar
🍺
I may be slow to respond.

PasserYi kylin17

🍺
I may be slow to respond.
View GitHub Profile
@ognian-
ognian- / android_ANRDetector
Created September 12, 2014 18:46
Android: detect long blocks on the main thread, and log a stack trace. Construct the object on the main thread and check the log output. Pass the threshold to trigger a stack dump in milliseconds.
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.util.Printer;
public class ANRDetector {
public static final String TAG = "ANRDetector";
private final Looper looper;
private final MessageQueue queue;
@rakawestu
rakawestu / build.gradle
Created March 12, 2017 14:09
Library Module Proguard
buildTypes {
release {
minifyEnabled true
consumerProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@codetalks-new
codetalks-new / main.py
Created January 25, 2017 13:26
微信 Android 自动发红包脚本
# -*- coding: utf-8 -*-
from com.android.monkeyrunner import MonkeyRunner as mr,MonkeyDevice as md
# Imports the monkeyrunner modules used by this program
# usage : $monkeyrunner main.py
# 下面的坐标是针对 1080 x 1920 的设备的 如果是其他分辨率的设备请自行调整
__author__ = 'banxi'
# Connects to the current device, returning a MonkeyDevice object
print("Waiting for connect...")
device = mr.waitForConnection()
@jacknie84
jacknie84 / mybatis.xml
Last active March 1, 2019 04:08
It's tip that write functional code on default script language of mybatis
Don't speak English well. Thank you for your patience.
It's functions xml file.
<mapper namespace="org.jacknie.mybatis.Functions">
<sql id="isBlank">
<bind name="isBlank" value=":[@org.apache.commons.lang3.StringUtils@isBlank(#this)]" />
</sql>
<sql id="sysout">
<bind name="sysout" value=":[@System@out.println(#this)]" />
</sql>
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@CodeK1988
CodeK1988 / TabLayout custom change tabTextSize
Last active February 18, 2021 06:28
TabLayout custom change tabTextSize
1.tabTextAppearance
<style name="YourTextAppearance" parent="TextAppearance.AppCompat.Button">
<item name="android:textSize">20sp</item>
...
</style>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
@jakubkinst
jakubkinst / SequentialRecyclerViewAnimationAdapter.java
Last active May 25, 2021 07:45
Simply add sequential animations to any RecyclerView
package com.example.view;
import android.animation.Animator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_example_gist_SignatureChecker */
#ifndef _Included_com_example_gist_SignatureChecker
#define _Included_com_example_gist_SignatureChecker
#ifdef __cplusplus
extern "C" {
#endif
/*
@sromku
sromku / ImageScaleView.java
Created November 20, 2015 15:32
Image View Top Crop / Bottom Crop
/**
* Scale to center top or scale to center bottom
*
* @author sromku
*/
public class ImageScaleView extends ImageView {
private MatrixCropType mMatrixType = MatrixCropType.TOP_CENTER; // default
private enum MatrixCropType {
@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 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