Skip to content

Instantly share code, notes, and snippets.

View beilly's full-sized avatar

benli.shi beilly

View GitHub Profile
@beilly
beilly / ToastUtil.java
Last active April 25, 2016 05:24
Android Toast 工具类,可关闭支持线程中和延时效果。
package com.benli.app.utils;
import android.content.Context;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;
/**
* @ClassName: ToastUtil
* @Description: TODO(...)
@beilly
beilly / InputTools.java
Last active April 25, 2016 05:24
键盘管理器
package com.benli.app.utils;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import java.util.Timer;
import java.util.TimerTask;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!-- Generated by RHY @will_awoke -->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
@beilly
beilly / LauncherActivity_OnCreate
Created August 26, 2016 07:05
解决4.4机器上面按home键返回桌面后恢复需要重新走launcher页面的bug
if (!isTaskRoot()) {
Intent intent = getIntent();
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
finish();
return;
}
}
@beilly
beilly / AdapterHolder.java
Created September 19, 2016 02:57
通用Adapter与ListView滚动时不加载图片的封装,摘自http://www.kymjs.com/code/2015/04/28/01/
/*
* Copyright (c) 2014, 张涛.
*
* 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
@beilly
beilly / AndroidComment.java
Created October 8, 2016 07:01
android跳转到应用市场评论
try {
Uri uri = Uri.parse("market://details?id="
+ BuildConfig.APPLICATION_ID);//需要评分的APP包名
Intent intent5 = new Intent(Intent.ACTION_VIEW, uri);
intent5.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent5);
} catch (Exception e) {
TooltipUtils.showToastL(this, getString(R.string.common_no_function));
}
@beilly
beilly / IconFontView.java
Created October 27, 2016 08:56
IconFont控件
package com.benli.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;
import com.vcredit.cp.R;
@beilly
beilly / OkHttp3Stack.java
Last active February 13, 2017 08:47
Volley Stack with OkHttp3,and it will trusting all certificates. You can remove "allowAllSSLOkHttp(builder);" if you do't want to trusting all.
package com.benli.app.utils.net;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.toolbox.HttpStack;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
@beilly
beilly / ShareWX.java
Created April 13, 2017 03:36
分享文件到微信
import com.tencent.mm.sdk.modelmsg.SendMessageToWX;
import com.tencent.mm.sdk.modelmsg.WXFileObject;
import com.tencent.mm.sdk.modelmsg.WXMediaMessage;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
/**
* Created by shibenli on 2017/4/6.
*/
@beilly
beilly / gradle.properties
Last active June 20, 2017 09:43
gradle 私服打包上传aar包
## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#