List of usage examples for android.widget FrameLayout removeView
@Override public void removeView(View view)
Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.
From source file:com.sabaibrowser.UI.java
private void removeTabFromContentView(Tab tab) { hideTitleBar();/*from www . j a v a 2 s. c o m*/ // Remove the container that contains the main WebView. WebView mainView = tab.getWebView(); View container = tab.getViewContainer(); if (mainView == null) { return; } // Remove the container from the content and then remove the // WebView from the container. This will trigger a focus change // needed by WebView. FrameLayout wrapper = (FrameLayout) container.findViewById(R.id.webview_wrapper); wrapper.removeView(mainView); mContentView.removeView(container); mUiController.endActionMode(); }
From source file:com.sabaibrowser.UI.java
public void onSetWebView(Tab tab, WebView webView) { View container = tab.getViewContainer(); if (container == null) { // The tab consists of a container view, which contains the main // WebView, as well as any other UI elements associated with the tab. container = mActivity.getLayoutInflater().inflate(R.layout.tab, mContentView, false); tab.setViewContainer(container); }//from w w w. j ava 2s .c o m if (tab.getWebView() != webView) { // Just remove the old one. FrameLayout wrapper = (FrameLayout) container.findViewById(R.id.webview_wrapper); wrapper.removeView(tab.getWebView()); } }
From source file:com.todoroo.astrid.activity.TaskListActivity.java
private void setupPopoverWithFragment(FragmentPopover popover, Fragment frag, LayoutParams params) { if (popover != null) { View view = frag.getView(); if (view != null) { FrameLayout parent = (FrameLayout) view.getParent(); if (parent != null) parent.removeView(view); if (params == null) popover.setContent(view); else/*from w w w. j av a2 s .c o m*/ popover.setContent(view, params); } } }
From source file:com.example.angelina.travelapp.map.MapFragment.java
/** * Remove special header and navigator buttons for route detail *///from ww w .j av a 2 s . co m public void removeRouteDetail() { mMapView.removeView(mRouteHeaderDetail); mRouteHeaderDetail = null; final FrameLayout navigatorLayout = (FrameLayout) getActivity().findViewById(R.id.map_fragment_container); navigatorLayout.removeView(mSegmentNavigator); mMapView.removeView(mSegmentNavigator); mSegmentNavigator = null; }
From source file:com.gitstudy.rili.liarbry.CalendarView.java
/** * ?/*from ww w . jav a 2 s .c om*/ * * @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 = (FrameLayout) 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); }
From source file:com.andreadec.musicplayer.MainActivity.java
@SuppressLint({ "InlinedApi", "NewApi" }) @Override//from w w w . ja v a 2s.c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(AudioManager.STREAM_MUSIC); preferences = PreferenceManager.getDefaultSharedPreferences(this); if (preferences.getBoolean(Constants.PREFERENCE_DISABLELOCKSCREEN, Constants.DEFAULT_DISABLELOCKSCREEN)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // Disable lock screen for this activity } requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); if (preferences.getBoolean(Constants.PREFERENCE_SHOWHELPOVERLAYMAINACTIVITY, true)) { final FrameLayout frameLayout = new FrameLayout(this); LayoutInflater layoutInflater = getLayoutInflater(); layoutInflater.inflate(R.layout.layout_main, frameLayout); layoutInflater.inflate(R.layout.layout_helpoverlay_main, frameLayout); final View overlayView = frameLayout.getChildAt(1); overlayView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { frameLayout.removeView(overlayView); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(Constants.PREFERENCE_SHOWHELPOVERLAYMAINACTIVITY, false); editor.commit(); } }); setContentView(frameLayout); } else { setContentView(R.layout.layout_main); } pages = new String[4]; pages[PAGE_BROWSER] = getResources().getString(R.string.browser); pages[PAGE_PLAYLISTS] = getResources().getString(R.string.playlist); pages[PAGE_RADIOS] = getResources().getString(R.string.radio); pages[PAGE_PODCASTS] = getResources().getString(R.string.podcasts); fragmentManager = getSupportFragmentManager(); setTitle(pages[currentPage]); /* NAVIGATION DRAWER */ drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { super.onDrawerClosed(view); setTitle(pages[currentPage]); } public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); setTitle(getResources().getString(R.string.app_name)); } }; drawerLayout.setDrawerListener(drawerToggle); if (Build.VERSION.SDK_INT >= 11) getActionBar().setDisplayHomeAsUpEnabled(true); drawerContainer = (RelativeLayout) findViewById(R.id.navigation_container); drawerList = (ListView) findViewById(R.id.navigation_list); navigationAdapter = new NavigationDrawerArrayAdapter(this, pages); drawerList.setAdapter(navigationAdapter); drawerList.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(@SuppressWarnings("rawtypes") AdapterView parent, View view, int position, long id) { openPage(position); drawerLayout.closeDrawer(drawerContainer); } }); buttonQuit = findViewById(R.id.navigation_buttonQuit); buttonQuit.setOnClickListener(this); if (Build.VERSION.SDK_INT >= 19) { // Android 4.4+ only boolean translucentStatus = preferences.getBoolean(Constants.PREFERENCE_TRANSLUCENTSTATUSBAR, Constants.DEFAULT_TRANSLUCENTSTATUSBAR); boolean translucentNavigation = preferences.getBoolean(Constants.PREFERENCE_TRANSLUCENTNAVIGATIONBAR, Constants.DEFAULT_TRANSLUCENTNAVIGATIONBAR); if (translucentStatus) getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); if (translucentNavigation) getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); SystemBarTintManager tintManager = new SystemBarTintManager(this); if (translucentStatus) { tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.actionBarBackground); } } textViewArtist = (TextView) findViewById(R.id.textViewArtist); textViewTitle = (TextView) findViewById(R.id.textViewTitle); textViewTime = (TextView) findViewById(R.id.textViewTime); imageViewSongImage = (ImageView) findViewById(R.id.imageViewSongImage); imageButtonPrevious = (ImageButton) findViewById(R.id.imageButtonPrevious); imageButtonPlayPause = (ImageButton) findViewById(R.id.imageButtonPlayPause); imageButtonNext = (ImageButton) findViewById(R.id.imageButtonNext); seekBar1 = (SeekBar) findViewById(R.id.seekBar1); seekBar2 = (SeekBar) findViewById(R.id.seekBar2); imageButtonShowSeekbar2 = (ImageButton) findViewById(R.id.imageButtonShowSeekbar2); imageButtonShuffle = (ImageButton) findViewById(R.id.imageButtonShuffle); imageButtonRepeat = (ImageButton) findViewById(R.id.imageButtonRepeat); imageButtonRepeatAll = (ImageButton) findViewById(R.id.imageButtonRepeatAll); buttonBassBoost = (Button) findViewById(R.id.buttonBassBoost); buttonEqualizer = (Button) findViewById(R.id.buttonEqualizer); buttonShake = (Button) findViewById(R.id.buttonShake); imageButtonShuffle.setOnClickListener(this); imageButtonRepeat.setOnClickListener(this); imageButtonRepeatAll.setOnClickListener(this); buttonBassBoost.setOnClickListener(this); buttonEqualizer.setOnClickListener(this); buttonShake.setOnClickListener(this); imageButtonShowSeekbar2.setOnClickListener(this); imageButtonPrevious.setOnClickListener(this); imageButtonPlayPause.setOnClickListener(this); imageButtonNext.setOnClickListener(this); seekBar1.setOnSeekBarChangeListener(this); seekBar1.setClickable(false); seekBar2.setOnSeekBarChangeListener(this); textViewTime.setOnClickListener(this); showSongImage = preferences.getBoolean(Constants.PREFERENCE_SHOWSONGIMAGE, Constants.DEFAULT_SHOWSONGIMAGE); imagesCache = new LruCache<String, Bitmap>(Constants.IMAGES_CACHE_SIZE); serviceIntent = new Intent(this, MusicService.class); startService(serviceIntent); // Starts the service if it is not running if (preferences.getBoolean(Constants.PREFERENCE_OPENLASTPAGEONSTART, Constants.DEFAULT_OPENLASTPAGEONSTART)) { openPage(preferences.getInt(Constants.PREFERENCE_LASTPAGE, Constants.DEFAULT_LASTPAGE)); } else { openPage(PAGE_BROWSER); } loadSongFromIntent(); layoutPlaybackControls = findViewById(R.id.layoutPlaybackControls); if (preferences.getBoolean(Constants.PREFERENCE_ENABLEGESTURES, Constants.DEFAULT_ENABLEGESTURES)) { final GestureDetectorCompat gestureDetector = new GestureDetectorCompat(this, new PlayerGestureListener()); View layoutTop = findViewById(R.id.layoutTop); layoutTop.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }); if (preferences.getBoolean(Constants.PREFERENCE_SHOWPLAYBACKCONTROLS, Constants.DEFAULT_SHOWPLAYBACKCONTROLS)) { layoutPlaybackControls.setVisibility(View.VISIBLE); } } else { layoutPlaybackControls.setVisibility(View.VISIBLE); } }
From source file:im.ene.lab.toro.ext.layeredvideo.PlaybackControlLayer.java
/** * Fades the playback control layer out and then removes it from the {@link * LayerManager}'s/*from www.jav a 2 s .co m*/ * container. */ public void hide() { if (isFadingOut) { return; } final FrameLayout container = layerManager.getContainer(); if (container == null) { return; } if (isVisible) { isFadingOut = true; playbackControlRootView.animate().alpha(0.0f).setDuration(FADE_OUT_DURATION_MS) .setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { isFadingOut = false; playbackControlRootView.setVisibility(View.INVISIBLE); container.removeView(view); handler.removeMessages(SHOW_PROGRESS); isVisible = false; } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); } }
From source file:org.apps8os.motivator.ui.MainActivity.java
/** * Showing the guide of the main sections in the application *//*from w w w . ja v a 2 s . c o m*/ public void showHelp() { if (!mHelpIsVisible) { mHelpIsVisible = true; mViewPager.setCurrentItem(1); final FrameLayout contentRoot = (FrameLayout) findViewById(R.id.root_view); // Inflate the help overlay to the fragment. getLayoutInflater().inflate(R.layout.element_help_overlay, contentRoot, true); final TextView helpTitle = (TextView) contentRoot.findViewById(R.id.help_overlay_title); helpTitle.setText(getString(R.string.today_section)); final TextView helpText = (TextView) contentRoot.findViewById(R.id.help_overlay_subtitle); helpText.setText(getString(R.string.today_section_help)); final LinearLayout helpBackground = (LinearLayout) contentRoot.findViewById(R.id.help_text_background); helpBackground.setBackgroundResource(R.color.actionbar_green); ((Button) contentRoot.findViewById(R.id.help_overlay_button)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mViewPager.getCurrentItem() == 0) { final View helpOverlay = (View) contentRoot.findViewById(R.id.help_overlay); helpOverlay.animate().alpha(0f).setDuration(500).setListener(new AnimatorListenerAdapter() { // Set the visibility to gone when animation has ended. @Override public void onAnimationEnd(Animator animation) { helpOverlay.setVisibility(View.GONE); contentRoot.removeView(helpOverlay); } }); mViewPager.setCurrentItem(1); SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(SEEN_HELP, true); editor.commit(); mHelpIsVisible = false; } else if (mViewPager.getCurrentItem() == 1) { mViewPager.setCurrentItem(2); helpTitle.setText(getString(R.string.plan_section)); helpText.setText(getString(R.string.plan_section_help)); helpBackground.setBackgroundResource(R.color.actionbar_blue); } else { mViewPager.setCurrentItem(0); helpTitle.setText(getString(R.string.history_section)); helpText.setText(getString(R.string.history_section_help)); helpBackground.setBackgroundResource(R.color.actionbar_orange); ((Button) contentRoot.findViewById(R.id.help_overlay_button)) .setText(getString(R.string.ok)); } } }); } }
From source file:io.github.calvinmikael.anymanga.WebViewFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override/*from w w w . ja va 2s . c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_web_view, container, false); mProgressBar = (ProgressBar) view.findViewById(R.id.progressBar); mProgressBar.setVisibility(View.GONE); mWebView = (ObservableWebView) view.findViewById(R.id.webView); mWebView.setScrollViewCallbacks(this); WebSettings settings = mWebView.getSettings(); settings.setLoadsImagesAutomatically(true); settings.setJavaScriptEnabled(true); settings.setDomStorageEnabled(true); mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); settings.setBuiltInZoomControls(true); settings.setDisplayZoomControls(false); mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (!mProgressBar.isShown()) { mProgressBar.setVisibility(View.VISIBLE); } } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (mProgressBar.isShown()) { mProgressBar.setVisibility(View.GONE); } } }); mWebView.setWebChromeClient(new WebChromeClient() { @Override public void onShowCustomView(View view, CustomViewCallback callback) { // if a view already exists then immediately terminate the new one if (mCustomView != null) { onHideCustomView(); return; } // Save the current state mCustomView = view; mOriginalSystemUiVisibility = getActivity().getWindow().getDecorView().getSystemUiVisibility(); // Save the custom view callback mCustomViewCallback = callback; // Add the custom view to the view hierarchy FrameLayout decorView = (FrameLayout) getActivity().getWindow().getDecorView(); decorView.addView(mCustomView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mTabStrip = (PagerSlidingTabStrip) getActivity().findViewById(R.id.tabs); mTabStrip.setVisibility(View.GONE); // Go fullscreen if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getActivity().getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getActivity().getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } @Override public void onHideCustomView() { // Remove the custom view FrameLayout decorView = (FrameLayout) getActivity().getWindow().getDecorView(); decorView.removeView(mCustomView); mCustomView = null; mTabStrip.setVisibility(View.VISIBLE); // Restore the original form getActivity().getWindow().getDecorView().setSystemUiVisibility(mOriginalSystemUiVisibility); // Call the custom view callback mCustomViewCallback.onCustomViewHidden(); mCustomViewCallback = null; } }); // The back button must be handled within the mWebView for the // mWebView to have back behavior based on the current mPage // if back behavior is not handled with this listener then // back behavior will be entirely dependent on the first mPage mWebView.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View view, int keyCode, KeyEvent keyEvent) { if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack() && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { mWebView.goBack(); return true; } return false; } }); if (savedInstanceState != null) { mWebView.restoreState(savedInstanceState); } else { if (mPage == 1) { mWebView.loadUrl(getString(R.string.website_kissmanga)); } else if (mPage == 2) { mWebView.loadUrl(getString(R.string.website_mangapark)); } else if (mPage == 3) { mWebView.loadUrl(getString(R.string.website_line_webtoon)); } } return view; }
From source file:com.dish.browser.activity.BrowserActivity.java
@Override public void onHideCustomView() { if (mCustomView == null || mCustomViewCallback == null || mCurrentView == null) { return;// www . j a va2s. com } Log.d(Constants.TAG, "onHideCustomView"); mCurrentView.setVisibility(View.VISIBLE); try { mCustomView.setKeepScreenOn(false); } catch (SecurityException e) { Log.e(Constants.TAG, "WebView is not allowed to keep the screen on"); } setFullscreen(mPreferences.getHideStatusBarEnabled()); FrameLayout decor = (FrameLayout) getWindow().getDecorView(); if (decor != null) { decor.removeView(mFullscreenContainer); } if (API < 19) { try { mCustomViewCallback.onCustomViewHidden(); } catch (Throwable ignored) { } } mFullscreenContainer = null; mCustomView = null; if (mVideoView != null) { mVideoView.setOnErrorListener(null); mVideoView.setOnCompletionListener(null); mVideoView = null; } setRequestedOrientation(mOriginalOrientation); }