Example usage for android.view ViewGroup findViewById

List of usage examples for android.view ViewGroup findViewById

Introduction

In this page you can find the example usage for android.view ViewGroup findViewById.

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:net.gaast.giggity.ScheduleViewActivity.java

public void finishNavDrawer() {
    if (sched == null) {
        Log.e("finishNavDrawer", "Called before critical was loaded?");
        return;/*from w w w.  j  a  v  a 2 s  . c om*/
    }

    LinkedList<Date> days = sched.getDays();
    TextView dr = (TextView) drawerLayout.findViewById(R.id.date_range);
    dr.setText(Giggity.dateRange(days.getFirst(), days.getLast()));

    if (sched.getLinks() != null) {
        ViewGroup menu = (LinearLayout) drawerLayout.findViewById(R.id.menu);
        View sep = menu.findViewById(R.id.custom_sep);
        sep.setVisibility(View.VISIBLE);
        for (final Schedule.Link link : sched.getLinks()) {
            TextView item = (TextView) getLayoutInflater().inflate(R.layout.burger_menu_item, null);
            item.setText(link.getTitle());
            item.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    openLink(link, true);
                    drawerLayout.closeDrawers();
                }
            });
            menu.addView(item, menu.indexOfChild(sep));
        }
    }
}

From source file:ca.etsmtl.applets.etsmobile.SecurityActivity.java

@Override
protected void onCreate(final android.os.Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.security);/*from   w w  w  .j a v a 2 s  .c om*/

    navBar = (NavBar) findViewById(R.id.navBar1);
    navBar.setTitle(getString(R.string.secu_title));
    navBar.hideLoading();
    navBar.hideRightButton();
    listView = (ListView) findViewById(android.R.id.list);

    final ViewGroup viewGroup = (ViewGroup) getLayoutInflater().inflate(R.layout.secu_list_header,
            (ViewGroup) findViewById(R.id.secu_list_header_layout));
    listView.addHeaderView(viewGroup, null, false);

    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> arg0, final View arg1, final int arg2, final long arg3) {
            final Intent intent = new Intent(getApplicationContext(), UrgenceActivity.class);
            intent.putExtra("id", arg2);
            startActivity(intent);

        }
    });
    listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
            getResources().getStringArray(R.array.secu_urgence)));

    viewGroup.findViewById(R.id.secu_list_header_phone).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(final View v) {
            final String phoneNumber = ((TextView) v).getText().toString();
            final String uri = "tel:" + phoneNumber.trim();
            final Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse(uri));
            startActivity(intent);
        }
    });

    final SupportMapFragment map = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    final GoogleMap mapView = map.getMap();

    if (mapView != null) {
        mapView.getUiSettings().setZoomControlsEnabled(false);
        mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 17));

        final MarkerOptions etsMarker = new MarkerOptions();
        etsMarker.position(new LatLng(lat, lng));
        etsMarker.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon));
        mapView.addMarker(etsMarker);
    } else {
        map.getView().setVisibility(View.GONE);
    }
}

