List of usage examples for android.text SpannableString SpannableString
public SpannableString(CharSequence source)
From source file:org.catrobat.catroid.ui.MainMenuActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main_menu, menu); mainMenu = menu;// w w w. j av a 2s.com final MenuItem scratchConverterMenuItem = menu.findItem(R.id.menu_scratch_converter); if (scratchConverterMenuItem != null) { final String title = getString(R.string.main_menu_scratch_converter); final String beta = getString(R.string.beta).toUpperCase(Locale.getDefault()); final SpannableString spanTitle = new SpannableString(title + " " + beta); final int begin = title.length() + 1; final int end = begin + beta.length(); final int betaLabelColor = ContextCompat.getColor(this, R.color.beta_label_color); spanTitle.setSpan(new ForegroundColorSpan(betaLabelColor), begin, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); scratchConverterMenuItem.setTitle(spanTitle); } return super.onCreateOptionsMenu(menu); }
From source file:com.github.andrewlord1990.snackbarbuilder.SnackbarBuilder.java
/** * Add some text to append to the message shown on the Snackbar and a colour to make it. * * @param message Text to append to the Snackbar message. * @param color Colour to make the appended text. * @return This instance.// w w w . j a va2 s . c om */ public SnackbarBuilder appendMessage(CharSequence message, @ColorInt int color) { initialiseAppendMessages(); Spannable spannable = new SpannableString(message); spannable.setSpan(new ForegroundColorSpan(color), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); appendMessages.append(spannable); return this; }
From source file:com.arantius.tivocommander.Person.java
private void requestFinished() { if (--mOutstandingRequests > 0) { return;// w w w. j a v a2 s . com } setProgressBarIndeterminateVisibility(false); if (mPerson == null || mCredits == null) { setContentView(R.layout.no_results); return; } setContentView(R.layout.list_person); // Credits. JsonNode[] credits = new JsonNode[mCredits.size()]; int i = 0; for (JsonNode credit : mCredits) { credits[i++] = credit; } ListView lv = getListView(); CreditsAdapter adapter = new CreditsAdapter(Person.this, R.layout.item_person_credits, credits); lv.setAdapter(adapter); lv.setOnItemClickListener(mOnItemClickListener); // Name. ((TextView) findViewById(R.id.person_name)).setText(mName); // Role. JsonNode rolesNode = mPerson.path("roleForPersonId"); String[] roles = new String[rolesNode.size()]; for (i = 0; i < rolesNode.size(); i++) { roles[i] = rolesNode.path(i).asText(); roles[i] = Utils.ucFirst(roles[i]); } ((TextView) findViewById(R.id.person_role)).setText(Utils.join(", ", roles)); // Birth date. TextView birthdateView = ((TextView) findViewById(R.id.person_birthdate)); if (mPerson.has("birthDate")) { Date birthdate = Utils.parseDateStr(mPerson.path("birthDate").asText()); SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMMM d, yyyy", Locale.US); dateFormatter.setTimeZone(TimeZone.getDefault()); Spannable birthdateStr = new SpannableString("Birthdate: " + dateFormatter.format(birthdate)); birthdateStr.setSpan(new ForegroundColorSpan(Color.WHITE), 11, birthdateStr.length(), 0); birthdateView.setText(birthdateStr); } else { birthdateView.setVisibility(View.GONE); } // Birth place. TextView birthplaceView = ((TextView) findViewById(R.id.person_birthplace)); if (mPerson.has("birthPlace")) { Spannable birthplaceStr = new SpannableString("Birthplace: " + mPerson.path("birthPlace").asText()); birthplaceStr.setSpan(new ForegroundColorSpan(Color.WHITE), 12, birthplaceStr.length(), 0); birthplaceView.setText(birthplaceStr); } else { birthplaceView.setVisibility(View.GONE); } ImageView iv = (ImageView) findViewById(R.id.person_image); View pv = findViewById(R.id.person_image_progress); String imgUrl = Utils.findImageUrl(mPerson); new DownloadImageTask(this, iv, pv).execute(imgUrl); }
From source file:org.mozilla.gecko.AboutHomeContent.java
public void init() { Context context = getContext(); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater.inflate(R.layout.abouthome_content, this); mAccountManager = AccountManager.get(context); // The listener will run on the background thread (see 2nd argument) mAccountManager.addOnAccountsUpdatedListener(new OnAccountsUpdateListener() { public void onAccountsUpdated(Account[] accounts) { final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode(); final boolean syncIsSetup = isSyncSetup(); GeckoApp.mAppContext.mMainHandler.post(new Runnable() { public void run() { // The listener might run before the UI is initially updated. // In this case, we should simply wait for the initial setup // to happen. if (mTopSitesAdapter != null) updateLayout(startupMode, syncIsSetup); }/*from w w w .j a va2 s. co m*/ }); } }, GeckoAppShell.getHandler(), false); mTopSitesGrid = (GridView) findViewById(R.id.top_sites_grid); mTopSitesGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Cursor c = (Cursor) parent.getItemAtPosition(position); String spec = c.getString(c.getColumnIndex(URLColumns.URL)); Log.i(LOGTAG, "clicked: " + spec); if (mUriLoadCallback != null) mUriLoadCallback.callback(spec); } }); mAddonsLayout = (LinearLayout) findViewById(R.id.recommended_addons); mLastTabsLayout = (LinearLayout) findViewById(R.id.last_tabs); TextView allTopSitesText = (TextView) findViewById(R.id.all_top_sites_text); allTopSitesText.setOnClickListener(new OnClickListener() { public void onClick(View v) { GeckoApp.mAppContext.showAwesomebar(AwesomeBar.Type.EDIT); } }); TextView allAddonsText = (TextView) findViewById(R.id.all_addons_text); allAddonsText.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (mUriLoadCallback != null) mUriLoadCallback.callback("https://addons.mozilla.org/android"); } }); TextView syncTextView = (TextView) findViewById(R.id.sync_text); String syncText = syncTextView.getText().toString() + " \u00BB"; String boldName = getContext().getResources().getString(R.string.abouthome_sync_bold_name); int styleIndex = syncText.indexOf(boldName); // Highlight any occurrence of "Firefox Sync" in the string // with a bold style. if (styleIndex >= 0) { SpannableString spannableText = new SpannableString(syncText); spannableText.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), styleIndex, styleIndex + 12, 0); syncTextView.setText(spannableText, TextView.BufferType.SPANNABLE); } RelativeLayout syncBox = (RelativeLayout) findViewById(R.id.sync_box); syncBox.setOnClickListener(new OnClickListener() { public void onClick(View v) { Context context = v.getContext(); Intent intent = new Intent(context, SetupSyncActivity.class); context.startActivity(intent); } }); }
From source file:org.easyrpg.player.player.EasyRpgPlayerActivity.java
private void reportBug() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle(R.string.app_name); final SpannableString bug_msg = new SpannableString( getApplicationContext().getString(R.string.report_bug_msg)); Linkify.addLinks(bug_msg, Linkify.ALL); // set dialog message alertDialogBuilder.setMessage(bug_msg).setCancelable(false) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ArrayList<Uri> files = new ArrayList<Uri>(); String savepath = getIntent().getStringExtra(TAG_SAVE_PATH); files.add(Uri.fromFile(new File(savepath + "/easyrpg_log.txt"))); for (File f : GameBrowserHelper.getSavegames(new File(savepath))) { files.add(Uri.fromFile(f)); }/*from w w w. j a v a 2 s . c o m*/ if (Build.VERSION.SDK_INT >= 24) { // Lazy workaround as suggested on https://stackoverflow.com/q/38200282 try { Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure"); m.invoke(null); } catch (Exception e) { Log.i("EasyRPG", "Bug report: Calling disableDeathOnFileUriExposure failed"); } } Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setData(Uri.parse("mailto:")); intent.setType("*/*"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "easyrpg@easyrpg.org" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Bug report"); intent.putExtra(Intent.EXTRA_TEXT, getApplicationContext().getString(R.string.report_bug_mail)); intent.putExtra(Intent.EXTRA_STREAM, files); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); ((TextView) alertDialog.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:arun.com.chromer.webheads.ui.views.BaseWebHead.java
private void inflateContent(@NonNull Context context) { // size/*w w w. ja v a 2 s. c om*/ if (Preferences.get(context).webHeadsSize() == 2) { contentRoot = (FrameLayout) LayoutInflater.from(getContext()) .inflate(R.layout.widget_web_head_layout_small, this, false); } else contentRoot = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.widget_web_head_layout, this, false); addView(contentRoot); ButterKnife.bind(this); webHeadColor = Preferences.get(context).webHeadColor(); indicator.setText(Utils.getFirstLetter(url)); indicator.setTextColor(getForegroundWhiteOrBlack(webHeadColor)); initRevealView(webHeadColor); if (badgeDrawable == null) { badgeDrawable = new BadgeDrawable.Builder().type(TYPE_NUMBER) .badgeColor(ContextCompat.getColor(getContext(), R.color.accent)).textColor(WHITE) .number(WEB_HEAD_COUNT).build(); } else { badgeDrawable.setNumber(WEB_HEAD_COUNT); } badgeView.setVisibility(VISIBLE); badgeView.setText(new SpannableString(badgeDrawable.toSpannable())); updateBadgeColors(webHeadColor); if (!Utils.isLollipopAbove()) { final int pad = dpToPx(5); badgeView.setPadding(pad, pad, pad, pad); } }
From source file:org.umit.icm.mobile.gui.ControlActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.controlactivity); WebsiteSuggestButton = (Button) this.findViewById(R.id.suggestWebsite); ServiceSuggestButton = (Button) this.findViewById(R.id.suggestService); scanButton = (Button) this.findViewById(R.id.scanButton); // filterButton = (Button) this.findViewById(R.id.filterButton); // servicesFilterButton = (Button) this.findViewById(R.id.serviceFilterButton); mapSelectionButton = (Button) this.findViewById(R.id.mapSelectionButton); enableTwitterButton = (Button) this.findViewById(R.id.enableTwitterButton); bugReportButton = (Button) this.findViewById(R.id.bugReportButton); aboutButton = (Button) this.findViewById(R.id.aboutButton); scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); try {/*from w ww.j a v a 2 s .co m*/ if (Globals.runtimeParameters.getTwitter().equals("Off")) { enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } else { enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } } catch (RuntimeException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("org.umit.icm.mobile.CONTROL_ACTIVITY")) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); } } }; registerReceiver(receiver, new IntentFilter("org.umit.icm.mobile.CONTROL_ACTIVITY")); WebsiteSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { WebsiteSuggestionDialog websiteSuggestionDialog = new WebsiteSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); websiteSuggestionDialog.show(); } }); ServiceSuggestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { ServiceSuggestionDialog suggestionDialog = new ServiceSuggestionDialog(ControlActivity.this, "", new OnReadyListener()); suggestionDialog.show(); } }); enableTwitterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (Globals.runtimeParameters.getTwitter().equals("Off")) { progressDialog = ProgressDialog.show(ControlActivity.this, getString(R.string.loading), getString(R.string.retrieving_website), true, false); new LaunchBrowser().execute(); TwitterDialog twitterDialog = new TwitterDialog(ControlActivity.this, ""); twitterDialog.show(); enableTwitterButton.setText(getString(R.string.disable_twitter_button)); } else { Globals.runtimeParameters.setTwitter("Off"); enableTwitterButton.setText(getString(R.string.enable_twitter_button)); } } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mapSelectionButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { MapSelectionDialog MapSelectionDialog = new MapSelectionDialog(ControlActivity.this, ""); MapSelectionDialog.show(); } }); /* filterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, WebsiteFilterActivity.class); startActivity(intent); } } ); servicesFilterButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, ServiceFilterActivity.class); startActivity(intent); } } );*/ bugReportButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(ControlActivity.this, BugReportActivity.class); startActivity(intent); } }); aboutButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String msg = getString(R.string.about_text) + "\n" + getString(R.string.link_to_open_monitor) + "\n" + getString(R.string.link_to_umit) + "\n" + getString(R.string.icons_by); final SpannableString spannableString = new SpannableString(msg); Linkify.addLinks(spannableString, Linkify.ALL); AlertDialog alertDialog = new AlertDialog.Builder(ControlActivity.this).create(); alertDialog.setTitle(getString(R.string.about_button)); alertDialog.setMessage(spannableString); alertDialog.setIcon(R.drawable.umit_128); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }); scanButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (Globals.scanStatus.equalsIgnoreCase(getString(R.string.scan_on))) { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_on)); Globals.scanStatus = getString(R.string.scan_off); stopService(new Intent(ControlActivity.this, ConnectivityService.class)); } else { scanButton.setText(getString(R.string.scan_text) + " " + getString(R.string.scan_off)); Globals.scanStatus = getString(R.string.scan_on); startService(new Intent(ControlActivity.this, ConnectivityService.class)); } try { Globals.runtimeParameters.setScanStatus(Globals.scanStatus); } catch (RuntimeException e) { e.printStackTrace(); } Context context = getApplicationContext(); CharSequence text = getString(R.string.toast_scan_change) + " " + Globals.scanStatus; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); }
From source file:com.ideascontest.navi.uask.MainQuestionAnswerAdapter.java
/** * OnBindViewHolder is called by the RecyclerView to display the data at the specified * position. In this method, we update the contents of the ViewHolder to display the correct * indices in the list for this particular position, using the "position" argument that is conveniently * passed into us./*from ww w . jav a2 s . com*/ * * @param holder The ViewHolder which should be updated to represent the contents of the * item at the given position in the data set. * @param position The position of the item within the adapter's data set. */ @Override public void onBindViewHolder(QuestionTopAnswerHolder holder, int position) { Log.d(TAG, "#" + position); QuestionTopAnswerHolder questionTopAnswerHolder = (QuestionTopAnswerHolder) holder; final Context context = questionTopAnswerHolder.v.getContext(); Log.d(TAG, "Category" + _category); switch (_category) { case 0: case 1: case 2: case 3: case 4: { if (position == 0) { /* String infoText = (String) questionTopAnswerHolder.basicInfoText.getText(); int count = infoText.split("\n").length; int upperLimit = (count > 5) ? MainAnswerAdapter.ordinalIndexOf(infoText, "\n", 5) : 140; if (infoText.length() > 140 || count > 5) { infoText = infoText.substring(0, upperLimit) + "... " + "view more"; SpannableString sText = new SpannableString(infoText); ClickableSpan myClickableSpan = new ClickableSpan() { @Override public void onClick(View v) { Log.d("MainCanvas Category", "clickable Span"); //finish(); } }; int spanLowLimit = upperLimit + 4; int spanHighLimit = upperLimit + 13; sText.setSpan(myClickableSpan, spanLowLimit, spanHighLimit, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); sText.setSpan(new RelativeSizeSpan(0.75f), spanLowLimit, spanHighLimit, 0); sText.setSpan(new ForegroundColorSpan( questionTopAnswerHolder.v.getResources().getColor(R.color.primaryOrange)), spanLowLimit, spanHighLimit, 0); questionTopAnswerHolder.basicInfoText.setText(sText); questionTopAnswerHolder.basicInfoText.setMovementMethod(LinkMovementMethod.getInstance()); }*/ String infoText = (String) questionTopAnswerHolder.basicInfoText.getText(); int upperLimit = 150; if (infoText.length() > 150) { infoText = infoText.substring(0, upperLimit) + "... " + "view more"; SpannableString sText = new SpannableString(infoText); ClickableSpan myClickableSpan = new ClickableSpan() { @Override public void onClick(View v) { Log.d("Mainadapter Category", "clickable Span"); Intent intent = new Intent(context, ShowBasicInfo.class); intent.putExtra("category", _category); context.startActivity(intent);//finish(); } }; int spanLowLimit = upperLimit + 4; int spanHighLimit = upperLimit + 13; sText.setSpan(myClickableSpan, spanLowLimit, spanHighLimit, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); sText.setSpan(new RelativeSizeSpan(0.75f), spanLowLimit, spanHighLimit, 0); sText.setSpan( new ForegroundColorSpan( questionTopAnswerHolder.v.getResources().getColor(R.color.primaryOrange)), spanLowLimit, spanHighLimit, 0); questionTopAnswerHolder.basicInfoText.setText(sText); questionTopAnswerHolder.basicInfoText.setMovementMethod(LinkMovementMethod.getInstance()); } } else { populateDynamicUiElements(questionTopAnswerHolder, (position - 1)); } } break; case 5: { if (position == 0) { questionTopAnswerHolder.basicInfoText.setText("List of all non-categorical questions"); questionTopAnswerHolder.basicInfoText.setGravity(Gravity.CENTER | Gravity.BOTTOM); questionTopAnswerHolder.headingText.setVisibility(View.INVISIBLE); } else { populateDynamicUiElements(questionTopAnswerHolder, (position - 1)); } } break; case 6: { if (position == 0) { questionTopAnswerHolder.basicInfoText.setText("List of all questions asked by you."); questionTopAnswerHolder.basicInfoText.setGravity(Gravity.CENTER | Gravity.BOTTOM); questionTopAnswerHolder.headingText.setVisibility(View.INVISIBLE); } else { populateDynamicUiElements(questionTopAnswerHolder, (position - 1)); } } break; case 7: { if (position == 0) { questionTopAnswerHolder.basicInfoText.setText("List of all questions answered by you."); questionTopAnswerHolder.basicInfoText.setGravity(Gravity.CENTER | Gravity.BOTTOM); questionTopAnswerHolder.headingText.setVisibility(View.INVISIBLE); } else { populateDynamicUiElements(questionTopAnswerHolder, (position - 1)); } } break; case 8: { if (position == 0) { questionTopAnswerHolder.basicInfoText.setText( "All the private questions asked by your faculty students. Visible only to fellow faculty students"); questionTopAnswerHolder.basicInfoText.setGravity(Gravity.CENTER | Gravity.BOTTOM); questionTopAnswerHolder.headingText.setVisibility(View.INVISIBLE); } else { populateDynamicUiElements(questionTopAnswerHolder, (position - 1)); } } break; default: { populateDynamicUiElements(questionTopAnswerHolder, position); } break; } }
From source file:org.eyeseetea.malariacare.LoginActivity.java
/** * Shows an alert dialog asking for acceptance of the EULA terms. If ok calls login function, * do//from w w w . ja va2 s . c o m * nothing otherwise */ public void askEula(int titleId, int rawId, final Context context) { InputStream message = context.getResources().openRawResource(rawId); String stringMessage = Utils.convertFromInputStreamToString(message).toString(); final SpannableString linkedMessage = new SpannableString(Html.fromHtml(stringMessage)); Linkify.addLinks(linkedMessage, Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS); AlertDialog dialog = new AlertDialog.Builder(context).setTitle(context.getString(titleId)) .setMessage(linkedMessage) .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { rememberEulaAccepted(context); login(serverText.getText().toString(), usernameEditText.getText().toString(), passwordEditText.getText().toString()); } }).setNegativeButton(android.R.string.no, null).create(); dialog.show(); ((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:eu.veldsoft.adsbobball.ActivityStateEnum.java
protected void update(final Canvas canvas, final GameState currGameState, long frameCounter) { final Player currPlayer = currGameState.getPlayer(playerId); if ((gameView != null)) { gameView.draw(canvas, currGameState); }/*from w w w .j av a 2 s . c o m*/ if (frameCounter % displayLoop.ITERATIONS_PER_STATUSUPDATE == 0) { SpannableStringBuilder timeLeftStr = SpannableStringBuilder .valueOf(getString(R.string.timeLeftLabel, gameManager.timeLeft() / 10)); SpannableStringBuilder livesStr = formatPerPlayer(getString(R.string.livesLabel), new playstat() { @Override public int call(Player p) { return p.getLives(); } }); SpannableStringBuilder scoreStr = formatPerPlayer(getString(R.string.scoreLabel), new playstat() { @Override public int call(Player p) { return p.getScore(); } }); SpannableStringBuilder clearedStr = formatPerPlayer(getString(R.string.areaClearedLabel), new playstat() { @Override public int call(Player p) { Grid grid = currGameState.getGrid(); if (grid != null) return currGameState.getGrid().getPercentComplete(p.getPlayerId()); else return 0; } }); // display fps if (secretHandshake >= 3) { float fps = displayLoop.getFPS(); int color = (fps < NUMBER_OF_FRAMES_PER_SECOND * 0.98f ? Color.RED : Color.GREEN); SpannableString s = new SpannableString(String.format(" FPS: %2.1f", fps)); s.setSpan(new ForegroundColorSpan(color), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); timeLeftStr.append(s); color = (gameManager.getUPS() < gameManager.NUMBER_OF_UPDATES_PER_SECOND * 0.98f ? Color.RED : Color.GREEN); s = new SpannableString(String.format(" UPS: %3.1f", gameManager.getUPS())); s.setSpan(new ForegroundColorSpan(color), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); timeLeftStr.append(s); } statusTopleft.setText(timeLeftStr); statusTopright.setText(livesStr); statusBotleft.setText(scoreStr); statusBotright.setText(clearedStr); } if (gameManager.hasWonLevel()) { showWonScreen(); } else if (gameManager.isGameLost()) { if ((numPlayers == 1) && scores.isTopScore(currPlayer.getScore())) { promptUsername(); } showDeadScreen(); } }