List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.eccyan.widget.SpinningTabStrip.java
private void updateTabStyles() { for (int i = 0; i < realTabCount; i++) { View v = tabsContainer.getChildAt(i); if (!(pager.getAdapter() instanceof CustomTabProvider)) { v.setBackgroundResource(tabBackgroundResId); }/*w w w . j a v a 2 s . c om*/ v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom()); TextView tabTitle = (TextView) v.findViewById(R.id.tab_title); if (tabTitle != null) { tabTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tabTitle.setTypeface(tabTypeface, pager.getCurrentItem() == i ? tabTypefaceSelectedStyle : tabTypefaceStyle); if (tabTextColor != null) { tabTitle.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) { tabTitle.setAllCaps(true); } else { tabTitle.setText(tabTitle.getText().toString().toUpperCase(locale)); } } } } }
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
private void setupLeftArrowButton(final TextView headerDate, final String currentDate, final Button arrowRightButton, Button arrowLeftButton) { arrowLeftButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j a v a 2 s . c o m*/ public void onClick(View v) { if (headerDate.toString().equals(currentDate)) { if (user.getToolLog().myLog.isEmpty()) { Log.d(TAG, "Decrementing date by one day, because the haul log is empty"); decrementDateByOneInHeader(headerDate.getText().toString(), headerDate); } else { String currentKey = user.getToolLog().myLog.lastKey(); if (currentKey.equals(currentDate)) { // Skip currentKey = user.getToolLog().myLog.lowerKey(currentKey); if (currentKey != null) { headerDate.setText(currentKey); } else { decrementDateByOneInHeader(headerDate.getText().toString(), headerDate); } } } } else { String currentKey = headerDate.getText().toString(); currentKey = user.getToolLog().myLog.lowerKey(currentKey); if (currentKey != null) { headerDate.setText(currentKey); } else { decrementDateByOneInHeader(headerDate.getText().toString(), headerDate); } } if (arrowRightButton.getVisibility() != View.VISIBLE && !headerDate.getText().toString().equals(currentDate)) { arrowRightButton.setVisibility(View.VISIBLE); } else { if (headerDate.getText().toString().equals(currentDate)) { arrowRightButton.setVisibility(View.INVISIBLE); } } } private void decrementDateByOneInHeader(String currentKey, final TextView headerDate) { final int DECREMENT_VALUE = -1; SimpleDateFormat sdf = new SimpleDateFormat(getString(R.string.datetime_format_yyyy_mm_dd), Locale.getDefault()); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date selectedDate = null; try { selectedDate = sdf.parse(currentKey); } catch (ParseException e) { Log.d(TAG, "Could not parse the given date in decrementByOneInHeader"); e.printStackTrace(); } Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.setTime(selectedDate); cal.add(Calendar.DATE, DECREMENT_VALUE); Date updatedDate = cal.getTime(); String mDate = sdf.format(updatedDate); headerDate.setText(mDate); } }); }
From source file:com.easy_binom.easybin.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;//ww w. j av a 2s . co m 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; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } if (tabTitleView != null) { tabTitleView.setText(adapter.getPageTitle(i)); } tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } if (tabTitleView != null) { tabTitleView.setTextColor(getResources().getColorStateList(R.color.selector)); tabTitleView.setTextSize(14); tabTitleView.setText(tabTitleView.getText().toString().toUpperCase()); } } }
From source file:gr.scify.newsum.ui.SearchViewActivity.java
protected void initRatingBar() { final TextView tx = (TextView) findViewById(R.id.textView1); // Set rating bar visibility final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar); rb.setVisibility(View.VISIBLE); final TextView rateLbl = (TextView) findViewById(R.id.rateLbl); rateLbl.setVisibility(View.VISIBLE); final Button btnSubmit = (Button) findViewById(R.id.submitRatingBtn); // Set rating bar reaction btnSubmit.setOnClickListener(new OnClickListener() { @Override//w w w . ja va 2 s .c o m public void onClick(View v) { HttpParams params = new BasicHttpParams(); // Basic params HttpClient client = new DefaultHttpClient(params); HttpPost post = new HttpPost("http://scify.iit.demokritos.gr/NewSumWeb/rate.php"); ArrayList<NameValuePair> alParams = new ArrayList<NameValuePair>(); NameValuePair nvSummary = new NameValuePair() { @Override public String getValue() { return tx.getText().toString(); } @Override public String getName() { return "sid"; } }; NameValuePair nvRating = new NameValuePair() { @Override public String getValue() { return String.valueOf(rb.getRating()); } @Override public String getName() { return "rating"; } }; // added User ID NameValuePair nvUserID = new NameValuePair() { @Override public String getValue() { SharedPreferences idSettings = getSharedPreferences(UID_PREFS_NAME, Context.MODE_PRIVATE); String sUID = idSettings.getString("UID", ""); return sUID; } @Override public String getName() { return "userID"; } }; alParams.add(nvSummary); alParams.add(nvRating); alParams.add(nvUserID); boolean bSuccess = false; try { post.setEntity(new UrlEncodedFormEntity(alParams, HTTP.UTF_8)); // with list of key-value pairs client.execute(post); bSuccess = true; } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (bSuccess) { Toast.makeText(SearchViewActivity.this, R.string.thankyou_rate, Toast.LENGTH_SHORT).show(); rb.setVisibility(View.GONE); rateLbl.setVisibility(View.GONE); btnSubmit.setVisibility(View.GONE); } else Toast.makeText(SearchViewActivity.this, R.string.fail_rate, Toast.LENGTH_SHORT).show(); } }); rb.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() { @Override public void onRatingChanged(final RatingBar ratingBar, float rating, boolean fromUser) { // Ignore auto setting if (!fromUser) return; // Allow submit btnSubmit.setVisibility(View.VISIBLE); } }); rb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Allow submit btnSubmit.setVisibility(View.VISIBLE); } }); rb.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // Allow submit btnSubmit.setVisibility(View.VISIBLE); return false; } }); }
From source file:com.barbrdo.app.activities.UserProfileActivity.java
private void showRadiusDialog(String radius) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle); LayoutInflater inflater = this.getLayoutInflater(); View dialogView = inflater.inflate(R.layout.dialog_radius, null); dialogBuilder.setView(dialogView);//from w ww . j a v a2 s. co m final TextView textViewRadius = (TextView) dialogView.findViewById(R.id.tv_radius); SeekBar seekBarRadius = (SeekBar) dialogView.findViewById(R.id.seekBar_radius); seekBarRadius.setProgress(Integer.parseInt(radius.replace(" mi", ""))); textViewRadius.setText(radius); final int stepSize = 5; seekBarRadius.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { progress = ((int) Math.round(progress / stepSize)) * stepSize; textViewRadius.setText(progress + " mi"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); dialogBuilder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { textViewSearchRadius.setText(textViewRadius.getText().toString()); dialog.dismiss(); } }); dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertDialog = dialogBuilder.create(); alertDialog.show(); }
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
private void setupTextChangedListenerOnHeaderDate(final TextView headerDate, final String currentDate, final Button arrowRightButton) { headerDate.addTextChangedListener(new TextWatcher() { @Override/*from w w w . jav a 2 s.c o m*/ public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { //generateDiaryTableDataOnCurrentlySelectedDate(rootView, headerDate, haulLogSpecies, speciesHeader, haulLogLayout); if (!headerDate.getText().toString().equals(currentDate)) { arrowRightButton.setVisibility(View.VISIBLE); } } }); }
From source file:com.sonetel.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;/*from w ww. j a v a 2 s. com*/ acc = accountChooserButton.getSelectedAccount(); if (acc != null) { 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.sonetel.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.example.guxiuzhong.pagerslidingtab_lib.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { FrameLayout frameLayout = (FrameLayout) tabsContainer.getChildAt(i); frameLayout.setBackgroundResource(tabBackgroundResId); for (int j = 0; j < frameLayout.getChildCount(); j++) { View v = frameLayout.getChildAt(j); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (j == 0) { tab.setTextColor(tabTextColor); } else { tab.setTextColor(selectedTabTextColor); }/*w w w . j a v a2s. c o m*/ ViewHelper.setAlpha(tabViews.get(i).get("normal"), 1); ViewHelper.setAlpha(tabViews.get(i).get("selected"), 0); //set normal Scale ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f); ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f); ViewHelper.setScaleX(frameLayout, 1f); ViewHelper.setScaleY(frameLayout, 1f); // 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)); } } if (i == selectedPosition) { ViewHelper.setAlpha(tabViews.get(i).get("normal"), 0); ViewHelper.setAlpha(tabViews.get(i).get("selected"), 1); //set select Scale ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f); ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f); ViewHelper.setScaleX(frameLayout, 1 + zoomMax); ViewHelper.setScaleY(frameLayout, 1 + zoomMax); } } } } }
From source file:org.mifos.androidclient.main.DepositDueDetailsActivity.java
private void updateContent(SavingsAccountDepositDue details) { mDetails = details;/* w w w . j a va 2 s . c om*/ TextView cell; Double nextDeposit, pastDepositAmount, pastDepositsSum = 0.0; cell = (TextView) findViewById(R.id.depositDueDetails_nextDeposit); nextDeposit = details.getNextDueDetail().getDueAmount(); cell.setText(nextDeposit.toString()); if (ValueUtils.hasElements(details.getPreviousDueDetails())) { TableLayout table = (TableLayout) findViewById(R.id.depositDueDetails_table); View view = findViewById(R.id.depositDueDetails_rowInsertPoint); int index = table.indexOfChild(view) + 1; view = findViewById(R.id.depositDueDetails_subTotal_label); TableLayoutHelper helper = new TableLayoutHelper(this, TableLayoutHelper.DEFAULT_TABLE_ROW_SEPARATOR_HEIGHT, view.getPaddingLeft(), view.getPaddingRight()); for (DueOnDate pastDeposit : details.getPreviousDueDetails()) { if (pastDeposit.getDueDate().before(details.getNextDueDetail().getDueDate())) { TableRow row = helper.createTableRow(); cell = helper.createTableCell(DateUtils.format(pastDeposit.getDueDate()), 1); row.addView(cell); pastDepositAmount = pastDeposit.getDueAmount(); cell = helper.createTableCell(pastDepositAmount.toString(), 2); row.addView(cell); table.addView(row, index); index++; table.addView(helper.createRowSeparator(), index); index++; pastDepositsSum += pastDepositAmount; } } } cell = (TextView) findViewById(R.id.depositDueDetails_subTotal); cell.setText(pastDepositsSum.toString()); cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue_label); cell.setText(cell.getText() + DateUtils.format(details.getNextDueDetail().getDueDate())); cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue); cell.setText(Double.toString(pastDepositsSum + nextDeposit)); }