android.content.Context#registerComponentCallbacks ( )源码实例Demo

下面列出了android.content.Context#registerComponentCallbacks ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: odyssey   文件: OdysseyBaseFragment.java
@Override
public void onAttach(@NonNull Context context) {
    super.onAttach(context);

    if (null == mComponentCallback) {
        mComponentCallback = new OdysseyComponentCallback();
    }

    // Register the memory trim callback with the system.
    context.registerComponentCallbacks(mComponentCallback);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mToolbarAndFABCallback = (ToolbarAndFABCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement ToolbarAndFABCallback");
    }
}
 
源代码2 项目: Hangar   文件: ColorPickerDialog.java
public ColorPickerDialog(Context context, int initialColor) {
super(context);
      context.registerComponentCallbacks(new ComponentCallbacks() {
         @Override
         public void onConfigurationChanged(Configuration newConfig) {
             setUp(mOldColor.getColor(), mNewColor.getColor());
             setAlphaSliderVisible(mAlphaSliderEnabled);
             setHexValueEnabled(mHexValueEnabled);
         }
         @Override
         public void onLowMemory() {
         }
      });

      init(initialColor);
  }
 
源代码3 项目: android-chromium   文件: MemoryPressureListener.java
@CalledByNative
private static void registerSystemCallback(Context context) {
    context.registerComponentCallbacks(
        new ComponentCallbacks2() {
              @Override
              public void onTrimMemory(int level) {
                  maybeNotifyMemoryPresure(level);
              }

              @Override
              public void onLowMemory() {
                  nativeOnMemoryPressure(MemoryPressureLevelList.MEMORY_PRESSURE_CRITICAL);
              }

              @Override
              public void onConfigurationChanged(Configuration configuration) {
              }
        });
}
 
源代码4 项目: android-chromium   文件: MemoryPressureListener.java
@CalledByNative
private static void registerSystemCallback(Context context) {
    context.registerComponentCallbacks(
        new ComponentCallbacks2() {
              @Override
              public void onTrimMemory(int level) {
                  maybeNotifyMemoryPresure(level);
              }

              @Override
              public void onLowMemory() {
                  nativeOnMemoryPressure(MemoryPressureLevelList.MEMORY_PRESSURE_CRITICAL);
              }

              @Override
              public void onConfigurationChanged(Configuration configuration) {
              }
        });
}
 
源代码5 项目: Camera2   文件: MemoryManagerImpl.java
/**
 * Use this to create a wired-up memory manager.
 *
 * @param context    this is used to register for system memory events.
 * @param mediaSaver this used to check if the saving queue is full.
 * @return A wired-up memory manager instance.
 */
public static MemoryManagerImpl create(Context context, MediaSaver mediaSaver)
{
    ActivityManager activityManager = AndroidServices.instance().provideActivityManager();
    int maxAllowedNativeMemory = getMaxAllowedNativeMemory(context);
    MemoryQuery mMemoryQuery = new MemoryQuery(activityManager);
    MemoryManagerImpl memoryManager = new MemoryManagerImpl(maxAllowedNativeMemory,
            mMemoryQuery);
    context.registerComponentCallbacks(memoryManager);
    mediaSaver.setQueueListener(memoryManager);
    return memoryManager;
}
 
源代码6 项目: island   文件: AppLabelCache.java
AppLabelCache(final Context context, final Callback callback) {
	mStore = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
	if (CLEAR_CACHE_UPON_START) mStore.edit().clear().apply();
	mCallback = callback;
	mPackageManager = context.getPackageManager();
	context.registerComponentCallbacks(this);		// No un-registration since AppLabelCache is never released.
	onConfigurationChanged(context.getResources().getConfiguration());
}
 
源代码7 项目: MultiLanguages   文件: LanguagesChange.java
/**
 * 注册系统语种变化监听
 */
static void register(Context context) {
    context.registerComponentCallbacks(new LanguagesChange());
}
 
源代码8 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
源代码9 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
源代码10 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
源代码11 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
源代码12 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
源代码13 项目: droidel   文件: Controller.java
public Controller(Context ctx) {
  ctx.registerComponentCallbacks(this);
}
 
 方法所在类
 同类方法