Example usage for android.widget TextView getBackground

List of usage examples for android.widget TextView getBackground

Introduction

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

Prototype

public Drawable getBackground() 

Source Link

Document

Gets the background drawable

Usage

From source file:com.xperia64.timidityae.Globals.java

@SuppressLint("NewApi")
public static int getBackgroundColor(TextView textView) {
    Drawable drawable = textView.getBackground();
    if (drawable instanceof ColorDrawable) {
        ColorDrawable colorDrawable = (ColorDrawable) drawable;
        if (Build.VERSION.SDK_INT >= 11) {
            return colorDrawable.getColor();
        }/*from   ww  w .  j  a  va2 s. c  om*/
        try {
            Field field = colorDrawable.getClass().getDeclaredField("mState");
            field.setAccessible(true);
            Object object = field.get(colorDrawable);
            field = object.getClass().getDeclaredField("mUseColor");
            field.setAccessible(true);
            return field.getInt(object);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    return 0;
}

From source file:it.enricocandino.ssv.sample.ScrollableFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_synchronized_scroll_view, container, false);

    LinearLayout rowContainer = (LinearLayout) rootView.findViewById(R.id.container);

    int fragmentColor = getArguments().getInt("color", 0xFFF44336);

    int count = 1;
    for (int opacity = 63; opacity < 256; opacity += 16) {

        TextView row = new TextView(getContext());
        row.setLayoutParams(new SynchronizedScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 250));
        row.setGravity(Gravity.CENTER);/* ww  w  .j av  a 2 s  .c o m*/

        row.setBackgroundColor(fragmentColor);
        row.getBackground().setAlpha(opacity);
        row.setText(String.valueOf(count++));

        rowContainer.addView(row);
    }

    return rootView;
}

From source file:com.jaspersoft.android.jaspermobile.widget.DraggableViewsContainer.java

private void showTextInputDialog(int viewId) {
    final AnnotationInputDialog annotationInputDialog = new AnnotationInputDialog(getContext());
    annotationInputDialog.setTitle(getContext().getString(R.string.annotation_add_note));
    annotationInputDialog.setId(viewId);
    annotationInputDialog.setValue("");
    annotationInputDialog.setOnEventListener(new AnnotationInputDialog.OnAnnotationInputListener() {
        @Override/*  w  w w  . j a  v a 2s.  c o  m*/
        public void onAnnotationEntered(int id, String inputText) {
            TextView note = (TextView) findViewById(id);
            note.setText(inputText);
            if (mNeedsBorder) {
                note.setBackgroundResource(R.drawable.bg_annotation_text_border);
                note.getBackground().setColorFilter(mColor, PorterDuff.Mode.MULTIPLY);
                int borderPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, BORDER_PADDING,
                        getContext().getResources().getDisplayMetrics());
                note.setPadding(borderPadding, borderPadding, borderPadding, borderPadding);
            }
            analytics.sendEvent(Analytics.EventCategory.RESOURCE.getValue(),
                    Analytics.EventAction.ANNOTATED.getValue(), Analytics.EventLabel.WITH_TEXT.getValue());
        }

        @Override
        public void onAnnotationCanceled(int id) {
            TextView noteView = (TextView) findViewById(id);
            removeView(noteView);
        }
    });
    annotationInputDialog.show();
}

From source file:com.karthikb351.vitinfo2.fragment.grades.GradeSemesterCardFragment.java

void addGrade(Grade grade) {
    View view = inflater.inflate(R.layout.card_acad_history, semCardContainer, false);
    TextView textViewGrade = ((TextView) view.findViewById(R.id.tv_grade));
    textViewGrade.setText(grade.getGrade());
    int pos = (int) grade.getGrade().charAt(0) - 65;
    if (pos >= gradeColors.length) {
        if (grade.getGrade().charAt(0) == 'S')
            pos = gradeColors.length - 2;
        else//from ww  w  .j av  a  2 s  .  c o  m
            pos = gradeColors.length - 1;
    }
    ((GradientDrawable) textViewGrade.getBackground()).setColor(gradeColors[pos]);
    ((TextView) view.findViewById(R.id.tv_course_code)).setText(grade.getCourseCode());
    ((TextView) view.findViewById(R.id.tv_course_name)).setText(grade.getCourseTitle());
    ((TextView) view.findViewById(R.id.tv_course_credit)).setText(getActivity().getResources()
            .getQuantityString(R.plurals.course_credits, grade.getCredits(), grade.getCredits()));
    semCardContainer.addView(view);
}

