Java Code Examples for android.support.v7.widget.Toolbar#setVisibility()
The following examples show how to use
android.support.v7.widget.Toolbar#setVisibility() .
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: ScoopSettingsActivity.java From Scoops with Apache License 2.0 | 6 votes |
private void setupActionBar() { if(getSupportActionBar() == null){ mAppBar = (Toolbar) findViewById(R.id.appbar); setSupportActionBar(mAppBar); mAppBar.setVisibility(View.VISIBLE); mAppBar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } if(TextUtils.isEmpty(mTitle)) { getSupportActionBar().setTitle(R.string.activity_settings); }else{ getSupportActionBar().setTitle(mTitle); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Example 2
Source File: ToolbarRenderer.java From px-android with MIT License | 6 votes |
private void renderToolbar(final View view, final ToolbarComponent component, final Context context) { final AppCompatActivity activity = (AppCompatActivity) context; final Toolbar toolbar = view.findViewById(R.id.toolbar); if (!component.props.toolbarVisible) { toolbar.setVisibility(View.GONE); } else { final TextView titleView = view.findViewById(R.id.title); activity.setSupportActionBar(toolbar); activity.getSupportActionBar().setDisplayShowTitleEnabled(false); activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { activity.onBackPressed(); } }); titleView.setText(component.props.toolbarTitle); } }
Example 3
Source File: BaseActivity.java From AndroidDesignPatterns with Apache License 2.0 | 6 votes |
@Override public void setContentView(int layoutResID) { fullLayout = (DrawerLayout) getLayoutInflater().inflate(R.layout.base_drawer_layout, null); // FrameLayout activityContainer = (FrameLayout) fullLayout.findViewById(R.id.activity_content); // getLayoutInflater().inflate(layoutResID, activityContainer, true); super.setContentView(fullLayout); toolbar = (Toolbar) findViewById(R.id.toolbar); navigationView = (NavigationView) findViewById(R.id.navigationView); if (useToolbar()) { setSupportActionBar(toolbar); } else { toolbar.setVisibility(View.GONE); } setUpNavView(); }
Example 4
Source File: FragmentWellcome.java From uPods-android with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_wellcome, container, false); Toolbar toolbar = ((IToolbarHolder) getActivity()).getToolbar(); toolbar.setVisibility(View.GONE); return view; }
Example 5
Source File: CallActivity.java From q-municate-android with Apache License 2.0 | 5 votes |
public void initActionBar() { toolbar = (Toolbar) findViewById(R.id.toolbar_call); if (toolbar != null) { toolbar.setVisibility(View.VISIBLE); setSupportActionBar(toolbar); } actionBar = getSupportActionBar(); }
Example 6
Source File: MaterialViewPager.java From MaterialViewPager with Apache License 2.0 | 5 votes |
@Override protected void onFinishInflate() { super.onFinishInflate(); //add @layout/material_view_pager_layout as child, containing all the MaterialViewPager views addView(LayoutInflater.from(getContext()).inflate(R.layout.material_view_pager_layout, this, false)); headerBackgroundContainer = (ViewGroup) findViewById(R.id.headerBackgroundContainer); pagerTitleStripContainer = (ViewGroup) findViewById(R.id.pagerTitleStripContainer); viewpagerContainer = (ViewGroup) findViewById(R.id.viewpager_layout); logoContainer = (ViewGroup) findViewById(R.id.logoContainer); mToolbar = (Toolbar) findViewById(R.id.toolbar); if (settings.disableToolbar) { mToolbar.setVisibility(INVISIBLE); } { //replace the viewpager ? int viewPagerLayoutId = settings.viewpagerId; if (viewPagerLayoutId != -1) { viewpagerContainer.removeAllViews(); viewpagerContainer.addView(LayoutInflater.from(getContext()).inflate(viewPagerLayoutId, viewpagerContainer, false)); } } mViewPager = (ViewPager) findViewById(R.id.materialviewpager_viewpager); mViewPager.addOnPageChangeListener(this); //inflate subviews defined in attributes { int headerId = settings.headerLayoutId; if (headerId == -1) { if (settings.animatedHeaderImage) { headerId = R.layout.material_view_pager_moving_header; } else { headerId = R.layout.material_view_pager_imageview_header; } } headerBackgroundContainer.addView(LayoutInflater.from(getContext()).inflate(headerId, headerBackgroundContainer, false)); } if (isInEditMode()) { //preview titlestrip //add fake tabs on edit mode settings.pagerTitleStripId = R.layout.tools_material_view_pager_pagertitlestrip; } if (settings.pagerTitleStripId != -1) { pagerTitleStripContainer.addView(LayoutInflater.from(getContext()).inflate(settings.pagerTitleStripId, pagerTitleStripContainer, false)); } if (settings.logoLayoutId != -1) { logoContainer.addView(LayoutInflater.from(getContext()).inflate(settings.logoLayoutId, logoContainer, false)); if (settings.logoMarginTop != 0) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) logoContainer.getLayoutParams(); layoutParams.setMargins(0, settings.logoMarginTop, 0, 0); logoContainer.setLayoutParams(layoutParams); } } headerBackground = findViewById(R.id.headerBackground); toolbarLayoutBackground = findViewById(R.id.toolbar_layout_background); initialiseHeights(); //construct the materialViewPagerHeader with subviews if (!isInEditMode()) { materialViewPagerHeader = MaterialViewPagerHeader .withToolbar(mToolbar) .withToolbarLayoutBackground(toolbarLayoutBackground) .withPagerSlidingTabStrip(pagerTitleStripContainer) .withHeaderBackground(headerBackground) .withStatusBackground(findViewById(R.id.statusBackground)) .withLogo(logoContainer); //and construct the MaterialViewPagerAnimator //attach it to the activity to enable MaterialViewPagerHeaderView.setMaterialHeight(); MaterialViewPagerHelper.register(getContext(), new MaterialViewPagerAnimator(this)); } else { //if in edit mode, add fake cardsviews View sample = LayoutInflater.from(getContext()).inflate(R.layout.tools_list_items, pagerTitleStripContainer, false); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) sample.getLayoutParams(); int marginTop = Math.round(Utils.dpToPx(settings.headerHeight + 10, getContext())); params.setMargins(0, marginTop, 0, 0); super.setLayoutParams(params); addView(sample); } }
Example 7
Source File: PhotoCropActivity.java From Yahala-Messenger with MIT License | 5 votes |
private Toolbar createToolbar() { Toolbar toolbar = new Toolbar(parentActivity); Toolbar.LayoutParams toolBarParams = new Toolbar.LayoutParams( Toolbar.LayoutParams.MATCH_PARENT, R.attr.actionBarSize ); toolbar.setLayoutParams(toolBarParams); toolbar.setVisibility(View.VISIBLE); return toolbar; }
Example 8
Source File: ActivityPlayer.java From uPods-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_player); toolbar = (Toolbar) findViewById(R.id.toolbar_player); toolbar.setTitleTextColor(getResources().getColor(R.color.white)); toolbar.inflateMenu(R.menu.menu_activity_player); toolbar.setOnMenuItemClickListener(this); toolbar.setVisibility(View.VISIBLE); itemFavorites = (ActionMenuItemView) toolbar.findViewById(R.id.action_favorites_player); currentMediaItem = UniversalPlayer.getInstance().getPlayingMediaItem(); if (currentMediaItem == null) { Toast.makeText(this, getString(R.string.error_cant_play), Toast.LENGTH_SHORT).show(); onBackPressed(); return; } if (getFragmentManager().getBackStackEntryCount() == 0) { if (currentMediaItem instanceof Podcast && MediaUtils.isVideoUrl(currentMediaItem.getAudeoLink())) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); FragmentVideoPlayer fragmentVideoPlayer = new FragmentVideoPlayer(); fragmentVideoPlayer.setOnPlayingFailedCallback(MediaUtils.getPlayerFailCallback(this, currentMediaItem)); showFragment(R.id.fl_window, fragmentVideoPlayer, FragmentVideoPlayer.TAG); } else { fragmentPlayer = new FragmentPlayer(); fragmentPlayer.setPlayableItem(currentMediaItem); showFragment(R.id.fl_window, fragmentPlayer, FragmentMainFeatured.TAG); } } }
Example 9
Source File: BaseActivity.java From MediaGallery with Apache License 2.0 | 5 votes |
private void initBaseViews() { mToolbar = (Toolbar) findViewById(R.id.toolbar_media_gallery); if (getSupportActionBar() != null) { mToolbar.setVisibility(View.GONE); getSupportActionBar().setTitle(String.valueOf(title)); } else { setSupportActionBar(mToolbar); mToolbar.setTitle(String.valueOf(title)); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); }
Example 10
Source File: NewsActivity.java From YuanNewsForAndroid with Apache License 2.0 | 4 votes |
@Override protected void initView(Bundle savedInstanceState,Toolbar toolbar) { toolbar.setVisibility(View.GONE); }
Example 11
Source File: MainActivity.java From NotifyUtil with Apache License 2.0 | 4 votes |
private void initToolBar() { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setVisibility(View.GONE); }
Example 12
Source File: MainActivity.java From AndroidProcess with Apache License 2.0 | 4 votes |
private void initToolBar() { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setVisibility(View.GONE); }
Example 13
Source File: BaseActivity.java From EasyVPN-Free with GNU General Public License v3.0 | 4 votes |
@Override public void setContentView(int layoutResID) { if (BuildConfig.FLAVOR == "pro" || BuildConfig.FLAVOR == "underground") { availableFilterAds = true; premiumServers = true; } fullLayout = (DrawerLayout) getLayoutInflater().inflate(R.layout.activity_base, null); FrameLayout activityContainer = (FrameLayout) fullLayout.findViewById(R.id.activity_content); getLayoutInflater().inflate(layoutResID, activityContainer, true); super.setContentView(fullLayout); toolbar = (Toolbar) findViewById(R.id.toolbar); if (useToolbar()) { setSupportActionBar(toolbar); } else { toolbar.setVisibility(View.GONE); } if (useHomeButton()) { if (getSupportActionBar() != null){ getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } } if (BuildConfig.DEBUG) { moreServersSKU = TEST_ITEM_SKU; adblockSKU = TEST_ITEM_SKU; } else { moreServersSKU = MORE_SERVERS_ITEM_SKU; adblockSKU = ADBLOCK_ITEM_SKU; } dbHelper = new DBHelper(this); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); widthWindow = dm.widthPixels; heightWindow = dm.heightPixels; localeCountries = CountriesNames.getCountries(); App application = (App) getApplication(); mTracker = application.getDefaultTracker(); }
Example 14
Source File: ActivityMain.java From uPods-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setBackgroundDrawable(null); setContentView(R.layout.activity_main); //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main); int startedFrom = getIntent().getIntExtra(ActivityPlayer.ACTIVITY_STARTED_FROM, -1); if (isFirstRun && !Arrays.asList(notificationsActions).contains(startedFrom)) { toolbar.setVisibility(View.GONE); final FragmentWellcome fragmentWellcome = new FragmentWellcome(); showFragment(R.id.fl_window, fragmentWellcome, FragmentWellcome.TAG); init(); new Handler().postDelayed(new Runnable() { public void run() { hideFragment(fragmentWellcome); if (!Prefs.getBoolean(FragmentHelp.PREF_HELP_SHOWN, false)) { //! showHelpFragment(); } else { toolbar.setVisibility(View.VISIBLE); showFragment(R.id.fl_content, getStartFragment(), FragmentMediaItemsGrid.TAG); } } }, WELLCOME_SCREEN_TIME); } else { init(); toolbar.setVisibility(View.VISIBLE); int startedFragmentNumber = ActivityMain.lastChildFragmentNumber; if (startedFrom == NetworkTasksService.NOTIFICATIONS_SHOW_PODCASTS_SUBSCRIBED) { startedFragmentNumber = 1; startedFrom = MediaItemType.PODCAST.ordinal(); NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nMgr.cancel(NetworkTasksService.NEW_EPISODS_NOTIFICATION_ID); } FragmentMediaItemsGrid fragmentMediaItemsGrid = new FragmentMediaItemsGrid(); fragmentMediaItemsGrid.setMediaItemType(startedFrom == MediaItemType.PODCAST.ordinal() ? MediaItemType.PODCAST : MediaItemType.RADIO); if (startedFragmentNumber >= 0) { fragmentMediaItemsGrid.setStartItemNumber(startedFragmentNumber); } showFragment(R.id.fl_content, fragmentMediaItemsGrid, FragmentMediaItemsGrid.TAG); AppRate.with(this) .setInstallDays(RATE_MIN_INSTALL_DAYS) .setLaunchTimes(RATE_MIN_INSTALL_TIMES) .setShowLaterButton(true) // default true .monitor(); // Show a dialog if meets conditions AppRate.showRateDialogIfMeetsConditions(this); } isFirstRun = false; }
Example 15
Source File: PictureActivity.java From actor-platform with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowCustomEnabled(false); actionBar.setTitle(R.string.media_picture); int statbarHeight = Screen.getStatusBarHeight(); if (Build.VERSION.SDK_INT >= 19) { toolbar.setPadding(0, statbarHeight, 0, 0); } final Bundle bundle = getIntent().getExtras(); path = bundle.getString(ARG_FILE_PATH); int sender = bundle.getInt(ARG_OWNER, 0); toolbar.setVisibility(View.GONE); transitionTop = bundle.getInt(ARG_IMAGE_TOP, 0); transitionLeft = bundle.getInt(ARG_IMAGE_LEFT, 0); transitionWidth = bundle.getInt(ARG_IMAGE_WIDTH, 0); transitionHeight = bundle.getInt(ARG_IMAGE_HEIGHT, 0); transitionView = (ImageView) findViewById(R.id.transition); backgroundView = findViewById(R.id.background); containerView = findViewById(R.id.container); containerView.setAlpha(0); fragment = new PictureFragment(); fragment.setArguments(bundle); getSupportFragmentManager().beginTransaction() .add(R.id.container, fragment) .commit(); Bitmap bitmap = null; try { bitmap = ImageLoading.loadBitmapOptimized(path); bitmapWidth = bitmap.getWidth(); bitmapHeight = bitmap.getHeight(); } catch (ImageLoadException e) { e.printStackTrace(); return; } transitionView.setImageBitmap(bitmap); if (bitmap != null) bitmap = null; MediaFullscreenAnimationUtils.animateForward(transitionView, bitmapWidth, bitmapHeight, transitionLeft, transitionTop, transitionWidth, transitionHeight, new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { containerView.setAlpha(1); transitionView.setAlpha(0f); } }); MediaFullscreenAnimationUtils.animateBackgroundForward(backgroundView, null); }
Example 16
Source File: FragmentMediaItemsGrid.java From uPods-android with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_media_grid, container, false); mediaPagesAdapter = new MediaPagesAdapter(getChildFragmentManager(), mediaItemType); vpMedia = (MediaViewpager) view.findViewById(R.id.vpMedia); vpMedia.setAdapter(mediaPagesAdapter); vpMediaTabs = (TabLayout) view.findViewById(R.id.tlMediaTabs); vpMediaTabs.setBackgroundResource(R.color.color_primary); Toolbar toolbar = ((IToolbarHolder) getActivity()).getToolbar(); toolbar.setVisibility(View.VISIBLE); toolbar.getMenu().findItem(R.id.action_search).setVisible(true); toolbar.getMenu().findItem(R.id.add_podcast).setVisible(true); toolbar.getMenu().findItem(R.id.add_radio).setVisible(true); if (mediaItemType == MediaItemType.RADIO) { vpMediaTabs.setTabMode(TabLayout.MODE_FIXED); vpMedia.setPagingEnabled(false); toolbar.setTitle(R.string.radio_main); ((ISlidingMenuHolder) getActivity()).setSlidingMenuHeader(getString(R.string.radio_main)); ActivityMain.lastFragmentType = MediaItemType.RADIO.ordinal(); } else { ActivityMain.lastFragmentType = MediaItemType.PODCAST.ordinal(); toolbar.setTitle(R.string.podcasts); ((ISlidingMenuHolder) getActivity()).setSlidingMenuHeader(getString(R.string.podcasts_main)); } //Tabs color //tlPodcastsTabs.setTabTextColors(R.color.white_material, R.color.viewPagerNotSelectedWhite); // Workaround for Google's bugs // See https://code.google.com/p/android/issues/detail?id=180462 vpMediaTabs.post(new Runnable() { @Override public void run() { vpMediaTabs.setupWithViewPager(vpMedia); } }); smallPlayer = new SmallPlayer(view, getActivity()); vpMedia.setCurrentItem(startItemNumber); return view; }
Example 17
Source File: ReorderSubreddits.java From Slide with GNU General Public License v3.0 | 4 votes |
public void doOldToolbar() { mToolbar = (Toolbar) findViewById(R.id.toolbar); mToolbar.setVisibility(View.VISIBLE); }