From source file:hult.netlab.pku.apmpowermanager.BatterySlidePageFragment.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.abttery_slide_page, container, false);
    String sqlCmd = "select level from batteryinfo order by timestamp desc limit 0, 72;";
    Cursor cursor = StartActivity.appDatabase.rawQuery(sqlCmd, null);
    double[] history = new double[72];
    int index = 0;
    if (cursor.getCount() < 72) {
        for (index = 0; index < 72 - cursor.getCount(); index++)
            history[index] = 0;/*w  w w  . java2s.co  m*/
    }
    index = 71;
    while (cursor.moveToNext()) {
        history[index] = cursor.getInt(0);
        index--;
    }
    cursor.close();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        CardView chartLayout = (CardView) rootView.findViewById(R.id.chartview);
        chartLayout.setElevation(6);
        if (mPageNumber == 0) {
            double[] dayBeforeYesterday = new double[24];
            for (int i = 0; i < 24; i++) {
                dayBeforeYesterday[i] = history[i];
            }
            View view = new LineChart(dayBeforeYesterday, 1).execute(container.getContext());
            chartLayout.addView(view);
        } else if (mPageNumber == 1) {
            double[] yesterday = new double[24];
            for (int i = 0; i < 24; i++) {
                yesterday[i] = history[i + 24];
            }
            View view = new LineChart(yesterday, 1).execute(container.getContext());
            chartLayout.addView(view);
        } else {
            double[] today = new double[24];
            for (int i = 0; i < 24; i++) {
                today[i] = history[i + 48];
            }
            View view = new LineChart(today, 1).execute(container.getContext());
            chartLayout.addView(view);
        }

    } else {
        LinearLayout chartLayout = (LinearLayout) rootView.findViewById(R.id.chartview);
        if (mPageNumber == 0) {
            double[] dayBeforeYesterday = new double[24];
            for (int i = 0; i < 24; i++) {
                dayBeforeYesterday[i] = history[i];
            }
            View view = new LineChart(dayBeforeYesterday, 1).execute(container.getContext());
            chartLayout.addView(view);
        } else if (mPageNumber == 1) {
            double[] yesterday = new double[24];
            for (int i = 0; i < 24; i++) {
                yesterday[i] = history[i + 24];
            }
            View view = new LineChart(yesterday, 1).execute(container.getContext());
            chartLayout.addView(view);
        } else {
            double[] today = new double[24];
            for (int i = 0; i < 24; i++) {
                today[i] = history[i + 48];
            }
            View view = new LineChart(today, 1).execute(container.getContext());
            chartLayout.addView(view);
        }
    }

    return rootView;
}

From source file:android.support.v17.leanback.app.OnboardingSupportFragment.java

@Nullable
@Override/* w ww.j ava2s .c om*/
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    resolveTheme();
    LayoutInflater localInflater = getThemeInflater(inflater);
    final ViewGroup view = (ViewGroup) localInflater.inflate(R.layout.lb_onboarding_fragment, container, false);
    mIsLtr = getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
    mPageIndicator = (PagingIndicator) view.findViewById(R.id.page_indicator);
    mPageIndicator.setOnClickListener(mOnClickListener);
    mPageIndicator.setOnKeyListener(mOnKeyListener);
    mStartButton = view.findViewById(R.id.button_start);
    mStartButton.setOnClickListener(mOnClickListener);
    mStartButton.setOnKeyListener(mOnKeyListener);
    mLogoView = (ImageView) view.findViewById(R.id.logo);
    mTitleView = (TextView) view.findViewById(R.id.title);
    mDescriptionView = (TextView) view.findViewById(R.id.description);
    if (sSlideDistance == 0) {
        sSlideDistance = (int) (SLIDE_DISTANCE
                * getActivity().getResources().getDisplayMetrics().scaledDensity);
    }
    if (savedInstanceState == null) {
        mCurrentPageIndex = 0;
        mEnterTransitionFinished = false;
        mPageIndicator.onPageSelected(0, false);
        view.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                view.getViewTreeObserver().removeOnPreDrawListener(this);
                if (!startLogoAnimation()) {
                    startEnterAnimation();
                }
                return true;
            }
        });
    } else {
        mEnterTransitionFinished = true;
        mCurrentPageIndex = savedInstanceState.getInt(KEY_CURRENT_PAGE_INDEX);
        initializeViews(view);
    }
    view.requestFocus();
    return view;
}

From source file:com.example.pdftranslator.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);
    String textFromPdf;/*from  w  w  w .  j a v  a 2  s  . c o m*/
    TextView textViewDisplayer;
    //    LinkedHashMap<Integer, String>   letter_index = new  LinkedHashMap<Integer,String>();
    //   int i;

    try {

        textFromPdf = PdfTextExtractor.getTextFromPage(ActivityTextDisplayer.reader, mPageNumber + 1);
        textFromPdf = textArranged(textFromPdf);

        /*      for( i = 0; i < textFromPdf.length(); i++)
                 letter_index.put(i,Character.toString( textFromPdf.charAt(i)));
              ActivityTextDisplayer.letter_index = letter_index;
        */

        textViewDisplayer = (TextView) rootView.findViewById(android.R.id.text1);
        textViewDisplayer.setOnTouchListener(this);
        textViewDisplayer.setText(textFromPdf);

    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    return rootView;
}

