Java Code Examples for android.app.Application#unregisterActivityLifecycleCallbacks()
The following examples show how to use
android.app.Application#unregisterActivityLifecycleCallbacks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PixateFreestyle.java From pixate-freestyle-android with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private static void initApp(Context context) { Application application = (Application) mAppContext; if (application != null) { mAppInited = true; if (mLifecycleCallbacks == null) { mLifecycleCallbacks = new PXLifecycleCallbacks(); } application .unregisterActivityLifecycleCallbacks((ActivityLifecycleCallbacks) mLifecycleCallbacks); application .registerActivityLifecycleCallbacks((ActivityLifecycleCallbacks) mLifecycleCallbacks); } }
Example 2
Source File: DevUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 解除注册 Activity 生命周期事件处理 * @param application {@link Application} */ private static void unregisterActivityLifecycleCallbacks(final Application application) { if (application != null) { try { // 先移除旧的监听 application.unregisterActivityLifecycleCallbacks(ACTIVITY_LIFECYCLE); } catch (Exception e) { LogPrintUtils.eTag(TAG, e, "unregisterActivityLifecycleCallbacks"); } } }
Example 3
Source File: VisualizedAutoTrackViewCrawler.java From sa-sdk-android with Apache License 2.0 | 5 votes |
void stopUpdates(boolean clear) { try { if (clear) { mFeatureCode = null; mPostUrl = null; } mMessageThreadHandler.removeMessages(MESSAGE_SEND_STATE_FOR_EDITING); final Application app = (Application) mActivity.getApplicationContext(); app.unregisterActivityLifecycleCallbacks(mLifecycleCallbacks); mVisualizedAutoTrackRunning = false; } catch (Exception e) { SALog.printStackTrace(e); } }
Example 4
Source File: HeatMapViewCrawler.java From sa-sdk-android with Apache License 2.0 | 5 votes |
public void stopUpdates(boolean clear) { try { if (clear) { mFeatureCode = null; mPostUrl = null; } mMessageThreadHandler.removeMessages(MESSAGE_SEND_STATE_FOR_EDITING); final Application app = (Application) mActivity.getApplicationContext(); app.unregisterActivityLifecycleCallbacks(mLifecycleCallbacks); } catch (Exception e) { com.sensorsdata.analytics.android.sdk.SALog.printStackTrace(e); } }
Example 5
Source File: ImageCanaryInternal.java From AndroidGodEye with Apache License 2.0 | 5 votes |
void stop(Application application) { if (callbacks == null) { return; } application.unregisterActivityLifecycleCallbacks(callbacks); callbacks = null; ThreadUtil.destoryHandler(IMAGE_CANARY_HANDLER); }
Example 6
Source File: ViewCanaryInternal.java From AndroidGodEye with Apache License 2.0 | 5 votes |
void stop(Application application) { if (callbacks == null) { return; } application.unregisterActivityLifecycleCallbacks(callbacks); callbacks = null; ThreadUtil.destoryHandler(VIEW_CANARY_HANDLER); }
Example 7
Source File: ScreenDensityUtils.java From YCVideoPlayer with Apache License 2.0 | 5 votes |
/** * 全局取消所有的适配 */ @RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void unregister(@NonNull final Application application, @NonNull int... matchUnit) { if (mActivityLifecycleCallback != null) { application.unregisterActivityLifecycleCallbacks(mActivityLifecycleCallback); mActivityLifecycleCallback = null; } for (int unit : matchUnit) { cancelMatch(application, unit); } }
Example 8
Source File: ScreenAdapterManager.java From CrazyDaily with Apache License 2.0 | 5 votes |
private void unregisterApp(@NonNull Application application) { if (activityLifecycleCallbacks != null) { application.unregisterActivityLifecycleCallbacks(activityLifecycleCallbacks); activityLifecycleCallbacks = null; } application.getResources().getDisplayMetrics().setTo(adapterMetrics); }
Example 9
Source File: PluginManager.java From Neptune with Apache License 2.0 | 5 votes |
/** * 取消插件Application里的ActivityLifeCycle监听 */ public static void unregisterActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) { synchronized (sActivityLifecycleCallbacks) { sActivityLifecycleCallbacks.remove(callback); } // 对于已经运行的插件,需要从其Application类中反注册 for (Map.Entry<String, PluginLoadedApk> entry : sPluginsMap.entrySet()) { PluginLoadedApk loadedApk = entry.getValue(); if (loadedApk != null && loadedApk.getPluginApplication() != null) { Application application = loadedApk.getPluginApplication(); application.unregisterActivityLifecycleCallbacks(callback); } } }
Example 10
Source File: SmartSwipeBack.java From SmartSwipe with Apache License 2.0 | 5 votes |
/** * The core function for global activity swipe back * @param application application * @param factory factory to create SwipeConsumer for each Activity * @param filter filter of activity, to determine which activity should finish via swipe motion */ public static void activityBack(Application application, SwipeBackConsumerFactory factory, ActivitySwipeBackFilter filter) { if (activitySwipeBackListener == null) { activitySwipeBackListener = new ActivitySwipeBackListener(factory, filter); } else { application.unregisterActivityLifecycleCallbacks(activitySwipeBackListener); activitySwipeBackListener.mFactory = factory; activitySwipeBackListener.mFilter = filter; } application.registerActivityLifecycleCallbacks(activitySwipeBackListener); }
Example 11
Source File: k.java From letv with Apache License 2.0 | 4 votes |
public static void a(Application application) { ActivityLifecycleCallbacks lVar = new l(); application.unregisterActivityLifecycleCallbacks(lVar); application.registerActivityLifecycleCallbacks(lVar); }
Example 12
Source File: TrackerManager.java From android_viewtracker with Apache License 2.0 | 4 votes |
/** * unregister Activity Lifecycle Callbacks * * @param application */ public void unInit(Application application) { if (mActivityLifecycle != null) { application.unregisterActivityLifecycleCallbacks(mActivityLifecycle); } }
Example 13
Source File: UtilsActivityLifecycleImpl.java From AndroidUtilCode with Apache License 2.0 | 4 votes |
void unInit(Application app) { mActivityList.clear(); app.unregisterActivityLifecycleCallbacks(this); }
Example 14
Source File: LifecycleDispatcher.java From AndroidLifecyle with Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private static void postIcsUnregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) { application.unregisterActivityLifecycleCallbacks(new ActivityLifecycleCallbacksWrapper(callback)); }
Example 15
Source File: ActivityEventListener.java From debugdrawer with Apache License 2.0 | 4 votes |
public void unegister(Application application) { application.unregisterActivityLifecycleCallbacks(callbacks); }
Example 16
Source File: ActivityLifecycleCallbacksAdapter.java From issue-reporter-android with MIT License | 4 votes |
public void unregister(Application application) { application.unregisterActivityLifecycleCallbacks(this); }
Example 17
Source File: StateSaverImpl.java From android-state with Eclipse Public License 1.0 | 3 votes |
/** * Turns automatic instance saving on or off for all activities and fragments from the support library. This avoids * manual calls of {@link #saveInstanceState(Object, Bundle)} and {@link #restoreInstanceState(Object, Bundle)}, instead * the library is doing this automatically for you. It's still necessary to annotate fields with {@link State}, though. * <br> * <br> * The best place to turn on this feature is in your {@link Application#onCreate()} method. * * @param application Your application instance. * @param enabled Whether this feature should be enabled. */ /*package*/ void setEnabledForAllActivitiesAndSupportFragments(@NonNull Application application, boolean enabled) { if (AndroidLifecycleCallbacks.INSTANCE.mEnabled != enabled) { if (enabled) { application.registerActivityLifecycleCallbacks(AndroidLifecycleCallbacks.INSTANCE); } else { application.unregisterActivityLifecycleCallbacks(AndroidLifecycleCallbacks.INSTANCE); } AndroidLifecycleCallbacks.INSTANCE.mEnabled = enabled; } }