Java Code Examples for android.view.Window#Callback

The following examples show how to use android.view.Window#Callback . 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: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setContentView(int layoutResId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] layoutResId: " + layoutResId);

    if (mContentParent == null) {
        installDecor();
    } else {
        mContentParent.removeAllViews();
    }
    mActivity.getLayoutInflater().inflate(layoutResId, mContentParent);

    Window.Callback callback = mActivity.getWindow().getCallback();
    if (callback != null) {
        callback.onContentChanged();
    }

    initActionBar();
}
 
Example 2
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);

    if (mContentParent == null) {
        installDecor();
    } else {
        mContentParent.removeAllViews();
    }
    mContentParent.addView(view, params);

    Window.Callback callback = mActivity.getWindow().getCallback();
    if (callback != null) {
        callback.onContentChanged();
    }

    initActionBar();
}
 
Example 3
Source File: AllegroUtils.java    From ans-android-sdk with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 通过View获取Dialog
 */
private static Dialog getDialogFromView(View v) {
    Object result = callMethod(v, "getWindow");
    if (result instanceof Window) {
        Window window = (Window) result;
        Window.Callback callback = window.getCallback();
        if (callback instanceof Dialog) {
            return (Dialog) callback;
        }
    }
    return null;
}
 
Example 4
Source File: GPTInstrumentation.java    From GPT with Apache License 2.0 5 votes vote down vote up
/**
 * 替换WindowCallback
 *
 * @param activity Activity
 */
public static void replaceWindowCallback(Activity activity) {
    activity.getWindow().setCallback(activity);

    Window.Callback callback = activity.getWindow().getCallback();

    WindowCallbackWorker callbackWorker = new WindowCallbackWorker();
    callbackWorker.mTarget = callback;
    callbackWorker.mActivity = activity;

    activity.getWindow().setCallback(callbackWorker);
}
 
Example 5
Source File: AppInventorCompatActivity.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("WeakerAccess")  // To maintain visibility compatibility with AppCompatActivity
public ActionBar getSupportActionBar() {
  Window.Callback classicCallback = getWindow().getCallback();
  try {
    return appCompatDelegate == null ? null : appCompatDelegate.getSupportActionBar();
  } catch (IllegalStateException e) {
    // Thrown in "Classic" mode
    appCompatDelegate = null;
    AppInventorCompatActivity.classicMode = true;
    getWindow().setCallback(classicCallback);
    return null;
  }
}
 
Example 6
Source File: RobotoInflater.java    From Android-RobotoTextView with Apache License 2.0 5 votes vote down vote up
public static void attach(@NonNull Activity activity) {
    if (activity instanceof AppCompatActivity) {
        LayoutInflaterCompat.setFactory(activity.getLayoutInflater(),
                new RobotoInflater(((AppCompatActivity) activity).getDelegate(), activity.getWindow()));
    } else {
        final Window window = activity.getWindow();
        final Window.Callback callback = window.getCallback();
        LayoutInflaterCompat.setFactory(activity.getLayoutInflater(),
                new RobotoInflater(AppCompatDelegate.create(activity, StubAppCompatCallback.INSTANCE), window));
        window.setCallback(callback);
    }
}
 
Example 7
Source File: MonitorActivityLifecycleCallbacks.java    From BehaviorCollect with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
    Window window = activity.getWindow();
    Window.Callback callback= window.getCallback();
    window.setCallback(new MonitorCallback(activity,callback));
}
 
Example 8
Source File: MonitorActivityLifecycleCallbacks.java    From BehaviorCollect with GNU General Public License v3.0 4 votes vote down vote up
MonitorCallback(Activity activity, Window.Callback callback){
    this.callback = callback;
    this.activity = activity;
}
 
Example 9
Source File: ApplicationStatus.java    From cronet with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public WindowCallbackProxy(Activity activity, Window.Callback callback) {
    mCallback = callback;
    mActivity = activity;
}
 
Example 10
Source File: MyWindowCallback.java    From MaterialChipsInput with Apache License 2.0 4 votes vote down vote up
public MyWindowCallback(Window.Callback localCallback, Activity activity) {
    mLocalCallback = localCallback;
    mActivity = activity;
}
 
Example 11
Source File: BaseChromiumApplication.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public WindowCallbackProxy(Activity activity, Window.Callback callback) {
    mCallback = callback;
    mActivity = activity;
}
 
Example 12
Source File: AppCompatv7DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void windowCallback(Window.Callback arg) {
  return BaseDSL.attr("windowCallback", arg);
}