List of usage examples for android.graphics Typeface SANS_SERIF
Typeface SANS_SERIF
To view the source code for android.graphics Typeface SANS_SERIF.
Click Source Link
From source file:com.mschlauch.comfortreader.FullscreenActivity.java
public void retreiveSavedOptions() { switchofallmenus = true;// ww w. j ava 2s . c o m spinner.setVisibility(View.VISIBLE); String eins = ""; new AsyncTask<String, Void, String>() { @Override protected String doInBackground(String... urlStr) { // do stuff on non-UI thread settingsload.reloadSelectedBook(); wordsperminute = settingsload.getWordsPerMinute(); segmenterObject.minblocksize = settingsload.getMinBlockSize(); segmenterObject.maxblocksize = settingsload.getMaxBlockSize(); segmenterObject.textcolor = settingsload.getTextColor(); segmenterObject.emphasiscolor = settingsload.getFocusColor(); segmenterObject.backgroundcolor = settingsload.getBackgroundColor(); segmenterObject.maxcharactersperline = settingsload.getMaxBlockSize(); segmenterObject.loadPreviewcolorString(); int actual = settingsload.getGlobalPosition(); segmenterObject.globalposition = actual; segmenterObject.globalpositionbefore = actual; //Load Content String text = settingsload.getTexttoRead() + ""; String textdefault = getString(R.string.support_standarttext); Log.i("fullscreen", "text is: " + text); segmenterObject.loadTexttoRead(textdefault); if (text.equals("standarttext")) { segmenterObject.loadTexttoRead(textdefault); segmenterObject.globalposition = 0; segmenterObject.emphasiscolor = Color.parseColor("#ffee00"); segmenterObject.textcolor = Color.parseColor("#ffffff"); } else { segmenterObject.loadTexttoRead(text); } if (text.length() > 16) { } else { //it is importanted that the default text is already segmentable. } Log.i("fullscreen 2", " real text is: " + segmenterObject.texttoread); segmenterObject.loadallprehtmls(); String out = ""; return out; } @Override protected void onPostExecute(String htmlCode) { // do stuff on UI thread with the html contentView.setTextSize(settingsload.getFontSize()); contentView.setBackgroundColor(settingsload.getBackgroundColor()); String parole = settingsload.getOrientationMode(); Log.i("Fullscreen", "orientation loading" + parole); if (parole.equals("1")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else if (parole.equals("2")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } else if (parole.equals("0")) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } parole = settingsload.getFontName(); Log.i("Fullscreen", "orientation loading" + parole); if (parole.equals("sans")) { contentView.setTypeface(Typeface.SANS_SERIF); } else if (parole.equals("serif")) { contentView.setTypeface(Typeface.SERIF); } else if (parole.equals("mono")) { contentView.setTypeface(Typeface.MONOSPACE); } spinner.setVisibility(View.GONE); switchofallmenus = false; previousButtonClicked(null); nextButtonClicked(null); } }.execute(eins); //Line Spacing... // contentView.setLineSpacing(0,(float) 1.28); //actual = retrieveNumber("maxlinelength"); //settingsload.adjustGlobalPositionToPercentage(settingsload.getGlobalPositionSeekbarValue()); //Log.i("fullscreen", "globalposition:" + actual); // get the seekbar etc right... // startdialog(); }
From source file:com.jjoe64.graphview_demos.fragments.Home.java
void loadDefaultSettingValues() { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); String res = pref.getString("display_list", Integer.toString(DISP_CHAR)); mDisplayType = Integer.valueOf(res); res = pref.getString("fontsize_list", Integer.toString(12)); mTextFontSize = Integer.valueOf(res); res = pref.getString("typeface_list", Integer.toString(3)); switch (Integer.valueOf(res)) { case 0:// ww w. j av a 2 s. co m mTextTypeface = Typeface.DEFAULT; break; case 1: mTextTypeface = Typeface.SANS_SERIF; break; case 2: mTextTypeface = Typeface.SERIF; break; case 3: mTextTypeface = Typeface.MONOSPACE; break; } mTvSerial.setTypeface(mTextTypeface); //etWrite.setTypeface(mTextTypeface); res = pref.getString("readlinefeedcode_list", Integer.toString(LINEFEED_CODE_CRLF)); mReadLinefeedCode = Integer.valueOf(res); res = pref.getString("writelinefeedcode_list", Integer.toString(LINEFEED_CODE_CRLF)); mWriteLinefeedCode = Integer.valueOf(res); res = pref.getString("email_edittext", "@gmail.com"); mEmailAddress = res; res = pref.getString("baudrate_list", Integer.toString(57600)); mBaudrate = Integer.valueOf(res); res = pref.getString("databits_list", Integer.toString(UartConfig.DATA_BITS8)); mDataBits = Integer.valueOf(res); res = pref.getString("parity_list", Integer.toString(UartConfig.PARITY_NONE)); mParity = Integer.valueOf(res); res = pref.getString("stopbits_list", Integer.toString(UartConfig.STOP_BITS1)); mStopBits = Integer.valueOf(res); res = pref.getString("flowcontrol_list", Integer.toString(UartConfig.FLOW_CONTROL_OFF)); mFlowControl = Integer.valueOf(res); }
From source file:com.egloos.hyunyi.musicinfo.LinkPopUp.java
private void displayArtistInfo(JSONObject j) throws JSONException { if (imageLoader == null) imageLoader = ImageLoader.getInstance(); if (!imageLoader.isInited()) imageLoader.init(config);//from ww w.jav a 2 s . c o m Log.i("musicInfo", "LinkPopUp. displayArtistInfo " + j.toString()); //JSONObject j_artist_info = j.getJSONObject("artist"); final String artist_name = j.getString("name"); tArtistName.setText(artist_name); final JSONObject urls = j.optJSONObject("urls"); final JSONArray videos = j.optJSONArray("video"); final JSONArray images = j.optJSONArray("images"); final String msg = artist_name.replaceAll("\\p{Punct}", " ").replaceAll("\\p{Space}", "+"); AsyncHttpClient client = new AsyncHttpClient(); String fmURL = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=" + msg + "&autocorrect[1]&format=json&api_key=ca4c10f9ae187ebb889b33ba12da7ee9"; Log.i("musicInfo", fmURL); client.get(fmURL, new AsyncHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { String r = new String(responseBody); ArrayList<String> image_urls = new ArrayList<String>(); try { Log.i("musicInfo", "Communicating with LastFM..."); JSONObject json = new JSONObject(r); Log.i("musicInfo", json.toString()); json = json.getJSONObject("artist"); Log.i("musicInfo", json.toString()); JSONArray artist_images = json.optJSONArray("image"); Log.i("musicInfo", artist_images.toString()); for (int i = 0; i < artist_images.length(); i++) { JSONObject j = artist_images.getJSONObject(i); Log.i("musicInfo", j.optString("size")); if (j.optString("size").contains("extralarge")) { image_urls.add(j.optString("#text")); //b.putString("fm_image", j.getString("#text")); //Log.i("musicInfo", j.getString("#text")); break; } } } catch (JSONException e) { e.printStackTrace(); } if (images != null) { for (int i = 0; i < images.length(); i++) { JSONObject image = null; try { image = images.getJSONObject(i); } catch (JSONException e) { e.printStackTrace(); } int width = image.optInt("width", 0); int height = image.optInt("height", 0); String url = image.optString("url", ""); Log.i("musicInfo", i + ": " + url); if ((width * height > 10000) && (width * height < 100000) && (!url.contains("userserve-ak"))) { //if ((width>300&&width<100)&&(height>300&&height<1000)&&(!url.contains("userserve-ak"))) { image_urls.add(url); Log.i("musicInfo", "Selected: " + url); //available_images.put(image); } } } int random = (int) (Math.random() * image_urls.size()); final String f_url = image_urls.get(random); Log.i("musicInfo", "Total image#=" + image_urls.size() + " Selected image#=" + random + " " + f_url); if (image_urls.size() > 0) { imageLoader.displayImage(f_url, ArtistImage, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { lLinkList.removeAllViews(); //String attr = fImage.optJSONObject("license").optString("attribution"); //tAttribution.setText("Credit. " + ((attr == null) || (attr.contains("n/a")) ? "Unknown" : attr)); if (urls != null) { String[] jsonName = { "wikipedia_url", "mb_url", "lastfm_url", "official_url", "twitter_url" }; for (int i = 0; i < jsonName.length; i++) { if ((urls.optString(jsonName[i]) != null) && (urls.optString(jsonName[i]) != "")) { Log.d("musicinfo", "Link URL: " + urls.optString(jsonName[i])); TextView tv = new TextView(getApplicationContext()); tv.setTextSize(11); tv.setPadding(16, 16, 16, 16); tv.setTextColor(Color.LTGRAY); tv.setTypeface(Typeface.SANS_SERIF); tv.setGravity(Gravity.CENTER_VERTICAL); switch (jsonName[i]) { case "official_url": tv.setText("HOME."); break; case "wikipedia_url": tv.setText("WIKI."); break; case "mb_url": tv.setText("Music Brainz."); break; case "lastfm_url": tv.setText("Last FM."); break; case "twitter_url": tv.setText("Twitter."); break; } try { tv.setTag(urls.getString(jsonName[i])); } catch (JSONException e) { e.printStackTrace(); } tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse((String) v.getTag())); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); Toast.makeText(getApplicationContext(), "Open the Link...", Toast.LENGTH_SHORT).show(); //finish(); } }); lLinkList.addView(tv); } } } else { TextView tv = new TextView(getApplicationContext()); tv.setTextSize(11); tv.setPadding(16, 16, 16, 16); tv.setTextColor(Color.LTGRAY); tv.setTypeface(Typeface.SANS_SERIF); tv.setGravity(Gravity.CENTER_VERTICAL); tv.setText("Sorry, No Link Here..."); lLinkList.addView(tv); } if (videos != null) { jVideoArray = videos; mAdapter = new StaggeredViewAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, generateImageData(videos)); //if (mData == null) { mData = generateImageData(videos); //} //mAdapter.clear(); for (JSONObject data : mData) { mAdapter.add(data); } mGridView.setAdapter(mAdapter); } else { } adjBottomColor(((ImageView) view).getDrawable()); } @Override public void onLoadingCancelled(String imageUri, View view) { } }); } else { ArtistImage.setImageResource(R.drawable.lamb_no_image_available); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { } }); }
From source file:com.example.drugsformarinemammals.General_Info_Drug.java
public void createTextViewAnatomical() { anatomicalGroup = new TextView(this); anatomicalGroup.setTextSize(18);/* w w w. ja va 2s . co m*/ anatomicalGroup.setTypeface(Typeface.SANS_SERIF); }
From source file:com.example.drugsformarinemammals.General_Info_Drug.java
public void createTextViewTherapeutic() { therapeuticGroup = new TextView(this); therapeuticGroup.setTextSize(18);/*ww w. j ava2 s . co m*/ therapeuticGroup.setTypeface(Typeface.SANS_SERIF); }
From source file:org.appcelerator.titanium.util.TiUIHelper.java
public static Typeface toTypeface(final Context context, String fontFamily, String weight) { Typeface tf = Typeface.SANS_SERIF; // default if (weight != null) { if (fontFamily == null && weight != "regular") { fontFamily = "sans-serif-" + weight.toLowerCase(); } else {/*from w w w. j av a 2 s . c o m*/ fontFamily += "-" + weight.toLowerCase(); } } if (fontFamily != null) { if ("monospace".equals(fontFamily)) { tf = Typeface.MONOSPACE; } else if ("serif".equals(fontFamily)) { tf = Typeface.SERIF; } else if ("sans-serif".equals(fontFamily)) { tf = Typeface.SANS_SERIF; } else { Typeface loadedTf = null; if (context != null) { try { loadedTf = loadTypeface(context, fontFamily); } catch (Exception e) { loadedTf = null; Log.e(TAG, "Unable to load font " + fontFamily + ": " + e.getMessage()); } } if (loadedTf == null) { Log.w(TAG, "Unsupported font: '" + fontFamily + "' supported fonts are 'monospace', 'serif', 'sans-serif'.", Log.DEBUG_MODE); } else { tf = loadedTf; } } } return tf; }
From source file:com.aujur.ebookreader.Configuration.java
private FontFamily getFontFamily(String fontKey, String defaultVal) { String fontFace = settings.getString(fontKey, defaultVal); if (!fontCache.containsKey(fontFace)) { if ("gen_book_bas".equals(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "GentiumBookBasic")); } else if ("gen_bas".equals(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "GentiumBasic")); } else if ("frankruehl".equalsIgnoreCase(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "FrankRuehl")); } else {/*from www . j a v a2 s. co m*/ Typeface face = Typeface.SANS_SERIF; if ("sans".equals(fontFace)) { face = Typeface.SANS_SERIF; } else if ("serif".equals(fontFace)) { face = Typeface.SERIF; } else if ("mono".equals(fontFace)) { face = Typeface.MONOSPACE; } fontCache.put(fontFace, new FontFamily(fontFace, face)); } } return fontCache.get(fontFace); }
From source file:com.crearo.gpslogger.GpsMainActivity.java
private void refreshProfileIcon(String profileName) { ImageView imgLetter = (ImageView) drawerHeader.getView().findViewById(R.id.profiletextletter); TextDrawable drawLetter = TextDrawable.builder().beginConfig().bold() .textColor(getResources().getColor(R.color.golden)).useFont(Typeface.SANS_SERIF).endConfig() .buildRound(profileName.substring(0, 1).toUpperCase(), getResources().getColor(R.color.primaryColorLight)); imgLetter.setImageDrawable(drawLetter); }
From source file:com.jjoe64.graphview_demos.fragments.CollectData.java
void loadDefaultSettingValues() { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); String res = pref.getString("display_list", Integer.toString(DISP_CHAR)); mDisplayType = Integer.valueOf(res); res = pref.getString("fontsize_list", Integer.toString(12)); mTextFontSize = Integer.valueOf(res); res = pref.getString("typeface_list", Integer.toString(3)); switch (Integer.valueOf(res)) { case 0://from w w w. ja v a2 s .c om mTextTypeface = Typeface.DEFAULT; break; case 1: mTextTypeface = Typeface.SANS_SERIF; break; case 2: mTextTypeface = Typeface.SERIF; break; case 3: mTextTypeface = Typeface.MONOSPACE; break; } mTvSerial.setTypeface(mTextTypeface); //etWrite.setTypeface(mTextTypeface); res = pref.getString("readlinefeedcode_list", Integer.toString(LINEFEED_CODE_CRLF)); mReadLinefeedCode = Integer.valueOf(res); res = pref.getString("writelinefeedcode_list", Integer.toString(LINEFEED_CODE_CRLF)); mWriteLinefeedCode = Integer.valueOf(res); res = pref.getString("email_edittext", "@gmail.com"); mEmailAddress = res; res = pref.getString("baudrate_list", Integer.toString(57600)); mBaudrate = Integer.valueOf(res); res = pref.getString("databits_list", Integer.toString(UartConfig.DATA_BITS8)); mDataBits = Integer.valueOf(res); res = pref.getString("parity_list", Integer.toString(UartConfig.PARITY_NONE)); mParity = Integer.valueOf(res); res = pref.getString("stopbits_list", Integer.toString(UartConfig.STOP_BITS1)); mStopBits = Integer.valueOf(res); res = pref.getString("flowcontrol_list", Integer.toString(UartConfig.FLOW_CONTROL_OFF)); mFlowControl = Integer.valueOf(res); }
From source file:org.eurekapp.pageturner.Configuration.java
private FontFamily getFontFamily(String fontKey, String defaultVal) { String fontFace = settings.getString(fontKey, defaultVal); if (!fontCache.containsKey(fontFace)) { if ("gen_book_bas".equals(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "GentiumBookBasic")); } else if ("gen_bas".equals(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "GentiumBasic")); } else if ("frankruehl".equalsIgnoreCase(fontFace)) { fontCache.put(fontFace, loadFamilyFromAssets(fontFace, "FrankRuehl")); } else {/*from ww w .ja v a 2 s .c o m*/ Typeface face = Typeface.SANS_SERIF; if ("sans".equals(fontFace)) { face = Typeface.SANS_SERIF; } else if ("serif".equals(fontFace)) { face = Typeface.SERIF; } else if ("mono".equals(fontFace)) { face = Typeface.MONOSPACE; } else if ("default".equals(fontFace)) { face = Typeface.DEFAULT; } fontCache.put(fontFace, new FontFamily(fontFace, face)); } } return fontCache.get(fontFace); }