Skip to content

Instantly share code, notes, and snippets.

Avatar

benli.shi beilly

View GitHub Profile
@beilly
beilly / ToastUtil.java
Last active Apr 25, 2016
Android Toast 工具类,可关闭支持线程中和延时效果。
View ToastUtil.java
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 Apr 25, 2016
键盘管理器
View InputTools.java
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;
View huawei_CheckStyle
<?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 Aug 26, 2016
解决4.4机器上面按home键返回桌面后恢复需要重新走launcher页面的bug
View LauncherActivity_OnCreate
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 Sep 19, 2016
通用Adapter与ListView滚动时不加载图片的封装,摘自http://www.kymjs.com/code/2015/04/28/01/
View AdapterHolder.java
/*
* 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 Oct 8, 2016
android跳转到应用市场评论
View AndroidComment.java
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));
}
View IconFontView.java
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 Feb 13, 2017
Volley Stack with OkHttp3,and it will trusting all certificates. You can remove "allowAllSSLOkHttp(builder);" if you do't want to trusting all.
View OkHttp3Stack.java
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 Apr 13, 2017
分享文件到微信
View ShareWX.java
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 Jun 20, 2017
gradle 私服打包上传aar包
View gradle.properties
## 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
#