List of usage examples for android.graphics Typeface DEFAULT_BOLD
Typeface DEFAULT_BOLD
To view the source code for android.graphics Typeface DEFAULT_BOLD.
Click Source Link
From source file:org.nativescript.widgets.TabLayout.java
/** * Create a default view to be used for tabs. *//* w ww . j a va 2s.c o m*/ protected View createDefaultTabView(Context context, TabItemSpec tabItem) { float density = getResources().getDisplayMetrics().density; int padding = (int) (TAB_VIEW_PADDING_DIPS * density); LinearLayout ll = new LinearLayout(context); ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); ll.setGravity(Gravity.CENTER); ll.setOrientation(LinearLayout.VERTICAL); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); ll.setBackgroundResource(outValue.resourceId); ImageView imgView = new ImageView(context); imgView.setScaleType(ScaleType.FIT_CENTER); LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); imgLP.gravity = Gravity.CENTER; imgView.setLayoutParams(imgLP); TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setMaxWidth((int) (TEXT_MAX_WIDTH * density)); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setAllCaps(true); textView.setMaxLines(2); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); textView.setPadding(padding, 0, padding, 0); this.setupItem(ll, textView, imgView, tabItem); ll.addView(imgView); ll.addView(textView); return ll; }
From source file:com.development.jaba.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./*from ww w .jav a 2s . co m*/ */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); // By default use the unselected title color. textView.setTextColor(mTitleColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:de.tudarmstadt.informatik.secuso.phishedu2.MainActivity.java
@Override public void displayToastScore(int score) { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.fragment_toast_score, (ViewGroup) findViewById(R.id.toast_layout_root)); String scoreString = Integer.toString(score); TextView text = (TextView) layout.findViewById(R.id.text); if (score < 0) { // red//from w w w. ja v a 2 s . co m text.setTextColor(Color.rgb(135, 0, 0)); } else { // green text.setTextColor(Color.rgb(0, 135, 0)); scoreString = "+ " + score; } text.setText(getString(R.string.scoreString, scoreString)); // scoreString + " Punkte" text.setTypeface(Typeface.DEFAULT_BOLD); Toast toast = new Toast(getApplicationContext()); toast.setDuration(Toast.LENGTH_SHORT); toast.setView(layout); toast.show(); }
From source file:com.example.abner.dynamicfragment.view.CustomSlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./* ww w .j av a2 s.c o m*/ */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(dTextColor); // mTextSize is sp textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); if (mNeedBold) { textView.setTypeface(Typeface.DEFAULT_BOLD); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); if (mShouldExpand) { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.width = 0; layoutParams.weight = 1; textView.setLayoutParams(layoutParams); } return textView; }
From source file:com.markupartist.sthlmtraveling.ui.view.TripView.java
public void updateViews() { this.setOrientation(VERTICAL); float scale = getResources().getDisplayMetrics().density; this.setPadding(getResources().getDimensionPixelSize(R.dimen.list_horizontal_padding), getResources().getDimensionPixelSize(R.dimen.list_vertical_padding), getResources().getDimensionPixelSize(R.dimen.list_horizontal_padding), getResources().getDimensionPixelSize(R.dimen.list_vertical_padding)); LinearLayout timeStartEndLayout = new LinearLayout(getContext()); TextView timeStartEndText = new TextView(getContext()); timeStartEndText.setText(DateTimeUtil.routeToTimeDisplay(getContext(), trip)); timeStartEndText.setTextColor(ContextCompat.getColor(getContext(), R.color.body_text_1)); timeStartEndText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); ViewCompat.setPaddingRelative(timeStartEndText, 0, 0, 0, (int) (2 * scale)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { if (RtlUtils.isRtl(Locale.getDefault())) { timeStartEndText.setTextDirection(View.TEXT_DIRECTION_RTL); }//from ww w . j a va 2 s. co m } // Check if we have Realtime for start and or end. boolean hasRealtime = false; Pair<Date, RealTimeState> transitTime = trip.departsAt(true); if (transitTime.second != RealTimeState.NOT_SET) { hasRealtime = true; } else { transitTime = trip.arrivesAt(true); if (transitTime.second != RealTimeState.NOT_SET) { hasRealtime = true; } } // if (hasRealtime) { // ImageView liveDrawable = new ImageView(getContext()); // liveDrawable.setImageResource(R.drawable.ic_live); // ViewCompat.setPaddingRelative(liveDrawable, 0, (int) (2 * scale), (int) (4 * scale), 0); // timeStartEndLayout.addView(liveDrawable); // // AlphaAnimation animation1 = new AlphaAnimation(0.4f, 1.0f); // animation1.setDuration(600); // animation1.setRepeatMode(Animation.REVERSE); // animation1.setRepeatCount(Animation.INFINITE); // // liveDrawable.startAnimation(animation1); // } timeStartEndLayout.addView(timeStartEndText); LinearLayout startAndEndPointLayout = new LinearLayout(getContext()); TextView startAndEndPoint = new TextView(getContext()); BidiFormatter bidiFormatter = BidiFormatter.getInstance(RtlUtils.isRtl(Locale.getDefault())); startAndEndPoint.setText(String.format("%s %s", bidiFormatter.unicodeWrap(trip.fromStop().getName()), bidiFormatter.unicodeWrap(trip.toStop().getName()))); startAndEndPoint.setTextColor(getResources().getColor(R.color.body_text_1)); // Dark gray startAndEndPoint.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { if (RtlUtils.isRtl(Locale.getDefault())) { startAndEndPoint.setTextDirection(View.TEXT_DIRECTION_RTL); } } ViewCompat.setPaddingRelative(startAndEndPoint, 0, (int) (4 * scale), 0, (int) (4 * scale)); startAndEndPointLayout.addView(startAndEndPoint); RelativeLayout timeLayout = new RelativeLayout(getContext()); LinearLayout routeChanges = new LinearLayout(getContext()); routeChanges.setGravity(Gravity.CENTER_VERTICAL); LinearLayout.LayoutParams changesLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); changesLayoutParams.gravity = Gravity.CENTER_VERTICAL; if (trip.hasAlertsOrNotes()) { ImageView warning = new ImageView(getContext()); warning.setImageResource(R.drawable.ic_trip_deviation); ViewCompat.setPaddingRelative(warning, 0, (int) (2 * scale), (int) (4 * scale), 0); routeChanges.addView(warning); } int currentTransportCount = 1; int transportCount = trip.getLegs().size(); for (Leg leg : trip.getLegs()) { if (!leg.isTransit() && transportCount > 3) { if (leg.getDistance() < 150) { continue; } } if (currentTransportCount > 1 && transportCount >= currentTransportCount) { ImageView separator = new ImageView(getContext()); separator.setImageResource(R.drawable.transport_separator); ViewCompat.setPaddingRelative(separator, 0, 0, (int) (2 * scale), 0); separator.setLayoutParams(changesLayoutParams); routeChanges.addView(separator); if (RtlUtils.isRtl(Locale.getDefault())) { ViewCompat.setScaleX(separator, -1f); } } ImageView changeImageView = new ImageView(getContext()); Drawable transportDrawable = LegUtil.getTransportDrawable(getContext(), leg); changeImageView.setImageDrawable(transportDrawable); if (RtlUtils.isRtl(Locale.getDefault())) { ViewCompat.setScaleX(changeImageView, -1f); } ViewCompat.setPaddingRelative(changeImageView, 0, 0, 0, 0); changeImageView.setLayoutParams(changesLayoutParams); routeChanges.addView(changeImageView); if (currentTransportCount <= 3) { String lineName = leg.getRouteShortName(); if (!TextUtils.isEmpty(lineName)) { TextView lineNumberView = new TextView(getContext()); lineNumberView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); RoundedBackgroundSpan roundedBackgroundSpan = new RoundedBackgroundSpan( LegUtil.getColor(getContext(), leg), Color.WHITE, ViewHelper.dipsToPix(getContext().getResources(), 4)); SpannableStringBuilder sb = new SpannableStringBuilder(); sb.append(lineName); sb.append(' '); sb.setSpan(roundedBackgroundSpan, 0, lineName.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); lineNumberView.setText(sb); ViewCompat.setPaddingRelative(lineNumberView, (int) (5 * scale), (int) (1 * scale), (int) (2 * scale), 0); lineNumberView.setLayoutParams(changesLayoutParams); routeChanges.addView(lineNumberView); } } currentTransportCount++; } TextView durationText = new TextView(getContext()); durationText.setText(DateTimeUtil.formatDetailedDuration(getResources(), trip.getDuration() * 1000)); durationText.setTextColor(ContextCompat.getColor(getContext(), R.color.body_text_1)); durationText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); durationText.setTypeface(Typeface.DEFAULT_BOLD); timeLayout.addView(routeChanges); timeLayout.addView(durationText); RelativeLayout.LayoutParams durationTextParams = (RelativeLayout.LayoutParams) durationText .getLayoutParams(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { durationTextParams.addRule(RelativeLayout.ALIGN_PARENT_END); } else { durationTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } durationText.setLayoutParams(durationTextParams); View divider = new View(getContext()); ViewGroup.LayoutParams dividerParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1); divider.setLayoutParams(dividerParams); this.addView(timeLayout); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) routeChanges.getLayoutParams(); params.height = LayoutParams.MATCH_PARENT; params.addRule(RelativeLayout.CENTER_VERTICAL); routeChanges.setLayoutParams(params); this.addView(startAndEndPointLayout); this.addView(timeStartEndLayout); if (mShowDivider) { this.addView(divider); } }
From source file:com.chao.facebookzc.widget.LoginButton.java
/** * Create the LoginButton by inflating from XML * * @see android.view.View#View(android.content.Context, android.util.AttributeSet) */// w ww . j ava 2 s . c om public LoginButton(Context context, AttributeSet attrs) { super(context, attrs); if (attrs.getStyleAttribute() == 0) { // apparently there's no method of setting a default style in xml, // so in case the users do not explicitly specify a style, we need // to use sensible defaults. this.setGravity(Gravity.CENTER); this.setTextColor(getResources().getColor(R.color.com_facebook_loginview_text_color)); this.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.com_facebook_loginview_text_size)); this.setTypeface(Typeface.DEFAULT_BOLD); if (isInEditMode()) { // cannot use a drawable in edit mode, so setting the background color instead // of a background resource. this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue)); // hardcoding in edit mode as getResources().getString() doesn't seem to work in IntelliJ loginText = "Log in with Facebook"; } else { this.setBackgroundResource(R.drawable.com_facebook_button_blue); this.setCompoundDrawablesWithIntrinsicBounds(R.drawable.com_facebook_inverse_icon, 0, 0, 0); this.setCompoundDrawablePadding(getResources() .getDimensionPixelSize(R.dimen.com_facebook_loginview_compound_drawable_padding)); this.setPadding(getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_left), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_top), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_right), getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_bottom)); } } parseAttributes(attrs); if (!isInEditMode()) { initializeActiveSessionWithCachedToken(context); } }
From source file:com.phonegap.plugins.slaveBrowser.SlaveBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load./*from ww w. j av a 2s . c o m*/ * @param jsonObject */ public String showWebPage(final String url, JSONObject options, String myNewTitle) { // Determine if we should hide the location bar. if (options != null) { showLocationBar = options.optBoolean("showLocationBar", true); } zeTitle = myNewTitle; // Create dialog in new thread Runnable runnable = new Runnable() { public void run() { dialog = new Dialog(ctx.getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(DialogInterface dialog) { try { JSONObject obj = new JSONObject(); obj.put("type", CLOSE_EVENT); sendUpdate(obj, false); } catch (JSONException e) { Log.d(LOG_TAG, "Should never happen"); } } }); LinearLayout.LayoutParams backParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams forwardParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams editParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f); LinearLayout.LayoutParams closeParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams wvParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); LinearLayout main = new LinearLayout(ctx.getContext()); main.setOrientation(LinearLayout.VERTICAL); LinearLayout toolbar = new LinearLayout(ctx.getContext()); toolbar.setOrientation(LinearLayout.HORIZONTAL); edittext = new TextView(ctx.getContext()); edittext.setId(3); edittext.setSingleLine(true); edittext.setText(zeTitle); edittext.setTextSize(TypedValue.COMPLEX_UNIT_PX, 24); edittext.setGravity(Gravity.CENTER); edittext.setTextColor(Color.DKGRAY); edittext.setTypeface(Typeface.DEFAULT_BOLD); edittext.setLayoutParams(editParams); webview = new WebView(ctx.getContext()); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); // dda: intercept calls to console.log webview.setWebChromeClient(new WebChromeClient() { public boolean onConsoleMessage(ConsoleMessage cmsg) { // check secret prefix if (cmsg.message().startsWith("MAGICHTML")) { String msg = cmsg.message().substring(9); // strip off prefix /* process HTML */ try { JSONObject obj = new JSONObject(); obj.put("type", PAGE_LOADED); obj.put("html", msg); sendUpdate(obj, true); } catch (JSONException e) { Log.d(LOG_TAG, "This should never happen"); } return true; } return false; } }); // dda: inject the JavaScript on page load webview.setWebViewClient(new SlaveBrowserClient(edittext) { public void onPageFinished(WebView view, String address) { // have the page spill its guts, with a secret prefix view.loadUrl( "javascript:console.log('MAGICHTML'+document.getElementsByTagName('html')[0].innerHTML);"); } }); webview.loadUrl(url); webview.setId(5); webview.setInitialScale(0); webview.setLayoutParams(wvParams); webview.requestFocus(); webview.requestFocusFromTouch(); toolbar.addView(edittext); if (getShowLocationBar()) { main.addView(toolbar); } main.addView(webview); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.FILL_PARENT; lp.height = WindowManager.LayoutParams.FILL_PARENT; dialog.setContentView(main); dialog.show(); dialog.getWindow().setAttributes(lp); } private Bitmap loadDrawable(String filename) throws java.io.IOException { InputStream input = ctx.getAssets().open(filename); return BitmapFactory.decodeStream(input); } }; this.ctx.runOnUiThread(runnable); return ""; }
From source file:com.tonyjs.hashtagram.ui.widget.SlidingTabLayout.java
private void scrollToTab(int tabIndex, int positionOffset) { final int tabStripChildCount = mTabStrip.getChildCount(); if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { return;//from w w w . j a v a 2 s. c o m } View selectedChild = mTabStrip.getChildAt(tabIndex); if (selectedChild != null) { for (int i = 0; i < tabStripChildCount; i++) { if (i == tabIndex) continue; TextView tv = (TextView) mTabStrip.getChildAt(i); tv.setTextColor(Color.parseColor("#e0e0e0")); tv.setTypeface(Typeface.DEFAULT); } TextView textView = (TextView) mTabStrip.getChildAt(tabIndex); textView.setTextColor(Color.WHITE); textView.setTypeface(Typeface.DEFAULT_BOLD); int targetScrollX = selectedChild.getLeft() + positionOffset; if (tabIndex > 0 || positionOffset > 0) { // If we're not at the first child and are mid-scroll, make sure we obey the offset targetScrollX -= mTitleOffset; } scrollTo(targetScrollX, 0); } }
From source file:com.manuelpeinado.numericpageindicator.NumericPageIndicator.java
@SuppressWarnings("deprecation") public NumericPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) { return;//from www . ja va2 s. com } // Load defaults from resources final Resources res = getResources(); final int defaultTextColor = res.getColor(R.color.default_page_number_indicator_text_color); final int defaultPageNumberTextColor = res .getColor(R.color.default_page_number_indicator_page_number_text_color); final boolean defaultPageNumberTextBold = res .getBoolean(R.bool.default_page_number_indicator_page_number_text_bold); final int defaultButtonPressedColor = res .getColor(R.color.default_page_number_indicator_pressed_button_color); final float defaultTopPadding = res.getDimension(R.dimen.default_page_number_indicator_top_padding); final float defaultBottomPadding = res.getDimension(R.dimen.default_page_number_indicator_bottom_padding); final float defaultTextSize = res.getDimension(R.dimen.default_page_number_indicator_text_size); final boolean defaultShowChangePageButtons = res .getBoolean(R.bool.default_page_number_indicator_show_change_page_buttons); final boolean defaultShowStartEndButtons = res .getBoolean(R.bool.default_page_number_indicator_show_start_end_buttons); final boolean defaultShowImagesForPageControls = res .getBoolean(R.bool.default_page_number_indicator_show_images_for_page_controls); // Retrieve styles attributes final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NumericPageIndicator, defStyle, 0); mTextTemplate = a.getString(R.styleable.NumericPageIndicator_textTemplate); if (mTextTemplate == null) { mTextTemplate = res.getString(R.string.default_page_number_indicator_text_template); ; } parseTextTemplate(); mTextStartButton = a.getString(R.styleable.NumericPageIndicator_startButtonText); if (mTextStartButton == null) { mTextStartButton = res.getString(R.string.default_page_number_indicator_start_button_text); } mTextEndButton = a.getString(R.styleable.NumericPageIndicator_endButtonText); if (mTextEndButton == null) { mTextEndButton = res.getString(R.string.default_page_number_indicator_end_button_text); } mTextPreviousButton = a.getString(R.styleable.NumericPageIndicator_previousButtonText); if (mTextPreviousButton == null) { mTextPreviousButton = res.getString(R.string.default_page_number_indicator_previous_button_text); } mTextNextButton = a.getString(R.styleable.NumericPageIndicator_nextButtonText); if (mTextNextButton == null) { mTextNextButton = res.getString(R.string.default_page_number_indicator_next_button_text); } // these will be null if they are unused mStartButtonImage = getBitmapFromDrawable(a.getDrawable(R.styleable.NumericPageIndicator_startButtonImage)); mEndButtonImage = getBitmapFromDrawable(a.getDrawable(R.styleable.NumericPageIndicator_endButtonImage)); mPreviousButtonImage = getBitmapFromDrawable( a.getDrawable(R.styleable.NumericPageIndicator_previousButtonImage)); mNextButtonImage = getBitmapFromDrawable(a.getDrawable(R.styleable.NumericPageIndicator_nextButtonImage)); mColorText = a.getColor(R.styleable.NumericPageIndicator_android_textColor, defaultTextColor); mColorPageNumberText = a.getColor(R.styleable.NumericPageIndicator_pageNumberTextColor, defaultPageNumberTextColor); mPageNumberTextBold = a.getBoolean(R.styleable.NumericPageIndicator_pageNumberTextBold, defaultPageNumberTextBold); mColorPressedButton = a.getColor(R.styleable.NumericPageIndicator_pressedButtonColor, defaultButtonPressedColor); mPaddingTop = a.getDimension(R.styleable.NumericPageIndicator_android_paddingTop, defaultTopPadding); mPaddingBottom = a.getDimension(R.styleable.NumericPageIndicator_android_paddingBottom, defaultBottomPadding); mPaintText.setColor(mColorText); mShowChangePageButtons = a.getBoolean(R.styleable.NumericPageIndicator_showChangePageButtons, defaultShowChangePageButtons); mShowStartEndButtons = a.getBoolean(R.styleable.NumericPageIndicator_showStartEndButtons, defaultShowStartEndButtons); mShowImagesForPageControls = a.getBoolean(R.styleable.NumericPageIndicator_showImagesForPageControls, defaultShowImagesForPageControls); mPaintButtonBackground.setColor(mColorPressedButton); final float textSize = a.getDimension(R.styleable.NumericPageIndicator_android_textSize, defaultTextSize); mPaintText.setTextSize(textSize); mPaintText.setAntiAlias(true); mPaintPageNumberText.setColor(mColorPageNumberText); mPaintPageNumberText.setTextSize(textSize); mPaintPageNumberText.setAntiAlias(true); if (mPageNumberTextBold) { mPaintPageNumberText.setTypeface(Typeface.DEFAULT_BOLD); } final Drawable background = a.getDrawable(R.styleable.NumericPageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); }
From source file:com.fishstix.dosboxfree.DBGLSurfaceView.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void setup(Context context) { mParent = (DBMain) context;// w w w. j a va2s.c o m //setRenderMode(RENDERMODE_WHEN_DIRTY); gestureScanner = new GestureDetector(context, new MyGestureDetector()); mBitmapPaint = new Paint(); mBitmapPaint.setFilterBitmap(true); mTextPaint = new Paint(); mTextPaint.setTextSize(15 * getResources().getDisplayMetrics().density); mTextPaint.setTypeface(Typeface.DEFAULT_BOLD); mTextPaint.setTextAlign(Paint.Align.CENTER); mTextPaint.setStyle(Paint.Style.FILL); mTextPaint.setSubpixelText(false); mBitmap = Bitmap.createBitmap(DEFAULT_WIDTH, DEFAULT_HEIGHT, Bitmap.Config.RGB_565); //setEGLContextClientVersion(1); mRenderer = new OpenGLRenderer(mParent); mRenderer.setBitmap(mBitmap); setRenderer(mRenderer); setRenderMode(RENDERMODE_WHEN_DIRTY); if (mGPURendering) { requestRender(); } mMouseThread = new DosBoxMouseThread(); mMouseThread.setPriority(Thread.MIN_PRIORITY); mMouseThread.setRunning(true); mMouseThread.start(); mVideoThread = new DosBoxVideoThread(); mKeyHandler = new KeyHandler(this); // Receive keyboard events requestFocus(); setFocusableInTouchMode(true); setFocusable(true); requestFocus(); requestFocusFromTouch(); getHolder().addCallback(this); getHolder().setFormat(PixelFormat.RGB_565); getHolder().setKeepScreenOn(true); if (Build.VERSION.SDK_INT >= 14) { setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); setOnSystemUiVisibilityChangeListener(new MySystemUiVisibilityChangeListener()); } else if (Build.VERSION.SDK_INT >= 11) { setSystemUiVisibility(View.STATUS_BAR_HIDDEN); setOnSystemUiVisibilityChangeListener(new MySystemUiVisibilityChangeListener()); } }