List of usage examples for android.graphics Typeface NORMAL
int NORMAL
To view the source code for android.graphics Typeface NORMAL.
Click Source Link
From source file:com.eveningoutpost.dexdrip.Home.java
private void displayCurrentInfoFromReading(BgReading lastBgReading, boolean predictive) { double estimate = 0; double estimated_delta = 0; String slope_arrow = lastBgReading.slopeArrow(); String extrastring = ""; if ((new Date().getTime()) - stale_data_millis() - lastBgReading.timestamp > 0) { notificationText.setText(R.string.signal_missed); if (!predictive) { estimate = lastBgReading.calculated_value; } else {/*www . java 2s . c om*/ estimate = BgReading.estimated_bg(lastBgReading.timestamp + (6000 * 7)); } currentBgValueText.setText(bgGraphBuilder.unitized_string(estimate)); currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); dexbridgeBattery.setPaintFlags(dexbridgeBattery.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { if (notificationText.getText().length() == 0) { notificationText.setTextColor(Color.WHITE); } boolean bg_from_filtered = prefs.getBoolean("bg_from_filtered", false); if (!predictive) { estimate = lastBgReading.calculated_value; // normal currentBgValueText.setTypeface(null, Typeface.NORMAL); // if noise has settled down then switch off filtered mode if ((bg_from_filtered) && (BgGraphBuilder.last_noise < BgGraphBuilder.NOISE_FORGIVE) && (prefs.getBoolean("bg_compensate_noise", false))) { bg_from_filtered = false; prefs.edit().putBoolean("bg_from_filtered", false).apply(); } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { estimate = BgGraphBuilder.best_bg_estimate; // this maybe needs scaling based on noise intensity estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; slope_arrow = BgReading .slopeToArrowSymbol(estimated_delta / (BgGraphBuilder.DEXCOM_PERIOD / 60000)); // delta by minute currentBgValueText.setTypeface(null, Typeface.ITALIC); extrastring = "\u26A0"; // warning symbol ! } if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_HIGH) && (DexCollectionType.hasFiltered())) { bg_from_filtered = true; // force filtered mode } if (bg_from_filtered) { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); estimate = lastBgReading.filtered_calculated_value; } else { currentBgValueText .setPaintFlags(currentBgValueText.getPaintFlags() & ~Paint.UNDERLINE_TEXT_FLAG); } String stringEstimate = bgGraphBuilder.unitized_string(estimate); if ((lastBgReading.hide_slope) || (bg_from_filtered)) { slope_arrow = ""; } currentBgValueText.setText(stringEstimate + " " + slope_arrow); } else { estimate = BgReading.activePrediction(); String stringEstimate = bgGraphBuilder.unitized_string(estimate); currentBgValueText.setText(stringEstimate + " " + BgReading.activeSlopeArrow()); } if (extrastring.length() > 0) currentBgValueText.setText(extrastring + currentBgValueText.getText()); } int minutes = (int) (System.currentTimeMillis() - lastBgReading.timestamp) / (60 * 1000); if ((!small_width) || (notificationText.length() > 0)) notificationText.append("\n"); if (!small_width) { notificationText.append(minutes + ((minutes == 1) ? getString(R.string.space_minute_ago) : getString(R.string.space_minutes_ago))); } else { // small screen notificationText.append(minutes + getString(R.string.space_mins)); currentBgValueText.setPadding(0, 0, 0, 0); } if (small_screen) { if (currentBgValueText.getText().length() > 4) currentBgValueText.setTextSize(25); } // do we actually need to do this query here if we again do it in unitizedDeltaString List<BgReading> bgReadingList = BgReading.latest(2, is_follower); if (bgReadingList != null && bgReadingList.size() == 2) { // same logic as in xDripWidget (refactor that to BGReadings to avoid redundancy / later inconsistencies)? display_delta = bgGraphBuilder.unitizedDeltaString(true, true, is_follower); // TODO reduce duplication of logic if ((BgGraphBuilder.last_noise > BgGraphBuilder.NOISE_TRIGGER) && (BgGraphBuilder.best_bg_estimate > 0) && (BgGraphBuilder.last_bg_estimate > 0) && (prefs.getBoolean("bg_compensate_noise", false))) { //final double estimated_delta = BgGraphBuilder.best_bg_estimate - BgGraphBuilder.last_bg_estimate; display_delta = bgGraphBuilder.unitizedDeltaStringRaw(true, true, estimated_delta); addDisplayDelta(); if (!prefs.getBoolean("show_noise_workings", false)) { notificationText.append("\nNoise: " + bgGraphBuilder.noiseString(BgGraphBuilder.last_noise)); } } else { addDisplayDelta(); } } if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } }
From source file:im.vector.fragments.VectorSettingsPreferencesFragment.java
/** * Refresh the pushers list// w w w .j av a 2 s .c o m */ private void refreshPushersList() { final GcmRegistrationManager gcmRegistrationManager = Matrix.getInstance(getActivity()) .getSharedGCMRegistrationManager(); final List<Pusher> pushersList = new ArrayList<>(gcmRegistrationManager.mPushersList); if (pushersList.isEmpty()) { getPreferenceScreen().removePreference(mPushersSettingsCategory); getPreferenceScreen().removePreference(mPushersSettingsDivider); return; } // check first if there is an update boolean isNewList = true; if ((null != mDisplayedPushers) && (pushersList.size() == mDisplayedPushers.size())) { isNewList = !mDisplayedPushers.containsAll(pushersList); } if (isNewList) { // remove the displayed one mPushersSettingsCategory.removeAll(); // add new emails list mDisplayedPushers = pushersList; int index = 0; for (final Pusher pusher : mDisplayedPushers) { if (null != pusher.lang) { boolean isThisDeviceTarget = TextUtils .equals(gcmRegistrationManager.getCurrentRegistrationToken(), pusher.pushkey); VectorCustomActionEditTextPreference preference = new VectorCustomActionEditTextPreference( getActivity(), isThisDeviceTarget ? Typeface.BOLD : Typeface.NORMAL); preference.setTitle(pusher.deviceDisplayName); preference.setSummary(pusher.appDisplayName); preference.setKey(PUSHER_PREFERENCE_KEY_BASE + index); index++; mPushersSettingsCategory.addPreference(preference); // the user cannot remove the self device target if (!isThisDeviceTarget) { preference.setOnPreferenceLongClickListener( new VectorCustomActionEditTextPreference.OnPreferenceLongClickListener() { @Override public boolean onPreferenceLongClick(Preference preference) { final String dialogMessage = getString( R.string.settings_delete_notification_targets_confirmation); new AlertDialog.Builder(getActivity()) .setTitle(R.string.dialog_title_confirmation) .setMessage(dialogMessage).setPositiveButton(R.string.remove, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); displayLoadingView(); gcmRegistrationManager.unregister(mSession, pusher, new ApiCallback<Void>() { @Override public void onSuccess(Void info) { refreshPushersList(); onCommonDone(null); } @Override public void onNetworkError( Exception e) { onCommonDone( e.getLocalizedMessage()); } @Override public void onMatrixError( MatrixError e) { onCommonDone( e.getLocalizedMessage()); } @Override public void onUnexpectedError( Exception e) { onCommonDone( e.getLocalizedMessage()); } }); } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .create().show(); return true; } }); } } } } }
From source file:jmri.enginedriver.throttle.java
void showDirectionIndication(int whichThrottle, int direction) { boolean setLeftDirectionButtonEnabled; if (direction == 0) { //0=reverse 1=forward setLeftDirectionButtonEnabled = directionButtonsAreCurrentlyReversed(whichThrottle); } else {// ww w . j av a2s .co m setLeftDirectionButtonEnabled = !directionButtonsAreCurrentlyReversed(whichThrottle); } if (!getConsist(whichThrottle).isActive()) { bFwds[whichThrottle].setSelected(false); bRevs[whichThrottle].setSelected(false); } else { if (!setLeftDirectionButtonEnabled) { bFwds[whichThrottle].setSelected(false); bRevs[whichThrottle].setSelected(true); bFwds[whichThrottle].setTypeface(null, Typeface.NORMAL); bRevs[whichThrottle].setTypeface(null, Typeface.ITALIC + Typeface.BOLD); if ((getSpeed(whichThrottle) > 0) && (!dirChangeWhileMoving)) { bFwds[whichThrottle].setEnabled(false); } bRevs[whichThrottle].setEnabled(true); } else { bFwds[whichThrottle].setSelected(true); bRevs[whichThrottle].setSelected(false); bFwds[whichThrottle].setTypeface(null, Typeface.ITALIC + Typeface.BOLD); bRevs[whichThrottle].setTypeface(null, Typeface.NORMAL); bFwds[whichThrottle].setEnabled(true); if ((getSpeed(whichThrottle) > 0) && (!dirChangeWhileMoving)) { bRevs[whichThrottle].setEnabled(false); } } } }
From source file:jmri.enginedriver.throttle.java
void set_stop_button(int whichThrottle, boolean pressed) { if (pressed) { bStops[whichThrottle].setPressed(true); bStops[whichThrottle].setTypeface(null, Typeface.ITALIC); } else {//w ww.j a v a2 s.c om bStops[whichThrottle].setPressed(false); bStops[whichThrottle].setTypeface(null, Typeface.NORMAL); } }
From source file:jmri.enginedriver.throttle.java
void set_function_request(int whichThrottle, int function, int reqState) { // Log.d("Engine_Driver","starting set_function_request"); Button b;//from w w w . ja v a 2 s . c o m b = functionMaps[whichThrottle].get(function); if (b != null) { if (reqState != 0) { b.setTypeface(null, Typeface.ITALIC + Typeface.BOLD); } else { b.setTypeface(null, Typeface.NORMAL); } } }
From source file:im.vector.fragments.VectorSettingsPreferencesFragment.java
/** * Build the devices portion of the settings.<br> * Each row correspond to a device ID and its corresponding device name. Clicking on the row * display a dialog containing: the device ID, the device name and the "last seen" information. * * @param aDeviceInfoList the list of the devices *//* w w w .java2 s. com*/ private void buildDevicesSettings(List<DeviceInfo> aDeviceInfoList) { VectorCustomActionEditTextPreference preference; int typeFaceHighlight; boolean isNewList = true; String myDeviceId = mSession.getCredentials().deviceId; if ((null != mDevicesNameList) && (aDeviceInfoList.size() == mDevicesNameList.size())) { isNewList = !mDevicesNameList.containsAll(aDeviceInfoList); } if (isNewList) { int prefIndex = 0; mDevicesNameList = aDeviceInfoList; // sort before display: most recent first DeviceInfo.sortByLastSeen(mDevicesNameList); // start from scratch: remove the displayed ones mDevicesListSettingsCategory.removeAll(); for (DeviceInfo deviceInfo : mDevicesNameList) { // set bold to distinguish current device ID if ((null != myDeviceId) && myDeviceId.equals(deviceInfo.device_id)) { mMyDeviceInfo = deviceInfo; typeFaceHighlight = Typeface.BOLD; } else { typeFaceHighlight = Typeface.NORMAL; } // add the edit text preference preference = new VectorCustomActionEditTextPreference(getActivity(), typeFaceHighlight); if ((null == deviceInfo.device_id) && (null == deviceInfo.display_name)) { continue; } else { if (null != deviceInfo.device_id) { preference.setTitle(deviceInfo.device_id); } // display name parameter can be null (new JSON API) if (null != deviceInfo.display_name) { preference.setSummary(deviceInfo.display_name); } } preference.setKey(DEVICES_PREFERENCE_KEY_BASE + prefIndex); prefIndex++; // onClick handler: display device details dialog final DeviceInfo fDeviceInfo = deviceInfo; preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { displayDeviceDetailsDialog(fDeviceInfo); return true; } }); mDevicesListSettingsCategory.addPreference(preference); } refreshCryptographyPreference(mMyDeviceInfo); } }
From source file:com.skytree.epubtest.BookViewActivity.java
public void checkSettings() { if (this.setting.fontSize == 0) { decreaseButton.setTextColor(Color.LTGRAY); } else {/* ww w . j a v a2 s.c o m*/ decreaseButton.setTextColor(Color.BLACK); } if (this.setting.fontSize == 4) { increaseButton.setTextColor(Color.LTGRAY); } else { increaseButton.setTextColor(Color.BLACK); } increaseLineSpaceButton.setEnabled(true); decreaseLineSpaceButton.setEnabled(true); increaseLineSpaceButton.setColorFilter(Color.BLACK); decreaseLineSpaceButton.setColorFilter(Color.BLACK); if (this.setting.lineSpacing == 4) { increaseLineSpaceButton.setEnabled(false); increaseLineSpaceButton.setColorFilter(Color.LTGRAY); } if (this.setting.lineSpacing == 0) { decreaseLineSpaceButton.setEnabled(false); decreaseLineSpaceButton.setColorFilter(Color.LTGRAY); } int fontIndex = this.getFontIndex(setting.fontName); for (int i = 0; i < fontListView.getChildCount(); i++) { Button button = (Button) fontListView.getChildAt(i); button.setTextColor(Color.BLACK); } for (int i = 0; i < fontListView.getChildCount(); i++) { Button button = (Button) fontListView.getChildAt(i); if (button.getId() == (fontIndex + 5100)) { button.setTextColor(Color.BLUE); } } for (int i = 0; i < themesView.getChildCount(); i++) { Button button = (Button) themesView.getChildAt(i); Typeface tf = null; int size = 13; if (button.getId() == (themeIndex + 7000)) { tf = this.getTypeface(setting.fontName, Typeface.BOLD); size = 18; } else { tf = this.getTypeface(setting.fontName, Typeface.NORMAL); } button.setTypeface(tf); button.setTextSize(size); } }