Example usage for android.widget TextView setTypeface

List of usage examples for android.widget TextView setTypeface

Introduction

In this page you can find the example usage for android.widget TextView setTypeface.

Prototype

public void setTypeface(@Nullable Typeface tf) 

Source Link

Document

Sets the typeface and style in which the text should be displayed.

Usage

From source file:com.corporatetaxi.TaxiArrived_Acitivity.java

private void initiatePopupWindowcanceltaxi() {
    try {/*ww w. jav  a 2  s.  c  o m*/
        dialog = new Dialog(TaxiArrived_Acitivity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
        dialog.setContentView(R.layout.canceltaxi_popup);

        cross = (ImageButton) dialog.findViewById(R.id.cross);
        cross.setOnClickListener(cancle_btn_click_listener);
        rd1 = (RadioButton) dialog.findViewById(R.id.radioButton);
        rd2 = (RadioButton) dialog.findViewById(R.id.radioButton2);
        rd3 = (RadioButton) dialog.findViewById(R.id.radioButton3);
        btn_confirm = (Button) dialog.findViewById(R.id.btn_acceptor);
        TextView txt = (TextView) dialog.findViewById(R.id.textView);
        textheader = (TextView) dialog.findViewById(R.id.popup_text);
        Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
        rd1.setTypeface(tf);
        rd2.setTypeface(tf);
        rd3.setTypeface(tf);
        btn_confirm.setTypeface(tf);
        txt.setTypeface(tf);
        textheader.setTypeface(tf);
        btn_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (rd1.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_one);

                } else if (rd2.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_two);

                } else if (rd3.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_three);

                }

                Allbeans allbeans = new Allbeans();

                allbeans.setCanceltaxirequest(canceltaxirequest);

                new CancelTaxiAsynch(allbeans).execute();

            }
        });
        dialog.show();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.github.antoniodisanto92.swipeselector.SwipeAdapter.java

/**
 * Override methods / listeners//from ww w  .ja  v a  2s  . c  o m
 */
@Override
public Object instantiateItem(ViewGroup container, int position) {
    SwipeItem slideItem = mItems.get(position);
    LinearLayout layout = null;

    switch (slideItem.iconGravity) {
    case CENTER:
    case DEFAULT:
        layout = (LinearLayout) View.inflate(mContext, R.layout.swipeselector_content_item, null);
        break;
    case LEFT:
        layout = (LinearLayout) View.inflate(mContext, R.layout.swipeselector_content_left_item, null);
        break;
    case RIGHT:
        layout = (LinearLayout) View.inflate(mContext, R.layout.swipeselector_content_right_item, null);
        break;
    }

    // GET VIEW
    ImageView icon = (ImageView) layout.findViewById(R.id.swipeselector_content_icon);
    TextView title = (TextView) layout.findViewById(R.id.swipeselector_content_title);
    TextView description = (TextView) layout.findViewById(R.id.swipeselector_content_description);

    // SET VIEW
    title.setText(slideItem.title);

    if (slideItem.description == null) {
        description.setVisibility(View.GONE);
    } else {
        description.setVisibility(View.VISIBLE);
        description.setText(slideItem.description);
    }

    if (slideItem.icon == null) {
        icon.setVisibility(View.GONE);
    } else {
        icon.setImageDrawable(slideItem.icon);
        icon.setVisibility(View.VISIBLE);
    }

    // We shouldn't get here if the typeface didn't exist.
    // But just in case, because we're paranoid.
    if (mCustomTypeFace != null) {
        title.setTypeface(mCustomTypeFace);
        description.setTypeface(mCustomTypeFace);
    }

    if (mTitleTextAppearance != -1) {
        setTextAppearanceCompat(title, mTitleTextAppearance);
    }

    if (mDescriptionTextAppearance != -1) {
        setTextAppearanceCompat(description, mDescriptionTextAppearance);
    }

    switch (slideItem.titleGravity) {
    case DEFAULT:
    case CENTER:
        title.setGravity(Gravity.CENTER);
        break;
    case LEFT:
        title.setGravity(Gravity.START);
        break;
    case RIGHT:
        title.setGravity(Gravity.END);
        break;
    }

    switch (slideItem.descriptionGravity) {
    case DEFAULT:
        if (mDescriptionGravity != -1) {
            description.setGravity(mDescriptionGravity);
        } else {
            description.setGravity(Gravity.CENTER);
        }
        break;
    case CENTER:
        description.setGravity(Gravity.CENTER);
        break;
    case LEFT:
        description.setGravity(Gravity.START);
        break;
    case RIGHT:
        description.setGravity(Gravity.END);
        break;
    }

    layout.setPadding(mContentLeftPadding, mSweetSixteen, mContentRightPadding, mSweetSixteen);

    container.addView(layout);
    return layout;
}

