Example usage for android.graphics Typeface DEFAULT_BOLD

List of usage examples for android.graphics Typeface DEFAULT_BOLD

Introduction

In this page you can find the example usage for android.graphics Typeface DEFAULT_BOLD.

Prototype

Typeface DEFAULT_BOLD

To view the source code for android.graphics Typeface DEFAULT_BOLD.

Click Source Link

Document

The default BOLD typeface object.

Usage

From source file:mobi.wrt.android.smartcontacts.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  .  j  a v  a  2  s . c o  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.setTextColor(myColorStateList);
    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);

    return textView;
}

From source file:com.presisco.example.slidingtabsicons.slidingtabsicons.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, int)}.
 *///from  www. j  a  va2 s  . c om
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);

    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    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:com.slushpupie.deskclock.DeskClock.java

/** Called when the activity is first created. */
@Override/*from w  ww.j a  v  a  2  s.c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.main);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    layout = (LinearLayout) findViewById(R.id.layout);
    display = (DisplayView) findViewById(R.id.display);
    registerForContextMenu(display);
    display.setOnTouchListener(this);
    display.setOnClickListener(this);

    fonts = new Typeface[17];
    fonts[0] = Typeface.DEFAULT_BOLD;
    fonts[1] = Typeface.SANS_SERIF;
    fonts[2] = Typeface.SERIF;
    fonts[3] = Typeface.MONOSPACE;
    fonts[4] = Typeface.createFromAsset(getAssets(), "fonts/Abduction2000.ttf");
    fonts[5] = Typeface.createFromAsset(getAssets(), "fonts/DSPoint.ttf");
    fonts[6] = Typeface.createFromAsset(getAssets(), "fonts/DSTerminal.ttf");
    fonts[7] = Typeface.createFromAsset(getAssets(), "fonts/DT104.ttf");
    fonts[8] = Typeface.createFromAsset(getAssets(), "fonts/Delusion.ttf");
    fonts[9] = Typeface.createFromAsset(getAssets(), "fonts/jd_scarabeo.ttf");
    fonts[10] = Typeface.createFromAsset(getAssets(), "fonts/stencilla.ttf");
    fonts[11] = Typeface.createFromAsset(getAssets(), "fonts/Digital2.ttf");
    fonts[12] = Typeface.createFromAsset(getAssets(), "fonts/DigitaldreamFat.ttf");
    fonts[13] = Typeface.createFromAsset(getAssets(), "fonts/DisplayDots.ttf");
    fonts[14] = Typeface.createFromAsset(getAssets(), "fonts/digi.otf");
    fonts[15] = Typeface.createFromAsset(getAssets(), "fonts/GentiumBinary.ttf");
    fonts[16] = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf");

    loadPrefs();

    if (lastChangelog == null || !lastChangelog.equals(getString(R.string.app_version))) {
        DialogFragment df = ChangelogDialog.newInstance();
        df.show(getSupportFragmentManager(), "dialog");
    }

    configureDisplay();
    resizeClock();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(this);
}

From source file:de.schildbach.wallet.ui.send.RaiseFeeDialogFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final View view = LayoutInflater.from(activity).inflate(R.layout.raise_fee_dialog, null);

    messageView = (TextView) view.findViewById(R.id.raise_fee_dialog_message);

    passwordGroup = view.findViewById(R.id.raise_fee_dialog_password_group);

    passwordView = (EditText) view.findViewById(R.id.raise_fee_dialog_password);
    passwordView.setText(null);//www  .  j  a  va  2s .  c  o  m

    badPasswordView = view.findViewById(R.id.raise_fee_dialog_bad_password);

    final DialogBuilder builder = new DialogBuilder(activity);
    builder.setTitle(R.string.raise_fee_dialog_title);
    builder.setView(view);
    // dummies, just to make buttons show
    builder.setPositiveButton(R.string.raise_fee_dialog_button_raise, null);
    builder.setNegativeButton(R.string.button_dismiss, null);
    builder.setCancelable(false);

    final AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);

    dialog.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(final DialogInterface d) {
            positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
            negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);

            positiveButton.setTypeface(Typeface.DEFAULT_BOLD);
            positiveButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {
                    handleGo();
                }
            });
            negativeButton.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {
                    dismissAllowingStateLoss();
                }
            });

            passwordView.addTextChangedListener(textWatcher);

            RaiseFeeDialogFragment.this.dialog = dialog;
            updateView();
        }
    });

    log.info("showing raise fee dialog");

    return dialog;
}

From source file:fer.hr.ferapp.common.custom_views.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.j  a  v  a 2 s . c  o m*/
 */
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);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    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.mein_fischfang.view.SlidingTabLayout.java

/**
 * createDefaultTabView// w w w.j a va 2 s. co m
 *
 * 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)}.
 *
 * @param context Context
 * @return TextView
 */
protected final 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);

    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:com.google.android.apps.santatracker.doodles.tilt.SwimmingFragment.java