From source file:com.cw.litenote.note.NoteUi.java

public NoteUi(AppCompatActivity activity, ViewPager viewPager, int position) {

    System.out.println("NoteUi / constructor");
    pager = viewPager;//  w  w w .j av  a2  s. c o m
    act = activity;
    mPosition = position;

    DB_page db_page = new DB_page(act, TabsHost.getCurrentPageTableId());
    setNotesCnt(db_page.getNotesCount(true));
    String pictureUri = db_page.getNotePictureUri(position, true);
    String linkUri = db_page.getNoteLinkUri(position, true);

    String tagStr = "current" + position + "pictureView";
    ViewGroup pictureGroup = (ViewGroup) pager.findViewWithTag(tagStr);

    if ((pictureGroup != null)) {
        setPictureView_listeners(act, pager, pictureUri, linkUri, pictureGroup);

        TextView picView_footer = (TextView) (pictureGroup.findViewById(R.id.image_footer));

        Button picView_back_button = (Button) (pictureGroup.findViewById(R.id.image_view_back));
        Button picView_viewMode_button = (Button) (pictureGroup.findViewById(R.id.image_view_mode));

        TextView videoView_currPosition = (TextView) (pictureGroup.findViewById(R.id.video_current_pos));
        SeekBar videoView_seekBar = (SeekBar) (pictureGroup.findViewById(R.id.video_seek_bar));
        TextView videoView_fileLength = (TextView) (pictureGroup.findViewById(R.id.video_file_length));

        // show back button
        if (Note.isPictureMode())
            picView_back_button.setVisibility(View.VISIBLE);
        else
            picView_back_button.setVisibility(View.GONE);

        // Show picture title
        TextView picView_title;
        picView_title = (TextView) (pictureGroup.findViewById(R.id.image_title));
        String pictureName;
        if (!Util.isEmptyString(pictureUri))
            pictureName = Util.getDisplayNameByUriString(pictureUri, act);
        else if (Util.isYouTubeLink(linkUri))
            pictureName = linkUri;
        else
            pictureName = "";

        if (!Util.isEmptyString(pictureName)) {
            picView_title.setVisibility(View.VISIBLE);
            picView_title.setText(pictureName);
        } else
            picView_title.setVisibility(View.INVISIBLE);

        // show footer
        if (Note.isPictureMode()) {
            picView_footer.setVisibility(View.VISIBLE);
            picView_footer.setText((pager.getCurrentItem() + 1) + "/" + pager.getAdapter().getCount());
        } else
            picView_footer.setVisibility(View.GONE);

        // for video
        if (UtilVideo.hasVideoExtension(pictureUri, act)) {
            if (!UtilVideo.hasMediaControlWidget)
                NoteUi.updateVideoPlayButtonState(pager, getFocus_notePos());
            else
                show_picViewUI_previous_next(false, 0);
        }

        // set image view buttons (View Mode, Previous, Next) visibility
        if (Note.isPictureMode()) {
            picView_viewMode_button.setVisibility(View.VISIBLE);

            // show previous/next buttons for image, not for video
            if (UtilVideo.hasVideoExtension(pictureUri, act) && !UtilVideo.hasMediaControlWidget) // for video
            {
                System.out.println("NoteUi / constructor / for video");
                show_picViewUI_previous_next(true, position);
            } else if (UtilImage.hasImageExtension(pictureUri, act) && (UtilVideo.mVideoView == null))// for image
            {
                System.out.println("NoteUi / constructor / for image");
                show_picViewUI_previous_next(true, position);
            }
        } else {
            show_picViewUI_previous_next(false, 0);
            picView_viewMode_button.setVisibility(View.GONE);
        }

        // show seek bar for video only
        if (!UtilVideo.hasMediaControlWidget) {
            if (UtilVideo.hasVideoExtension(pictureUri, act)) {
                MediaPlayer mp = MediaPlayer.create(act, Uri.parse(pictureUri));

                if (mp != null) {
                    videoFileLength_inMilliSeconds = mp.getDuration();
                    mp.release();
                }

                primaryVideoSeekBarProgressUpdater(pager, position, UtilVideo.mPlayVideoPosition, pictureUri);
            } else {
                videoView_currPosition.setVisibility(View.GONE);
                videoView_seekBar.setVisibility(View.GONE);
                videoView_fileLength.setVisibility(View.GONE);
            }
        }

        showSeekBarProgress = true;
    }
}