From source file:com.usertaxi.TaxiOntheWay_Activity.java

private void initiatePopupWindowcanceltaxi() {
    try {//from   ww  w. j  a  v  a  2  s . c o m
        dialog = new Dialog(TaxiOntheWay_Activity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
        dialog.setContentView(R.layout.canceltaxi_popup);
        cross = (ImageButton) dialog.findViewById(R.id.cross);
        cross.setOnClickListener(cancle_btn_click_listener);
        rd1 = (RadioButton) dialog.findViewById(R.id.radioButton);
        rd2 = (RadioButton) dialog.findViewById(R.id.radioButton2);
        rd3 = (RadioButton) dialog.findViewById(R.id.radioButton3);
        btn_cancel = (Button) dialog.findViewById(R.id.btn_acceptor);
        TextView txt = (TextView) dialog.findViewById(R.id.textView);
        textheader = (TextView) dialog.findViewById(R.id.popup_text);
        Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
        rd1.setTypeface(tf);
        rd2.setTypeface(tf);
        rd3.setTypeface(tf);
        btn_cancel.setTypeface(tf);
        txt.setTypeface(tf);
        textheader.setTypeface(tf);
        btn_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (rd1.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_canceltaxione);

                } else if (rd2.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_two);

                } else if (rd3.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_three);

                }

                Allbeans allbeans = new Allbeans();
                allbeans.setCanceltaxirequest(canceltaxirequest);

                new CancelTaxiAsynch(allbeans).execute();

            }
        });

        dialog.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.example.ray.firstapp.bottombar.BottomBar.java

/**
 * Set a custom TypeFace for the tab titles.
 * The .ttf file should be located at "/src/main/assets".
 *
 * @param typeFacePath path for the custom typeface in the assets directory.
 *//* w  ww  .j a v a 2s .c o m*/
public void setTypeFace(String typeFacePath) {
    Typeface typeface = Typeface.createFromAsset(mContext.getAssets(), typeFacePath);

    if (mItemContainer != null && mItemContainer.getChildCount() > 0) {
        for (int i = 0; i < mItemContainer.getChildCount(); i++) {
            View bottomBarTab = mItemContainer.getChildAt(i);
            TextView title = (TextView) bottomBarTab.findViewById(R.id.bb_bottom_bar_title);
            title.setTypeface(typeface);
        }
    } else {
        mPendingTypeface = typeface;
    }
}

From source file:com.github.fountaingeyser.typefacecompat.FactoryTypefaceCompat.java

@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    View result = null;//from  w  w w. j a v a2  s.c om
    // Allow base factory to try and create a view first
    if (mBaseFactory != null) {
        result = mBaseFactory.onCreateView(parent, name, context, attrs);
    }
    if (result instanceof TextView) {
        TextView textView = (TextView) result;
        String fontFamily = null;
        int style = 0;
        Resources.Theme theme = context.getTheme();
        TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.TextViewAppearance, 0, 0);
        TypedArray appearance = null;
        int ap = a.getResourceId(R.styleable.TextViewAppearance_android_textAppearance, -1);
        a.recycle();
        if (ap != -1) {
            appearance = theme.obtainStyledAttributes(ap, R.styleable.TextAppearance);
        }
        if (appearance != null) {
            fontFamily = appearance.getString(R.styleable.TextAppearance_android_fontFamily);
            style = appearance.getInt(R.styleable.TextAppearance_android_textStyle, 0);
            appearance.recycle();
        }
        a = theme.obtainStyledAttributes(attrs, R.styleable.TextAppearance, 0, 0);
        if (a.hasValue(R.styleable.TextAppearance_android_fontFamily)) {
            fontFamily = a.getString(R.styleable.TextAppearance_android_fontFamily);
            style = a.getInt(R.styleable.TextAppearance_android_textStyle, 0);
        }
        a.recycle();
        if (fontFamily != null && TypefaceCompat.isSupported(fontFamily)) {
            Typeface tf = TypefaceCompat.create(textView.getContext(), fontFamily, style);
            if (tf != null) {
                textView.setTypeface(tf);
            }
        }
    }
    return result;
}