From source file:com.mycompany.popularmovies.DetailActivity.DetailFragment.java

@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    if (cursorLoader == mGeneralInfoLoader) {
        if (cursor != null && cursor.moveToFirst()) {
            int columnIndexPosterPath = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_POSTER_PATH);
            String posterPath = MovieAdapter.POSTER_BASE_URL_W185 + cursor.getString(columnIndexPosterPath);
            Picasso picasso = Picasso.with(getActivity());
            picasso.load(posterPath).into(mPosterImageView);

            int columnIndexTitle = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_TITLE);
            String title = cursor.getString(columnIndexTitle);
            mTitleTextView.setText(title);

            int columnIndexIsFavorite = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_FAVORITED);
            int isFavorite = cursor.getInt(columnIndexIsFavorite);
            mHeartImageView/*w w w.ja  va2s.  c om*/
                    .setImageResource(isFavorite == 1 ? R.drawable.heart_active : R.drawable.heart_inactive);
            mHeartImageView.setOnClickListener(this);

            int columnIndexReleaseDate = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_RELEASE_DATE);
            String releaseDateText = cursor.getString(columnIndexReleaseDate);
            String releaseYearText = releaseDateText.substring(0, Math.min(releaseDateText.length(), 4));
            mReleaseYearTextView.setText(releaseYearText);

            int columnIndexVoteAverage = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_VOTE_AVERAGE);
            float vote_average = cursor.getFloat(columnIndexVoteAverage);
            mRatingBar.setRating(vote_average);

            int columnIndexSynopsis = cursor.getColumnIndex(MovieContract.MovieTable.COLUMN_SYNOPSIS);
            mSynopsisTextView.setText(cursor.getString(columnIndexSynopsis));

            // If onCreateOptionsMenu has already happened, we need to update the share intent now.
            if (mShareActionProvider != null) {
                mShareText = title;
                mShareActionProvider.setShareIntent(createShareIntent());
            }
        } else {
            Log.e(LOG_TAG, "Cursor to populate general info was empty or null!");
        }
    } else if (cursorLoader == mTrailerLoader) {
        if (cursor == null || !cursor.moveToFirst()) {
            mTrailerListTitle.setVisibility(View.INVISIBLE);
        } else {
            mTrailerListTitle.setVisibility(View.VISIBLE);
            for (cursor.moveToFirst(); cursor.getPosition() < cursor.getCount(); cursor.moveToNext()) {
                int columnIndexName = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_NAME);
                String trailerName = cursor.getString(columnIndexName);

                int columnIndexLanguageCode = cursor
                        .getColumnIndex(MovieContract.TrailersTable.COLUMN_LANGUAGE_CODE);
                String trailerLanguageCode = cursor.getString(columnIndexLanguageCode);

                String trailer_summary = String.format("%s (%s)", trailerName,
                        trailerLanguageCode.toUpperCase());

                int columnIndexSite = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_SITE);
                String site = cursor.getString(columnIndexSite);

                int columnIndexKey = cursor.getColumnIndex(MovieContract.TrailersTable.COLUMN_KEY);
                String key = cursor.getString(columnIndexKey);

                String link = null;
                if (site.compareTo("YouTube") == 0) {
                    link = "https://www.youtube.com/watch?v=" + key;
                } else {
                    Log.e(LOG_TAG, "Unsupported site: " + site);
                }

                ImageView trailerThumbnail = (ImageView) mActivity.getLayoutInflater()
                        .inflate(R.layout.detail_fragment_trailer_item, null, false);
                if (site.compareTo("YouTube") == 0) {
                    Picasso picasso = Picasso.with(mActivity);
                    String youtubeThumbnailPath = String.format("http://img.youtube.com/vi/%s/mqdefault.jpg",
                            key);
                    picasso.load(youtubeThumbnailPath).into(trailerThumbnail);
                    trailerThumbnail.setTag(link);
                    trailerThumbnail.setOnClickListener(this);
                }

                mTrailerList.addView(trailerThumbnail);
            }
        }
    } else if (cursorLoader == mReviewLoader) {
        if (cursor == null || !cursor.moveToFirst()) {
            mReviewListTitle.setVisibility(View.INVISIBLE);
        } else {
            mReviewListTitle.setVisibility(View.VISIBLE);
            String colors[] = { "#00BFFF", "#00CED1", "#FF8C00", "#00FA9A", "#9400D3" };
            for (cursor.moveToFirst(); cursor.getPosition() < cursor.getCount(); cursor.moveToNext()) {
                int columnIndexAuthor = cursor.getColumnIndex(MovieContract.ReviewsTable.COLUMN_AUTHOR);
                String author = cursor.getString(columnIndexAuthor);
                String authorAbbreviation = author != null && author.length() >= 1 ? author.substring(0, 1)
                        : "?";

                int columnIndexReviewText = cursor
                        .getColumnIndex(MovieContract.ReviewsTable.COLUMN_REVIEW_TEXT);
                String reviewText = cursor.getString(columnIndexReviewText);

                RelativeLayout review = (RelativeLayout) mActivity.getLayoutInflater()
                        .inflate(R.layout.detail_fragment_review_item, null, false);
                review.setOnClickListener(this);
                review.setTag(TAG_REVIEW_COLLAPSED);

                TextView authorIcon = (TextView) review.findViewById(R.id.author_icon);
                authorIcon.setText(authorAbbreviation);
                int color = Color.parseColor(colors[cursor.getPosition() % colors.length]);
                authorIcon.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);

                TextView authorFullName = (TextView) review.findViewById(R.id.author_full_name);
                authorFullName.setText(author);

                TextView reviewTextView = (TextView) review.findViewById(R.id.review_text);
                reviewTextView.setText(reviewText);

                mReviewList.addView(review);
            }
        }
    }
}