From source file:com.cw.litenote.note.NoteUi.java

private void show_picViewUI_previous_next(boolean show, int position) {
    String tagStr = "current" + position + "pictureView";
    ViewGroup pictureGroup = (ViewGroup) pager.findViewWithTag(tagStr);
    //        System.out.println("NoteUi / _show_PicViewUI_previous_next / tagStr = " + tagStr);

    Button picView_previous_button;
    Button picView_next_button;//from   www.  j  a va 2s .  c o  m

    if (pictureGroup != null) {
        picView_previous_button = (Button) (pictureGroup.findViewById(R.id.image_view_previous));
        picView_next_button = (Button) (pictureGroup.findViewById(R.id.image_view_next));

        if (show) {
            picView_previous_button.setVisibility(View.VISIBLE);
            picView_previous_button.setEnabled(position != 0);
            picView_previous_button.setAlpha(position == 0 ? 0.1f : 1f);

            picView_next_button.setVisibility(View.VISIBLE);
            picView_next_button.setAlpha(position == (Note.mPagerAdapter.getCount() - 1) ? 0.1f : 1f);
            picView_next_button.setEnabled(position != (Note.mPagerAdapter.getCount() - 1));
        } else {
            picView_previous_button.setVisibility(View.GONE);
            picView_next_button.setVisibility(View.GONE);
        }
    }
}

From source file:com.gcssloop.diycode.activity.ImageActivity.java

/**
 * ? View ? initDatas ?/* w  w  w  . ja  va  2  s. com*/
 *
 * @param holder
 * @param root
 */
@Override
protected void initViews(ViewHolder holder, View root) {
    setTitle("");
    mCache = new DiskImageCache(this);
    if (mCurrentMode == MODE_ERROR) {
        //TODO 
        return;
    }
    // TODO ??
    // 
    ViewPager viewPager = holder.get(R.id.view_pager);

    Logger.e("Size" + images.size());
    final LayoutInflater inflater = getLayoutInflater();

    viewPager.setAdapter(new PagerAdapter() {
        @Override
        public int getCount() {
            return images.size();
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            PhotoView photoView = (PhotoView) inflater.inflate(R.layout.item_image, container, false);
            photoView.enable();
            String url = images.get(position);
            if (mCache.hasCache(url)) {
                String file = mCache.getDiskPath(url);
                Glide.with(ImageActivity.this).load(file).into(photoView);
            } else {
                Glide.with(ImageActivity.this).load(images.get(position)).into(photoView);
            }
            container.addView(photoView);
            Logger.e("Item");
            return photoView;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            PhotoView photoView = (PhotoView) container.findViewById(R.id.photo_view);
            container.removeView(photoView);
        }
    });

    viewPager.setCurrentItem(current_image_position);
}

