Exemplo n.º 1
0
  public static void owlAfterCreate(Activity activity) {
    View root = activity.getWindow().getDecorView();
    OwlViewContext viewContext = obtainViewContext(root);
    checkNonNull(viewContext, "OwlViewContext can not be null!");

    // not support before lollipop.
    if (!checkBeforeLollipop()) viewContext.setupWithCurrentActivity(activity);

    // init set
    viewContext.notifyObserver(sharedInstance().mMode.get(), activity);
  }
Exemplo n.º 2
0
  private static void owlDressUp(int mode, @NonNull Activity activity) {
    // View tree
    NightOwl owl = sharedInstance();
    View root = activity.getWindow().getDecorView();
    OwlViewContext viewContext = obtainViewContext(root);
    checkNonNull(viewContext, "OwlViewContext can not be null!");

    if (viewContext.needSync(mode)) {
      // refresh skin
      innerRefreshSkin(mode, root);

      // OwlObserver
      viewContext.notifyObserver(mode, activity);
    }

    owl.mMode.set(mode);
    if (owl.mOwlObserver != null) owl.mOwlObserver.onSkinChange(mode, activity);
  }