List of usage examples for android.graphics Typeface DEFAULT
Typeface DEFAULT
To view the source code for android.graphics Typeface DEFAULT.
Click Source Link
From source file:net.bither.fragment.hot.PeerListFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new ArrayAdapter<Peer>(activity, 0) { @Override//from ww w .j a v a 2 s .c o m public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = getLayoutInflater(null).inflate(R.layout.fragment_peer_list_row, null); final Peer peer = getItem(position); final boolean isDownloading = peer.getDownloadData(); final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); rowIp.setText(hostname != null ? hostname : address.getHostAddress()); final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height); final long bestHeight = peer.getDisplayLastBlockHeight(); rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null); rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version); rowVersion.setText(peer.getSubVersion()); rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol); rowProtocol.setText("protocol: " + peer.getClientVersion()); rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping); final long pingTime = peer.pingTime; rowPing.setText( pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; } @Override public boolean isEnabled(final int position) { return false; } }; setListAdapter(adapter); loaderManager.initLoader(ID_PEER_LOADER, null, peerLoaderCallbacks); }
From source file:com.layer_net.stepindicator.StepIndicator.java
private void init(Context context, AttributeSet attributeSet) { initAttributes(context, attributeSet); paint = new Paint(); pStoke = new Paint(); pText = new Paint(); paint.setColor(stepColor);/*from w w w .j a v a 2s .co m*/ paint.setFlags(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth(lineWidth); pStoke.setColor(stepColor); pStoke.setStrokeWidth(strokeWidth); pStoke.setStyle(Paint.Style.STROKE); pStoke.setFlags(Paint.ANTI_ALIAS_FLAG); pText.setColor(textColor); pText.setTextSize(radius); pText.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); pText.setTextAlign(Paint.Align.CENTER); pText.setFlags(Paint.ANTI_ALIAS_FLAG); setMinimumHeight(radius * 3); Color.colorToHSV(currentColor, hsvCurrent); Color.colorToHSV(backgroundColor, hsvBG); Color.colorToHSV(stepColor, hsvProgress); invalidate(); }
From source file:biz.wiz.android.wallet.ui.PeerListFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new ArrayAdapter<Peer>(activity, 0) { private final LayoutInflater inflater = LayoutInflater.from(activity); @Override//from ww w . j ava2 s. co m public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = inflater.inflate(R.layout.peer_list_row, null); final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.getDownloadData(); final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); rowIp.setText(hostname != null ? hostname : address.getHostAddress()); final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height); final long bestHeight = peer.getBestHeight(); rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null); rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version); rowVersion.setText(versionMessage.subVer); rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol); rowProtocol.setText("protocol: " + versionMessage.clientVersion); rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping); final long pingTime = peer.getPingTime(); rowPing.setText( pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; } @Override public boolean isEnabled(final int position) { return false; } }; setListAdapter(adapter); }
From source file:cc.mintcoin.wallet.ui.PeerListFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new ArrayAdapter<Peer>(activity, 0) { @Override/* w ww. j av a 2s . c om*/ public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = getLayoutInflater(null).inflate(R.layout.peer_list_row, null); final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.getDownloadData(); final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); rowIp.setText(hostname != null ? hostname : address.getHostAddress()); final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height); final long bestHeight = peer.getBestHeight(); rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null); rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version); rowVersion.setText(versionMessage.subVer); rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol); rowProtocol.setText("protocol: " + versionMessage.clientVersion); rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping); final long pingTime = peer.getPingTime(); rowPing.setText( pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; } @Override public boolean isEnabled(final int position) { return false; } }; setListAdapter(adapter); }
From source file:com.cannabiscoin.wallet.ui.PeerListFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); adapter = new ArrayAdapter<Peer>(activity, 0) { @Override//from ww w.jav a2 s .c om public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = getLayoutInflater(null).inflate(R.layout.peer_list_row, null); final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.getDownloadData(); final TextView rowIp = (TextView) row.findViewById(R.id.peer_list_row_ip); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); rowIp.setText(/*address.toString()*/hostname != null ? hostname : address.getHostAddress()); final TextView rowHeight = (TextView) row.findViewById(R.id.peer_list_row_height); final long bestHeight = peer.getBestHeight(); rowHeight.setText(bestHeight > 0 ? bestHeight + " blocks" : null); rowHeight.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowVersion = (TextView) row.findViewById(R.id.peer_list_row_version); rowVersion.setText(versionMessage.subVer); rowVersion.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowProtocol = (TextView) row.findViewById(R.id.peer_list_row_protocol); rowProtocol.setText("protocol: " + versionMessage.clientVersion); rowProtocol.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final TextView rowPing = (TextView) row.findViewById(R.id.peer_list_row_ping); final long pingTime = peer.getPingTime(); rowPing.setText( pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); rowPing.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); return row; } @Override public boolean isEnabled(final int position) { return false; } }; setListAdapter(adapter); }
From source file:org.creativecommons.thelist.fragments.AccountFragment.java
@Override public void onResume() { super.onResume(); mContext = getActivity();//w w w .j a va 2 s .c o m mMessageHelper = new MessageHelper(mContext); //Get account information String accountName = getActivity().getIntent().getStringExtra(ARG_ACCOUNT_NAME); final String accountType = getActivity().getIntent().getStringExtra(ARG_ACCOUNT_TYPE); mAuthTokenType = getActivity().getIntent().getStringExtra(ARG_AUTH_TYPE); if (mAuthTokenType == null) mAuthTokenType = AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS; if (accountName != null) { ((EditText) getView().findViewById(R.id.accountName)).setText(accountName); } //UI Elements final Button cancelButton = (Button) getView().findViewById(R.id.cancelButton); final Button loginButton = (Button) getView().findViewById(R.id.loginButton); final Button signUpButton = (Button) getView().findViewById(R.id.signUpButton); final EditText accountEmailField = (EditText) getView().findViewById(R.id.accountName); final EditText accountPasswordField = (EditText) getView().findViewById(R.id.accountPassword); accountPasswordField.setTypeface(Typeface.DEFAULT); final TextView newAccountButton = (TextView) getView().findViewById(R.id.signUp); //Try Login on Click loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String accountEmail = accountEmailField.getText().toString().trim(); final String accountPassword = accountPasswordField.getText().toString().trim(); if (accountEmail.isEmpty() || accountPassword.isEmpty()) { mMessageHelper.showDialog(mContext, getString(R.string.login_error_title), getString(R.string.login_error_message)); } else { ListUser mCurrentUser = new ListUser(getActivity()); try { mCurrentUser.userSignIn(accountEmail, accountPassword, mAuthTokenType, new ListUser.AuthCallback() { @Override public void onSuccess(String authtoken) { //TODO: authtoken stuff Bundle data = new Bundle(); data.putString(AccountManager.KEY_ACCOUNT_NAME, accountEmail); data.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType); data.putString(AccountManager.KEY_AUTHTOKEN, authtoken); data.putString(PARAM_USER_PASS, accountPassword); //Create Bundle to create Account mCallback.onUserSignedIn(data); } }); } catch (Exception e) { Log.d("LoginFragment", e.getMessage()); //data.putString(KEY_ERROR_MESSAGE, e.getMessage()); } } } }); //Actually I need an account --> show user Sign Up Button if (newAccountButton != null) { newAccountButton.setMovementMethod(LinkMovementMethod.getInstance()); } //TODO: hide loginButton and show signUpButton // newAccountButton.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // //loginButton.setVisibility(View.GONE); // //signUpButton.setVisibility(View.VISIBLE); // } // }); //Cancel Activity cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mCallback.onCancelLogin(); } }); //TODO: do when we have register user // signUpButton.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // //TODO:userSignUp // final String accountEmail = accountEmailField.getText().toString().trim(); // final String accountPassword = accountPasswordField.getText().toString().trim(); // // if (accountEmail.isEmpty() || accountPassword.isEmpty()) { // mMessageHelper.showDialog(mContext, getString(R.string.login_error_title), // getString(R.string.login_error_message)); // } else { // //TODO: Login User + save to sharedPreferences // ListUser mCurrentUser = new ListUser(getActivity()); // try { // mCurrentUser.userSignUp(accountEmail, accountPassword, mAuthTokenType, new ListUser.AuthCallback() { // @Override // public void onSuccess(String authtoken) { // // Bundle data = new Bundle(); // // data.putString(AccountManager.KEY_ACCOUNT_NAME, accountEmail); // data.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType); // data.putString(AccountManager.KEY_AUTHTOKEN, authtoken); // data.putString(PARAM_USER_PASS, accountPassword); // // mCallback.onUserSignedUp(data); // } // }); // } catch (Exception e) { // Log.d("LoginFragment", e.getMessage()); // } // } // } // }); }
From source file:piuk.blockchain.android.ui.WalletTransactionsFragment.java
public void initAdapter() { adapter = new ArrayAdapter<Transaction>(activity, 0) { final DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(activity); final DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(activity); final int colorSignificant = getResources().getColor(R.color.significant); final int colorInsignificant = getResources().getColor(R.color.insignificant); final int colorSent = getResources().getColor(R.color.color_sent); final int colorReceived = getResources().getColor(R.color.color_received); @Override/* www.j av a2s . co m*/ public View getView(final int position, View row, final ViewGroup parent) { if (row == null) row = getLayoutInflater(null).inflate(R.layout.transaction_row, null); final CurrencyAmountView rowValue = (CurrencyAmountView) row .findViewById(R.id.transaction_row_value); final TextView rowLabel = (TextView) row.findViewById(R.id.transaction_row_address); final TextView rowTime = (TextView) row.findViewById(R.id.transaction_row_time); try { synchronized (adapter) { final Transaction tx = getItem(position); if (tx.getHash() == null) { rowLabel.setTextColor(Color.BLACK); rowLabel.setText(R.string.no_transactions); rowLabel.setTypeface(Typeface.DEFAULT); rowLabel.setTextColor(Color.BLACK); rowTime.setVisibility(View.INVISIBLE); rowValue.setVisibility(View.INVISIBLE); rowLabel.setGravity(Gravity.CENTER); return row; } else { rowTime.setVisibility(View.VISIBLE); rowValue.setVisibility(View.VISIBLE); rowLabel.setGravity(Gravity.LEFT); final TransactionConfidence confidence = tx.getConfidence(); final ConfidenceType confidenceType = confidence.getConfidenceType(); try { BigInteger value = null; if (tx instanceof MyTransaction) { value = ((MyTransaction) tx).getResult(); } else { value = tx.getValue(application.bitcoinjWallet); } final boolean sent = value.signum() < 0; final int textColor; if (confidenceType == ConfidenceType.NOT_SEEN_IN_CHAIN) { textColor = colorInsignificant; } else if (confidenceType == ConfidenceType.BUILDING) { textColor = colorSignificant; } else if (confidenceType == ConfidenceType.NOT_IN_BEST_CHAIN) { textColor = colorSignificant; } else if (confidenceType == ConfidenceType.DEAD) { textColor = Color.RED; } else { textColor = colorInsignificant; } final String address; if (sent) if (tx.getOutputs().size() == 0) address = "Unknown"; else address = tx.getOutputs().get(0).getScriptPubKey().getToAddress() .toString(); else if (tx.getInputs().size() == 0) address = "Generation"; else address = tx.getInputs().get(0).getFromAddress().toString(); String label = null; if (tx instanceof MyTransaction && ((MyTransaction) tx).getTag() != null) label = ((MyTransaction) tx).getTag(); else label = AddressBookProvider.resolveLabel(activity.getContentResolver(), address); final Date time = tx.getUpdateTime(); rowTime.setText( time != null ? (DateUtils.isToday(time.getTime()) ? timeFormat.format(time) : dateFormat.format(time)) : null); rowTime.setTextColor(textColor); rowLabel.setTextColor(textColor); rowLabel.setText(label != null ? label : address); rowLabel.setTypeface(label != null ? Typeface.DEFAULT : Typeface.MONOSPACE); rowValue.setCurrencyCode(null); rowValue.setAmountSigned(true); rowValue.setTextColor(textColor); rowValue.setAmount(value); if (sent) { rowValue.setTextColor(colorSent); } else { rowValue.setTextColor(colorReceived); } return row; } catch (final ScriptException x) { throw new RuntimeException(x); } } } } catch (Exception e) { e.printStackTrace(); rowLabel.setTextColor(Color.BLACK); rowLabel.setText(R.string.unknown_error); rowLabel.setTypeface(Typeface.DEFAULT); rowLabel.setTextColor(Color.BLACK); rowLabel.setGravity(Gravity.CENTER); rowTime.setVisibility(View.INVISIBLE); rowValue.setVisibility(View.INVISIBLE); return row; } } }; setAdapterContent(); setListAdapter(adapter); }
From source file:com.dictionary.codebhak.LangTextView.java
/** * Sets the typeface to the value selected in the preference. * @param context the {@link Context} to use */// w ww . j av a 2s .co m private void setTypeface(Context context) { if (robotoTypefacePreferenceSet(context)) { setTypeface(Typeface.DEFAULT); } else if (!isInEditMode() && !TextUtils.isEmpty(NOTO_SERIF)) { Typeface typeface = sTypefaceCache.get(NOTO_SERIF); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), "fonts/" + NOTO_SERIF); // Cache the Typeface object sTypefaceCache.put(NOTO_SERIF, typeface); } setTypeface(typeface); // Note: This flag is required for proper typeface rendering setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } }
From source file:com.grarak.kerneladiutor.elements.SplashView.java
private void draw(Canvas canvas, int x, int y, int radius) { if (radius > 0) canvas.drawCircle(x / 2, y / 2, radius, mPaintCircle); matrix.postRotate(rotate);/*from ww w. j av a 2s.c o m*/ Bitmap iconRotate = Bitmap.createBitmap(icon, 0, 0, icon.getWidth(), icon.getHeight(), matrix, false); canvas.drawBitmap(iconRotate, x / 2 - iconRotate.getWidth() / 2, y / 2 - iconRotate.getHeight() / 2, mPaintCircle); TextPaint textPaint = new TextPaint(); textPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); textPaint.setColor(textColor); textPaint.setAntiAlias(true); textPaint.setTextAlign(Paint.Align.CENTER); textPaint.setTextSize(textSize); float textHeight = textPaint.descent() - textPaint.ascent(); float textOffset = (textHeight / 2) - textPaint.descent(); canvas.drawText(getResources().getString(R.string.root_waiting), x / 2, y - textOffset - y / 4, textPaint); }
From source file:com.philliphsu.bottomsheetpickers.time.grid.NumbersGrid.java
/** * Clear the selection indicator on the last selected view. Clearing the indicator * reverts the text color back to its default. *//*from w w w . j a v a 2s . com*/ protected void clearIndicator() { if (mLastSelectedView != null) { TextView tv = (TextView) mLastSelectedView; tv.setTextColor(mDefaultTextColor); tv.setTypeface(Utils.isJellybeanOrLater() ? Utils.SANS_SERIF_LIGHT : Typeface.DEFAULT); mLastSelectedView = null; } }