List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:de.gebatzens.ggvertretungsplan.fragment.ExamFragment.java
@Override public void createView(LayoutInflater inflater, ViewGroup view) { ScrollView sv = new ScrollView(getActivity()); sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); sv.setTag("exam_scroll"); ((LinearLayout) view.findViewById(R.id.exam_content)).addView(sv); LinearLayout l = new LinearLayout(getActivity()); l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); l.setOrientation(LinearLayout.VERTICAL); int p = toPixels(6); l.setPadding(p, p, p, p);/*from ww w . jav a 2 s .c o m*/ sv.addView(l); createTextView(getResources().getString(R.string.my_exams), toPixels(12), inflater, l); for (Exams.ExamItem item : GGApp.GG_APP.exams) { if (GGApp.GG_APP.filters.mainFilter.matches(item)) { CardView cv = createCardItem(item, inflater); if (cv != null) { l.addView(cv); } } } createTextView(getResources().getString(R.string.all_exams), toPixels(12), inflater, l); for (Exams.ExamItem item : GGApp.GG_APP.exams) { CardView cv = createCardItem(item, inflater); if (cv != null) { l.addView(cv); } } cardColorIndex = 0; }
From source file:gov.wa.wsdot.android.wsdot.ui.ferries.FerriesRouteSchedulesFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_recycler_list_with_swipe_refresh, null); mRecyclerView = root.findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new RouteSchedulesAdapter(getActivity()); mRecyclerView.setAdapter(mAdapter);//ww w . j ava 2 s . co m mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity())); // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity. root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); swipeRefreshLayout = root.findViewById(R.id.swipe_container); swipeRefreshLayout.setOnRefreshListener(this); swipeRefreshLayout.setColorSchemeResources(R.color.holo_blue_bright, R.color.holo_green_light, R.color.holo_orange_light, R.color.holo_red_light); mEmptyView = root.findViewById(R.id.empty_list_view); viewModel = ViewModelProviders.of(this, viewModelFactory).get(FerrySchedulesViewModel.class); viewModel.init(null); viewModel.getResourceStatus().observe(this, resourceStatus -> { if (resourceStatus != null) { switch (resourceStatus.status) { case LOADING: swipeRefreshLayout.setRefreshing(true); break; case SUCCESS: swipeRefreshLayout.setRefreshing(false); if (mAdapter.getItemCount() > 0) { mEmptyView.setVisibility(View.GONE); } break; case ERROR: swipeRefreshLayout.setRefreshing(false); if (mAdapter.getItemCount() > 0) { mEmptyView.setVisibility(View.GONE); } Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_SHORT).show(); } } }); viewModel.getFerrySchedules().observe(this, schedules -> { mSchedule = schedules; mAdapter.notifyDataSetChanged(); }); return root; }
From source file:com.handmark.pulltorefresh.library.internal.LoadingLayout.java
public LoadingLayout(final Context context, final Mode mode, final TypedArray attrs) { super(context); final ViewGroup header = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.pull_to_refresh_header, this); mMode = mode;/* ww w .ja v a 2s . c o m*/ mHeaderText = (TextView) header.findViewById(R.id.pull_to_refresh_text); mSubHeaderText = (TextView) header.findViewById(R.id.pull_to_refresh_sub_text); mHeaderProgress = (ProgressBar) header.findViewById(R.id.pull_to_refresh_progress); mHeaderArrow = (ImageView) header.findViewById(R.id.pull_to_refresh_arrow); mRotateAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.pull_to_refresh_rotate); audioManager = (AudioManager) context.getSystemService(Activity.AUDIO_SERVICE); mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); mContext = context; switch (mode) { case PULL_UP_TO_REFRESH: // Load in labels mPullLabel = context.getString(R.string.pull_to_refresh_from_bottom_pull_label); mRefreshingLabel = context.getString(R.string.pull_to_refresh_from_bottom_refreshing_label); mReleaseLabel = context.getString(R.string.pull_to_refresh_from_bottom_release_label); rotateArrow(); break; case PULL_DOWN_TO_REFRESH: default: // Load in labels mPullLabel = context.getString(R.string.pull_to_refresh_pull_label); mRefreshingLabel = context.getString(R.string.pull_to_refresh_refreshing_label); mReleaseLabel = context.getString(R.string.pull_to_refresh_release_label); break; } if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextColor)) { final ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderTextColor); setTextColor(null != colors ? colors : ColorStateList.valueOf(0xFF000000)); } if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderSubTextColor)) { final ColorStateList colors = attrs.getColorStateList(R.styleable.PullToRefresh_ptrHeaderSubTextColor); setSubTextColor(null != colors ? colors : ColorStateList.valueOf(0xFF000000)); } if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) { final Drawable background = attrs.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground); if (null != background) { setBackgroundDrawable(background); } } reset(); }
From source file:com.baruckis.nanodegree.spotifystreamer.fragments.ArtistsListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_artists_list, container, false); mSearchEditText = (EditText) rootView.findViewById(R.id.search_edit_text); mInfoView = (InfoView) rootView.findViewById(R.id.info_view); ViewGroup contentLayout = (ViewGroup) rootView.findViewById(R.id.content_layout); contentLayout.addView(view);/*from ww w. jav a 2s . c o m*/ // after add info view goes behind and becomes unclickable, so that's why it is moved to front. mInfoView.bringToFront(); return rootView; }
From source file:net.abcdroid.devfest12.ui.WhatsOnFragment.java
/** * Show the the announcements/* w w w .j a v a 2 s. c o m*/ */ private void showAnnouncements(Cursor announcements) { mAnnouncementsCursor = announcements; ViewGroup announcementsRootView = (ViewGroup) mInflater.inflate(R.layout.whats_on_announcements, mRootView, false); final ViewPager pager = (ViewPager) announcementsRootView.findViewById(R.id.announcements_pager); final View previousButton = announcementsRootView.findViewById(R.id.announcements_previous_button); final View nextButton = announcementsRootView.findViewById(R.id.announcements_next_button); final PagerAdapter adapter = new AnnouncementsAdapter(); pager.setAdapter(adapter); pager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.announcements_margin_width)); pager.setPageMarginDrawable(R.drawable.announcements_divider); pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { previousButton.setEnabled(position > 0); nextButton.setEnabled(position < adapter.getCount() - 1); } }); previousButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { pager.setCurrentItem(pager.getCurrentItem() - 1); } }); nextButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { pager.setCurrentItem(pager.getCurrentItem() + 1); } }); previousButton.setEnabled(false); nextButton.setEnabled(adapter.getCount() > 1); mRootView.removeAllViews(); mRootView.addView(announcementsRootView); }
From source file:com.achep.acdisplay.acdisplay.components.NotificationUI.java
@Override protected ViewGroup onCreateExpandedView(LayoutInflater inflater, ViewGroup container, ViewGroup sceneView) { boolean initialize = sceneView == null; if (initialize) { sceneView = (ViewGroup) inflater.inflate(R.layout.acdisplay_scene_notification, container, false); assert sceneView != null; }/* w w w. ja v a2 s . co m*/ mNotifyWidget = (NotificationWidget) sceneView.findViewById(R.id.notification); if (!initialize) { return sceneView; } mNotifyWidget.setOnClickListener(new NotificationWidget.OnClickListener() { @Override public void onClick(View v) { final OpenStatusBarNotification osbn = mNotifyWidget.getNotification(); if (osbn != null) { getHostFragment().showMainWidget(); getHostFragment().unlock(new Runnable() { @Override public void run() { osbn.click(); } }, false); } } @Override public void onActionButtonClick(View v, final PendingIntent pendingIntent) { getHostFragment().showMainWidget(); getHostFragment().unlock(new Runnable() { @Override public void run() { PendingIntentUtils.sendPendingIntent(pendingIntent); } }, false); } }); return sceneView; }
From source file:org.ementasua.SwipeyTabFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.inflat = inflater; ViewGroup root = (ViewGroup) inflater.inflate(R.layout.tab_layout, null); try {/*from ww w. j a v a 2s . c om*/ menu = EmentasGetter.getEmentasUA(); } catch (Exception e) { e.printStackTrace(); } TableLayout tl = (TableLayout) root.findViewById(R.id.tableLayout); for (Canteen cant : getCanteens()) buildDetails(inflater, tl, cant); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); show_next_day = sharedPreferences.getBoolean("mostra", true); return root; }
From source file:com.ehret.mixit.fragment.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.mInflater = inflater; ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_session, container, false); this.imageFavorite = (ImageView) rootView.findViewById(R.id.talk_image_favorite); this.imageTrack = (ImageView) rootView.findViewById(R.id.talk_image_track); this.horaire = (TextView) rootView.findViewById(R.id.talk_horaire); this.level = (TextView) rootView.findViewById(R.id.talk_level); this.name = (TextView) rootView.findViewById(R.id.talk_name); this.summary = (TextView) rootView.findViewById(R.id.talk_summary); this.descriptif = (TextView) rootView.findViewById(R.id.talk_desciptif); this.salle = (TextView) rootView.findViewById(R.id.talk_salle); this.sessionPersonList = (LinearLayout) rootView.findViewById(R.id.sessionPersonList); this.langImage = (ImageView) rootView.findViewById(R.id.talk_image_language); this.track = (TextView) rootView.findViewById(R.id.talk_track); this.imageFavorite.setOnClickListener(new View.OnClickListener() { @Override/* w w w . j a v a2 s . c o m*/ public void onClick(View v) { if (toggleFavorite() == Toggle.TRUE) { imageFavorite.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_important)); } else { imageFavorite.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_not_important)); } } }); return rootView; }
From source file:com.commit451.springy.CompanionWatchFaceConfigActivity.java
private void updatePreviewView(Themes.Theme theme, ViewGroup clockContainerView) { if (theme == Themes.MUZEI_THEME) { if (mMuzeiLoadedArtwork != null) { ((ImageView) clockContainerView.findViewById(R.id.background_image)) .setImageBitmap(mMuzeiLoadedArtwork.bitmap); }/*from ww w . ja v a 2s . c o m*/ clockContainerView.setBackgroundColor(Color.BLACK); } else { ((ImageView) clockContainerView.findViewById(R.id.background_image)).setImageDrawable(null); clockContainerView.setBackgroundColor(theme.color); } }
From source file:com.todoroo.astrid.actfm.TagUpdatesFragment.java
private void populateListHeader(ViewGroup header) { if (header == null) return;//from ww w .java2 s .co m TextView tagTitle = (TextView) header.findViewById(R.id.tag_title); String tagName = tagData.getValue(TagData.NAME); tagTitle.setText(tagName); TextView descriptionTitle = (TextView) header.findViewById(R.id.tag_description); String description = tagData.getValue(TagData.TAG_DESCRIPTION); if (!TextUtils.isEmpty(description)) { descriptionTitle.setText(description); descriptionTitle.setVisibility(View.VISIBLE); } else { descriptionTitle.setVisibility(View.GONE); } AsyncImageView imageView = (AsyncImageView) header.findViewById(R.id.tag_picture); imageView.setDefaultImageResource(TagService.getDefaultImageIDForTag(tagName)); imageView.setUrl(tagData.getValue(TagData.PICTURE)); }