Example usage for android.graphics Typeface createFromAsset

List of usage examples for android.graphics Typeface createFromAsset

Introduction

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

Prototype

public static Typeface createFromAsset(AssetManager mgr, String path) 

Source Link

Document

Create a new typeface from the specified font data.

Usage

From source file:com.geomoby.geodeals.notification.CustomNotification.java

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

    //Hide Title Bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.geomoby_offer);

    Intent intent = getIntent();/*ww w. j a v a2 s . c o m*/

    ArrayList<GeoMessage> geoMessage = intent.getParcelableArrayListExtra("GeoMessage");

    String title = geoMessage.get(0).title;
    String link = geoMessage.get(0).siteURL;
    String image_url = geoMessage.get(0).imageURL;
    String description = geoMessage.get(0).message;
    final double latitude = Double.valueOf(geoMessage.get(0).latitude);
    final double longitude = Double.valueOf(geoMessage.get(0).longitude);
    int notification_id = geoMessage.get(0).id;

    Button btnClose = (Button) findViewById(R.id.close);
    btnClose.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click   
            CustomNotification.this.finish();
        }
    });

    Button btnNearest = (Button) findViewById(R.id.nearest);
    btnNearest.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            SharedPreferences settingsActivity = CustomNotification.this.getSharedPreferences("GeoMobyPrefs",
                    MODE_PRIVATE);
            final double myLatitude = Double.valueOf(settingsActivity.getString(SETTING_LAT, ""));
            final double myLongitude = Double.valueOf(settingsActivity.getString(SETTING_LNG, ""));

            Context context = CustomNotification.this;
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&saddr="
                    + myLatitude + "," + myLongitude + "&daddr=" + latitude + "," + longitude + "&dirflg=w"));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    });

    Typeface font = Typeface.createFromAsset(getAssets(), "Bitter-Bold.otf");

    TextView tvTitle = (TextView) findViewById(R.id.title);
    tvTitle.setTypeface(font);
    tvTitle.setText(title);

    TextView tvDesc = (TextView) findViewById(R.id.description);
    tvDesc.setTypeface(font);
    tvDesc.setText(description);

    TextView tvLink = (TextView) findViewById(R.id.link);
    tvLink.setTypeface(font);
    String desc = "<a href=\"" + link + "\">Demo Link</a>";
    tvLink.setText(Html.fromHtml(desc));
    tvLink.setMovementMethod(LinkMovementMethod.getInstance());

    // Warning - Big bitmap images might create errors
    if (!image_url.equals(""))
        new DownloadImageTask((ImageView) findViewById(R.id.image)).execute(image_url);

    //Notify GeoMoby server that user has opened the notification
    //new ClickThroughAsyncTask(this).execute(notification_id);
}

From source file:com.scigames.registration.Registration4PhotoActivity.java

