Example usage for android.widget TextView setTextColor

List of usage examples for android.widget TextView setTextColor

Introduction

In this page you can find the example usage for android.widget TextView setTextColor.

Prototype

@android.view.RemotableViewMethod
public void setTextColor(ColorStateList colors) 

Source Link

Document

Sets the text color.

Usage

From source file:com.android.messaging.ui.ViewPagerTabs.java

private void addTab(CharSequence tabTitle, final int position) {
    final TextView textView = new TextView(getContext());
    textView.setText(tabTitle);// ww w . j a  va 2 s  . c om
    textView.setBackgroundResource(R.drawable.contact_picker_tab_background_selector);
    textView.setGravity(Gravity.CENTER);
    textView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mPager.setCurrentItem(getRtlPosition(position));
        }
    });

    // Assign various text appearance related attributes to child views.
    if (mTextStyle > 0) {
        textView.setTypeface(textView.getTypeface(), mTextStyle);
    }
    if (mTextSize > 0) {
        textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
    }
    if (mTextColor != null) {
        textView.setTextColor(mTextColor);
    }
    textView.setAllCaps(mTextAllCaps);
    textView.setPadding(mSidePadding, 0, mSidePadding, 0);
    mTabStrip.addView(textView,
            new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1));
    // Default to the first child being selected
    if (position == 0) {
        mPrevSelected = 0;
        textView.setSelected(true);
    }
}

From source file:com.astuetz.PagerSlidingTabStripPlus.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        for (int k = 0; k < ((LinearLayout) tabsContainer.getChildAt(i)).getChildCount(); k++) {

            View v = ((LinearLayout) tabsContainer.getChildAt(i)).getChildAt(k);

            v.setBackgroundResource(tabBackgroundResId);

            if (v instanceof TextView) {

                TextView tab = (TextView) v;
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);

                // Setting color of textView
                if (textColorTab != null) {
                    tab.setTextColor(textColorTab);
                } else {
                    tab.setTextColor(Color.BLACK);
                }//from   w w  w  .  j av a 2 s. c o m

                // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
                // pre-ICS-build
                if (textAllCaps) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        tab.setAllCaps(true);
                    } else {
                        tab.setText(tab.getText().toString().toUpperCase(locale));
                    }
                }
            }
        }
    }
}

From source file:com.hypodiabetic.happ.MainActivity.java

public void test(View view) {
    TextView notificationText = (TextView) findViewById(R.id.notices);
    notificationText.setTextColor(Color.WHITE);
    //Snackbar snackbar = Snackbar.make(view, String.valueOf(MainApp.insulin_Integration_App_isBound), Snackbar.LENGTH_INDEFINITE);

    //snackbar.show();

}

From source file:busradar.madison.StopDialog.java

