List of usage examples for android.widget GridLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:online.privacy.SetupActivity.java
private void setErrorInfoVisibility(int visibility) { GridLayout errorInfo = (GridLayout) findViewById(R.id.credential_error_info); errorInfo.setVisibility(visibility); }
From source file:org.xbmc.kore.ui.sections.video.TVShowProgressFragment.java
/** * Display the seasons list//from w ww . java 2 s.c om * * @param cursor Cursor with the data */ private void displaySeasonList(Cursor cursor) { TextView seasonsListTitle = (TextView) getActivity().findViewById(R.id.seasons_title); GridLayout seasonsList = (GridLayout) getActivity().findViewById(R.id.seasons_list); if (cursor.moveToFirst()) { seasonsListTitle.setVisibility(View.VISIBLE); seasonsList.setVisibility(View.VISIBLE); HostManager hostManager = HostManager.getInstance(getActivity()); View.OnClickListener seasonListClickListener = new View.OnClickListener() { @Override public void onClick(View v) { listenerActivity.onSeasonSelected(itemId, (int) v.getTag()); } }; // Get the art dimensions Resources resources = getActivity().getResources(); int artWidth = (int) (resources.getDimension(R.dimen.seasonlist_art_width) / UIUtils.IMAGE_RESIZE_FACTOR); int artHeight = (int) (resources.getDimension(R.dimen.seasonlist_art_heigth) / UIUtils.IMAGE_RESIZE_FACTOR); // Get theme colors Resources.Theme theme = getActivity().getTheme(); TypedArray styledAttributes = theme .obtainStyledAttributes(new int[] { R.attr.colorinProgress, R.attr.colorFinished }); int inProgressColor = styledAttributes.getColor(styledAttributes.getIndex(0), resources.getColor(R.color.orange_500)); int finishedColor = styledAttributes.getColor(styledAttributes.getIndex(1), resources.getColor(R.color.green_400)); styledAttributes.recycle(); seasonsList.removeAllViews(); do { int seasonNumber = cursor.getInt(SeasonsListQuery.SEASON); String thumbnail = cursor.getString(SeasonsListQuery.THUMBNAIL); int numEpisodes = cursor.getInt(SeasonsListQuery.EPISODE); int watchedEpisodes = cursor.getInt(SeasonsListQuery.WATCHEDEPISODES); View seasonView = LayoutInflater.from(getActivity()).inflate(R.layout.grid_item_season, seasonsList, false); ImageView seasonPictureView = (ImageView) seasonView.findViewById(R.id.art); TextView seasonNumberView = (TextView) seasonView.findViewById(R.id.season); TextView seasonEpisodesView = (TextView) seasonView.findViewById(R.id.episodes); ProgressBar seasonProgressBar = (ProgressBar) seasonView.findViewById(R.id.season_progress_bar); seasonNumberView .setText(String.format(getActivity().getString(R.string.season_number), seasonNumber)); seasonEpisodesView.setText(String.format(getActivity().getString(R.string.num_episodes), numEpisodes, numEpisodes - watchedEpisodes)); seasonProgressBar.setMax(numEpisodes); seasonProgressBar.setProgress(watchedEpisodes); if (Utils.isLollipopOrLater()) { int watchedColor = (numEpisodes - watchedEpisodes == 0) ? finishedColor : inProgressColor; seasonProgressBar.setProgressTintList(ColorStateList.valueOf(watchedColor)); } UIUtils.loadImageWithCharacterAvatar(getActivity(), hostManager, thumbnail, String.valueOf(seasonNumber), seasonPictureView, artWidth, artHeight); seasonView.setTag(seasonNumber); seasonView.setOnClickListener(seasonListClickListener); seasonsList.addView(seasonView); } while (cursor.moveToNext()); } else { // No seasons, hide views seasonsListTitle.setVisibility(View.GONE); seasonsList.setVisibility(View.GONE); } }
From source file:org.xbmc.kore.ui.sections.video.TVShowProgressFragment.java
/** * Display next episode list/*from www . j av a 2 s. c o m*/ * * @param cursor Cursor with the data */ @TargetApi(21) private void displayNextEpisodeList(Cursor cursor) { TextView nextEpisodeTitle = (TextView) getActivity().findViewById(R.id.next_episode_title); GridLayout nextEpisodeList = (GridLayout) getActivity().findViewById(R.id.next_episode_list); if (cursor.moveToFirst()) { nextEpisodeTitle.setVisibility(View.VISIBLE); nextEpisodeList.setVisibility(View.VISIBLE); HostManager hostManager = HostManager.getInstance(getActivity()); View.OnClickListener episodeClickListener = new View.OnClickListener() { @Override public void onClick(View v) { AbstractInfoFragment.DataHolder vh = (AbstractInfoFragment.DataHolder) v.getTag(); listenerActivity.onNextEpisodeSelected(itemId, vh); } }; // Get the art dimensions Resources resources = getActivity().getResources(); int artWidth = (int) (resources.getDimension(R.dimen.detail_poster_width_square) / UIUtils.IMAGE_RESIZE_FACTOR); int artHeight = (int) (resources.getDimension(R.dimen.detail_poster_height_square) / UIUtils.IMAGE_RESIZE_FACTOR); nextEpisodeList.removeAllViews(); do { int episodeId = cursor.getInt(NextEpisodesListQuery.EPISODEID); String title = cursor.getString(NextEpisodesListQuery.TITLE); String seasonEpisode = String.format(getString(R.string.season_episode), cursor.getInt(NextEpisodesListQuery.SEASON), cursor.getInt(NextEpisodesListQuery.EPISODE)); int runtime = cursor.getInt(NextEpisodesListQuery.RUNTIME) / 60; String duration = runtime > 0 ? String.format(getString(R.string.minutes_abbrev), String.valueOf(runtime)) + " | " + cursor.getString(NextEpisodesListQuery.FIRSTAIRED) : cursor.getString(NextEpisodesListQuery.FIRSTAIRED); String thumbnail = cursor.getString(NextEpisodesListQuery.THUMBNAIL); View episodeView = LayoutInflater.from(getActivity()).inflate(R.layout.list_item_next_episode, nextEpisodeList, false); ImageView artView = (ImageView) episodeView.findViewById(R.id.art); TextView titleView = (TextView) episodeView.findViewById(R.id.title); TextView detailsView = (TextView) episodeView.findViewById(R.id.details); TextView durationView = (TextView) episodeView.findViewById(R.id.duration); titleView.setText(title); detailsView.setText(seasonEpisode); durationView.setText(duration); UIUtils.loadImageWithCharacterAvatar(getActivity(), hostManager, thumbnail, title, artView, artWidth, artHeight); AbstractInfoFragment.DataHolder vh = new AbstractInfoFragment.DataHolder(episodeId); vh.setTitle(title); vh.setUndertitle(seasonEpisode); episodeView.setTag(vh); episodeView.setOnClickListener(episodeClickListener); // For the popupmenu ImageView contextMenu = (ImageView) episodeView.findViewById(R.id.list_context_menu); contextMenu.setTag(episodeId); contextMenu.setOnClickListener(contextlistItemMenuClickListener); nextEpisodeList.addView(episodeView); } while (cursor.moveToNext()); } else { // No episodes, hide views nextEpisodeTitle.setVisibility(View.GONE); nextEpisodeList.setVisibility(View.GONE); } }