From source file:com.example.search.car.pools.welcome.java

public void dialog(String name, final String[] arr, final TextView tv) {

    final Dialog dialog = new Dialog(welcome.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.setContentView(R.layout.dialog);
    final ListView list = (ListView) dialog.findViewById(R.id.list_cities);
    DialogAdapter adapter = new DialogAdapter(welcome.this, arr);
    list.setAdapter(adapter);// w w w  .  j a  v  a 2s.co  m
    final TextView t = (TextView) dialog.findViewById(R.id.tv_1_send_msg);
    t.setText("Select " + name);
    Typeface tf = Typeface.createFromAsset(welcome.this.getAssets(), "AvenirLTStd_Book.otf");
    t.setTypeface(tf);
    list.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            tv.setText(arr[position]);
            dialog.dismiss();
        }
    });
    final RelativeLayout l_close = (RelativeLayout) dialog.findViewById(R.id.l_close);
    l_close.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.speed.traquer.app.TraqComplaintTaxi.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_traq_complaint_taxi);
    easyTracker = EasyTracker.getInstance(TraqComplaintTaxi.this);
    //onCreateView(savedInstanceState);
    //InitialSetupUI();

    //Added UIHelper
    uiHelper = new UiLifecycleHelper(this, null);
    uiHelper.onCreate(savedInstanceState);

    inputTaxi = (EditText) findViewById(R.id.taxi_id);
    taxiDriver = (EditText) findViewById(R.id.taxi_driver);
    taxiLic = (EditText) findViewById(R.id.taxi_license);
    geoLat = (TextView) findViewById(R.id.geoLat);
    geoLong = (TextView) findViewById(R.id.geoLong);
    editDate = (EditText) findViewById(R.id.editDate);
    editTime = (EditText) findViewById(R.id.editTime);
    editCurrTime = (EditText) findViewById(R.id.editCurrTime);
    complainSend = (Button) findViewById(R.id.complain_send);

    ProgressBar barProgress = (ProgressBar) findViewById(R.id.progressLoading);
    ProgressBar barProgressFrom = (ProgressBar) findViewById(R.id.progressLoadingFrom);
    ProgressBar barProgressTo = (ProgressBar) findViewById(R.id.progressLoadingTo);

    actv_comp_taxi = (AutoCompleteTextView) findViewById(R.id.search_taxi_comp);
    SuggestionAdapter sa = new SuggestionAdapter(this, actv_comp_taxi.getText().toString(), taxiUrl,
            "compcode");
    sa.setLoadingIndicator(barProgress);
    actv_comp_taxi.setAdapter(sa);/*from  w  w w. j a  v  a  2  s  .  c  o m*/

    actv_from = (AutoCompleteTextView) findViewById(R.id.search_from);
    SuggestionAdapter saFrom = new SuggestionAdapter(this, actv_from.getText().toString(), locUrl, "location");
    saFrom.setLoadingIndicator(barProgressFrom);
    actv_from.setAdapter(saFrom);

    actv_to = (AutoCompleteTextView) findViewById(R.id.search_to);
    SuggestionAdapter saTo = new SuggestionAdapter(this, actv_to.getText().toString(), locUrl, "location");
    saTo.setLoadingIndicator(barProgressTo);
    actv_to.setAdapter(saTo);

    /*if(isNetworkConnected()) {
    new getTaxiComp().execute(new ApiConnector());
    }*/

    //Setting Fonts
    String fontPath = "fonts/segoeuil.ttf";
    Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
    complainSend.setTypeface(tf);
    inputTaxi.setTypeface(tf);
    editDate.setTypeface(tf);
    editTime.setTypeface(tf);
    actv_comp_taxi.setTypeface(tf);
    actv_to.setTypeface(tf);
    actv_from.setTypeface(tf);
    taxiDriver.setTypeface(tf);
    taxiLic.setTypeface(tf);

    TextView txtComp = (TextView) findViewById(R.id.taxi_comp);
    txtComp.setTypeface(tf);

    TextView txtTaxiDriver = (TextView) findViewById(R.id.txt_taxi_driver);
    txtTaxiDriver.setTypeface(tf);

    TextView txtTaxiLic = (TextView) findViewById(R.id.txt_taxi_license);
    txtTaxiLic.setTypeface(tf);

    TextView txtNumber = (TextView) findViewById(R.id.taxi_number);
    txtNumber.setTypeface(tf);

    TextView txtTo = (TextView) findViewById(R.id.to);
    txtTo.setTypeface(tf);

    TextView txtDate = (TextView) findViewById(R.id.date);
    txtDate.setTypeface(tf);

    TextView txtTime = (TextView) findViewById(R.id.time);
    txtTime.setTypeface(tf);

    gLongitude = this.getIntent().getExtras().getDouble("Longitude");
    gLatitude = this.getIntent().getExtras().getDouble("Latitude");
    speedTaxiExceed = this.getIntent().getExtras().getDouble("SpeedTaxiExceed");

    isTwitterSelected = false;
    isFacebookSelected = false;
    isDefaultSelected = false;
    isSmsSelected = false;

    geoLat.setText(Double.toString(gLatitude));
    geoLong.setText(Double.toString(gLongitude));

    rateBtnBus = (ImageButton) findViewById(R.id.btn_rate_bus);

    rateBtnBus.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (actv_comp_taxi.length() != 0) {
                final AlertDialog.Builder alertBox = new AlertDialog.Builder(TraqComplaintTaxi.this);
                alertBox.setIcon(R.drawable.info_icon);
                alertBox.setCancelable(false);
                alertBox.setTitle("Do you want to cancel complaint?");
                alertBox.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface arg0, int arg1) {
                        // finish used for destroyed activity
                        easyTracker.send(MapBuilder
                                .createEvent("Complaint", "Cancel Complaint (Yes)", "Complaint event", null)
                                .build());
                        finish();
                    }
                });

                alertBox.setNegativeButton("No", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int arg1) {
                        easyTracker.send(MapBuilder
                                .createEvent("Complaint", "Cancel Complaint (No)", "Complaint event", null)
                                .build());
                        dialog.cancel();
                    }
                });

                alertBox.show();
            } else {
                Intent intent = new Intent(getApplicationContext(), TraqComplaint.class);
                intent.putExtra("Latitude", gLatitude);
                intent.putExtra("Longitude", gLongitude);
                intent.putExtra("SpeedBusExceed", speedTaxiExceed);
                startActivity(intent);
            }
        }
    });

    complainSend.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String taxi_id = inputTaxi.getText().toString().toUpperCase();
            String taxi_comp = actv_comp_taxi.getText().toString();

            /*if(taxi_comp.length() == 0){
            Toast.makeText(TraqComplaintTaxi.this, "Taxi Company is required!", Toast.LENGTH_SHORT).show();
            }else */
            if (taxi_comp.length() < 2) {
                Toast.makeText(TraqComplaintTaxi.this, "Invalid Taxi Company.", Toast.LENGTH_SHORT).show();
            } else if (taxi_id.length() == 0) {
                Toast.makeText(TraqComplaintTaxi.this, "Taxi Plate Number is required!", Toast.LENGTH_SHORT)
                        .show();
            } else if (taxi_id.length() < 7) {
                Toast.makeText(TraqComplaintTaxi.this, "Invalid Taxi Number.", Toast.LENGTH_SHORT).show();
            } else {
                easyTracker.send(
                        MapBuilder.createEvent("Complaint", "Dialog Prompt", "Complaint event", null).build());
                PromptCustomDialog();
            }
        }
    });
    setCurrentDateOnView();
    getCurrentTime();

    //Shi Chuan's Code

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    cd = new ConnectionDetector(getApplicationContext());

    // Check if Internet present
    if (!cd.isConnectingToInternet()) {
        // Internet Connection is not present
        alert.showAlertDialog(TraqComplaintTaxi.this, "Internet Connection Error",
                "Please connect to working Internet connection", false);
        // stop executing code by return
        return;
    }

    // Check if twitter keys are set
    if (TWITTER_CONSUMER_KEY.trim().length() == 0 || TWITTER_CONSUMER_SECRET.trim().length() == 0) {
        // Internet Connection is not present
        alert.showAlertDialog(TraqComplaintTaxi.this, "Twitter oAuth tokens",
                "Please set your twitter oauth tokens first!", false);
        // stop executing code by return
        return;
    }

    // Shared Preferences
    mSharedPreferences = getApplicationContext().getSharedPreferences("MyPref", 0);

    /** This if conditions is tested once is
     * redirected from twitter page. Parse the uri to get oAuth
     * Verifier
     * */

    if (!isTwitterLoggedInAlready()) {
        Uri uri = getIntent().getData();
        if (uri != null && uri.toString().startsWith(TWITTER_CALLBACK_URL)) {
            // oAuth verifier
            String verifier = uri.getQueryParameter(URL_TWITTER_OAUTH_VERIFIER);

            try {
                // Get the access token
                AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);

                // Shared Preferences
                SharedPreferences.Editor e = mSharedPreferences.edit();

                // After getting access token, access token secret
                // store them in application preferences
                e.putString(PREF_KEY_OAUTH_TOKEN, accessToken.getToken());
                e.putString(PREF_KEY_OAUTH_SECRET, accessToken.getTokenSecret());
                // Store login status - true
                e.putBoolean(PREF_KEY_TWITTER_LOGIN, true);
                e.commit(); // save changes

                Log.e("Twitter OAuth Token", "> " + accessToken.getToken());

                // Getting user details from twitter
                // For now i am getting his name only
                long userID = accessToken.getUserId();
                User user = twitter.showUser(userID);

                String username = user.getName();
                String description = user.getDescription();

                // Displaying in xml ui
                //lblUserName.setText(Html.fromHtml("<b>Welcome " + username + "</b>" + description));
            } catch (Exception e) {
                // Check log for login errors
                Log.e("Twitter Login Error", "> " + e.getMessage());
            }
        }
    }

    //LocationManager lm = (LocationManager)  this.getSystemService(Context.LOCATION_SERVICE);
    //LocationListener ll = new passengerLocationListener();
    //lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);

}

