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
kylin17 / stopFinalizerWatchdogDaemon
Created August 13, 2018 03:29
Android stop 'FinalizerWatchdogDaemon' use reflection to avoid 'finalize timed out after 10 seconds' exception.
public static void stopFinalizerWatchdogDaemon() {
try {
Class<?> watchdogDaemonClazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon");
Class<?> daemonClazz = Class.forName("java.lang.Daemons$Daemon");
Field instanceField = watchdogDaemonClazz.getDeclaredField("INSTANCE");
Object watchdogDaemonInstance = instanceField.get(null);
Method daemonIsRunningMethod = daemonClazz.getDeclaredMethod("isRunning");
kylin17 /
Last active December 13, 2017 06:11
remove any “Installed by enterprise policy” Chrome Extension

In administrator mode

  • Step 1:
rd /S /Q "%WinDir%\System32\GroupPolicyUsers"

Press Enter.

  • Step 2:
rd /S /Q "%WinDir%\System32\GroupPolicy"
kylin17 / gist:149fa8135ae87d36fa2f442d05b499b6
Created March 7, 2017 07:04 — forked from HanCheng/gist:42a27ec8df2c56ea3b0c
cleaning up lint warnings and errors
1. For paddingStart, Severity: Errors.
because we also have paddingLeft, so for old platform, the paddingStart is ignored; so api < 17, the lint tool
will show error about paddingStart, and we do not currently support RTL, and paddingStart work the same way as
paddingLeft, so i think it really about the NewApi. Because the lint tool just check whether paddingStart is
compatible with api < 17, and I check that when api == 16, it works fine and does not crash. I have checked all
the lint error list, i do not find other lint checks might solve this. So I think just add
tools:ignore="NewApi" will be fine.
2. the warnings in build.gradle showing that some of the tools are using the old version, do i need change
these to newest, or just suppress lint to ignore NewerVersionAvailable.
kylin17 /
Created October 28, 2015 03:08 — forked from ssinss/
Endless RecyclerView OnScrollListener
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;