Java Code Examples for android.widget.FrameLayout#removeAllViews()
The following examples show how to use
android.widget.FrameLayout#removeAllViews() .
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: BaseActivityDi.java From demo-firebase-android with The Unlicense | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); LayoutInflater inflater = getLayoutInflater(); View baseView = inflater.inflate(R.layout.activity_base, null); FrameLayout flBaseContainer = baseView.findViewById(R.id.flBaseContainer); llBaseLoading = baseView.findViewById(R.id.llBaseLoading); llBaseLoadingTextNoNetwork = baseView.findViewById(R.id.tvBaseNoNetwork); View childView = inflater.inflate(getLayout(), null); flBaseContainer.removeAllViews(); flBaseContainer.addView(childView); setContentView(baseView); ButterKnife.bind(this); postButterInit(); }
Example 2
Source File: BaseActivity.java From demo-firebase-android with The Unlicense | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = getLayoutInflater(); View baseView = inflater.inflate(R.layout.activity_base, null); FrameLayout flBaseContainer = baseView.findViewById(R.id.flBaseContainer); llBaseLoading = baseView.findViewById(R.id.llBaseLoading); llBaseLoadingTextNoNetwork = baseView.findViewById(R.id.tvBaseNoNetwork); View childView = inflater.inflate(getLayout(), null); flBaseContainer.removeAllViews(); flBaseContainer.addView(childView); setContentView(baseView); ButterKnife.bind(this); postButterInit(); }
Example 3
Source File: PickerItemAdapter.java From YImagePicker with Apache License 2.0 | 6 votes |
ItemViewHolder(@NonNull View itemView, boolean isCamera, BaseSelectConfig selectConfig, IPickerPresenter presenter, PickerUiConfig uiConfig) { super(itemView); context = itemView.getContext(); FrameLayout layout = itemView.findViewById(R.id.mRoot); int width = (getScreenWidth() - dp(2)) / selectConfig.getColumnCount(); PViewSizeUtils.setViewSize(layout, width, 1.00f); pickerItemView = uiConfig.getPickerUiProvider().getItemView(context); layout.removeAllViews(); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.bottomMargin = dp(1); params.topMargin = dp(1); params.rightMargin = dp(1); params.leftMargin = dp(1); if (isCamera) { layout.addView(pickerItemView.getCameraView(selectConfig, presenter), params); } else { layout.addView(pickerItemView, params); } }
Example 4
Source File: PickerItemAdapter.java From YImagePicker with Apache License 2.0 | 6 votes |
ItemViewHolder(@NonNull View itemView, boolean isCamera, BaseSelectConfig selectConfig, IPickerPresenter presenter, PickerUiConfig uiConfig) { super(itemView); context = itemView.getContext(); FrameLayout layout = itemView.findViewById(R.id.mRoot); int width = (getScreenWidth() - dp(2)) / selectConfig.getColumnCount(); PViewSizeUtils.setViewSize(layout, width, 1.00f); pickerItemView = uiConfig.getPickerUiProvider().getItemView(context); layout.removeAllViews(); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.bottomMargin = dp(1); params.topMargin = dp(1); params.rightMargin = dp(1); params.leftMargin = dp(1); if (isCamera) { layout.addView(pickerItemView.getCameraView(selectConfig, presenter), params); } else { layout.addView(pickerItemView, params); } }
Example 5
Source File: WXEmbed.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void onException(NestedContainer container, String errCode, String msg) { if (TextUtils.equals(errCode, WXRenderErrorCode.WX_NETWORK_ERROR) && container instanceof WXEmbed) { final WXEmbed comp = ((WXEmbed)container); final ImageView imageView = new ImageView(comp.getContext()); imageView.setImageResource(R.drawable.error); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ERROR_IMG_WIDTH, ERROR_IMG_HEIGHT); layoutParams.gravity = Gravity.CENTER; imageView.setLayoutParams(layoutParams); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setAdjustViewBounds(true); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.setOnClickListener(null); imageView.setEnabled(false); comp.loadContent(); } }); FrameLayout hostView = comp.getHostView(); hostView.removeAllViews(); hostView.addView(imageView); WXLogUtils.e("WXEmbed", "NetWork failure :" + errCode + ",\n error message :" + msg); } }
Example 6
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 6 votes |
void addRemoteVideo(View singleRemoteView, SurfaceView video, String userId) { if (singleRemoteView == null) return; FrameLayout remoteVideoView = (FrameLayout) singleRemoteView.findViewById(R.id.viewlet_remote_video_user); remoteVideoView.removeAllViews(); if (video.getParent() != null) { ((ViewGroup) video.getParent()).removeView(video); } remoteVideoView.addView(video, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); // TextView remoteNameTextView = new TextView(this); // TextView tv = (TextView) singleRemoteView.findViewById(R.id.user_name); // ViewGroup.LayoutParams params = tv.getLayoutParams(); // remoteNameTextView.setLayoutParams(params); // remoteNameTextView.setTextAppearance(this, R.style.rc_voip_text_style_style); // UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(userId); // if (userInfo != null) { // remoteNameTextView.setText(userInfo.getName()); // } else { // remoteNameTextView.setText(userId); // } // remoteVideoView.addView(remoteNameTextView); remoteVideoView.setVisibility(View.VISIBLE); remoteVideoView.setTag(userId); }
Example 7
Source File: LayerManager.java From google-media-framework-android with Apache License 2.0 | 6 votes |
/** * Given a container, create the video layers and add them to the container. * @param activity The activity which will display the video player. * @param container The frame layout which will contain the views. * @param video the video that will be played by this LayerManager. * @param layers The layers which should be displayed on top of the container. */ public LayerManager(Activity activity, FrameLayout container, Video video, List<Layer> layers) { this.activity = activity; this.container = container; container.setBackgroundColor(Color.BLACK); ExoplayerWrapper.RendererBuilder rendererBuilder = RendererBuilderFactory.createRendererBuilder(activity, video); exoplayerWrapper = new ExoplayerWrapper(rendererBuilder); exoplayerWrapper.prepare(); this.control = exoplayerWrapper.getPlayerControl(); // Put the layers into the container. container.removeAllViews(); for (Layer layer : layers) { container.addView(layer.createView(this)); layer.onLayerDisplayed(this); } }
Example 8
Source File: ResultsDiagramFragment.java From BlurTestAndroid with Apache License 2.0 | 5 votes |
private void updateGraph() { if (BenchmarkStorage.getInstance(getActivity()).loadResultsDB() != null) { FrameLayout layout = getView().findViewById(R.id.graph); layout.removeAllViews(); layout.addView(createGraph(BenchmarkStorage.getInstance(getActivity()).loadResultsDB(), dataType, radius)); } }
Example 9
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 5 votes |
@Override public void onRemoteUserLeft(String userId, RongCallCommon.CallDisconnectedReason reason) { //incoming状态,localViewUserId为空 if (localViewUserId == null) return; if (localViewUserId.equals(userId)) { localViewContainer.removeAllViews(); String currentUserId = RongIMClient.getInstance().getCurrentUserId(); FrameLayout remoteVideoView = (FrameLayout) remoteViewContainer.findViewWithTag(currentUserId); localView = (SurfaceView) remoteVideoView.getChildAt(0); remoteVideoView.removeAllViews(); localViewContainer.addView(localView); TextView topUserNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name); UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(currentUserId); if (userInfo != null) { topUserNameView.setText(userInfo.getName()); } else { topUserNameView.setText(currentUserId); } localViewUserId = currentUserId; } View singleRemoteView = remoteViewContainer.findViewWithTag(userId + "view"); if (singleRemoteView == null) return; LinearLayout container = (LinearLayout) singleRemoteView.getParent(); container.removeView(singleRemoteView); if (container.equals(remoteViewContainer2)) { if (remoteViewContainer1.getChildCount() > 0) { View childView = remoteViewContainer1.getChildAt(0); remoteViewContainer1.removeView(childView); remoteViewContainer2.addView(childView); } } }
Example 10
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 5 votes |
protected void initViews() { inflater = LayoutInflater.from(this); localViewContainer = (FrameLayout) findViewById(R.id.rc_local_user_view); remoteViewContainer = (LinearLayout) findViewById(R.id.rc_remote_user_container); remoteViewContainer1 = (LinearLayout) findViewById(R.id.rc_remote_user_container_1); remoteViewContainer2 = (LinearLayout) findViewById(R.id.rc_remote_user_container_2); topContainer = (LinearLayout) findViewById(R.id.rc_top_container); waitingContainer = (LinearLayout) findViewById(R.id.rc_waiting_container); bottomButtonContainer = (LinearLayout) findViewById(R.id.rc_bottom_button_container); participantPortraitContainer = (LinearLayout) findViewById(R.id.rc_participant_portait_container); minimizeButton = (ImageView) findViewById(R.id.rc_voip_call_minimize); addButton = (ImageView) findViewById(R.id.rc_voip_call_add); switchCameraButton = (ImageView) findViewById(R.id.rc_voip_switch_camera); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); remoteUserViewWidth = (metrics.widthPixels - 50) / 4; localView = null; localViewContainer.removeAllViews(); remoteViewContainer1.removeAllViews(); remoteViewContainer2.removeAllViews(); minimizeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
Example 11
Source File: GroupedRecyclerViewItemFrameLayout.java From RedReader with GNU General Public License v3.0 | 5 votes |
@Override public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder) { final FrameLayout view = (FrameLayout)viewHolder.itemView; view.removeAllViews(); if(mParent != null && mChildView.getParent() == mParent) { mParent.removeAllViews(); } mParent = view; view.addView(mChildView); mChildView.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; }
Example 12
Source File: ExoPlayerHelper.java From ExoPlayer-Wrapper with Apache License 2.0 | 5 votes |
@Override public void releaseAdsLoader() { if (mImaAdsLoader != null) { mImaAdsLoader.release(); mImaAdsLoader = null; FrameLayout layout = mExoPlayerView.getOverlayFrameLayout(); if (layout != null) { layout.removeAllViews(); } } }
Example 13
Source File: MeasurementView.java From openScale with GNU General Public License v3.0 | 5 votes |
private void prepareInputDialog(final AlertDialog dialog) { dialog.setTitle(getName()); dialog.setIcon(getIcon()); final View input = getInputView(); FrameLayout fl = dialog.findViewById(android.R.id.custom); fl.removeAllViews(); fl.addView(input, new LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); View.OnClickListener clickListener = new View.OnClickListener() { @Override public void onClick(View view) { if (view == dialog.getButton(DialogInterface.BUTTON_POSITIVE) && !validateAndSetInput(input)) { return; } dialog.dismiss(); } }; dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(clickListener); dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setOnClickListener(clickListener); final MeasurementView next = getNextView(); if (next != null) { dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (validateAndSetInput(input)) { next.prepareInputDialog(dialog); } } }); } else { dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setVisibility(GONE); } }
Example 14
Source File: SubscriptionFragment.java From redgram-for-reddit with GNU General Public License v3.0 | 5 votes |
@Override protected void setupToolbar() { //add refresh //setting up toolbar frameLayout = (FrameLayout)mToolbar.findViewById(R.id.toolbar_child_view); frameLayout.removeAllViews(); RelativeLayout rl = (RelativeLayout) mInflater.inflate(R.layout.fragment_sub_toolbar, frameLayout, false); frameLayout.addView(rl); subRefresh = (ImageView)rl.findViewById(R.id.sub_refresh); setupRefresh(); }
Example 15
Source File: MainActivity.java From jxcore-android-basics with MIT License | 5 votes |
@Override protected void onDestroy() { super.onDestroy(); Log.w("jxcore-MainActivity", "destroy"); FrameLayout layout = (FrameLayout) AppManager.currentActivity .findViewById(R.id.container); layout.removeAllViews(); web.destroy(); web = null; instance_alive = false; }
Example 16
Source File: PickerFolderAdapter.java From YImagePicker with Apache License 2.0 | 5 votes |
ViewHolder(View view, PickerUiConfig uiConfig) { super(view); pickerFolderItemView = uiConfig.getPickerUiProvider().getFolderItemView(view.getContext()); if (pickerFolderItemView == null) { pickerFolderItemView = new WXFolderItemView(view.getContext()); } FrameLayout layout = itemView.findViewById(R.id.mRoot); int height = pickerFolderItemView.getItemHeight(); layout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height > 0 ? height : ViewGroup.LayoutParams.WRAP_CONTENT)); layout.removeAllViews(); layout.addView(pickerFolderItemView); }
Example 17
Source File: FloatingVoipService.java From webrtc_android with MIT License | 5 votes |
private void showVideoInfo() { view.findViewById(R.id.audioLinearLayout).setVisibility(View.GONE); FrameLayout remoteVideoFrameLayout = view.findViewById(R.id.remoteVideoFrameLayout); remoteVideoFrameLayout.setVisibility(View.VISIBLE); View surfaceView = session.setupRemoteVideo(session.mTargetId, true); if (surfaceView != null) { remoteVideoFrameLayout.removeAllViews(); remoteVideoFrameLayout.addView(surfaceView); } }
Example 18
Source File: DemoActivity.java From prebid-mobile-android with Apache License 2.0 | 4 votes |
void createDFPNative() { FrameLayout adFrame = (FrameLayout) findViewById(R.id.adFrame); adFrame.removeAllViews(); final PublisherAdView nativeAdView = new PublisherAdView(this); nativeAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { super.onAdLoaded(); LogUtil.d("ad loaded"); } }); nativeAdView.setAdUnitId(Constants.DFP_IN_BANNER_NATIVE_ADUNIT_ID_APPNEXUS); nativeAdView.setAdSizes(AdSize.FLUID); adFrame.addView(nativeAdView); final PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder(); request = builder.build(); NativeAdUnit nativeAdUnit = (NativeAdUnit) adUnit; nativeAdUnit.setContextType(NativeAdUnit.CONTEXT_TYPE.SOCIAL_CENTRIC); nativeAdUnit.setPlacementType(NativeAdUnit.PLACEMENTTYPE.CONTENT_FEED); nativeAdUnit.setContextSubType(NativeAdUnit.CONTEXTSUBTYPE.GENERAL_SOCIAL); ArrayList<NativeEventTracker.EVENT_TRACKING_METHOD> methods = new ArrayList<>(); methods.add(NativeEventTracker.EVENT_TRACKING_METHOD.IMAGE); try { NativeEventTracker tracker = new NativeEventTracker(NativeEventTracker.EVENT_TYPE.IMPRESSION, methods); nativeAdUnit.addEventTracker(tracker); } catch (Exception e) { e.printStackTrace(); } NativeTitleAsset title = new NativeTitleAsset(); title.setLength(90); title.setRequired(true); nativeAdUnit.addAsset(title); NativeImageAsset icon = new NativeImageAsset(); icon.setImageType(NativeImageAsset.IMAGE_TYPE.ICON); icon.setWMin(20); icon.setHMin(20); icon.setRequired(true); nativeAdUnit.addAsset(icon); NativeImageAsset image = new NativeImageAsset(); image.setImageType(NativeImageAsset.IMAGE_TYPE.MAIN); image.setHMin(200); image.setWMin(200); image.setRequired(true); nativeAdUnit.addAsset(image); NativeDataAsset data = new NativeDataAsset(); data.setLen(90); data.setDataType(NativeDataAsset.DATA_TYPE.SPONSORED); data.setRequired(true); nativeAdUnit.addAsset(data); NativeDataAsset body = new NativeDataAsset(); body.setRequired(true); body.setDataType(NativeDataAsset.DATA_TYPE.DESC); nativeAdUnit.addAsset(body); NativeDataAsset cta = new NativeDataAsset(); cta.setRequired(true); cta.setDataType(NativeDataAsset.DATA_TYPE.CTATEXT); nativeAdUnit.addAsset(cta); int millis = getIntent().getIntExtra(Constants.AUTO_REFRESH_NAME, 0); nativeAdUnit.setAutoRefreshPeriodMillis(millis); nativeAdUnit.fetchDemand(request, new OnCompleteListener() { @Override public void onComplete(ResultCode resultCode) { DemoActivity.this.resultCode = resultCode; nativeAdView.loadAd(request); DemoActivity.this.request = request; refreshCount++; } }); }
Example 19
Source File: WXEmbed.java From ucar-weex-core with Apache License 2.0 | 4 votes |
@Override public void onViewCreated(WXSDKInstance instance, View view) { FrameLayout hostView = mComponent.getHostView(); hostView.removeAllViews(); hostView.addView(view); }
Example 20
Source File: WXEmbed.java From weex-uikit with MIT License | 4 votes |
@Override public void onViewCreated(WXSDKInstance instance, View view) { FrameLayout hostView = mComponent.getHostView(); hostView.removeAllViews(); hostView.addView(view); }