Skip to content

Instantly share code, notes, and snippets.

View CMFS's full-sized avatar
🎯
Focusing

Tong Gang CMFS

🎯
Focusing
View GitHub Profile
@CMFS
CMFS / AsyncHandler.java
Created March 31, 2016 15:27
AsyncHandler
package com.cmfs.library.util;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.os.Process;
import java.util.concurrent.atomic.AtomicInteger;
public class AsyncHandler {
@CMFS
CMFS / BaseRecyclerAdapter.java
Last active March 31, 2016 16:20
BaseRecyclerAdapter
package com.cmfs.library.util;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
@CMFS
CMFS / BaseViewAdapter.java
Created March 31, 2016 16:19
BaseViewAdapter
package com.cmfs.library.util;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
@CMFS
CMFS / Hooks.java
Last active January 11, 2025 07:30
Hook Instrumentation, ActivityManager, PackageManager, ServiceManager, Binder
package com.cmfs.demo.hook;
import android.annotation.SuppressLint;
import android.app.Instrumentation;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.IInterface;
import android.support.annotation.Nullable;
@CMFS
CMFS / MultiProcessApplication.java
Created September 20, 2017 01:52
MultiProcessApplication
package com.cmfs.library;
import android.app.Application;
import android.content.res.Configuration;
import android.os.Process;
import android.support.v4.util.ArrayMap;
import android.util.SparseArray;
/**
* @author cmfs
@CMFS
CMFS / ViewPrinter.java
Last active October 9, 2017 06:45
Print View
package com.cmfs.util;
import android.util.Printer;
import android.view.View;
import android.view.ViewGroup;
/**
* @author cmfs
*/
@CMFS
CMFS / AssetManagerHook.java
Last active September 21, 2017 08:53
Hook AssetManager
package com.cmfs.util;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.content.res.XmlResourceParser;
import java.io.IOException;
import java.io.InputStream;
@CMFS
CMFS / LayoutInflaterCompat.java
Created September 22, 2017 08:43
LayoutInflaterCompat
package com.cmfs.util;
import android.support.v4.view.LayoutInflaterFactory;
import android.view.LayoutInflater;
import java.lang.reflect.Field;
/**
* @author cmfs
*/
@CMFS
CMFS / Reflects.java
Created September 28, 2017 10:21
load class
package com.cmfs.util;
/**
* @author cmfs
*/
public class Reflects {
public static <T> T loadAs(String className, Class<T> targetClass, T defValue) {
T instance = null;
@CMFS
CMFS / SingleFragmentHelper.java
Created November 16, 2017 18:54
对于指定的tag只会添加一个Fragment实例。存在添加失败的情况,所以通过getFragment不一定是同一个对象。(From Glide)
public abstract class SingleFragmentHelper<T extends Fragment> implements Handler.Callback {
private static final String TAG = "SingleFragmentHelper";
private static final int ID_REMOVE_SUPPORT_FRAGMENT_MANAGER = 1234;
private final String mTag;
private Map<FragmentManager, T> fragmentMap = new HashMap<>();
private Handler mainHandler;
public SingleFragmentHelper(String tag) {
mTag = tag;
mainHandler = new Handler(Looper.getMainLooper());