/** Called with the activity is first created. */
@Override/*from   ww  w  .j  a v a  2 s.c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    studentIdIn = i.getStringExtra("studentId");
    visitIdIn = i.getStringExtra("visitId");
    Log.d(TAG, "...getStringExtra");

    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration4_photo);
    Log.d(TAG, "...setContentView");

    avatarPhoto = (ImageView) this.findViewById(R.id.avatar_photo);
    Log.d(TAG, "...findViewById. avatar_photo");

    or = (TextView) findViewById(R.id.or);
    or.setVisibility(View.INVISIBLE);
    retakeButton = (Button) findViewById(R.id.retake_pic);
    retakeButton.setVisibility(View.INVISIBLE);
    retakeButton.setOnClickListener(mTakePhotoListener);

    saveButton = (Button) findViewById(R.id.save_button);
    saveButton.setOnClickListener(mContinueButtonListener);
    saveButton.setVisibility(View.INVISIBLE);

    takePhotoButton = (Button) findViewById(R.id.take_pic);
    takePhotoButton.setOnClickListener(mTakePhotoListener);
    takePhotoButton.setVisibility(View.VISIBLE);
    //((Button) findViewById(R.id.take_pic)).setOnClickListener(mTakePhotoListener);
    Log.d(TAG, "...instantiateButtons");

    //set listener
    task.setOnResultsListener(this);

    Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    //       TextView welcome = (TextView)findViewById(R.id.welcome);
    //instruction = (TextView)findViewById(R.id.instructions);
    //       setTextViewFont(ExistenceLightOtf, welcome);
    setButtonFont(Museo500Regular, retakeButton);
    setTextViewFont(Museo300Regular, or);
}

From source file:com.cloverstudio.spikademo.SpikaApp.java

@Override
public void onCreate() {
    super.onCreate();
    sInstance = this;
    mPreferences = new Preferences(this);
    mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName());
    gOpenFromBackground = true;//from  w  ww.  j a  v a 2 s  .  com
    mFileDir = new FileDir(this);

    ImageLoader.initImageLoaderInstance(this);

    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);

    // Create typefaces
    mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf");
    mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf");

    setTransportBasedOnScreenDensity(42);

    // Example interpolator; could use linear or accelerate interpolator
    // instead
    final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator();
    final LinearInterpolator linearInterpolator = new LinearInterpolator();
    final int slidingDuration = getResources().getInteger(R.integer.sliding_duration);

    // Set up animations
    mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0);
    mSlideInLeft.setDuration(slidingDuration);
    // mSlideInLeft.setFillAfter(true); // hmm not sure
    mSlideInLeft.setFillEnabled(false);
    mSlideInLeft.setInterpolator(linearInterpolator);

    mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0);
    mSlideOutRight.setDuration(slidingDuration);
    mSlideOutRight.setFillAfter(true);
    mSlideOutRight.setFillEnabled(true);
    mSlideOutRight.setInterpolator(linearInterpolator);

    mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0);
    mSlideOutLeft.setDuration(slidingDuration);
    mSlideOutLeft.setInterpolator(linearInterpolator);

    mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0);
    mSlideInRight.setDuration(slidingDuration);
    mSlideInRight.setFillAfter(true);
    mSlideInRight.setFillEnabled(true);
    mSlideInRight.setInterpolator(linearInterpolator);

    mSlideFromTop.setFillAfter(true);
    mSlideFromTop.setFillEnabled(true);
    mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime));
    mSlideFromTop.setInterpolator(linearInterpolator);

    mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime));
    mSlideOutTop.setInterpolator(linearInterpolator);

    String strUUID = UUID.randomUUID().toString();
    Logger.debug("uuid", strUUID);
}

From source file:com.example.xyzreader.cpfinal.ArticleDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_article_detail, container, false);

    // Show the dummy content as text in a TextView.
    if (mItem != null) {
        ((TextView) rootView.findViewById(R.id.article_title)).setText(mItem.title);
        ((TextView) rootView.findViewById(R.id.article_byline))
                .setText(Html.fromHtml(mItem.time.toUpperCase(Locale.getDefault()) + " BY <font color='"
                        + getResources().getString(R.string.author_font_color) + "'>"
                        + mItem.author.toUpperCase(Locale.getDefault()) + "</a>"));
        ((TextView) rootView.findViewById(R.id.article_byline)).setMovementMethod(new LinkMovementMethod());
        //            ((TextView) rootView.findViewById(R.id.article_date))
        //                    .setText(mItem.time);
        ((TextView) rootView.findViewById(R.id.article_body)).setText(Html.fromHtml(mItem.content));
        ((TextView) rootView.findViewById(R.id.article_body))
                .setTypeface(Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf"));
        ((ImageView) rootView.findViewById(R.id.photo))
                .setImageDrawable(getResources().getDrawable(mItem.photoResId));
    }/*from  w w  w .  jav  a2 s.  co m*/

    return rootView;
}