From source file:com.fexcon.demolayout.RecipeAdapter.java

/**
 * Get a View that displays the data at the specified position in the data set. You can either
 * create a View manually or inflate it from an XML layout file. When the View is inflated, the
 * parent View (GridView, ListView...) will apply default layout parameters unless you use
 * {@link LayoutInflater#inflate(int, ViewGroup, boolean)}
 * to specify a root view and to prevent attachment to the root.
 *
 * @param position    The position of the item within the adapter's data set of the item whose view
 *                    we want./*from w  w  w.j a  va 2  s.c  o  m*/
 * @param convertView The old view to reuse, if possible. Note: You should check that this view
 *                    is non-null and of an appropriate type before using. If it is not possible to convert
 *                    this view to display the correct data, this method can create a new view.
 *                    Heterogeneous lists can specify their number of view types, so that this View is
 *                    always of the right type (see {@link #getViewTypeCount()} and
 *                    {@link #getItemViewType(int)}).
 * @param parent      The parent that this view will eventually be attached to
 * @return A View corresponding to the data at the specified position.
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    // check if the view already exists if so, no need to inflate and findViewById again!
    if (convertView == null) {

        // Inflate the custom row layout from your XML.
        convertView = mInflater.inflate(R.layout.list_item_recipe, parent, false);

        // create a new "Holder" with subviews
        holder = new ViewHolder();
        holder.thumbnailImageView = (ImageView) convertView.findViewById(R.id.recipe_list_thumbnail);
        holder.titleTextView = (TextView) convertView.findViewById(R.id.recipe_list_title);
        holder.subtitleTextView = (TextView) convertView.findViewById(R.id.recipe_list_subtitle);
        holder.detailTextView = (TextView) convertView.findViewById(R.id.recipe_list_detail);

        // hang onto this holder for future recyclage
        convertView.setTag(holder);
    } else {

        // skip all the expensive inflation/findViewById and just get the holder you already made
        holder = (ViewHolder) convertView.getTag();
    }

    // Get relevant subviews of row view
    TextView titleTextView = holder.titleTextView;
    TextView subtitleTextView = holder.subtitleTextView;
    TextView detailTextView = holder.detailTextView;
    ImageView thumbnailImageView = holder.thumbnailImageView;

    //Get corresponding recipe for row
    Recipe recipe = (Recipe) getItem(position);

    // Update row view's textviews to display recipe information
    titleTextView.setText(recipe.title);
    subtitleTextView.setText(recipe.description);
    detailTextView.setText(recipe.label);

    // Use Picasso to load the image. Temporarily have a placeholder in case it's slow to load
    //    Picasso.with(mContext).load(recipe.imageUrl).placeholder(R.mipmap
    //        .ic_launcher).error(R.drawable.image1).into(thumbnailImageView);

    Picasso.Builder builder = new Picasso.Builder(mContext);
    builder.listener(new Picasso.Listener() {
        @Override
        public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
            exception.printStackTrace();
        }
    });
    builder.build().load(recipe.imageUrl).placeholder(R.mipmap.ic_launcher).into(thumbnailImageView);

    // Style text views
    Typeface titleTypeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/CaviarDreams.ttf");
    titleTextView.setTypeface(titleTypeFace);
    Typeface subtitleTypeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/ostrich-regular.ttf");
    subtitleTextView.setTypeface(subtitleTypeFace);
    Typeface detailTypeFace = Typeface.createFromAsset(mContext.getAssets(), "fonts/OstrichSans-Light.otf");
    detailTextView.setTypeface(detailTypeFace);
    //    detailTextView.setTextColor(android.support.v4.content.ContextCompat.getColor(mContext, LABEL_COLORS
    //        .get(recipe.label)));

    return convertView;
}

From source file:com.arlib.floatingsearchview.FloatingSearchView.java

private int getSuggestionItemHeight(SearchSuggestion suggestion) {
    int leftRightMarginsWidth = Util.dpToPx(124);

    //todo improve efficiency
    TextView textView = new TextView(getContext());
    textView.setTypeface(Typeface.DEFAULT);
    textView.setText(suggestion.getBody(), TextView.BufferType.SPANNABLE);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mSuggestionsTextSizePx);
    int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(mSuggestionsList.getWidth() - leftRightMarginsWidth,
            View.MeasureSpec.AT_MOST);
    int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    textView.measure(widthMeasureSpec, heightMeasureSpec);
    int heightPlusPadding = textView.getMeasuredHeight() + Util.dpToPx(8);
    int minHeight = Util.dpToPx(48);
    int height = heightPlusPadding >= minHeight ? heightPlusPadding : minHeight;
    return heightPlusPadding >= minHeight ? heightPlusPadding : minHeight;
}

