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:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java
public void createButtonWithText(Activity activity, ViewGroup l, String text, String button, View.OnClickListener onclick) { RelativeLayout r = new RelativeLayout(activity); r.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TextView tv = new TextView(activity); RelativeLayout.LayoutParams tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); tvparams.addRule(RelativeLayout.ABOVE, R.id.reload_button); tvparams.addRule(RelativeLayout.CENTER_HORIZONTAL); tv.setLayoutParams(tvparams);// www. ja v a 2s . c o m tv.setText(text); tv.setTextSize(23); tv.setPadding(0, 0, 0, toPixels(15)); tv.setGravity(Gravity.CENTER_HORIZONTAL); r.addView(tv); Button b = new Button(activity); RelativeLayout.LayoutParams bparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); bparams.addRule(RelativeLayout.CENTER_VERTICAL); bparams.addRule(RelativeLayout.CENTER_HORIZONTAL); b.setLayoutParams(bparams); b.setId(R.id.reload_button); b.setText(button); b.setTextSize(23); b.setAllCaps(false); b.setTypeface(null, Typeface.NORMAL); b.setOnClickListener(onclick); r.addView(b); l.addView(r); }
From source file:org.rm3l.ddwrt.tiles.admin.nvram.EditNVRAMKeyValueDialogFragment.java
@Override public void onStart() { super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point final AlertDialog d = (AlertDialog) getDialog(); if (d != null) { ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key)).setText(this.mKey); final EditText valueEditText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value); valueEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override//w w w . j ava 2 s. c om public void onFocusChange(View v, boolean hasFocus) { ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_value_textview)).setTypeface(null, hasFocus ? Typeface.BOLD_ITALIC : Typeface.NORMAL); } }); valueEditText.setText(this.mValue, TextView.BufferType.EDITABLE); d.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Validate data final EditText editText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value); final Editable newValue = editText.getText(); if (mValue != null && StringUtils.equals(newValue.toString(), mValue.toString())) { //Crouton Crouton.makeText(getActivity(), "No change", ALERT, (ViewGroup) (d.findViewById(R.id.tile_admin_nvram_edit_notification_viewgroup))) .show(); editText.requestFocus(); //Open Keyboard final InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { // only will trigger it if no physical keyboard is open imm.showSoftInput(editText, 0); } return; } final CharSequence variableKey = ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key)) .getText(); final Bundle token = new Bundle(); token.putInt(POSITION, mPosition); token.putCharSequence(VALUE, newValue); token.putCharSequence(KEY, variableKey); //nvram set data changed new UndoBarController.UndoBar(getSherlockActivity()) .message(String.format("Variable '%s' will be updated", variableKey)) .listener(nvramDataRecyclerViewAdapter).token(token).show(); d.cancel(); } }); } }
From source file:org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { TextView vName = (TextView) view.findViewById(R.id.user_id_item_name); TextView vAddress = (TextView) view.findViewById(R.id.user_id_item_address); TextView vComment = (TextView) view.findViewById(R.id.user_id_item_comment); ImageView vVerified = (ImageView) view.findViewById(R.id.user_id_item_certified); ViewAnimator vVerifiedLayout = (ViewAnimator) view.findViewById(R.id.user_id_icon_animator); ImageView vDeleteButton = (ImageView) view.findViewById(R.id.user_id_item_delete_button); vDeleteButton.setVisibility(View.GONE); // not used String userId = cursor.getString(INDEX_USER_ID); OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(userId); if (splitUserId.name != null) { vName.setText(splitUserId.name); } else {/*from w w w . ja v a 2 s . c o m*/ vName.setText(R.string.user_id_no_name); } if (splitUserId.email != null) { vAddress.setText(splitUserId.email); vAddress.setVisibility(View.VISIBLE); } else { vAddress.setVisibility(View.GONE); } if (splitUserId.comment != null) { vComment.setText(splitUserId.comment); vComment.setVisibility(View.VISIBLE); } else { vComment.setVisibility(View.GONE); } boolean isPrimary = cursor.getInt(INDEX_IS_PRIMARY) != 0; boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0; // for edit key if (mSaveKeyringParcel != null) { boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null); boolean changeThisPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null && mSaveKeyringParcel.mChangePrimaryUserId.equals(userId)); boolean revokeThisUserId = (mSaveKeyringParcel.mRevokeUserIds.contains(userId)); // only if primary user id will be changed // (this is not triggered if the user id is currently the primary one) if (changeAnyPrimaryUserId) { // change _all_ primary user ids and set new one to true isPrimary = changeThisPrimaryUserId; } if (revokeThisUserId) { if (!isRevoked) { isRevoked = true; } } vVerifiedLayout.setDisplayedChild(2); } else { vVerifiedLayout.setDisplayedChild(mShowStatusImages ? 1 : 0); } if (isRevoked) { // set revocation icon (can this even be primary?) KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.REVOKED, R.color.key_flag_gray); // disable revoked user ids vName.setEnabled(false); vAddress.setEnabled(false); vComment.setEnabled(false); } else { vName.setEnabled(true); vAddress.setEnabled(true); vComment.setEnabled(true); if (isPrimary) { vName.setTypeface(null, Typeface.BOLD); vAddress.setTypeface(null, Typeface.BOLD); } else { vName.setTypeface(null, Typeface.NORMAL); vAddress.setTypeface(null, Typeface.NORMAL); } int isVerified = cursor.getInt(INDEX_VERIFIED); switch (isVerified) { case Certs.VERIFIED_SECRET: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.VERIFIED, KeyFormattingUtils.DEFAULT_COLOR); break; case Certs.VERIFIED_SELF: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.UNVERIFIED, KeyFormattingUtils.DEFAULT_COLOR); break; default: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.INVALID, KeyFormattingUtils.DEFAULT_COLOR); break; } } }
From source file:com.d2connect.droidltest.util.LPreviewUtilsImpl.java
@Override public void setMediumTypeface(TextView textView) { if (sMediumTypeface == null) { sMediumTypeface = Typeface.create("sans-serif-medium", Typeface.NORMAL); }// w ww . j a v a 2s.com textView.setTypeface(sMediumTypeface); }
From source file:com.androidquery.simplefeed.fragments.FeedFragment.java
public void notiCb(String url, JSONObject jo, AjaxStatus status) { AQUtility.debug("noti", jo); if (jo != null) { int count = 0; PQuery aq = aq2.recycle(header); /*//from ww w . j a v a 2s. c o m JSONObject sum = jo.optJSONObject("summary"); if(sum != null){ count = sum.optInt("unseen_count", 0); }*/ JSONArray ja = jo.optJSONArray("data"); for (int i = 0; i < ja.length(); i++) { JSONObject noti = ja.optJSONObject(i); if (noti.optInt("unread", 0) != 0) { count++; } } String message = count + " " + getString(R.string.n_notifications); aq.id(R.id.text_noti).text(message); int colorId = R.color.noti; int tf = Typeface.BOLD; if (count == 0) { colorId = R.color.grey; tf = Typeface.NORMAL; } aq.textColor(getResources().getColor(colorId)).getTextView().setTypeface(null, tf); } }
From source file:org.sufficientlysecure.keychain.ui.adapter.SubkeysAddedAdapter.java
public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { // Not recycled, inflate a new view convertView = mInflater.inflate(R.layout.view_key_adv_subkey_item, parent, false); final ViewHolder holder = new ViewHolder(); holder.vKeyId = (TextView) convertView.findViewById(R.id.subkey_item_key_id); holder.vKeyDetails = (TextView) convertView.findViewById(R.id.subkey_item_details); holder.vKeyExpiry = (TextView) convertView.findViewById(R.id.subkey_item_expiry); holder.vCertifyIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_certify); holder.vSignIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_sign); holder.vEncryptIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_encrypt); holder.vAuthenticateIcon = (ImageView) convertView.findViewById(R.id.subkey_item_ic_authenticate); holder.vDelete = (ImageButton) convertView.findViewById(R.id.subkey_item_delete_button); holder.vDelete.setVisibility(View.VISIBLE); // always visible // not used: ImageView vEdit = (ImageView) convertView.findViewById(R.id.subkey_item_edit_image); vEdit.setVisibility(View.GONE); ImageView vStatus = (ImageView) convertView.findViewById(R.id.subkey_item_status); vStatus.setVisibility(View.GONE); convertView.setTag(holder);//from ww w . ja v a 2s . c o m } final ViewHolder holder = (ViewHolder) convertView.getTag(); // save reference to model item holder.mModel = getItem(position); String algorithmStr = KeyFormattingUtils.getAlgorithmInfo(mActivity, holder.mModel.mAlgorithm, holder.mModel.mKeySize, holder.mModel.mCurve); boolean isMasterKey = mNewKeyring && position == 0; if (isMasterKey) { holder.vKeyId.setTypeface(null, Typeface.BOLD); holder.vDelete.setImageResource(R.drawable.ic_change_grey_24dp); holder.vDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // swapping out the old master key with newly set master key AddSubkeyDialogFragment addSubkeyDialogFragment = AddSubkeyDialogFragment.newInstance(true); addSubkeyDialogFragment.setOnAlgorithmSelectedListener( new AddSubkeyDialogFragment.OnAlgorithmSelectedListener() { @Override public void onAlgorithmSelected(SaveKeyringParcel.SubkeyAdd newSubkey) { // calculate manually as the provided position variable // is not always accurate int pos = SubkeysAddedAdapter.this.getPosition(holder.mModel); SubkeysAddedAdapter.this.remove(holder.mModel); SubkeysAddedAdapter.this.insert(newSubkey, pos); } }); addSubkeyDialogFragment.show(((FragmentActivity) mActivity).getSupportFragmentManager(), "addSubkeyDialog"); } }); } else { holder.vKeyId.setTypeface(null, Typeface.NORMAL); holder.vDelete.setImageResource(R.drawable.ic_close_grey_24dp); holder.vDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // remove reference model item from adapter (data and notify about change) SubkeysAddedAdapter.this.remove(holder.mModel); } }); } holder.vKeyId.setText(R.string.edit_key_new_subkey); holder.vKeyDetails.setText(algorithmStr); if (holder.mModel.mExpiry != 0L) { Date expiryDate = new Date(holder.mModel.mExpiry * 1000); Calendar expiryCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); expiryCal.setTime(expiryDate); // convert from UTC to time zone of device expiryCal.setTimeZone(TimeZone.getDefault()); holder.vKeyExpiry.setText(getContext().getString(R.string.label_expiry) + ": " + DateFormat.getDateFormat(getContext()).format(expiryCal.getTime())); } else { holder.vKeyExpiry.setText( getContext().getString(R.string.label_expiry) + ": " + getContext().getString(R.string.none)); } int flags = holder.mModel.mFlags; if ((flags & KeyFlags.CERTIFY_OTHER) > 0) { holder.vCertifyIcon.setVisibility(View.VISIBLE); } else { holder.vCertifyIcon.setVisibility(View.GONE); } if ((flags & KeyFlags.SIGN_DATA) > 0) { holder.vSignIcon.setVisibility(View.VISIBLE); } else { holder.vSignIcon.setVisibility(View.GONE); } if (((flags & KeyFlags.ENCRYPT_COMMS) > 0) || ((flags & KeyFlags.ENCRYPT_STORAGE) > 0)) { holder.vEncryptIcon.setVisibility(View.VISIBLE); } else { holder.vEncryptIcon.setVisibility(View.GONE); } if ((flags & KeyFlags.AUTHENTICATION) > 0) { holder.vAuthenticateIcon.setVisibility(View.VISIBLE); } else { holder.vAuthenticateIcon.setVisibility(View.GONE); } return convertView; }
From source file:io.coldstart.android.TrapListFragment.java
@Override public void onStart() { super.onStart(); try {//from ww w . ja va2 s. c om if (listOfTraps.size() == 0) { getActivity().findViewById(R.id.noTrapsMessage).setVisibility(View.VISIBLE); ((TextView) getActivity().findViewById(R.id.noTrapsMessage)) .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL)); } else { getActivity().findViewById(R.id.noTrapsMessage).setVisibility(View.GONE); } } catch (Exception e) { e.printStackTrace(); } }
From source file:net.droidsolutions.droidcharts.core.plot.Marker.java
/** * Constructs a new marker./*from w w w.ja va 2 s. c om*/ * * @param paint * the paint (<code>null</code> not permitted). * @param stroke * the stroke (<code>null</code> not permitted). * @param outlinePaint * the outline paint (<code>null</code> permitted). * @param outlineStroke * the outline stroke (<code>null</code> permitted). * @param alpha * the alpha transparency (must be in the range 0.0f to 1.0f). * * @throws IllegalArgumentException * if <code>paint</code> or <code>stroke</code> is * <code>null</code>, or <code>alpha</code> is not in the * specified range. */ protected Marker(int paint, float stroke, int outlinePaint, float outlineStroke, int alpha) { Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(paint); this.paint = p; this.stroke = stroke; p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(outlinePaint); this.outlinePaint = p; this.outlineStroke = outlineStroke; this.alpha = alpha; this.labelFont = new Font("SansSerif", Typeface.NORMAL, 9); p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(Color.BLACK); this.labelPaint = p; this.labelAnchor = RectangleAnchor.TOP_LEFT; this.labelOffset = new RectangleInsets(3.0, 3.0, 3.0, 3.0); this.labelOffsetType = LengthAdjustmentType.CONTRACT; this.labelTextAnchor = TextAnchor.CENTER; }
From source file:de.hackerspacebremen.fragments.StatusFragment.java
@Override public void onStart() { super.onStart(); EventBus.getDefault().register(this); // initializing the statusview holder StatusViewHolder.init(this.getView()); StatusViewHolder.get().statusLayout.setOnLongClickListener(new OnLongClickListener() { @Override//from w w w . ja v a 2s . c o m public boolean onLongClick(View v) { if (statusAnimation != null) { statusAnimation.start(); } if (messageAnimation != null) { messageAnimation.start(); } StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.GONE); StatusViewHolder.get().imgStatus.setVisibility(ImageView.VISIBLE); StatusViewHolder.get().imgConnErr.setVisibility(ImageView.GONE); final TextView text = StatusViewHolder.get().statusMessage; text.setTypeface(null, Typeface.NORMAL); text.setText(getString(R.string.fetch_status)); final TextView messageText = StatusViewHolder.get().messageText; messageText.setText(getString(R.string.fetch_message)); final TextView messageLabel = StatusViewHolder.get().messageLabel; messageLabel.setVisibility(TextView.GONE); startStatusCommunication(); return true; } }); if (this.spaceData == null) { this.startAnimation(); this.startStatusCommunication(); if (notificationRegistry == null) { this.notificationRegistry = new NotificationRegistry(this.getActivity()); } this.notificationRegistry.register(); } else { this.outputStatus(this.spaceData); } }
From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java
public void createMessage(ViewGroup l, String text, String button, View.OnClickListener onclick) { RelativeLayout r = new RelativeLayout(getActivity()); r.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); LinearLayout l2 = new LinearLayout(getActivity()); l2.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutparams.addRule(RelativeLayout.CENTER_VERTICAL); l2.setLayoutParams(layoutparams);//from w w w .ja v a 2 s. c om l2.setGravity(Gravity.CENTER_HORIZONTAL); TextView tv = new TextView(getActivity()); LinearLayout.LayoutParams tvparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); tv.setLayoutParams(tvparams); tv.setText(text); tv.setTextSize(23); tv.setPadding(0, 0, 0, toPixels(15)); l2.addView(tv); if (button != null) { Button b = new Button(getActivity()); LinearLayout.LayoutParams bparams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); bparams.setMargins(toPixels(4), toPixels(0), toPixels(4), toPixels(4)); b.setLayoutParams(bparams); b.setId(R.id.reload_button); b.setText(button); b.setTextSize(23); b.setAllCaps(false); b.setTypeface(null, Typeface.NORMAL); b.setOnClickListener(onclick); l2.addView(b); } r.addView(l2); l.addView(r); }