StopDialog(final Context ctx, final int stopid, final int lat, final int lon) {
    super(ctx);/*  w w  w  .j a  v a 2  s  . c  o  m*/
    this.stopid = stopid;

    // getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
    getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

    final String name = DB.getStopName(stopid);
    setTitle(name);

    routes = get_time_urls(StopDialog.this.stopid);

    // getWindow().setLayout(LayoutParams.FILL_PARENT,
    // LayoutParams.FILL_PARENT);

    setContentView(new RelativeLayout(ctx) {
        {
            addView(new TextView(ctx) {
                {
                    setId(stop_num_id);
                    setText(Html.fromHtml(String.format(
                            "[<a href='http://www.cityofmadison.com/metro/BusStopDepartures/StopID/%04d.pdf'>%04d</a>]",
                            stopid, stopid)));
                    setPadding(0, 0, 5, 0);
                    this.setMovementMethod(LinkMovementMethod.getInstance());
                }
            }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) {
                {
                    addRule(ALIGN_PARENT_RIGHT);
                }
            });

            addView(new ImageView(ctx) {
                boolean enabled;

                @Override
                public void setEnabled(boolean e) {
                    enabled = e;

                    setImageResource(e ? R.drawable.love_enabled : R.drawable.love_disabled);
                    if (e) {
                        G.favorites.add_favorite_stop(stopid, name, lat, lon);
                        Toast.makeText(ctx, "Added stop to Favorites", Toast.LENGTH_SHORT).show();
                    } else {
                        G.favorites.remove_favorite_stop(stopid);
                        Toast.makeText(ctx, "Removed stop from Favorites", Toast.LENGTH_SHORT).show();
                    }
                }

                {
                    enabled = G.favorites.is_stop_favorite(stopid);
                    setImageResource(enabled ? R.drawable.love_enabled : R.drawable.love_disabled);

                    setPadding(0, 0, 10, 0);
                    setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {
                            setEnabled(!enabled);
                        }
                    });
                }
            }, new RelativeLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT) {
                {
                    addRule(LEFT_OF, stop_num_id);
                    setMargins(0, -3, 0, 0);
                }
            });

            addView(cur_loading_text = new TextView(ctx) {
                {
                    setText("Loading...");
                    setPadding(5, 0, 0, 0);
                }
            });
            addView(new HorizontalScrollView(ctx) {
                {
                    setId(route_list_id);
                    setHorizontalScrollBarEnabled(false);

                    addView(new LinearLayout(ctx) {
                        float text_size;
                        Button cur_button;
                        {
                            int last_route = -1;
                            for (int i = 0; i < routes.length; i++) {

                                final RouteURL route = routes[i];

                                if (route.route == last_route)
                                    continue;
                                last_route = route.route;

                                addView(new Button(ctx) {
                                    public void setEnabled(boolean e) {
                                        if (e) {
                                            setBackgroundColor(0xff000000 | G.route_points[route.route].color);
                                            setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size * 1.5f);
                                        } else {
                                            setBackgroundColor(0x90000000 | G.route_points[route.route].color);
                                            setTextSize(TypedValue.COMPLEX_UNIT_PX, text_size);
                                        }
                                    }

                                    {
                                        setText(G.route_points[route.route].name);
                                        setTextColor(0xffffffff);
                                        setTypeface(Typeface.DEFAULT_BOLD);
                                        text_size = getTextSize();

                                        if (G.active_route == route.route) {
                                            setEnabled(true);
                                            cur_button = this;
                                        } else
                                            setEnabled(false);

                                        final Button b = this;

                                        setOnClickListener(new OnClickListener() {
                                            public void onClick(View v) {
                                                if (cur_button != null) {
                                                    cur_button.setEnabled(false);
                                                }

                                                if (cur_button == b) {
                                                    cur_button.setEnabled(false);
                                                    cur_button = null;

                                                    selected_route = null;
                                                    update_time_display();
                                                } else {
                                                    cur_button = b;
                                                    cur_button.setEnabled(true);

                                                    selected_route = route;
                                                    update_time_display();
                                                }
                                            }
                                        });

                                    }
                                });
                            }
                        }
                    });
                }
            }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {
                {
                    addRule(RelativeLayout.BELOW, stop_num_id);
                    addRule(RelativeLayout.CENTER_HORIZONTAL);
                }
            });

            addView(status_text = new TextView(ctx) {
                {
                    setText("");
                }
            }, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {
                {
                    addRule(RelativeLayout.BELOW, route_list_id);
                    addRule(RelativeLayout.CENTER_HORIZONTAL);
                }
            });
            addView(list_view = new ListView(ctx) {
                {
                    setId(time_list_id);
                    setVerticalScrollBarEnabled(false);
                    setAdapter(times_adapter = new BaseAdapter() {

                        public View getView(final int position, View convertView, ViewGroup parent) {
                            CellView v;

                            if (convertView == null)
                                v = new CellView(ctx);
                            else
                                v = (CellView) convertView;

                            RouteTime rt = curr_times.get(position);
                            v.setBackgroundColor(G.route_points[rt.route].color | 0xff000000);
                            v.route_textview.setText(G.route_points[rt.route].name);
                            if (rt.dir != null)
                                v.dir_textview.setText("to " + rt.dir);
                            v.time_textview.setText(rt.time);

                            return v;

                        }

                        public int getCount() {
                            return curr_times.size();
                        }

                        public Object getItem(int position) {
                            return null;
                        }

                        public long getItemId(int position) {
                            return 0;
                        }

                    });
                }
            }, new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT) {
                {
                    addRule(RelativeLayout.BELOW, route_list_id);
                }
            });
        }
    });

    TextView title = (TextView) findViewById(android.R.id.title);
    title.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    title.setSelected(true);
    title.setTextColor(0xffffffff);
    title.setMarqueeRepeatLimit(-1);

    // getWindow().set, value)
    // getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
    // android.R.drawable.ic_dialog_info);

    // title.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL);

    if (G.active_route >= 0)
        for (int i = 0; i < routes.length; i++)
            if (routes[i].route == G.active_route) {
                selected_route = routes[i];

                RouteURL[] rnew = new RouteURL[routes.length];
                rnew[0] = selected_route;

                for (int j = 0, k = 1; j < routes.length; j++)
                    if (j != i)
                        rnew[k++] = routes[j];

                routes = rnew;
                break;
            }
    update_time_display();
}