@Override
protected void firstPassLoadOnUiThread() {
    final FrameLayout.LayoutParams wrapperLP = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);/*from  w w w .  j av  a  2  s . co m*/

    final SwimmingFragment that = this;
    scoreView = getScoreView();
    pauseView = getPauseView();

    int diveViewBottomMargin = (int) context.getResources().getDimension(R.dimen.dive_margin_bottom);
    int diveViewStartMargin = (int) context.getResources().getDimension(R.dimen.dive_margin_left);
    int diveViewSize = (int) context.getResources().getDimension(R.dimen.dive_image_size);

    FrameLayout.LayoutParams diveViewLP = new LayoutParams(diveViewSize, diveViewSize);
    diveViewLP.setMargins(diveViewStartMargin, 0, 0, diveViewBottomMargin);
    diveViewLP.gravity = Gravity.BOTTOM | Gravity.LEFT;

    if (VERSION.SDK_INT >= 17) {
        diveViewLP.setMarginStart(diveViewStartMargin);
    }
    diveView = new DiveView(context);

    countdownView = new TextView(context);
    countdownView.setGravity(Gravity.CENTER);
    countdownView.setTextColor(context.getResources().getColor(R.color.ui_text_yellow));
    countdownView.setTypeface(Typeface.DEFAULT_BOLD);
    countdownView.setText("0");
    countdownView.setVisibility(View.INVISIBLE);
    Locale locale = context.getResources().getConfiguration().locale;
    countdownView.setText(NumberFormat.getInstance(locale).format(3));
    Point screenDimens = AndroidUtils.getScreenSize();
    UIUtil.fitToBounds(countdownView, screenDimens.x / 10, screenDimens.y / 10);

    LinearLayout gameView = new LinearLayout(context);
    gameView.setOrientation(LinearLayout.VERTICAL);

    // Add game view.
    swimmingView = new SwimmingView(context);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT, 7);
    gameView.addView(swimmingView, lp);

    if (editorMode) {
        LinearLayout buttonWrapper = new LinearLayout(context);
        buttonWrapper.setOrientation(LinearLayout.HORIZONTAL);
        lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT, 1);
        gameView.addView(buttonWrapper, lp);

        resetButton = getButton(R.string.reset_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                SwimmingModel level = levelManager.loadDefaultLevel();
                initializeLevel(level, false);

                getActivity().getSharedPreferences(context.getString(R.string.swimming), Context.MODE_PRIVATE)
                        .edit().putString(CURRENT_LEVEL_KEY, null).commit();
            }
        });
        deleteButton = getButton(R.string.delete_levels, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new DeleteLevelDialogFragment();
                dialogFragment.show(getActivity().getFragmentManager(), "delete");
            }
        });
        loadButton = getButton(R.string.load_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new LoadLevelDialogFragment(that);
                dialogFragment.show(getActivity().getFragmentManager(), "load");
            }
        });
        saveButton = getButton(R.string.save_level, new OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogFragment dialogFragment = new SaveLevelDialogFragment(that);
                dialogFragment.show(getActivity().getFragmentManager(), "save");
            }
        });
        collisionModeButton = new ToggleButton(context);
        collisionModeButton.setText(R.string.scenery_mode);
        collisionModeButton.setTextOff(context.getString(R.string.scenery_mode));
        collisionModeButton.setTextOn(context.getString(R.string.collision_mode));
        collisionModeButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                model.collisionMode = isChecked;
            }
        });

        lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.MATCH_PARENT, 1);
        buttonWrapper.addView(deleteButton, lp);
        buttonWrapper.addView(resetButton, lp);
        buttonWrapper.addView(loadButton, lp);
        buttonWrapper.addView(saveButton, lp);
        buttonWrapper.addView(collisionModeButton, lp);
    }

    sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    if (accelerometerSensor == null) {
        // TODO: The game won't be playable without this, so what should we do?
        Log.d(TAG, "Accelerometer sensor is null");
    }
    displayRotation = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
            .getRotation();

    wrapper.addView(gameView, 0, wrapperLP);
    wrapper.addView(countdownView, 1);
    wrapper.addView(diveView, 2, diveViewLP);
    wrapper.addView(scoreView, 3);
    wrapper.addView(pauseView, 4);
}