From source file:cl.smartcities.isci.transportinspector.adapters.dialogAdapters.EventAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;

    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.event_layout_row, parent, false);
        holder = new ViewHolder();
        holder.event_icon = (ImageView) convertView.findViewById(R.id.event_icon);
        holder.description = (TextView) convertView.findViewById(R.id.description);
        holder.time = (TextView) convertView.findViewById(R.id.event_time);
        holder.yes_counter = (TextView) convertView.findViewById(R.id.yes_counter);
        holder.no_counter = (TextView) convertView.findViewById(R.id.no_counter);
        holder.yesIcon = (ImageButton) convertView.findViewById(R.id.yes_icon);
        holder.noIcon = (ImageButton) convertView.findViewById(R.id.no_icon);
        holder.true_text = (TextView) convertView.findViewById(R.id.true_text);
        holder.false_text = (TextView) convertView.findViewById(R.id.false_text);
        holder.ticket_font_green = (TextView) convertView.findViewById(R.id.ticket_font_green);
        holder.ticket_font_red = (TextView) convertView.findViewById(R.id.ticket_font_red);
        holder.confirm_button_layout = (RelativeLayout) convertView.findViewById(R.id.confirm_button_layout);
        holder.decline_button_layout = (RelativeLayout) convertView.findViewById(R.id.decline_button_layout);
        Typeface robotoRegular = Typeface.createFromAsset(this.getContext().getAssets(),
                this.context.getString(R.string.roboto_regular_font));
        Typeface robotoBold = Typeface.createFromAsset(this.getContext().getAssets(),
                this.context.getString(R.string.roboto_bold_font));
        Typeface iconFont = Typeface.createFromAsset(this.getContext().getAssets(),
                this.context.getString(R.string.icon_font));
        holder.setHolderTypefaceRegular(robotoRegular);
        holder.setHolderTypefaceBold(robotoBold);
        holder.setHolderIconFont(iconFont);

        convertView.setTag(holder);/*from   ww w . j  a va 2 s. c  o m*/
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    final Event event = this.events.get(position);

    //Descripcion del evento
    String description = this.events.get(position).getDescription();
    holder.description.setText(description);

    //Time del evento
    String date = this.events.get(position).getTime();
    holder.time.setText(date);

    //Confirmaciones del evento
    String confirms = this.events.get(position).getConfirms() + "";
    holder.yes_counter.setText(confirms);

    //Negaciones del evento
    String declines = this.events.get(position).getDeclines() + "";
    holder.no_counter.setText(declines);

    // Event icon
    int resDrawableId = this.events.get(position).getResDrawableId();
    holder.event_icon.setImageResource(resDrawableId);

    //id del evento
    final String id = this.events.get(position).getId();

    final EventRequest eventRequest;

    if (this.type.equals("Bus")) {
        eventRequest = new BusEventRequest(this.code, this.title, id);
    } else {
        eventRequest = new BusStopEventRequest(this.code, id);
    }

    holder.decline_button_layout.setVisibility(View.VISIBLE);
    holder.decline_button_layout.setVisibility(View.VISIBLE);
    if (getLastStateAccordingToPosition(position).equals(State.ONLY_CONFIRM)) {
        holder.decline_button_layout.setVisibility(View.GONE);
    }
    if (getLastStateAccordingToPosition(position).equals(State.ONLY_DECLINE)) {
        holder.confirm_button_layout.setVisibility(View.GONE);
    }

    //Listener de eventos
    holder.yesIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Map<String, String> attributes = new HashMap<>();
            attributes.put("Event name", event.getName());
            attributes.put("BusStop/Service Code", code);
            TranSappApplication.addFabricLog("Event confirmed", attributes);

            setCurrentState(position, State.ONLY_CONFIRM);
            confirmEvent(holder, eventRequest, event);
            holder.decline_button_layout.setVisibility(View.GONE);
            holder.ticket_font_green.setVisibility(View.VISIBLE);
        }
    });
    holder.noIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Map<String, String> attributes = new HashMap<>();
            attributes.put("Event name", event.getName());
            attributes.put("BusStop/Service Code", code);
            TranSappApplication.addFabricLog("Event denied", attributes);

            setCurrentState(position, State.ONLY_DECLINE);
            denyEvent(holder, eventRequest, event);
            holder.confirm_button_layout.setVisibility(View.GONE);
            holder.ticket_font_red.setVisibility(View.VISIBLE);
        }
    });

    /* save holder onStopListener convertView */
    if (position % 2 == 0) {
        convertView.setBackgroundColor(ContextCompat.getColor(context, R.color.even_row));
    } else {
        convertView.setBackgroundColor(ContextCompat.getColor(context, R.color.odd_row));
    }
    return convertView;
}

From source file:com.agustinprats.myhrv.fragment.MonitorFragment.java

/** This method should be called when the fragment is initialised in the onCreate */
protected void initUI(View rootView) {

    _heartImage = (ImageView) rootView.findViewById(R.id.heartImage);
    _statusText = (TextView) rootView.findViewById(R.id.statusText);
    _timeText = (TextView) rootView.findViewById(R.id.timeText);
    _batteryLevelImage = (ImageView) rootView.findViewById(R.id.batteryLevelImage);
    _digitalTypeface = Typeface.createFromAsset(getMainActivity().getAssets(), "fonts/digital7.ttf");
    _timeText.setTypeface(_digitalTypeface);
    _heartImage.setAlpha(BEATDOWN_ALPHA);

    setHasOptionsMenu(true);/*from w  w w. j  av  a  2  s  . c  o  m*/
}

From source file:com.calgen.udacity.lego.ui.ArticleListActivity.java

private void setToolbarTitleTypeFace() {
    for (int i = 0; i < toolbar.getChildCount(); i++) {
        View view = toolbar.getChildAt(i);
        if (view instanceof TextView) {
            TextView textView = (TextView) view;
            Typeface pacifico = Typeface.createFromAsset(getAssets(), "fonts/Pacifico-Regular.ttf");
            textView.setTypeface(pacifico);
            return;
        }/*  ww w  .jav  a  2  s  .  c om*/
    }
}