From source file:ca.ualberta.cmput301w14t08.geochan.adapters.ThreadViewAdapter.java

/**
 * Sets the required fields of the orignal post of the thread.
 * Title, creator, comment, timestamp, location.
 * //from  w ww .j av  a2s . c  o  m
 * @param convertView
 *            View container of a listView item.
 */
private void setOPFields(View convertView) {
    // Thread title
    TextView title = (TextView) convertView.findViewById(R.id.thread_view_op_threadTitle);
    // Special case of Viewing a Favourite Comment in ThreadView
    if (thread.getTitle().equals("")) {
        title.setVisibility(View.GONE);
        LinearLayout buttons = (LinearLayout) convertView.findViewById(R.id.thread_view_op_buttons);
        buttons.setVisibility(View.GONE);
    } else {
        title.setText(thread.getTitle());
    }
    // Thread creator
    TextView threadBy = (TextView) convertView.findViewById(R.id.thread_view_op_commentBy);
    threadBy.setText(
            "Posted by " + thread.getBodyComment().getUser() + "#" + thread.getBodyComment().getHash() + "  ");
    if (HashHelper.getHash(thread.getBodyComment().getUser()).equals(thread.getBodyComment().getHash())) {
        threadBy.setBackgroundResource(R.drawable.username_background_thread_rect);
        threadBy.setTextColor(Color.WHITE);
    }

    // Thread body comment
    TextView body = (TextView) convertView.findViewById(R.id.thread_view_op_commentBody);
    body.setText(thread.getBodyComment().getTextPost());
    // Thread timestamp
    TextView threadTime = (TextView) convertView.findViewById(R.id.thread_view_op_commentDate);
    threadTime.setText(thread.getBodyComment().getCommentDateString());
    // Location text
    TextView origPostLocationText = (TextView) convertView.findViewById(R.id.thread_view_op_locationText);
    GeoLocation loc = thread.getBodyComment().getLocation();
    String locDescriptor = loc.getLocationDescription();
    if (loc != null) {
        if (locDescriptor != null) {
            origPostLocationText.setText("near: " + locDescriptor);
        } else {
            // The rounding of long and lat for max 4 decimal digits.
            DecimalFormat format = new DecimalFormat();
            format.setRoundingMode(RoundingMode.HALF_EVEN);
            format.setMinimumFractionDigits(0);
            format.setMaximumFractionDigits(4);

            origPostLocationText.setText("Latitude: " + format.format(loc.getLatitude()) + " Longitude: "
                    + format.format(loc.getLongitude()));
        }
    }

    // Set the thumbnail if there is an image
    if (thread.getBodyComment().hasImage()) {
        ImageButton thumbnail = (ImageButton) convertView.findViewById(R.id.thread_view_comment_thumbnail);
        thumbnail.setVisibility(View.VISIBLE);
        thumbnail.setFocusable(false);
        thumbnail.setImageBitmap(thread.getBodyComment().getImageThumb());
    }
}