From source file:com.example.mcervantes.quakereport.EarthquakeAdapter.java

/**
 * Returns a list item view that displays information about the earthquake at the given position
 * in the list of earthquakes./*from ww  w .j a va 2  s.co  m*/
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // Check if there is an existing list item view (called convertView) that we can reuse,
    // otherwise, if convertView is null, then inflate a new list item layout.
    View listItemView = convertView;
    if (listItemView == null) {
        listItemView = LayoutInflater.from(getContext()).inflate(R.layout.earthquake_list_item, parent, false);
    }

    // Find the earthquake at the given position in the list of earthquakes
    Earthquake currentEarthquake = getItem(position);

    // Find the TextView with view ID magnitude
    TextView magnitudeView = (TextView) listItemView.findViewById(R.id.magnitude);
    // Format the magnitude to show 1 decimal place
    String formattedMagnitude = formatMagnitude(currentEarthquake.getMagnitude());
    // Display the magnitude of the current earthquake in that TextView
    magnitudeView.setText(formattedMagnitude);

    // Set the proper background color on the magnitude circle.
    // Fetch the background from the TextView, which is a GradientDrawable.
    GradientDrawable magnitudeCircle = (GradientDrawable) magnitudeView.getBackground();
    // Get the appropriate background color based on the current earthquake magnitude
    int magnitudeColor = getMagnitudeColor(currentEarthquake.getMagnitude());
    // Set the color on the magnitude circle
    magnitudeCircle.setColor(magnitudeColor);

    // Get the original location string from the Earthquake object,
    // which can be in the format of "5km N of Cairo, Egypt" or "Pacific-Antarctic Ridge".
    String originalLocation = currentEarthquake.getLocation();

    // If the original location string (i.e. "5km N of Cairo, Egypt") contains
    // a primary location (Cairo, Egypt) and a location offset (5km N of that city)
    // then store the primary location separately from the location offset in 2 Strings,
    // so they can be displayed in 2 TextViews.
    String primaryLocation;
    String locationOffset;

    // Check whether the originalLocation string contains the " of " text
    if (originalLocation.contains(LOCATION_SEPARATOR)) {
        // Split the string into different parts (as an array of Strings)
        // based on the " of " text. We expect an array of 2 Strings, where
        // the first String will be "5km N" and the second String will be "Cairo, Egypt".
        String[] parts = originalLocation.split(LOCATION_SEPARATOR);
        // Location offset should be "5km N " + " of " --> "5km N of"
        locationOffset = parts[0] + LOCATION_SEPARATOR;
        // Primary location should be "Cairo, Egypt"
        primaryLocation = parts[1];
    } else {
        // Otherwise, there is no " of " text in the originalLocation string.
        // Hence, set the default location offset to say "Near the".
        locationOffset = getContext().getString(R.string.near_the);
        // The primary location will be the full location string "Pacific-Antarctic Ridge".
        primaryLocation = originalLocation;
    }

    // Find the TextView with view ID location
    TextView primaryLocationView = (TextView) listItemView.findViewById(R.id.primary_location);
    // Display the location of the current earthquake in that TextView
    primaryLocationView.setText(primaryLocation);

    // Find the TextView with view ID location offset
    TextView locationOffsetView = (TextView) listItemView.findViewById(R.id.location_offset);
    // Display the location offset of the current earthquake in that TextView
    locationOffsetView.setText(locationOffset);

    // Create a new Date object from the time in milliseconds of the earthquake
    Date dateObject = new Date(currentEarthquake.getTimeInMilliseconds());

    // Find the TextView with view ID date
    TextView dateView = (TextView) listItemView.findViewById(R.id.date);
    // Format the date string (i.e. "Mar 3, 1984")
    String formattedDate = formatDate(dateObject);
    // Display the date of the current earthquake in that TextView
    dateView.setText(formattedDate);

    // Find the TextView with view ID time
    TextView timeView = (TextView) listItemView.findViewById(R.id.time);
    // Format the time string (i.e. "4:30PM")
    String formattedTime = formatTime(dateObject);
    // Display the time of the current earthquake in that TextView
    timeView.setText(formattedTime);

    // Return the list item view that is now showing the appropriate data
    return listItemView;
}

