Java Code Examples for android.widget.FrameLayout#removeView()

The following examples show how to use android.widget.FrameLayout#removeView() . 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: AnimatedDoorActivity.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedDoorLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mDoorType = getIntent().getIntExtra("door_type", AnimatedDoorLayout.HORIZONTAL_DOOR);
    mAnimated.setDoorType(mDoorType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_DOOR_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
Example 2
Source File: CalendarView.java    From ShizuruNotes with Apache License 2.0 6 votes vote down vote up
/**
 * 设置周栏视图
 *
 * @param cls WeekBar.class
 */
public final void setWeekBar(Class<?> cls) {
    if (cls == null) {
        return;
    }
    if (mDelegate.getWeekBarClass().equals(cls)) {
        return;
    }
    mDelegate.setWeekBarClass(cls);
    FrameLayout frameContent = findViewById(R.id.frameContent);
    frameContent.removeView(mWeekBar);

    try {
        Constructor constructor = cls.getConstructor(Context.class);
        mWeekBar = (WeekBar) constructor.newInstance(getContext());
    } catch (Exception e) {
        e.printStackTrace();
    }
    frameContent.addView(mWeekBar, 2);
    mWeekBar.setup(mDelegate);
    mWeekBar.onWeekStartChange(mDelegate.getWeekStart());
    this.mMonthPager.mWeekBar = mWeekBar;
    mWeekBar.onDateSelected(mDelegate.mSelectedCalendar, mDelegate.getWeekStart(), false);
}
 
Example 3
Source File: AnimatedRectActivity.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedRectLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mAnimationType = getIntent().getIntExtra("animation_type", AnimatedRectLayout.ANIMATION_RANDOM);
    mAnimated.setAnimationType(mAnimationType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
Example 4
Source File: CameraActivity.java    From KrGallery with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onFragmentDestroy() {
    super.onFragmentDestroy();
    NotificationCenter.getInstance().removeObserver(this, NotificationCenter.cameraInitied);
    if (!deviceHasGoodCamera || cameraView == null) {
        return;
    }
    if (cameraAnimationInProgress) {
        return;
    }
    if (cameraOpened) {
        closeCamera(true);
    }
    hideCamera(true);
    if (cameraView != null) {
        cameraView.destroy(true, null);
        FrameLayout frameLayout = (FrameLayout) fragmentView;
        frameLayout.removeView(cameraView);
        cameraView = null;
    }
    fragmentView = null;
    if (mBaseDialog != null)
        mBaseDialog.dismiss();
    mBaseDialog = null;
}
 
Example 5
Source File: AnimatedRectActivity.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedRectLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mAnimationType = getIntent().getIntExtra("animation_type", AnimatedRectLayout.ANIMATION_RANDOM);
    mAnimated.setAnimationType(mAnimationType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
Example 6
Source File: AnimatedDoorActivity.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedDoorLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mDoorType = getIntent().getIntExtra("door_type", AnimatedDoorLayout.HORIZONTAL_DOOR);
    mAnimated.setDoorType(mDoorType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_DOOR_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
Example 7
Source File: OverMenuView.java    From OverlayMenu with Apache License 2.0 5 votes vote down vote up
private void removeMenuOverlay() {
    if (DEBUG) {
        Log.i(TAG, "removeMenuOverlay");
    }
    FrameLayout root = (FrameLayout) ((Activity) getContext()).getWindow().getDecorView();
    View view = root.findViewById(R.id.OverMenuId);
    if (null != view) {
        root.removeView(view);
    }
    mMenuShown = false;
}
 
Example 8
Source File: PullToRefreshAdapterViewBase.java    From Roid-Library with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this
 * method yourself. Calling setEmptyView on the AdapterView will
 * automatically call this method and set everything up. This includes
 * when the Android Framework automatically sets the Empty View based on
 * it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

    // If we already have an Empty View, remove it
    if (null != mEmptyView) {
        refreshableViewWrapper.removeView(mEmptyView);
    }

    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as
        // a
        // target for Touch Events
        newEmptyView.setClickable(true);

        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }

        refreshableViewWrapper.addView(newEmptyView, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
    }

    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
 
Example 9
Source File: BaseFragmentWithTitleBarSimple.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/***
 * 设置内容布局
 *
 * @param layoutId layout id
 */
private void setCustomContentView(FrameLayout view_container, int layoutId) {
    View localView = View.inflate(getActivity(), layoutId, null);
    if (localView != null) {
        if (this.mDecoratedView != null) {
            view_container.removeView(mDecoratedView);
        }
        view_container.addView(localView);
        localView.setId(layoutId);
        mDecoratedView = localView;
    }
}
 
Example 10
Source File: BaseFragmentWithTitleBar.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/***
 * 设置内容布局
 *
 * @param layoutId layout id
 */
private void setCustomContentView(FrameLayout view_container, int layoutId) {
    View localView = View.inflate(getActivity(), layoutId, null);
    if (localView != null) {
        if (this.mDecoratedView != null) {
            view_container.removeView(mDecoratedView);
        }
        view_container.addView(localView);
        localView.setId(layoutId);
        mDecoratedView = localView;
    }
}
 
Example 11
Source File: ActivityContentVideoViewClient.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void onDestroyContentVideoView() {
    mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    mView = null;
}
 
Example 12
Source File: ActivityContentVideoViewClient.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void onDestroyContentVideoView() {
    mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    mView = null;
}
 
Example 13
Source File: VideoTextureView.java    From YCVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * 添加TextureView到视图中
 * @param frameLayout               布局
 * @param textureView               textureView
 */
public void addTextureView(FrameLayout frameLayout , VideoTextureView textureView){
    frameLayout.removeView(textureView);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER);
    frameLayout.addView(textureView, 0, params);
}
 
Example 14
Source File: ActivityContentVideoViewEmbedder.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void exitFullscreenVideo() {
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    setSystemUiVisibility(false);
    mView = null;
}
 
Example 15
Source File: Shell.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Set the SurfaceView being renderered to as soon as it is available.
 */
public void setContentViewRenderView(ContentViewRenderView contentViewRenderView) {
    FrameLayout contentViewHolder = (FrameLayout) findViewById(R.id.contentview_holder);
    if (contentViewRenderView == null) {
        if (mContentViewRenderView != null) {
            contentViewHolder.removeView(mContentViewRenderView);
        }
    } else {
        contentViewHolder.addView(contentViewRenderView,
                new FrameLayout.LayoutParams(
                        FrameLayout.LayoutParams.MATCH_PARENT,
                        FrameLayout.LayoutParams.MATCH_PARENT));
    }
    mContentViewRenderView = contentViewRenderView;
}
 
Example 16
Source File: WebVideoActivity.java    From fvip with Apache License 2.0 5 votes vote down vote up
/** 隐藏视频全屏 */
private void hideCustomView() {
    if (customView == null) {
        return;
    }

    setStatusBarVisibility(true);
    FrameLayout decor = (FrameLayout) getWindow().getDecorView();
    decor.removeView(fullscreenContainer);
    fullscreenContainer = null;
    customView = null;
    customViewCallback.onCustomViewHidden();
    webView.setVisibility(View.VISIBLE);
}
 
Example 17
Source File: VrShellDelegate.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void removeVrViews() {
    mActivity.onExitVr();
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mVrShell.getContainer());
}
 
Example 18
Source File: PluginManager.java    From Dota2Helper with Apache License 2.0 4 votes vote down vote up
public void removePlugin(PluginOverlay plugin, FrameLayout stub) {
	stub.removeView(plugin);
}
 
Example 19
Source File: PluginManager.java    From SimplifyReader with Apache License 2.0 4 votes vote down vote up
public void removePlugin(PluginOverlay plugin, FrameLayout stub) {
	stub.removeView(plugin);
}
 
Example 20
Source File: ImageViewerActivity.java    From android-wear-gopro-remote with Apache License 2.0 4 votes vote down vote up
@Override
protected Object instantiateItem(ViewGroup viewGroup, int row, int col) {
    View view = null;

    if(col == 0) {
        view = View.inflate(mContext, R.layout.image_viewer, null);
        ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
        TextView statusText = (TextView) view.findViewById(R.id.textViewStatus);
        if (Logger.DEBUG) imageView.setOnClickListener(ImageViewerActivity.this);
        imageView.setOnLongClickListener(ImageViewerActivity.this);

        File file = null;
        if (mCount > 0) {
            file = mFileList.get(mCount - (row + 1));
        }
        statusText.setText(String.format("%d/%d", row + 1, mCount));
        if (mFirstImage != null && row == mFirstIndex) {
            imageView.setImageBitmap(mFirstImage);
        } else {
            if (file != null) {
                Bitmap thumb = ThumbCache.getThumbFromMemCache(file);
                if (thumb != null) {
                    imageView.setImageBitmap(thumb);
                    Logger.debug(TAG, "Got thumb %s from memcache.", file);
                } else {
                    new LoadThumbTask(imageView, file).execute();
                }
            } else {
                TextView textView = new TextView(mContext);
                textView.setText(R.string.label_no_images);
                textView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
                FrameLayout frame = ((FrameLayout) view);
                frame.addView(textView);
                frame.removeView(imageView);
            }
        }

        if (file != null) {
            ImageView imageViewVideo = (ImageView) view.findViewById(R.id.imageViewVideo);
            String fname = file.getName().toUpperCase();
            if (fname.endsWith("MP4")) {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_video);
            } else if (fname.endsWith("JPG")) {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_photo);
            } else {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_burst);
            }
        }
        viewGroup.addView(view);
    }
    if(Logger.DEBUG) Logger.debug(TAG, "View created: %d/%d", row, col);
    return view;
}