From source file:android.olayinka.file.transfer.widget.SlidingTabLayout.java

private void populateTabStrip() {
    final PagerAdapter adapter = mViewPager.getAdapter();
    final OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
        View tabView = null;//from www .  java2s.  com
        TextView tabTitleView = null;

        if (mTabViewLayoutId != 0) {
            // If there is a custom tab view layout id set, try and inflate it
            tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
            tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
        }

        if (tabView == null) {
            tabView = createDefaultTabView(getContext());
        }

        if (tabTitleView == null && TextView.class.isInstance(tabView)) {
            tabTitleView = (TextView) tabView;
        }

        assert tabTitleView != null;
        tabTitleView.setText(adapter.getPageTitle(i));
        tabTitleView.setTextColor(getResources().getColorStateList(R.color.tab_color));
        if (i == mViewPager.getCurrentItem()) {
            tabView.setSelected(true);
        }
        tabView.setOnClickListener(tabClickListener);

        mTabStrip.addView(tabView);
    }
}

From source file:com.battlelancer.seriesguide.ui.OverviewFragment.java

private void onPopulateShowData(Cursor show) {
    if (show == null || !show.moveToFirst()) {
        return;//  www  .  j  a  v a  2s . co  m
    }
    mShowCursor = show;

    // set show title in action bar
    mShowTitle = show.getString(ShowQuery.SHOW_TITLE);
    ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar();
    actionBar.setTitle(mShowTitle);

    // status
    final TextView statusText = (TextView) getView().findViewById(R.id.showStatus);
    int status = show.getInt(ShowQuery.SHOW_STATUS);
    if (status == 1) {
        statusText.setTextColor(getResources().getColor(
                Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.textColorSgGreen)));
        statusText.setText(getString(R.string.show_isalive));
    } else if (status == 0) {
        statusText.setTextColor(Color.GRAY);
        statusText.setText(getString(R.string.show_isnotalive));
    }

    // favorite
    final ImageView favorited = (ImageView) getView().findViewById(R.id.imageViewFavorite);
    boolean isFavorited = show.getInt(ShowQuery.SHOW_FAVORITE) == 1;
    if (isFavorited) {
        favorited.setImageResource(
                Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.drawableStar));
    } else {
        favorited.setImageResource(
                Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.drawableStar0));
    }
    CheatSheet.setup(favorited, isFavorited ? R.string.context_unfavorite : R.string.context_favorite);
    favorited.setTag(isFavorited);

    // poster background
    Utils.loadPosterBackground(getActivity(), mBackgroundImage, show.getString(ShowQuery.SHOW_POSTER));

    // air time and network
    final StringBuilder timeAndNetwork = new StringBuilder();
    final long releaseTime = show.getLong(ShowQuery.SHOW_RELEASE_TIME);
    final String releaseCountry = show.getString(ShowQuery.SHOW_RELEASE_COUNTRY);
    final String releaseDay = show.getString(ShowQuery.SHOW_RELEASE_DAY);
    if (!TextUtils.isEmpty(releaseDay) && releaseTime != -1) {
        String[] values = TimeTools.formatToShowReleaseTimeAndDay(getActivity(), releaseTime, releaseCountry,
                releaseDay);
        timeAndNetwork.append(values[1]).append(" ").append(values[0]).append(" ");
    }
    final String network = show.getString(ShowQuery.SHOW_NETWORK);
    if (!TextUtils.isEmpty(network)) {
        timeAndNetwork.append(getString(R.string.show_on_network, network));
    }
    ((TextView) getActivity().findViewById(R.id.showmeta)).setText(timeAndNetwork.toString());
}

From source file:fr.cph.chicago.core.activity.BusActivity.java