From source file:com.app.blockydemo.content.bricks.SetVariableBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        TextView textSetVariable = (TextView) view.findViewById(R.id.brick_set_variable_label);
        TextView textTo = (TextView) view.findViewById(R.id.brick_set_variable_to_textview);
        TextView editVariable = (TextView) view.findViewById(R.id.brick_set_variable_edit_text);
        Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.set_variable_spinner);

        ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue);
        variablebrickSpinner.getBackground().setAlpha(alphaValue);
        if (adapterView != null) {
            ((TextView) adapterView.getChildAt(0)).setTextColor(color);
        }//from  ww  w.  jav  a 2 s  . c  om
        textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue));
        textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue));
        editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue));
        editVariable.getBackground().setAlpha(alphaValue);

        this.alphaValue = (alphaValue);

    }

    return view;
}

From source file:com.app.blockydemo.content.bricks.ChangeVariableBrick.java

@Override
public View getViewWithAlpha(int alphaValue) {

    if (view != null) {

        View layout = view.findViewById(R.id.brick_change_variable_layout);
        Drawable background = layout.getBackground();
        background.setAlpha(alphaValue);

        TextView textSetVariable = (TextView) view.findViewById(R.id.brick_change_variable_label);
        TextView textTo = (TextView) view.findViewById(R.id.brick_change_variable_by);
        TextView editVariable = (TextView) view.findViewById(R.id.brick_change_variable_edit_text);
        Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner);

        ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue);
        variablebrickSpinner.getBackground().setAlpha(alphaValue);
        if (adapterView != null) {
            ((TextView) adapterView.getChildAt(0)).setTextColor(color);
        }//  w w w . j  a v  a  2s .co m
        textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue));
        textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue));
        editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue));
        editVariable.getBackground().setAlpha(alphaValue);

        this.alphaValue = (alphaValue);

    }
    return view;
}

