Skip to content

Instantly share code, notes, and snippets.

View brucetoo's full-sized avatar
🎧
Visualization

Bruce too brucetoo

🎧
Visualization
View GitHub Profile
@brucetoo
brucetoo / RefHandler.java
Created October 26, 2018 06:21
Handler之防止任意引用泄漏
package com.brucetoo.androidnotes.tools;
import android.os.Handler;
import android.os.Message;
import java.lang.ref.WeakReference;
/**
* Created by Bruce Too
* On 2018/10/26.
@brucetoo
brucetoo / WifiP2PAssistant.java
Created April 27, 2018 03:23
WifiP2p helper class
package com.brucetoo.wifip2p;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pConfig;
import android.net.wifi.p2p.WifiP2pDevice;
@brucetoo
brucetoo / proguard.pro
Created January 3, 2018 10:36
Android proguard optimize
1.保存唯一唯一的包名
-keepattributes InnerClasses,...
-keeppackagenames **
2.防止有些资源没被混淆
#-dontshrink
3.去掉抛出异常时保留代码行数
#-keepattributes SourceFile,LineNumberTable
@brucetoo
brucetoo / DividerItemDecoration.java
Created November 8, 2017 08:34
Item Decoration
package com.brucetoo.expandrecyclerview.reyclerview;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
@brucetoo
brucetoo / Custom_Toast_TIME.java
Created August 30, 2017 02:23
custom toast show time(not really precise)
final Toast toast = new Toast(getContext());
toast.setDuration(Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0);
View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_game_guide_25, null);
((TextView) view.findViewById(R.id.txt_hint)).setText(getResources().getText(R.string.game_tool_n_phone_permission_hint));
toast.setView(view);
CountDownTimer toastCountDown = new CountDownTimer(5000, 1000 ) {
public void onTick(long millisUntilFinished) {
toast.show();
}
package com.brucetoo.expandrecyclerview.animator;
import android.animation.Animator;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.support.annotation.IntRange;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
@brucetoo
brucetoo / SwipeableLayout.java
Created June 13, 2017 12:01
Can config swipe direction's Layout~
package com.brucetoo.expandrecyclerview.lockscreen;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.support.annotation.IdRes;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
@brucetoo
brucetoo / ViewPagerAnimator.java
Created May 31, 2017 01:36
A simple ViewPagerAnimator implement
package com.stylingandroid.viewpageranimator;
import android.animation.ArgbEvaluator;
import android.animation.FloatEvaluator;
import android.animation.IntEvaluator;
import android.animation.TypeEvaluator;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
@brucetoo
brucetoo / RefHandler.java
Created May 8, 2017 06:21
Handler tools to wrap Activity with WeakReference
package com.aliyun.wireless.vos.appstore.shortcut;
import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import java.lang.ref.WeakReference;
/**
* Created by Bruce Too
@brucetoo
brucetoo / Reflecter.java
Created December 15, 2016 06:40
java reflect helper
/**
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without