From source file:org.medcada.android.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    GlucosioApplication application = (GlucosioApplication) getApplication();
    //startActivity(new Intent(this,PinCodeActivity.class));
    initPresenters(application);/*from   w ww . ja  v a  2  s .  c  o m*/
    setContentView(R.layout.activity_main);
    showDebugDBAddressLogToast();
    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    tabLayout = (TabLayout) findViewById(R.id.activity_main_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.activity_main_pager);

    if (toolbar != null) {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setElevation(0);
        getSupportActionBar().setTitle("assistBUD");
        getSupportActionBar().setLogo(R.drawable.ic_logo);
    }

    homePagerAdapter = new HomePagerAdapter(getSupportFragmentManager(), getApplicationContext());

    viewPager.setAdapter(homePagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            super.onTabSelected(tab);
        }
    });

    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            if (position == 2) {
                hideFabAnimation();
                LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.activity_main_empty_layout);
                ViewPager pager = (ViewPager) findViewById(R.id.activity_main_pager);
                if (pager.getVisibility() == View.GONE) {
                    pager.setVisibility(View.VISIBLE);
                    emptyLayout.setVisibility(View.INVISIBLE);
                }
            } else {
                showFabAnimation();
                checkIfEmptyLayout();
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    FloatingActionButton fabAddReading = (FloatingActionButton) findViewById(
            R.id.activity_main_fab_add_reading);
    fabAddReading.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            bottomSheetAddDialog.show();
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    });

    bottomSheetAddDialog = new BottomSheetDialog(this);

    // Add Nav Drawer
    final PrimaryDrawerItem itemSettings = new PrimaryDrawerItem().withName(R.string.action_settings)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_settings_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemExport = new PrimaryDrawerItem().withName(R.string.sidebar_backup_export)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_backup_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemFeedback = new PrimaryDrawerItem().withName(R.string.menu_support)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_announcement_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemAbout = new PrimaryDrawerItem().withName(R.string.preferences_about_glucosio)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_info_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemInvite = new PrimaryDrawerItem().withName(R.string.action_invite)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_face_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    //final PrimaryDrawerItem itemDonate = new PrimaryDrawerItem().withName(R.string.about_donate).withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_favorite_grey_24dp, null)).withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemA1C = new PrimaryDrawerItem().withName("Profile")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_person_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itememergency = new PrimaryDrawerItem().withName("Emergency")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_add_alert_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemmedications = new PrimaryDrawerItem().withName("Medications")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_calculator_a1c_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemReminders = new PrimaryDrawerItem().withName(R.string.activity_reminders_title)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_alarm_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);

    DrawerBuilder drawerBuilder = new DrawerBuilder().withActivity(this).withTranslucentStatusBar(false)
            .withToolbar(toolbar).withActionBarDrawerToggle(true)
            .withAccountHeader(new AccountHeaderBuilder().withActivity(this)

                    .withHeaderBackground(R.drawable.drawer_header).build())
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem.equals(itemSettings)) {
                        // Settings
                        openPreferences();
                    } else if (drawerItem.equals(itemAbout)) {
                        // About
                        startAboutActivity();
                    } else if (drawerItem.equals(itemFeedback)) {
                        // Feedback
                        openSupportDialog();
                    } else if (drawerItem.equals(itemInvite)) {
                        // Invite
                        showInviteDialog();
                    } else if (drawerItem.equals(itemExport)) {
                        // Export
                        startExportActivity();
                    }
                    //                        else if (drawerItem.equals(itemDonate)) {
                    //                            // Donate
                    //                            openDonateIntent();
                    //                        }

                    else if (drawerItem.equals(itemA1C)) {
                        startProfileActivity();
                    }

            else if (drawerItem.equals(itemmedications)) {
                        startMedicationActivity();
                    } else if (drawerItem.equals(itemReminders)) {
                        openRemindersActivity();
                    }
                    return false;
                }
            });

    if (isPlayServicesAvailable()) {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout,
                //itemDonate,
                itemInvite).withSelectedItem(-1).build();
    } else {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout
        // itemDonate
        ).withSelectedItem(-1).build();
    }

    // Restore pager position
    Bundle b = getIntent().getExtras();
    if (b != null) {
        viewPager.setCurrentItem(b.getInt("pager"));
    }

    checkIfEmptyLayout();
    bottomSheetAddDialog.setContentView(bottomSheetAddDialogView);
    bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetAddDialogView.getParent());
    bottomSheetBehavior.setHideable(false);

    Analytics analytics = application.getAnalytics();
    Log.i("MainActivity", "Setting screen name: " + "main");
    analytics.reportScreen("Main Activity");
}

From source file:org.cicadasong.samples.tubestatus.TubeStatus.java

protected void onDraw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setTextAlign(Paint.Align.CENTER);
    paint.setTypeface(Typeface.DEFAULT_BOLD);

    // We've centered the output vertically, so it works with the reduced canvas height in
    // widget mode.
    int y = canvas.getHeight() / 2;
    int x = canvas.getWidth() / 2;

    paint.setTypeface(Typeface.DEFAULT);
    paint.setTextSize(11);//from  ww w .j a v a2 s . c  o m
    canvas.drawText(TubeLine.allLines.get(selectionIndex).name, x, y - paint.descent() - 1, paint);

    paint.setTextSize(11); // TODO dynamically adjust font size depending on length of status string?
    canvas.drawText(status, x, y + (int) -paint.ascent() + 1, paint);
}

From source file:com.homework.group.videoplayer.ui.widgets.slidingTab.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)}./*  www .  j  ava 2s  .  c o  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);
    textView.setTextAppearance(context, R.style.SlidingTextViewStyle);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        //            
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
        //            textView.setBackgroundResource(R.color.theme_color);
    }

    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;
}