From source file:com.freeme.filemanager.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //*/ add by xueweili for after Switch the language, file manager  stop running on 20160518
    if (savedInstanceState != null) {
        savedInstanceState.remove("android:fragments");
    }/*from   w  w w.jav  a 2 s . c  o m*/
    //*/
    Log.i("liuhaoran", "oncreate");
    super.onCreate(savedInstanceState);

    mContext = this;

    MobclickAgent.setDebugMode(true);
    MobclickAgent.openActivityDurationTrack(false);
    MobclickAgent.startWithConfigure(new UMAnalyticsConfig(mContext, "57dfa18e67e58e7d2b003625", "hwdroi",
            EScenarioType.E_UM_ANALYTICS_OEM, false));

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    StorageHelper.getInstance(this).setCurrentMountPoint(Environment.getExternalStorageDirectory().getPath());
    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    //*/ test
    if (FileManagerApplication.mIsTest.equals("true")) {
        final TextView test = (TextView) findViewById(R.id.tv_test);
        test.setVisibility(View.VISIBLE);
        test.getBackground().setAlpha(100);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                test.setVisibility(View.GONE);
            }
        }, 3000);
    }
    //*/

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(null, FileCategoryContainerFragment.class, null);
    mTabsAdapter.addTab(null, FileViewFragment.class, null);
    mTabsAdapter.addTab(null, ServerControlFragment.class, null);
    mViewPager.setAdapter(mTabsAdapter);
    //*/ modified by tyd wulianghuan 2013-07-15 for: make the second tab be selected when usbStorge mounted
    //*/add by droi mingjun for updateself on 20151221
    mSharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    editor = mSharedPref.edit();

    //*/end
    mTabHost = (RadioGroup) findViewById(R.id.home_group);
    mTabBtnOne = (RadioButton) findViewById(R.id.home_radio_one);
    mTabBtnTwo = (RadioButton) findViewById(R.id.home_radio_two);
    mTabBtnThree = (RadioButton) findViewById(R.id.home_radio_three);

    if (FileManagerApplication.mIsHideFTP.equals("false")) {
        mTabBtnThree.setVisibility(View.GONE);
    }

    mTabHost.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup arg0, int arg1) {
            // TODO Auto-generated method stub
            switch (arg0.getCheckedRadioButtonId()) {
            case R.id.home_radio_one:
                Log.i("home_radio_one", "home_radio_one");
                // hometype = 1;
                if ((FileViewFragment) mTabsAdapter.getItem(1) != null
                        && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) {
                    ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode();
                    //((FileCategoryContainerFragment)mTabsAdapter.getItem(0)).setStorageDeviceInfo();
                }
                mViewPager.setCurrentItem(0, false);
                break;

            case R.id.home_radio_two:
                // hometype = 2;
                if ((FileCategoryContainerFragment) mTabsAdapter.getItem(0) != null
                        && ((FileCategoryContainerFragment) mTabsAdapter
                                .getItem(0)).mFileViewInteractionHub != null) {

                    ((FileCategoryContainerFragment) mTabsAdapter.getItem(0)).mFileViewInteractionHub
                            .exitActionMode();
                }
                mViewPager.setCurrentItem(1, false);
                break;

            case R.id.home_radio_three:
                // hometype = 3;
                if ((FileViewFragment) mTabsAdapter.getItem(1) != null
                        && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) {
                    ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode();
                }
                mViewPager.setCurrentItem(2, false);
                break;
            default:
                break;
            }
        }
    });
    int tabindex = getIntent().getIntExtra("TAB", Util.CATEGORY_TAB_INDEX);
    if (tabindex != 2) {
        int index = getIntent().getIntExtra("tab_index", Util.CATEGORY_TAB_INDEX);
    }
    //*/ modify end

    initButtonReceiver();

    UpdateMonitor.Builder
            //*/ init UpdateMonitor
            .getInstance(this)
            //*/ register you Application to obsever
            .registerApplication(getApplication())
            //*/ register you Application is Service or hasEnrtyActivity
            .setApplicationIsServices(true)
            //*/ default notify small icon, ifnot set use updateself_ic_notify_small
            .setDefaultNotifyIcon(R.drawable.updateself_ic_notify_small).complete();

    checkSecurityPermissions();
    //        requestPermissionsMonery();
}

From source file:org.onebusaway.android.ui.ArrivalsListHeader.java

/**
 * Sets the popup for the status/*from ww  w  .jav a  2s.  c  om*/
 *
 * @param index      0 if this is for the top ETA row, 1 if it is for the second
 * @param color      color resource id to use for the popup background
 * @param statusText text to show in the status popup
 * @return a new PopupWindow initialized based on the provided parameters
 */
private PopupWindow setupPopup(final int index, int color, String statusText) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    TextView statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_large,
            null);
    statusView.setBackgroundResource(R.drawable.round_corners_style_b_status);
    GradientDrawable d = (GradientDrawable) statusView.getBackground();
    if (color != R.color.stop_info_ontime) {
        // Show early/late color
        d.setColor(mResources.getColor(color));
    } else {
        // For on-time, use header default color
        d.setColor(mResources.getColor(R.color.theme_primary));
    }
    d.setStroke(UIUtils.dpToPixels(mContext, 1), mResources.getColor(R.color.header_text_color));
    int pSides = UIUtils.dpToPixels(mContext, 5);
    int pTopBottom = UIUtils.dpToPixels(mContext, 2);
    statusView.setPadding(pSides, pTopBottom, pSides, pTopBottom);
    statusView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    statusView.measure(TextView.MeasureSpec.UNSPECIFIED, TextView.MeasureSpec.UNSPECIFIED);
    statusView.setText(statusText);
    PopupWindow p = new PopupWindow(statusView, statusView.getWidth(), statusView.getHeight());
    p.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    p.setBackgroundDrawable(new ColorDrawable(mResources.getColor(android.R.color.transparent)));
    p.setOutsideTouchable(true);
    p.setTouchInterceptor(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            boolean touchInView;
            if (index == 0) {
                touchInView = UIUtils.isTouchInView(mEtaAndMin1, event);
            } else {
                touchInView = UIUtils.isTouchInView(mEtaAndMin2, event);
            }
            return touchInView;
        }
    });
    return p;
}