From source file:com.appdupe.flamer.LoginUsingFacebook.java

private void initdata() {

    galleryToplayout = (RelativeLayout) findViewById(R.id.galleryToplayout);

    galleryforsuprvisore = (ExtendedGallery) findViewById(R.id.gallery);
    buttonLoginLogout = (Button) findViewById(R.id.buttonLoginLogout);
    loginwithfacebook = (Button) findViewById(R.id.loginwithfacebook);
    count_layout = (LinearLayout) findViewById(R.id.image_count_homescreen);
    // textInstructionsOrLink =
    // (TextView)findViewById(R.id.instructionsOrLink);
    privacypolicy = (RelativeLayout) findViewById(R.id.privacypolicy);
    privacypolicy.setOnClickListener(this);

    privacylayout = (LinearLayout) findViewById(R.id.privacylayout);
    privacylayout.setVisibility(View.GONE);
    tendethomeloginactivitytoplayout = (RelativeLayout) findViewById(R.id.tendethomeloginactivitytoplayout);
    tendethomeloginactivitybottomlayout = (LinearLayout) findViewById(R.id.tendethomeloginactivitybottomlayout);

    Typeface segoeuiregular = Typeface.createFromAsset(getAssets(), "fonts/segoeui.ttf");
    Typeface segoeuilLight = Typeface.createFromAsset(getAssets(), "fonts/segoeuil.ttf");

    TextView wetakeyourprivacy = (TextView) findViewById(R.id.wetakeyourprivacy);
    // TextView textviewsecond = (TextView)
    // findViewById(R.id.textviewsecond);
    TextView textviewthird = (TextView) findViewById(R.id.textviewthird);

    wetakeyourprivacy.setTypeface(segoeuilLight);
    // textviewsecond.setTypeface(segoeuilLight);
    wetakeyourprivacy.setTextColor(android.graphics.Color.rgb(76, 76, 76));
    // textviewsecond.setTextColor(android.graphics.Color.rgb(76, 76, 76));

    textviewthird.setTypeface(segoeuiregular);
    textviewthird.setTextColor(android.graphics.Color.rgb(76, 76, 76));

    TextView textviewfourth = (TextView) findViewById(R.id.textviewfourth);
    textviewfourth.setTypeface(segoeuiregular);
    textviewfourth.setTextColor(android.graphics.Color.rgb(76, 76, 76));

    TextView textviewfifth = (TextView) findViewById(R.id.textviewfifth);
    textviewfifth.setTypeface(segoeuiregular);
    textviewfifth.setTextColor(android.graphics.Color.rgb(76, 76, 76));

    TextView textviewfirst = (TextView) findViewById(R.id.textviewfirst);
    textviewfirst.setTypeface(segoeuiregular);
    textviewfirst.setTextColor(android.graphics.Color.rgb(76, 76, 76));

    loginwithfacebook.setTypeface(segoeuiregular);
}