/**
 * Draw arrivals in current main.java.fr.cph.chicago.res.layout
 *//* w w  w.j a  v a  2 s  .com*/
public void drawArrivals() {
    final Map<String, TextView> tempMap = new HashMap<>();
    if (busArrivals.size() != 0) {
        Stream.of(busArrivals).filter(arrival -> arrival.getRouteDirection().equals(bound)
                || arrival.getRouteDirection().equals(boundTitle)).forEach(arrival -> {
                    final String destination = arrival.getBusDestination();
                    final String arrivalText;
                    if (tempMap.containsKey(destination)) {
                        final TextView arrivalView = tempMap.get(destination);
                        arrivalText = arrival.isDly() ? arrivalView.getText() + " Delay"
                                : arrivalView.getText() + " " + arrival.getTimeLeft();
                        arrivalView.setText(arrivalText);
                    } else {
                        final TextView arrivalView = new TextView(getApplicationContext());
                        arrivalText = arrival.isDly() ? arrival.getBusDestination() + " Delay"
                                : arrival.getBusDestination() + " " + arrival.getTimeLeft();
                        arrivalView.setText(arrivalText);
                        arrivalView.setTextColor(grey);
                        tempMap.put(destination, arrivalView);
                    }
                });
    } else {
        final TextView arrivalView = new TextView(getApplicationContext());
        arrivalView.setTextColor(grey);
        arrivalView.setText(busActivityNoService);
        tempMap.put("", arrivalView);
    }
    stopsView.removeAllViews();
    Stream.of(tempMap.entrySet()).forEach(entry -> stopsView.addView(entry.getValue()));
}

From source file:com.example.drugsformarinemammals.Dose_Information.java

private void displayMessage(String messageTitle, String message) {
    AlertDialog.Builder myalert = new AlertDialog.Builder(this);

    TextView title = new TextView(this);
    title.setTypeface(Typeface.SANS_SERIF);
    title.setTextSize(20);//from   ww  w . j  a  v a  2  s  . c om
    title.setTextColor(getResources().getColor(R.color.blue));
    title.setPadding(8, 8, 8, 8);
    title.setText("Synchronization");
    title.setGravity(Gravity.CENTER_VERTICAL);

    LinearLayout layout = new LinearLayout(this);
    TextView text = new TextView(this);
    text.setTypeface(Typeface.SANS_SERIF);
    text.setTextSize(20);
    text.setPadding(10, 10, 10, 10);
    text.setText(message);
    layout.addView(text);

    myalert.setView(layout);
    myalert.setCustomTitle(title);
    myalert.setCancelable(true);
    myalert.show();

}

From source file:com.atomjack.vcfp.VideoControllerView.java

