Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

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

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:com.abcs.huaqiaobang.tljr.news.tabs.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(tabTextSize);
            //tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // 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 ww w . j  a va  2s  .c  o m*/
            }
        }
    }

}

From source file:fr.cph.chicago.activity.StationActivity.java

/**
 * Draw line/*from   w  w w .  j a  v  a2 s  .c o  m*/
 * 
 * @param eta
 *            the eta
 */
private final void drawLine3(final Eta eta) {
    TrainLine line = eta.getRouteName();
    Stop stop = eta.getStop();
    int line3Padding = (int) getResources().getDimension(R.dimen.activity_station_stops_line3);
    Integer viewId = mIds.get(line.toString() + "_" + stop.getDirection().toString());
    // viewId might be not there if CTA API provide wrong data
    if (viewId != null) {
        LinearLayout line3View = (LinearLayout) findViewById(viewId);
        Integer id = mIds.get(line.toString() + "_" + stop.getDirection().toString() + "_" + eta.getDestName());
        if (id == null) {
            LinearLayout insideLayout = new LinearLayout(this);
            insideLayout.setOrientation(LinearLayout.HORIZONTAL);
            insideLayout.setLayoutParams(mParamsStop);
            int newId = Util.generateViewId();
            insideLayout.setId(newId);
            mIds.put(line.toString() + "_" + stop.getDirection().toString() + "_" + eta.getDestName(), newId);

            TextView stopName = new TextView(this);
            stopName.setText(eta.getDestName() + ": ");
            stopName.setTextColor(getResources().getColor(R.color.grey));
            stopName.setPadding(line3Padding, 0, 0, 0);
            insideLayout.addView(stopName);

            TextView timing = new TextView(this);
            timing.setText(eta.getTimeLeftDueDelay() + " ");
            timing.setTextColor(getResources().getColor(R.color.grey));
            timing.setLines(1);
            timing.setEllipsize(TruncateAt.END);
            insideLayout.addView(timing);

            line3View.addView(insideLayout);
        } else {
            LinearLayout insideLayout = (LinearLayout) findViewById(id);
            TextView timing = (TextView) insideLayout.getChildAt(1);
            timing.setText(timing.getText() + eta.getTimeLeftDueDelay() + " ");
        }
        line3View.setVisibility(View.VISIBLE);
    }
}

From source file:com.csipsimple.ui.dialpad.DialerFragment.java

public void placeVMCall() {
    Long accountToUse = SipProfile.INVALID_ID;
    SipProfile acc = null;//from w  ww.  j  ava2  s  . c  om
    acc = accountChooserButton.getSelectedAccount();
    if (acc == null) {
        // Maybe we could inform user nothing will happen here?
        return;
    }

    accountToUse = acc.id;

    if (accountToUse >= 0) {
        SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id,
                new String[] { SipProfile.FIELD_VOICE_MAIL_NBR });
        if (!TextUtils.isEmpty(vmAcc.vm_nbr)) {
            // Account already have a VM number
            try {
                service.makeCall(vmAcc.vm_nbr, (int) acc.id);
            } catch (RemoteException e) {
                Log.e(THIS_FILE, "Service can't be called to make the call");
            }
        } else {
            // Account has no VM number, propose to create one
            final long editedAccId = acc.id;
            LayoutInflater factory = LayoutInflater.from(getActivity());
            final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);

            missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name)
                    .setView(textEntryView)
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {

                            if (missingVoicemailDialog != null) {
                                TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield);
                                if (tf != null) {
                                    String vmNumber = tf.getText().toString();
                                    if (!TextUtils.isEmpty(vmNumber)) {
                                        ContentValues cv = new ContentValues();
                                        cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber);

                                        int updated = getActivity().getContentResolver()
                                                .update(ContentUris.withAppendedId(
                                                        SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null,
                                                        null);
                                        Log.d(THIS_FILE, "Updated accounts " + updated);
                                    }
                                }
                                missingVoicemailDialog.hide();
                            }
                        }
                    }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            if (missingVoicemailDialog != null) {
                                missingVoicemailDialog.hide();
                            }
                        }
                    }).create();

            // When the dialog is up, completely hide the in-call UI
            // underneath (which is in a partially-constructed state).
            missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

            missingVoicemailDialog.show();
        }
    } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(),
            (new ComponentName(getActivity(), com.csipsimple.plugins.telephony.CallHandler.class)
                    .flattenToString()))) {
        // Case gsm voice mail
        TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
        String vmNumber = tm.getVoiceMailNumber();

        if (!TextUtils.isEmpty(vmNumber)) {
            if (service != null) {
                try {
                    service.ignoreNextOutgoingCallFor(vmNumber);
                } catch (RemoteException e) {
                    Log.e(THIS_FILE, "Not possible to ignore next");
                }
            }
            Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        } else {

            missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm)
                    .setMessage(R.string.no_voice_mail_configured)
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            if (missingVoicemailDialog != null) {
                                missingVoicemailDialog.hide();
                            }
                        }
                    }).create();

            // When the dialog is up, completely hide the in-call UI
            // underneath (which is in a partially-constructed state).
            missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

            missingVoicemailDialog.show();
        }
    }
    // TODO : manage others ?... for now, no way to do so cause no vm stored
}

From source file:com.dengfx.googleplay.view.astuetz.PagerSlidingTabStrip.java

/**
 * ?_???/* w w  w  .  j  a  va  2s  . c o  m*/
 */
private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

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

            // 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:cn.bingoogol.tabhost.ui.view.PagerSlidingTabStrip.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            // 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   w w w  .  j  av a  2  s  . c  o  m
            }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.greatspeeches.helper.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);
        v.setAlpha(25f);/*w  ww  . j a v a2s.c om*/

        if (v instanceof TextView) {

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

            // 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:app.lib.beta.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

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

            // 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 w  w w  .  ja v a 2 s.  c o m*/
            }
        }
    }

}

From source file:com.jfeinstein.jazzyviewpager.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        if (tabBackgroundResId != -1) {
            v.setBackgroundResource(tabBackgroundResId);
        }//from  w  w w. j  a  va 2 s . c  o m

        if (v instanceof TextView) {

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

            // 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.abct.tljr.news.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(tabTextSize);
            // tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // 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  ww w.j ava  2  s. c  o m*/
            }
        }
    }

}

From source file:com.common.view.tab.slider.PagerSlidingTabStrip.java

private void updateTabStyles() {

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

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

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

            // 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   ww w  .ja  va  2  s  .c  o m
                if (i == selectedPosition) {
                    tab.setTextColor(selectedTabTextColor);
                }
            }
        }
    }

}