From source file:com.cryart.sabbathschool.view.SSReadingActivity.java

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

    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    checkIfReaderNeeded();//from www  .j a va2s .c  o m

    binding = DataBindingUtil.setContentView(this, R.layout.ss_reading_activity);

    SSReadingSheetAdapter adapter = new SSReadingSheetAdapter();
    binding.ssReadingSheetList.setAdapter(adapter);
    binding.ssReadingSheetList.setLayoutManager(new LinearLayoutManager(this));

    setSupportActionBar(binding.ssReadingAppBar.ssReadingToolbar);
    ActionBar ssToolbar = getSupportActionBar();
    if (ssToolbar != null) {
        ssToolbar.setDisplayHomeAsUpEnabled(true);
    }

    binding.ssReadingAppBar.ssReadingCollapsingToolbar
            .setCollapsedTitleTextAppearance(R.style.AppThemeAppBarTextStyle);
    binding.ssReadingAppBar.ssReadingCollapsingToolbar
            .setExpandedTitleTextAppearance(R.style.AppThemeAppBarTextStyleExpanded);

    binding.ssReadingAppBar.ssReadingCollapsingToolbar
            .setCollapsedTitleTypeface(Typeface.createFromAsset(getAssets(), "fonts/Lato-Bold.ttf"));
    binding.ssReadingAppBar.ssReadingCollapsingToolbar
            .setExpandedTitleTypeface(Typeface.createFromAsset(getAssets(), "fonts/Lato-Bold.ttf"));

    ViewCompat.setNestedScrollingEnabled(binding.ssReadingSheetList, false);

    ssReadingViewModel = new SSReadingViewModel(this, this,
            getIntent().getExtras().getString(SSConstants.SS_LESSON_INDEX_EXTRA),
            getIntent().getExtras().getString(SSConstants.SS_READ_INDEX_EXTRA), binding);
    ((SSReadingSheetAdapter) binding.ssReadingSheetList.getAdapter()).setReadingViewModel(ssReadingViewModel);

    binding.ssReadingViewPager.setAdapter(new SSReadingViewAdapter(this, ssReadingViewModel));
    binding.ssReadingViewPager.addOnPageChangeListener(this);

    binding.executePendingBindings();
    binding.setViewModel(ssReadingViewModel);

    setUpDrawer();
    updateColorScheme();
}

