Skip to content

Instantly share code, notes, and snippets.

:bowtie:
Coding

Logan Guo Logan676

:bowtie:
Coding
Block or report user

Report or block Logan676

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Logan676
Logan676 / ClearBackgroundDrawable.java
Created Aug 14, 2017
把系统自带的背景去掉
View ClearBackgroundDrawable.java
getWindow().setBackgroundDrawable(new ColorDrawable(0));
try {
getWindow().getDecorView().setBackgroundDrawable(null);
} catch (Throwable e){
}
View gist:417ee2aebfa3f7656eeadd73f6a5893d
<?xml version="1.0" encoding="utf-8"?>
<me.relex.photodraweeview.PhotoDraweeView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/iv_gallery_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fadeDuration="1000"
app:failureImage="@drawable/works_list_default_img"
app:failureImageScaleType="centerInside"
app:placeholderImage="@drawable/loading_everyday"
@Logan676
Logan676 / BestPractice.java
Last active Mar 11, 2017
项目最佳实践
View BestPractice.java
public static void start(Activity context, BooksBean positionData, ImageView imageView) {
Intent intent = new Intent(context, BookDetailActivity.class);
intent.putExtra(EXTRA_PARAM, positionData);
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(context,
imageView, CommonUtils.getString(R.string.transition_book_img));//与xml文件对应
ActivityCompat.startActivity(context, intent, options.toBundle());
}
RxBus.getDefault().toObservable(RxCodeConstants.JUMP_TYPE_TO_ONE, RxBusBaseMessage.class)
View 优雅地启动activity的方法.java
public static void start(Activity context, BooksBean positionData, ImageView imageView) {
Intent intent = new Intent(context, BookDetailActivity.class);
intent.putExtra(EXTRA_PARAM, positionData);
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(context,
imageView, CommonUtils.getString(R.string.transition_book_img));//与xml文件对应
ActivityCompat.startActivity(context, intent, options.toBundle());
}
@Logan676
Logan676 / FileSplit.java
Created Jan 22, 2016
Read portions of bytes to byte array and store them in new files when buffer is full or it is end of file
View FileSplit.java
class FileSplit {
public static void splitFile(File f) throws IOException {
int partCounter = 1;//I like to name parts from 001, 002, 003, ...
//you can change it to 0 if you want 000, 001, ...
int sizeOfFiles = 1024 * 1024;// 1MB
byte[] buffer = new byte[sizeOfFiles];
try (BufferedInputStream bis = new BufferedInputStream(
new FileInputStream(f))) {//try-with-resources to ensure closing stream
View CircularRevealAnimation.java
/**
* On Lollipop+ perform a circular reveal animation (an expanding circular mask) when showing
* the search panel.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doEnterAnim() {
// Fade in a background scrim as this is a floating window. We could have used a
// translucent window background but this approach allows us to turn off window animation &
// overlap the fade with the reveal animation – making it feel snappier.
View scrim = findViewById(R.id.scrim);
View 设置密码输入框字体样式
提示:默认情况下,当您将 EditText 元素设置为使用 "textPassword" 输入类型时,字体系列将设置为固定宽度。因此,您应该将其字体系列更改为 "sans-serif",以便两个文本字段都使用匹配的字体样式。
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/header_logo"
android:layout_width="match_parent"
View wx_pay_useful_methods.java
/** JSAPI支付 */
public JSONObject jsPay() {
JSONObject obj = new JSONObject();
WeixinMpAccount weixinAccount = JSON.parseObject(
ConfigUtil.getValue("account"), WeixinMpAccount.class);
// V3 支付
PayPackage payPackage = new PayPackageV3(weixinAccount, "用户openid",
"商品描述", "系统内部订单号", 1d, "IP地址", TradeType.JSAPI);
// V2 支付
View AndroidStudio使用教程(第七弹).md

AndroidStudio使用教程(第七弹)

本文讲解一下Gradle的应用,大家都知道Gradle使用起来非常方便,那他究竟方便在哪里?                          

  • 很多时候我们在打印Log日志的时候都是需要在Debug版本中进行打印,而在正式版本中关闭。 通常我们都是用一个Config文件来配置,不知道大家有没有遇到过正式版中忘记关闭Log日志的情况。
  • 多渠道包非常让人头疼。现在国内市场这么多。一个个的打多麻烦,虽然我们会用友盟打包工具等。 怎么破?
View FileUtils.java
/**
* Attempts to open a file for viewing.
*
* @param fileholder The holder of the file to open.
*/
public static void openFile(FileHolder fileholder, Context c) {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = FileUtils.getUri(fileholder.getFile());
String type = fileholder.getMimeType();
You can’t perform that action at this time.