Java Code Examples for org.chromium.ui.UiUtils#removeViewFromParent()

The following examples show how to use org.chromium.ui.UiUtils#removeViewFromParent() . 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: TabContentViewParent.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onContentChanged(Tab tab) {
    // If the tab is frozen, both native page and content view are not ready.
    if (tab.isFrozen()) return;

    View viewToShow = getViewToShow(tab);
    if (isShowing(viewToShow)) return;

    removeCurrentContent();
    LayoutParams lp = (LayoutParams) viewToShow.getLayoutParams();
    if (lp == null) {
        lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    }
    // Weirdly enough, if gravity is not top, top_margin is not respected by FrameLayout.
    // Yet for many native pages on tablet, top_margin is necessary to not overlap the tab
    // switcher.
    lp.gravity = Gravity.TOP;
    UiUtils.removeViewFromParent(viewToShow);
    addView(viewToShow, CONTENT_INDEX, lp);
    viewToShow.requestFocus();
}
 
Example 2
Source File: VrShellImpl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void shutdown() {
    if (mNativeVrShell != 0) {
        nativeDestroy(mNativeVrShell);
        mNativeVrShell = 0;
    }
    if (mNativePage != null) UiUtils.removeViewFromParent(mNativePage.getView());
    mTabModelSelector.removeObserver(mTabModelSelectorObserver);
    mTabModelSelectorTabObserver.destroy();
    mTab.removeObserver(mTabObserver);
    restoreTabFromVR();

    if (mTab != null) {
        mTab.updateBrowserControlsState(BrowserControlsState.SHOWN, true);
    }

    mContentVirtualDisplay.destroy();
    super.shutdown();
}
 
Example 3
Source File: DownloadItemView.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void showLayout(View layoutToShow) {
    if (mLayoutCompleted != layoutToShow) UiUtils.removeViewFromParent(mLayoutCompleted);
    if (mLayoutInProgress != layoutToShow) UiUtils.removeViewFromParent(mLayoutInProgress);

    if (layoutToShow.getParent() == null) {
        LinearLayout.LayoutParams params =
                new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT);
        params.weight = 1;
        mLayoutContainer.addView(layoutToShow, params);
    }
}
 
Example 4
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Prevents the shadow from being rendered.
 */
public void disableShadow() {
    View toolbarShadow = mControlContainer.findViewById(R.id.toolbar_shadow);
    if (toolbarShadow != null) UiUtils.removeViewFromParent(toolbarShadow);
}
 
Example 5
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Prevents the shadow from being rendered.
 */
public void disableShadow() {
    View toolbarShadow = mControlContainer.findViewById(R.id.toolbar_shadow);
    if (toolbarShadow != null) UiUtils.removeViewFromParent(toolbarShadow);
}