private void initControllerView(View v) {
    mPauseButton = (ImageButton) v.findViewById(R.id.pause);
    if (mPauseButton != null) {
        mPauseButton.requestFocus();/* w ww  .jav a  2 s . co m*/
        mPauseButton.setOnClickListener(mPauseListener);
    }

    mFullscreenButton = (ImageButton) v.findViewById(R.id.fullscreen);
    if (mFullscreenButton != null) {
        mFullscreenButton.requestFocus();
        mFullscreenButton.setOnClickListener(mFullscreenListener);
    }

    mMediaOptionsButton = (ImageButton) v.findViewById(R.id.mediaOptions);
    if (mMediaOptionsButton != null) {
        mMediaOptionsButton.setOnClickListener(mMediaOptionsListener);
    }

    mMicButton = (ImageButton) v.findViewById(R.id.mic);
    if (mMicButton != null) {
        mMicButton.setOnClickListener(mMicListener);
    }

    mMediaControllerPosterContainer = (ViewGroup) v.findViewById(R.id.mediaControllerPosterContainer);
    mMediaControllerPosterContainer.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            mPlayer.onPosterContainerTouch(v, event);
            return true;
        }
    });

    mFfwdButton = (ImageButton) v.findViewById(R.id.ffwd);
    if (mFfwdButton != null) {
        mFfwdButton.setOnClickListener(mFfwdListener);
        if (!mFromXml) {
            mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mRewButton = (ImageButton) v.findViewById(R.id.rew);
    if (mRewButton != null) {
        mRewButton.setOnClickListener(mRewListener);
        if (!mFromXml) {
            mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
        }
    }

    mStopButton = (ImageButton) v.findViewById(R.id.stop);
    if (mStopButton != null) {
        mStopButton.setOnClickListener(mStopListener);
    }

    // By default these are hidden. They will be enabled when setPrevNextListeners() is called
    mNextButton = (ImageButton) v.findViewById(R.id.next);
    if (mNextButton != null && !mFromXml && !mListenersSet) {
        mNextButton.setVisibility(View.GONE);
    }
    mPrevButton = (ImageButton) v.findViewById(R.id.prev);
    if (mPrevButton != null && !mFromXml && !mListenersSet) {
        mPrevButton.setVisibility(View.GONE);
    }

    mPoster = (ImageView) v.findViewById(R.id.poster);
    if (mPosterBitmap != null)
        mPoster.setImageBitmap(mPosterBitmap);

    mBitrateSpinner = (CustomSpinner) v.findViewById(R.id.bitrateSpinner);
    if (mBitrateSpinner != null) {

        mBitrateSpinner.getBackground().setColorFilter(ContextCompat.getColor(mContext, R.color.white),
                PorterDuff.Mode.SRC_ATOP);

        final ArrayList<String> list = new ArrayList<>(
                VoiceControlForPlexApplication.localVideoQualityOptions.keySet());
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, R.layout.bitrate_dropdown_item,
                list) {
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                TextView textView = (TextView) super.getView(position, convertView, parent);
                textView.setTextColor(ContextCompat.getColor(mContext, R.color.white));
                return textView;
            }

            @Override
            public View getDropDownView(int position, View convertView, ViewGroup parent) {
                TextView textView = (TextView) super.getDropDownView(position, convertView, parent);
                textView.setTextColor(ContextCompat.getColor(mContext,
                        textView.getText().equals(mCurrentVideoQuality) ? R.color.black : R.color.white));
                textView.setBackgroundColor(ContextCompat.getColor(mContext,
                        textView.getText().equals(mCurrentVideoQuality) ? R.color.white
                                : R.color.mediaControllerBackground));
                return textView;
            }
        };
        mBitrateSpinner.setAdapter(adapter);

        mBitrateSpinner.setSelection(list.indexOf(mCurrentVideoQuality), false);

        mBitrateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                String item = list.get(position);
                // Only notify the activity if the bitrate clicked on is not the current one
                if (mBitrateChangeListener != null && !item.equals(mCurrentVideoQuality)) {
                    hide();
                    mBitrateChangeListener.onBitrateChange(item);
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        mBitrateSpinner.setSpinnerEventsListener(new CustomSpinner.OnSpinnerEventsListener() {
            @Override
            public void onSpinnerOpened() {
                mBitrateSpinnerIsOpen = true;
            }

            @Override
            public void onSpinnerClosed() {
                mBitrateSpinnerIsOpen = false;
                // hide the controller after 3 seconds
                Message msg = mHandler.obtainMessage(FADE_OUT);
                mHandler.removeMessages(FADE_OUT);
                mHandler.sendMessageDelayed(msg, sDefaultTimeout);
            }
        });

    }

    mProgress = (SeekBar) v.findViewById(R.id.mediacontroller_progress);
    if (mProgress != null) {
        if (mProgress instanceof SeekBar) {
            SeekBar seeker = (SeekBar) mProgress;
            seeker.setOnSeekBarChangeListener(mSeekListener);
        }
        mProgress.setMax(1000);
    }

    mEndTime = (TextView) v.findViewById(R.id.time);
    mCurrentTime = (TextView) v.findViewById(R.id.time_current);
    mFormatBuilder = new StringBuilder();
    mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());

    installPrevNextListeners();
}