From source file:com.openerp.addons.idea.product.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);/*from   w  ww  .j a  v a2  s  . c  o  m*/

    View rootView = inflater.inflate(R.layout.fragment_productlist, container, false);

    getActivity().setTitle(R.string.label_product);

    if (db().isEmptyTable()) {
        IdeaDemoRecords rec = new IdeaDemoRecords(getActivity());
        rec.createDemoRecords();
    }
    //INTERNAL 
    MainActivity.global = 2;
    OEHelper.check_for_product_from_where = 0;
    TextView txv4 = (TextView) rootView.findViewById(R.id.textView1);
    Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf");
    txv4.setTypeface(font, Typeface.BOLD);
    mListView = (ListView) rootView.findViewById(R.id.listview);

    oehelper = new OEHelper(getActivity());

    btn = (Button) rootView.findViewById(R.id.barcode);

    List<String> k = oehelper.product_name();

    //   oehelper.releted_selected_stock_location_id();

    mListView.setAdapter(new ArrayAdapter<String>(getActivity(), R.layout.fragment_product_bind_item,
            OEHelper.datatemplate) {

        public View getView(int position, View convertView, ViewGroup parent) {
            View mView = convertView;

            if (mView == null)
                mView = getActivity().getLayoutInflater().inflate(R.layout.fragment_product_bind_item, parent,
                        false);
            TextView txv = (TextView) mView.findViewById(R.id.tx_productname);
            TextView txv4 = (TextView) mView.findViewById(R.id.textView1);
            TextView txv5 = (TextView) mView.findViewById(R.id.textView2);
            txv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
            Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf");
            txv.setTypeface(font, Typeface.BOLD);
            txv4.setTypeface(font, Typeface.BOLD);
            txv5.setTypeface(font);
            //   txv.setTextColor(Color.rgb(84, 84, 84));
            txv.setText(":" + OEHelper.datatemplate.get(position));
            // txv.setText(""+OEHelper.product_pty_stock_move);
            //            txv.setTextAppearance(getActivity(),
            //                  android.R.attr.textAppearance);
            TextView txv1 = (TextView) mView.findViewById(R.id.tx_reference);
            txv1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11);

            txv1.setTypeface(font);
            //   txv1.setTextColor(Color.rgb(84, 84, 84));
            txv1.setText(":" + OEHelper.default_code_of_product_product.get(position));
            //            txv1.setTextAppearance(getActivity(),
            //                  android.R.attr.textAppearance);
            // txv.setText("Product");
            Log.d("row***************" + OEHelper.data, "*************");
            return mView;
        }
    });
    btn.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {

            OEHelper oehelper1 = new OEHelper(getActivity());
            List<String> p = oehelper1.readproducttempalate();
            checkqtycallornot = 0;
            productQR_scan_from_scandit detail = new productQR_scan_from_scandit();
            FragmentListener frag = (FragmentListener) getActivity();
            frag.startDetailFragment(detail);

            // barcoderead.EAN13_code=("2100002000003");
            // String selected=barcoderead.EAN13_code;
            // int
            // indexofbarcodeproduct=OEHelper.ean13_of_product_product.indexOf(selected);
            // //String
            // idofproduct=MainActivity.idofproduct_product.get(indexofbarcodeproduct);
            //
            // String
            // sale_price_of_product_template=OEHelper.list_price_of_product_template.get(indexofbarcodeproduct);
            // String
            // cost_price_of_product_template=OEHelper.standard_price_of_product_template.get(indexofbarcodeproduct);
            // String
            // ean13_of_product_product1=OEHelper.ean13_of_product_product.get(indexofbarcodeproduct);
            // String
            // reference_of_product_product1=OEHelper.default_code_of_product_product.get(indexofbarcodeproduct);
            // String
            // type_Of_product_template=OEHelper.type_of_product_template.get(indexofbarcodeproduct);
            // String
            // supply_method_product_template1=OEHelper.supply_method_product_template.get(indexofbarcodeproduct);
            // String
            // procure_method_product_template1=OEHelper.procure_method_product_template.get(indexofbarcodeproduct);
            // image_of_produc1t=OEHelper.image_of_product.get(indexofbarcodeproduct);
            //
            // oeh.menufecturingData();
            // // Toast.makeText(getActivity(),
            // ""+MainActivity.getidfrom_product_product, 60).show();
            // Product_Detail detail =new Product_Detail();
            // Bundle args = new Bundle();
            // // args.putParcelable("BundleIcon", image_of_produc1t);
            // args.putString("name",
            // MainActivity.data.get(indexofbarcodeproduct));
            // args.putString("saleprice", sale_price_of_product_template);
            // args.putString("type", type_Of_product_template);
            // args.putString("reference", reference_of_product_product1);
            // args.putString("costprice", cost_price_of_product_template);
            // args.putString("supplymethod",
            // supply_method_product_template1);
            // args.putString("procuremethod",
            // procure_method_product_template1);
            // args.putString("ean13", ean13_of_product_product1);
            //
            //
            // detail.setArguments(args);
            // FragmentListener frag = (FragmentListener) getActivity();
            // frag.startDetailFragment(detail);

        }
    });

    mListView.setOnItemClickListener(this);
    return rootView;
}

From source file:com.spacescout.spacescout_android.MainActivity.java

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

    getActionBar().setDisplayShowCustomEnabled(true);
    getActionBar().setDisplayShowTitleEnabled(false);

    overridePendingTransition(R.anim.fadein, R.anim.fadeout);

    //set content to layout_main
    setContentView(R.layout.layout_main);

    //get the title
    mTitle = mDrawerTitle = getTitle();//from   w w  w  .j  a v a 2 s .  c  o m

    //Generate nav menu item title
    navItemTitle = new String[] { "All Spaces", "Filter Spaces", "Favorite Spaces" };

    navItemIcon = new int[] { R.drawable.nav_all_spaces, R.drawable.nav_search, R.drawable.nav_fav_spaces };

    //Locate drawer_layout and drawer ListView in layout_main.xml
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    //pass string arrays to NavMenuListAdapter
    mNavMenuAdapter = new NavMenuListAdapter(this.getBaseContext(), navItemTitle, navItemIcon);

    //set the NavMenuListAdapter to the ListView
    mDrawerList.setAdapter(mNavMenuAdapter);

    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
            R.string.navigation_drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            getActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflator.inflate(R.layout.custom_title_actionbar, null);

    Typeface typeface = Typeface.createFromAsset(this.getAssets(), "fonts/Manteka.ttf");

    TextView titleSpace = (TextView) v.findViewById(R.id.titleSpace);
    TextView titleScout = (TextView) v.findViewById(R.id.titleScout);
    titleSpace.setTypeface(typeface);
    titleScout.setTypeface(typeface);

    getActionBar().setCustomView(v);

    if (savedInstanceState == null) {
        selectItem(0);
    }
}