Coder Social home page Coder Social logo

activitystack's Introduction

ActivityStack    

这个项目有什么用呢?其实没什么用,但其实也很有用。主要是一些跟具体项目无关的工具类。

ShowMoreAniamtion

增加一些工具代码,可以辅助定位界面所在Acitivity和Fragment。

GitHub

一个通过Looper.setMessageLogging来监听HandlerMessage消息实现的监控主线程是否出现卡顿的工具。

注意由于原理是监控的Handler消息的处理,所以如果有代码在主线程执行时候没有经过Handler处理,那将监控不到,比如触摸事件,触摸事件是在nativePollOnce里直接跳转到WindowInputEventReceiver#dispatchInputEvent方法,完全没有经过Handler,所以触摸事件将无法监控到。

ThreadMonitor.getInstance().install();

一个反射工具类,可以类似写脚本一样反射java属性和方法。

ReflectUtils.reflect(application, "mLoadedApk.mActivityThread.mActivities");
ReflectUtils.reflect(application, "mModel.getName().toString()");
ReflectUtils.reflect(application, "mModel.setName(%1)", new Object[]{"new_name"});
ReflectUtils.reflect(null, "android.app.ActivityThread#currentApplication()");

用ReflectUtils反射获取当前App的所有处于Activity栈中的Activity的引用。

ApplicationUtils.getTopActivity();
ApplicationUtils.getActivities();

打印Activity和Fragment生命周期的工具,利用了系统Api,对Activity和Fragment是0侵入。如果项目非常大了,一些界面很可能不是自己维护的,要找到某个界面对应的类,看源码可能效率不是很高,可以用这个类非常简单快速的定位界面对应的类。

new LifecycleUtils(this).register();

这个是从Facebook的ReactNative中偷过来的。ReactNative里可以通过摇一摇手机然后弹一个弹窗辅助开发。比如某个界面需要手动输入的东西非常多。这时候可以写一个自动填充的代码,然后通过摇一摇弹出菜单,点击调用代码。

new ShakeManager(this).registerShakeDetector();

activitystack's People

Contributors

aesean avatar

Watchers

frank avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.