From source file:com.alexcruz.papuhwalls.Credits.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.credits, null);
    this.Preferences = new Preferences(getContext());

    context = getActivity();/*from w  ww. j  ava  2s .c  o m*/

    ActionBar toolbar = ((ActionBarActivity) context).getSupportActionBar();
    toolbar.setTitle(R.string.section_aboutapp);

    //Credits
    TextView credit_title = (TextView) root.findViewById(R.id.credit_title);
    credit_title.setTextColor(Preferences.PrimaryText());

    TextView credit_desc = (TextView) root.findViewById(R.id.credit_desc);
    credit_desc.setText(Html.fromHtml(getString(R.string.credit_desc)));
    credit_desc.setTextColor(Preferences.SecondaryText());

    //Free and open source text
    TextView freeandopensource_text = (TextView) root.findViewById(R.id.freeandopensource_text);
    freeandopensource_text.setTextColor(Preferences.PrimaryText());

    //Library number two
    TextView libtwo_title = (TextView) root.findViewById(R.id.libtwo_title);
    libtwo_title.setTextColor(Preferences.PrimaryText());

    TextView libtwo_content = (TextView) root.findViewById(R.id.libtwo_content);
    libtwo_content.setText(Html.fromHtml(getString(R.string.fab_desc)));
    libtwo_content.setTextColor(Preferences.SecondaryText());

    TextView libtwo_license = (TextView) root.findViewById(R.id.libtwo_license);
    libtwo_license.setTextColor(Preferences.PrimaryText());

    TextView libtwo_author = (TextView) root.findViewById(R.id.libtwo_author);
    libtwo_author.setTextColor(Preferences.SecondaryText());

    //Library number three
    TextView libthree_title = (TextView) root.findViewById(R.id.libthree_title);
    libthree_title.setTextColor(Preferences.PrimaryText());

    TextView libthree_content = (TextView) root.findViewById(R.id.libthree_content);
    libthree_content.setText(Html.fromHtml(getString(R.string.materialdialogs_desc)));
    libthree_content.setTextColor(Preferences.SecondaryText());

    TextView libthree_license = (TextView) root.findViewById(R.id.libthree_license);
    libthree_license.setTextColor(Preferences.PrimaryText());

    TextView libthree_author = (TextView) root.findViewById(R.id.libthree_author);
    libthree_author.setTextColor(Preferences.SecondaryText());

    //Library number four
    TextView libfour_title = (TextView) root.findViewById(R.id.libfour_title);
    libfour_title.setTextColor(Preferences.PrimaryText());

    TextView libfour_content = (TextView) root.findViewById(R.id.libfour_content);
    libfour_content.setText(Html.fromHtml(getString(R.string.materialdrawer_desc)));
    libfour_content.setTextColor(Preferences.SecondaryText());

    TextView libfour_license = (TextView) root.findViewById(R.id.libfour_license);
    libfour_license.setTextColor(Preferences.PrimaryText());

    TextView libfour_author = (TextView) root.findViewById(R.id.libfour_author);
    libfour_author.setTextColor(Preferences.SecondaryText());

    //Library number five
    TextView libfive_title = (TextView) root.findViewById(R.id.libfive_title);
    libfive_title.setTextColor(Preferences.PrimaryText());

    TextView libfive_content = (TextView) root.findViewById(R.id.libfive_content);
    libfive_content.setText(Html.fromHtml(getString(R.string.picasso_desc)));
    libfive_content.setTextColor(Preferences.SecondaryText());

    TextView libfive_license = (TextView) root.findViewById(R.id.libfive_license);
    libfive_license.setTextColor(Preferences.PrimaryText());

    TextView libfive_author = (TextView) root.findViewById(R.id.libfive_author);
    libfive_author.setTextColor(Preferences.SecondaryText());

    //Library number six
    TextView libsix_title = (TextView) root.findViewById(R.id.libsix_title);
    libsix_title.setTextColor(Preferences.PrimaryText());

    TextView libsix_content = (TextView) root.findViewById(R.id.libsix_content);
    libsix_content.setText(Html.fromHtml(getString(R.string.okhttp_desc)));
    libsix_content.setTextColor(Preferences.SecondaryText());

    TextView libsix_license = (TextView) root.findViewById(R.id.libsix_license);
    libsix_license.setTextColor(Preferences.PrimaryText());

    TextView libsix_author = (TextView) root.findViewById(R.id.libsix_author);
    libsix_author.setTextColor(Preferences.SecondaryText());

    //Library number seven
    TextView libseven_title = (TextView) root.findViewById(R.id.libseven_title);
    libseven_title.setTextColor(Preferences.PrimaryText());

    TextView libseven_content = (TextView) root.findViewById(R.id.libseven_content);
    libseven_content.setText(Html.fromHtml(getString(R.string.snackbar_desc)));
    libseven_content.setTextColor(Preferences.SecondaryText());

    TextView libseven_license = (TextView) root.findViewById(R.id.libseven_license);
    libseven_license.setTextColor(Preferences.PrimaryText());

    TextView libseven_author = (TextView) root.findViewById(R.id.libseven_author);
    libseven_author.setTextColor(Preferences.SecondaryText());

    //Library number eight
    TextView libeight_title = (TextView) root.findViewById(R.id.libeight_title);
    libeight_title.setTextColor(Preferences.PrimaryText());

    TextView libeight_content = (TextView) root.findViewById(R.id.libeight_content);
    libeight_content.setText(Html.fromHtml(getString(R.string.crash_desc)));
    libeight_content.setTextColor(Preferences.SecondaryText());

    TextView libeight_license = (TextView) root.findViewById(R.id.libeight_license);
    libeight_license.setTextColor(Preferences.PrimaryText());

    TextView libeight_author = (TextView) root.findViewById(R.id.libeight_author);
    libeight_author.setTextColor(Preferences.SecondaryText());

    //Library number nine
    TextView libnine_title = (TextView) root.findViewById(R.id.libnine_title);
    libnine_title.setTextColor(Preferences.PrimaryText());

    TextView libnine_content = (TextView) root.findViewById(R.id.libnine_content);
    libnine_content.setText(Html.fromHtml(getString(R.string.appintro_desc)));
    libnine_content.setTextColor(Preferences.SecondaryText());

    TextView libnine_license = (TextView) root.findViewById(R.id.libnine_license);
    libnine_license.setTextColor(Preferences.PrimaryText());

    TextView libnine_author = (TextView) root.findViewById(R.id.libnine_author);
    libnine_author.setTextColor(Preferences.SecondaryText());

    //Library number ten
    TextView libten_title = (TextView) root.findViewById(R.id.libten_title);
    libten_title.setTextColor(Preferences.PrimaryText());

    TextView libten_content = (TextView) root.findViewById(R.id.libten_content);
    libten_content.setText(Html.fromHtml(getString(R.string.materialripple_desc)));
    libten_content.setTextColor(Preferences.SecondaryText());

    TextView libten_license = (TextView) root.findViewById(R.id.libten_license);
    libten_license.setTextColor(Preferences.PrimaryText());

    TextView libten_author = (TextView) root.findViewById(R.id.libten_author);
    libten_author.setTextColor(Preferences.SecondaryText());

    //Library number eleven
    TextView libeleven_title = (TextView) root.findViewById(R.id.libeleven_title);
    libeleven_title.setTextColor(Preferences.PrimaryText());

    TextView libeleven_content = (TextView) root.findViewById(R.id.libeleven_content);
    libeleven_content.setText(Html.fromHtml(getString(R.string.materialpreference_desc)));
    libeleven_content.setTextColor(Preferences.SecondaryText());

    TextView libeleven_license = (TextView) root.findViewById(R.id.libeleven_license);
    libeleven_license.setTextColor(Preferences.PrimaryText());

    TextView libeleven_author = (TextView) root.findViewById(R.id.libeleven_author);
    libeleven_author.setTextColor(Preferences.SecondaryText());

    //Library number twelve
    TextView libtwelve_title = (TextView) root.findViewById(R.id.libtwelve_title);
    libtwelve_title.setTextColor(Preferences.PrimaryText());

    TextView libtwelve_content = (TextView) root.findViewById(R.id.libtwelve_content);
    libtwelve_content.setText(Html.fromHtml(getString(R.string.licensesdialog_desc)));
    libtwelve_content.setTextColor(Preferences.SecondaryText());

    TextView libtwelve_license = (TextView) root.findViewById(R.id.libtwelve_license);
    libtwelve_license.setTextColor(Preferences.PrimaryText());

    TextView libtwelve_author = (TextView) root.findViewById(R.id.libtwelve_author);
    libtwelve_author.setTextColor(Preferences.SecondaryText());

    //Library source buttons
    TextView credit = (TextView) root.findViewById(R.id.github_button);
    credit.setTextColor(Preferences.Accent());
    credit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent credit = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.jahir_link)));
            startActivity(credit);
        }
    });

    TextView fab_web = (TextView) root.findViewById(R.id.floating_github_button);
    fab_web.setTextColor(Preferences.Accent());
    fab_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent fab_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.fab_web)));
            startActivity(fab_web);
        }
    });

    TextView materialdialogs_web = (TextView) root.findViewById(R.id.dialogs_github_button);
    materialdialogs_web.setTextColor(Preferences.Accent());
    materialdialogs_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent materialdialogs_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.materialdialogs_web)));
            startActivity(materialdialogs_web);
        }
    });

    TextView materialdrawer_web = (TextView) root.findViewById(R.id.materialdrawer_github_button);
    materialdrawer_web.setTextColor(Preferences.Accent());
    materialdrawer_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent materialdrawer_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.materialdrawer_web)));
            startActivity(materialdrawer_web);
        }
    });

    TextView picasso_web = (TextView) root.findViewById(R.id.picasso_github_button);
    picasso_web.setTextColor(Preferences.Accent());
    picasso_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent picasso_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.picasso_web)));
            startActivity(picasso_web);
        }
    });

    TextView okhttp_web = (TextView) root.findViewById(R.id.okhttp_github_button);
    okhttp_web.setTextColor(Preferences.Accent());
    okhttp_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent okhttp_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.okhttp_web)));
            startActivity(okhttp_web);
        }
    });

    TextView snackbar_web = (TextView) root.findViewById(R.id.snackbar_github_button);
    snackbar_web.setTextColor(Preferences.Accent());
    snackbar_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent snackbar_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.snackbar_web)));
            startActivity(snackbar_web);
        }
    });

    TextView crash_web = (TextView) root.findViewById(R.id.crash_github_button);
    crash_web.setTextColor(Preferences.Accent());
    crash_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent crash_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.crash_web)));
            startActivity(crash_web);
        }
    });

    TextView appintro_web = (TextView) root.findViewById(R.id.appintro_github_button);
    appintro_web.setTextColor(Preferences.Accent());
    appintro_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent appintro_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.appintro_web)));
            startActivity(appintro_web);
        }
    });

    TextView materialripple_web = (TextView) root.findViewById(R.id.materialripple_github_button);
    materialripple_web.setTextColor(Preferences.Accent());
    materialripple_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent materialripple_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.materialripple_web)));
            startActivity(materialripple_web);
        }
    });

    TextView materialpreference_web = (TextView) root.findViewById(R.id.materialpreference_github_button);
    materialpreference_web.setTextColor(Preferences.Accent());
    materialpreference_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent materialpreference_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.materialpreference_web)));
            startActivity(materialpreference_web);
        }
    });

    TextView licensesdialog_web = (TextView) root.findViewById(R.id.licensesdialog_github_button);
    licensesdialog_web.setTextColor(Preferences.Accent());
    licensesdialog_web.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent licensesdialog_web = new Intent(Intent.ACTION_VIEW,
                    Uri.parse(getResources().getString(R.string.licensesdialog_web)));
            startActivity(licensesdialog_web);
        }
    });

    return root;
}

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDayDeparturesFragment.java

@SuppressWarnings("deprecation")
@Override/*from   w w  w  .ja v a  2s  .co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Typeface tfb = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Bold.ttf");

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_swipe_refresh, null);

    // 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 = (SwipeRefreshLayout) root.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setOnRefreshListener(this);
    swipeRefreshLayout.setColorScheme(17170451, // android.R.color.holo_blue_bright 
            17170452, // android.R.color.holo_green_light 
            17170456, // android.R.color.holo_orange_light 
            17170454); // android.R.color.holo_red_light)        

    mHeaderView = inflater.inflate(R.layout.list_item_departure_times_header, null);
    TextView departing_title = (TextView) mHeaderView.findViewById(R.id.departing_title);
    departing_title.setTypeface(tfb);
    TextView arriving_title = (TextView) mHeaderView.findViewById(R.id.arriving_title);
    arriving_title.setTypeface(tfb);

    mEmptyView = root.findViewById(R.id.empty_list_view);

    return root;
}