List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:io.vit.vitio.Navigation.NavigationDrawerFragment.java
private void init(ViewGroup rootView) { myTheme = new MyTheme(getActivity()); tf = myTheme.getMyThemeTypeface();/*from w w w. ja v a 2 s.c o m*/ recyclerView = (RecyclerView) rootView.findViewById(R.id.drawer_recycler_view); headerRegNo = (TextView) rootView.findViewById(R.id.header_reg_no); headerSchool = (TextView) rootView.findViewById(R.id.header_school); subheaderPer = (TextView) rootView.findViewById(R.id.subheader_per); subheaderleft = (TextView) rootView.findViewById(R.id.subheader_head_left); navFooterLeft = (FrameLayout) rootView.findViewById(R.id.nav_footer1); navFooterLeftText = (TextView) rootView.findViewById(R.id.nav_footer_left_text); subheadAttLeft = (LinearLayout) rootView.findViewById(R.id.subheader_per_left); subheadAttRight = (LinearLayout) rootView.findViewById(R.id.subheader_per_right); navFooterSettings = (LinearLayout) rootView.findViewById(R.id.nav_footer2); fl = (LinearLayout) rootView.findViewById(R.id.drawer_frame); adapter = new NavigationDrawerAdapter(getActivity(), getData()); dataHandler = DataHandler.getInstance(getActivity()); }
From source file:com.baruckis.nanodegree.spotifystreamer.fragments.ArtistTracksListFragment.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_artist_tracks_list, container, false); mInfoView = (InfoView) rootView.findViewById(R.id.info_view); ViewGroup contentLayout = (ViewGroup) rootView.findViewById(R.id.content_layout); contentLayout.addView(view);/*from w ww . j a va 2 s .c om*/ // 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:com.ehret.mixit.fragment.PeopleDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mInflater = inflater;/* w ww. j a va 2 s . c o m*/ ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_people, container, false); this.membreUserName = (TextView) rootView.findViewById(R.id.membre_user_name); this.titleSessions = (TextView) rootView.findViewById(R.id.titleSessions); this.titleLinks = (TextView) rootView.findViewById(R.id.titleLinks); this.personDesciptif = (TextView) rootView.findViewById(R.id.membre_desciptif); this.personShortDesciptif = (TextView) rootView.findViewById(R.id.membre_shortdesciptif); this.membreEntreprise = (TextView) rootView.findViewById(R.id.membre_entreprise); this.profileImage = (ImageView) rootView.findViewById(R.id.membre_image); this.logoImage = (ImageView) rootView.findViewById(R.id.membre_logo); this.linkLayout = (LinearLayout) rootView.findViewById(R.id.personLinkFragment); this.sessionLayout = (LinearLayout) rootView.findViewById(R.id.personSessionFragment); return rootView; }
From source file:gov.wa.wsdot.android.wsdot.ui.trafficmap.socialmedia.twitter.TwitterFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_recycler_with_spinner_swipe_refresh, null); mRecyclerView = root.findViewById(R.id.my_recycler_view); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new TwitterItemAdapter(null); mRecyclerView.setAdapter(mAdapter);// w ww .jav a 2 s. c om // 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); Spinner spinner = root.findViewById(R.id.fragment_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.twitter_accounts, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); viewModel = ViewModelProviders.of(this, viewModelFactory).get(TwitterViewModel.class); viewModel.getResourceStatus().observe(this, resourceStatus -> { if (resourceStatus != null) { switch (resourceStatus.status) { case LOADING: swipeRefreshLayout.setRefreshing(true); break; case SUCCESS: swipeRefreshLayout.setRefreshing(false); break; case ERROR: swipeRefreshLayout.setRefreshing(false); TextView t = (TextView) mEmptyView; t.setText(R.string.no_connection); mEmptyView.setVisibility(View.VISIBLE); Toast.makeText(getContext(), "connection error", Toast.LENGTH_SHORT).show(); } } }); viewModel.getTwitterPosts().observe(this, twitterItems -> { if (twitterItems != null) { mEmptyView.setVisibility(View.GONE); if (!twitterItems.isEmpty()) { mAdapter.setData(twitterItems); } else { TextView t = (TextView) mEmptyView; t.setText("tweets unavailable."); mEmptyView.setVisibility(View.VISIBLE); } } }); viewModel.refresh(); return root; }
From source file:com.jsvr.sprinkles.tutorial.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false); // // Set the title view to show the page number. // ((TextView) rootView.findViewById(android.R.id.text1)).setText( // getString(R.string.title_template_step, mPageNumber + 1)); if (mDrawable.equals("end")) { Button b = (Button) rootView.findViewById(R.id.button_stop_tutorial); b.setVisibility(View.VISIBLE); TextView t = (TextView) rootView.findViewById(R.id.privacy_warning); t.setVisibility(View.VISIBLE); return rootView; }//from w w w .j av a2s . c o m ImageView image = ((ImageView) rootView.findViewById(R.id.tutorial_image)); int id = getResources().getIdentifier(mDrawable, "drawable", ScreenSlideActivity.PACKAGE_NAME); image.setImageResource(id); return rootView; }
From source file:gov.wa.wsdot.android.wsdot.ui.traveltimes.TravelTimesFragment.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); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mLayoutManager); mAdapter = new TravelTimesAdapter(getActivity()); mRecyclerView.setAdapter(mAdapter);/*from ww w. j a va 2s . 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(TravelTimesViewModel.class); viewModel.getResourceStatus().observe(this, resourceStatus -> { if (resourceStatus != null) { switch (resourceStatus.status) { case LOADING: swipeRefreshLayout.setRefreshing(true); break; case SUCCESS: swipeRefreshLayout.setRefreshing(false); break; case ERROR: swipeRefreshLayout.setRefreshing(false); Toast.makeText(this.getContext(), "connection error", Toast.LENGTH_LONG).show(); } } }); viewModel.getQueryTravelTimes().observe(this, travelTimes -> { if (travelTimes != null) { if (travelTimes.size() == 0) { TextView t = (TextView) mEmptyView; if (!viewModel.getQueryTermValue().equals("")) { t.setText(R.string.no_matching_travel_times); } else { t.setText("travel times unavailable."); } mEmptyView.setVisibility(View.VISIBLE); } else { mEmptyView.setVisibility(View.GONE); } mAdapter.setData(new ArrayList<>(travelTimes)); } }); viewModel.setQueryTerm(""); return root; }
From source file:com.achep.acdisplay.acdisplay.components.NotifyWidget.java
@Override protected ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container, @Nullable ViewGroup sceneView) { boolean initialize = sceneView == null; if (initialize) { sceneView = (ViewGroup) inflater.inflate(R.layout.acdisplay_scene_notification, container, false); assert sceneView != null; }//www . j a v a 2s.c om mNotifyWidget = (NotificationWidget) sceneView.findViewById(R.id.notification); if (!initialize) { return sceneView; } // mNotifyWidget.setActionButtonsAlignment(RelativeLayout.ALIGN_BOTTOM); mNotifyWidget.setOnClickListener(new NotificationWidget.OnClickListener() { @Override public void onClick(NotificationWidget widget, View v) { final OpenNotification osbn = widget.getNotification(); if (osbn != null) { getHostFragment().unlock(new Runnable() { @Override public void run() { osbn.click(); } }, false); } } @Override public void onActionButtonClick(NotificationWidget widget, View v, final PendingIntent pendingIntent) { getHostFragment().unlock(new Runnable() { @Override public void run() { PendingIntentUtils.sendPendingIntent(pendingIntent); } }, false); } }); return sceneView; }
From source file:net.nurik.roman.formwatchface.CompanionWatchFaceConfigActivity.java
private void updatePreviewView(Theme theme, ViewGroup clockContainerView, FormClockView clockView) { if (theme == Themes.MUZEI_THEME) { if (mMuzeiLoadedArtwork != null) { ((ImageView) clockContainerView.findViewById(R.id.background_image)) .setImageBitmap(mMuzeiLoadedArtwork.bitmap); clockView.setColors(mMuzeiLoadedArtwork.color1, mMuzeiLoadedArtwork.color2, Color.WHITE); }//w ww . j av a2 s . c om clockContainerView.setBackgroundColor(Color.BLACK); } else { ((ImageView) clockContainerView.findViewById(R.id.background_image)).setImageDrawable(null); final Resources res = getResources(); clockView.setColors(res.getColor(theme.lightRes), res.getColor(theme.midRes), Color.WHITE); clockContainerView.setBackgroundColor(res.getColor(theme.darkRes)); } }
From source file:org.alfresco.mobile.android.application.ui.form.FormManager.java
protected View generateForm(String formIdentifier, LayoutInflater li, boolean isEdition) { ViewGroup rootView = (ViewGroup) li.inflate(R.layout.form_root, null); ViewGroup hookView = rootView;// ww w . j a va 2s . c om fieldsIndex = new HashMap<>(); // Retrieve form config by Id ConfigScope scope = configManager.getCurrentScope(); scope.add(ConfigScope.NODE, node); FormConfig config = configService.getFormConfig(formIdentifier, scope); ViewGroup groupRoot = null; BaseField field; if (config.getGroups() != null && config.getGroups().size() > 0) { // Header if (!TextUtils.isEmpty(config.getLabel())) { ViewGroup headerView = (ViewGroup) li.inflate(R.layout.form_header, null); TextView tv = (TextView) headerView.findViewById(R.id.title); tv.setText(config.getLabel()); hookView = (ViewGroup) headerView.findViewById(R.id.group_panel); rootView.addView(headerView); } // Add Children for (FieldGroupConfig group : config.getGroups()) { createPropertyFields(group, hookView, li, isEdition); } } // Now time to isVisible everyone evaluateViews(); return rootView; }
From source file:com.grepsound.fragments.MyProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_myprofile, container, false); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) rootView.findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(2); mViewPager.setAdapter(mPagerAdapter); mHeader = rootView.findViewById(R.id.header); mPagerAdapter.setTabHolderScrollingContent(this); final PagerSlidingTabStrip strip = PagerSlidingTabStrip.class.cast(rootView.findViewById(R.id.pts_main)); strip.setViewPager(mViewPager);// w w w . j a v a 2s.com strip.setOnPageChangeListener(this); mUserCover = (ImageView) rootView.findViewById(R.id.user_cover); mSpannableString = new SpannableString(getString(R.string.app_name)); mName = (TextView) rootView.findViewById(R.id.user_name); mFollowers = (TwoTextCounter) rootView.findViewById(R.id.followers_button); mFollowers.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallbacks.displayFollowers(); } }); mFollowing = (TwoTextCounter) rootView.findViewById(R.id.following_button); mFollowing.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallbacks.displayFollowing(); } }); mCity = (TextView) rootView.findViewById(R.id.user_city); mFollowers.setLabel("followers"); mFollowing.setLabel("following"); mAlphaForegroundColorSpan = new AlphaForegroundColorSpan(0xffffffff); return rootView; }