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.corporatetaxi.TaxiArrived_Acitivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_taxiarrived);
    taxiArrived_AcitivityInstance = this;
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.BLACK);
    setSupportActionBar(toolbar);//from  ww  w.j av  a 2 s. com
    // getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    String title = getString(R.string.title_activity_taxidetail);
    getSupportActionBar().setTitle(title);
    txt_header = (TextView) findViewById(R.id.textheader);
    fab_menu = (FloatingActionsMenu) findViewById(R.id.fab_menu);
    fab_msg = (FloatingActionButton) findViewById(R.id.fab_message);
    fab_boarded = (FloatingActionButton) findViewById(R.id.fab_boarded);
    fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);

    textname = (TextView) findViewById(R.id.name_text);
    textmobilenumber = (TextView) findViewById(R.id.mobile_text);
    textcompanyname = (TextView) findViewById(R.id.companyname);
    texttaxinumber = (TextView) findViewById(R.id.taxinumber);
    mtextnamehead = (TextView) findViewById(R.id.namehead);
    mtextcompanyhead = (TextView) findViewById(R.id.companyhead);
    mtextmobilehead = (TextView) findViewById(R.id.mobilehead);
    mtexttexinumhead = (TextView) findViewById(R.id.taxiplatthead);
    taxinamehead = (TextView) findViewById(R.id.taxinamehead);
    taxiname = (TextView) findViewById(R.id.taxinametext);
    mdriverimage = (ImageView) findViewById(R.id.driver_image);
    mdriverlicense = (TextView) findViewById(R.id.driverlicense);
    medriverinsurance = (TextView) findViewById(R.id.driverinsurance);

    map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    getLocation();

    Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
    txt_header.setTypeface(tf);

    mtextnamehead.setTypeface(tf);
    mtextcompanyhead.setTypeface(tf);
    mtextmobilehead.setTypeface(tf);
    mtexttexinumhead.setTypeface(tf);
    taxinamehead.setTypeface(tf);
    taxiname.setTypeface(tf);
    textname.setTypeface(tf);
    textmobilenumber.setTypeface(tf);
    textcompanyname.setTypeface(tf);
    texttaxinumber.setTypeface(tf);
    mdriverlicense.setTypeface(tf);
    medriverinsurance.setTypeface(tf);
    /////back arrow ////////////
    //        final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    //        upArrow.setColorFilter(getResources().getColor(R.color.colorbutton), PorterDuff.Mode.SRC_ATOP);
    //        getSupportActionBar().setHomeAsUpIndicator(upArrow);

    ////////current date time//////////////////
    currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date());
    Log.d("currentdatetime", currentDateTimeString);
    //caceldialog();
    /////////////notification data///////////////
    Intent intent = getIntent();
    String data = intent.getStringExtra("data");

    Log.d("data value", data + "");
    try {
        JSONObject jsonObject = new JSONObject(data);
        drivermobile = jsonObject.getString("mobile");
        drivername = jsonObject.getString("username");
        drivercompanyname = jsonObject.getString("taxicompany");
        drivertaxiname = jsonObject.getString("vehicalname");
        drivertexinumber = jsonObject.getString("vehicle_number");
        // driverlatitude = jsonObject.getDouble("latitude");
        //driverlongitude = jsonObject.getDouble("longitude");
        driverimage = jsonObject.getString("driverImage");
        tripamount = jsonObject.getString("amount");
        Log.d("amooo", tripamount);
        tripdestination = jsonObject.getString("destination");
        corporateusercompany = jsonObject.getString("corporatecompany");
        SourceAddress = jsonObject.getString("source_address");
        sourcelatitude = jsonObject.getDouble("source_latitude");
        sourcelongitude = jsonObject.getDouble("source_longitude");
        driverlicense = jsonObject.getString("driverlicense");
        driverinsurance = jsonObject.getString("driverinsurance");

        final LatLng loc = new LatLng(new Double(sourcelatitude), new Double(sourcelongitude));

        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 15));
        MarkerOptions marker = new MarkerOptions().position(loc).title(SourceAddress);
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_three));
        map.addMarker(marker);

        Log.d("driveriamge", driverimage);
        Log.d("longitudeeeee:------", String.valueOf(jsonObject.getDouble("longitude")));

        textname.setText(drivername);
        textmobilenumber.setText(drivermobile);
        textcompanyname.setText(drivercompanyname);
        texttaxinumber.setText(drivertexinumber);
        taxiname.setText(drivertaxiname);
        mdriverlicense.setText(driverlicense);
        medriverinsurance.setText(driverinsurance);

        if (mdriverlicense.length() == 0) {
            mdriverlicense.setVisibility(View.GONE);
        }
        if (medriverinsurance.length() == 0) {
            medriverinsurance.setVisibility(View.GONE);
        }
        if (driverimage.equalsIgnoreCase("")) {
            mdriverimage.setImageResource(R.drawable.ic_action_user);
        } else {
            Picasso.with(getApplicationContext()).load(driverimage).error(R.drawable.ic_action_user)
                    .resize(200, 200).into(mdriverimage);
        }

        Timer timer;
        TimerTask task;
        int delay = 10000;
        int period = 10000;

        timer = new Timer();

        timer.scheduleAtFixedRate(task = new TimerTask() {
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        /*loc2 = new LatLng(new Double(AppPreferences.getCurrentlat(TaxiArrived_Acitivity.this)),
                            new Double(AppPreferences.getCurrentlong(TaxiArrived_Acitivity.this)));
                        MarkerOptions marker2 = new MarkerOptions().position(loc2);
                        map.clear();
                        marker2.icon(BitmapDescriptorFactory.fromResource(R.drawable.drivertaxi));
                        map.addMarker(marker2.title(drivername));*/
                        loc2 = new LatLng(new Double(AppPreferences.getCurrentlat(TaxiArrived_Acitivity.this)),
                                new Double(AppPreferences.getCurrentlong(TaxiArrived_Acitivity.this)));

                        if (marker1 == null) {
                            marker1 = map.addMarker(new MarkerOptions().position(loc2).title(drivername)
                                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.drivertaxi)));

                        }
                        animateMarker(marker1, loc2, false);

                    }
                });

            }
        }, delay, period);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    ////////////notification dataend///////////////
    fab_cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowcanceltaxi();
        }
    });
    fab_boarded.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent1 = new Intent(TaxiArrived_Acitivity.this, Payment_Activity.class);

            intent1.putExtra("driver_companyname", drivercompanyname);
            intent1.putExtra("trip_amount", tripamount);
            intent1.putExtra("trip_destination", tripdestination);
            intent1.putExtra("user_company", corporateusercompany);
            intent1.putExtra("driver_image", driverimage);
            intent1.putExtra("drver_name", drivername);
            intent1.putExtra("driver_mobile", drivermobile);
            intent1.putExtra("driver_taxinumber", drivertexinumber);
            intent1.putExtra("driver_taxiname", drivertaxiname);
            startActivity(intent1);

            new BoardeTripAsynch().execute();

        }
    });
    fab_msg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowsendmesage();
        }
    });

}

From source file:org.gluu.super_gluu.app.MainActivityFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_main, container, false);
    this.inflater = inflater;
    context = view.getContext();/*from w  w  w  .  j  av  a 2 s  .com*/
    this.dataStore = new AndroidKeyDataStore(context);
    this.u2f = new SoftwareDevice(getActivity(), dataStore);
    adView = (LinearLayout) view.findViewById(R.id.view_ad_free);
    //        adView.setVisibility(View.GONE);
    View actionBarView = (View) view.findViewById(R.id.actionBarView);
    actionBarView.findViewById(R.id.action_left_button).setVisibility(View.GONE);
    actionBarView.findViewById(R.id.action_right_button).setVisibility(View.GONE);
    actionBarView.findViewById(R.id.actionbar_icon).setVisibility(View.VISIBLE);
    actionBarView.findViewById(R.id.actionbar_textview).setVisibility(View.GONE);
    Boolean isAdFree = Settings.getPurchase(context);
    if (isAdFree) {
        adView.setVisibility(View.GONE);
    }
    Button adFreeButton = (Button) view.findViewById(R.id.button_ad_free);
    adFreeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            runSubscribeFlow();
        }
    });
    scanButton = (Button) view.findViewById(R.id.button_scan);
    scanButton.setOnClickListener(this);

    //Setup message receiver
    //        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver,
    //                new IntentFilter("ox_request-precess-event"));
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mAdFreeReceiver,
            new IntentFilter("on-ad-free-event"));
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(onAdFree,
            new IntentFilter("on-ad-free-flow"));
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(onRestorePurchase,
            new IntentFilter("on-restore-purchase-flow"));
    //Init GoogleMobile AD
    initGoogleInterstitialAd();

    //Setup fonts
    TextView welcomeTextView = (TextView) view.findViewById(R.id.textView);
    TextView subTextView = (TextView) view.findViewById(R.id.textView2);

    Typeface face = Typeface.createFromAsset(getActivity().getAssets(), "ProximaNova-Semibold.otf");
    Typeface faceLight = Typeface.createFromAsset(getActivity().getAssets(), "ProximaNova-Regular.otf");
    scanButton.setTypeface(face);
    adFreeButton.setTypeface(face);
    welcomeTextView.setTypeface(face);
    subTextView.setTypeface(faceLight);

    return view;
}

From source file:codepath.watsiapp.utils.Util.java

public static void applyPrimaryFont(Context ctx, TextView textView) {
    Typeface typeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/" + PRIMARY_FONT);
    textView.setTypeface(typeface);/* w w  w .  j  a v  a 2  s. c  om*/
}

From source file:org.crossconnect.bible.activity.MainActivity.java

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

    setContentView(R.layout.activity_main);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();//from   ww  w.  j av a  2s  .  co m

    mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(3);
    mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

    //Add top menu icons into the seperate list 
    resource_top_icons = new ArrayList<ImageButton>();
    resource_top_icons.add((ImageButton) findViewById(R.id.menu_button_churches));
    resource_top_icons.add((ImageButton) findViewById(R.id.menu_button_browse_resources));

    bible_text_top_icons = new ArrayList<ImageButton>();
    //        bible_text_top_icons.add((ImageButton) findViewById(R.id.menu_button_tabs));
    bible_text_top_icons.add((ImageButton) findViewById(R.id.menu_button_windows));

    audio_top_icons = new ArrayList<ImageButton>();
    audio_top_icons.add((ImageButton) findViewById(R.id.menu_button_audio));
    //        audio_top_icons.add((ImageButton) findViewById(R.id.menu_button_browse_audio));

    notes_top_icons = new ArrayList<ImageButton>();
    notes_top_icons.add((ImageButton) findViewById(R.id.menu_button_notes));
    notes_top_icons.add((ImageButton) findViewById(R.id.menu_button_notes_lock));

    hideAllIcons();

    //Load last opened verse
    bibleText = Utils.loadBibleText(getSharedPreferences("APP SETTINGS", Context.MODE_PRIVATE));

    //Setup listeners for top menu icons

    //Go to notes browsing view
    ((ImageButton) findViewById(R.id.menu_button_notes)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            saveCurrentTab();
            Intent intent = new Intent(MainActivity.this, NotesActivity.class);
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivityForResult(intent, NOTES_SELECT_CODE);
        }
    });

    ((ImageButton) findViewById(R.id.menu_button_churches)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, ResourceRepositoryActivity.class);
            startActivity(intent);
        }
    });

    //        ((ImageButton) findViewById(R.id.menu_button_browse_audio)).setOnClickListener(new OnClickListener(){
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(MainActivity.this, ResourceRepositoryActivity.class);
    //                startActivity(intent);    
    //            }
    //        });

    ((ImageButton) findViewById(R.id.menu_button_audio)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, MusicActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivity(intent);
        }
    });

    ((ImageButton) findViewById(R.id.menu_button_browse_resources)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, MusicActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivity(intent);
        }
    });

    headerTitleText = (Button) findViewById(R.id.header_title);
    headerTitleText.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/" + "Ubuntu-R.ttf"),
            Typeface.NORMAL);

    headerTitleText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            saveCurrentTab();

            //TODO: can we pass the actual BibleText?
            Intent intent = new Intent(MainActivity.this, ChapterSelectionActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivityForResult(intent, CHAPTER_SELECT_CODE);
        }
    });

    final ActionItem settingsAction = new ActionItem();

    settingsAction.setTitle("Settings");
    settingsAction.setIcon(getResources().getDrawable(R.drawable.icon_gear));

    //        final ActionItem accAction = new ActionItem();
    //        
    //        accAction.setTitle("Share");
    //        accAction.setIcon(getResources().getDrawable(R.drawable.icon_gear));
    //        
    //        final ActionItem upAction = new ActionItem();
    //        
    //        upAction.setTitle("Star");
    //        upAction.setIcon(getResources().getDrawable(R.drawable.icon_support));

    findViewById(R.id.title_bar_icon).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mQuickAction = new QuickActionHorizontal(findViewById(R.id.title_bar_icon));

            settingsAction.setOnClickListener(new OnClickListener() {

                //Copy text action item
                @Override
                public void onClick(View v) {
                    startActivityForResult(new Intent(MainActivity.this, PreferencesFromXml.class),
                            SETTINGS_CODE);
                    mQuickAction.dismiss();
                }
            });

            //              accAction.setOnClickListener(new OnClickListener() {
            //                  @Override
            //                  public void onClick(View v) {
            //                      mQuickAction.dismiss();
            //                  }
            //              });
            //              
            //              upAction.setOnClickListener(new OnClickListener() {
            //                  @Override
            //                  public void onClick(View v) {
            //                      mQuickAction.dismiss();
            //                  }
            //              });

            mQuickAction.addActionItem(settingsAction);
            //              mQuickAction.addActionItem(accAction);
            //              mQuickAction.addActionItem(upAction);

            mQuickAction.setAnimStyle(QuickActionVertical.ANIM_AUTO);

            mQuickAction.setOnDismissListener(new OnDismissListener() {
                @Override
                public void onDismiss() {
                }
            });
            mQuickAction.show();
        }
    });

    //        if (Build.VERSION.SDK_INT >=  HONEYCOMB) {
    //            // If has holo theme use holo themed buttons
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), NoteManagerBibleNotesFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), BookmanagerBibleFragment.class, null);

    //            mTabsAdapter.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
    //                LoaderCursorSupport.CursorLoaderListFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"), LoaderCustomSupport.AppListFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
    //                LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
    //        } else {
    // Use custom tab style
    setupTab(new TextView(this), AUDIO_TAG, R.drawable.ico_audio, AudioBibleFragment.class);
    setupTab(new TextView(this), BIBLE_TAG, R.drawable.ico_bible, BibleTextFragment.class);
    setupTab(new TextView(this), NOTES_TAG, R.drawable.ico_notes, NotesEditorFragment.class);
    setupTab(new TextView(this), RESOURCE_TAG, R.drawable.ic_action_microphone, ResourceFragment.class);

    //            setupTab(new TextView(this), "Tab 3", LoaderCustomSupport.AppListFragment.class);
    //            setupTab(new TextView(this), "Tab 4", LoaderThrottleSupport.ThrottledLoaderListFragment.class);
    //        }

    //Set starting tab
    if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString(DEFAULT_TAB));
    } else {
        mTabHost.setCurrentTabByTag(BIBLE_TAG);
    }
}

From source file:com.crossconnect.activity.MainActivity.java

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

    setContentView(R.layout.activity_main);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();//  w ww .  j av  a2  s  .com

    mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

    //Add top menu icons into the seperate list 
    resource_top_icons = new ArrayList<ImageButton>();
    resource_top_icons.add((ImageButton) findViewById(R.id.menu_button_churches));
    resource_top_icons.add((ImageButton) findViewById(R.id.menu_button_browse_resources));

    bible_text_top_icons = new ArrayList<ImageButton>();
    bible_text_top_icons.add((ImageButton) findViewById(R.id.menu_button_tabs));
    bible_text_top_icons.add((ImageButton) findViewById(R.id.menu_button_windows));

    audio_top_icons = new ArrayList<ImageButton>();
    audio_top_icons.add((ImageButton) findViewById(R.id.menu_button_audio));
    //        audio_top_icons.add((ImageButton) findViewById(R.id.menu_button_browse_audio));

    notes_top_icons = new ArrayList<ImageButton>();
    notes_top_icons.add((ImageButton) findViewById(R.id.menu_button_notes));
    notes_top_icons.add((ImageButton) findViewById(R.id.menu_button_notes_lock));

    hideAllIcons();

    //Load last opened verse
    bibleText = Utils.loadBibleText(getSharedPreferences("APP SETTINGS", Context.MODE_PRIVATE));

    //Setup listeners for top menu icons

    //Go to notes browsing view
    ((ImageButton) findViewById(R.id.menu_button_notes)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, NotesActivity.class);
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivityForResult(intent, NOTES_SELECT_CODE);
        }
    });

    ((ImageButton) findViewById(R.id.menu_button_churches)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, ResourceRepositoryActivity.class);
            startActivity(intent);
        }
    });

    //        ((ImageButton) findViewById(R.id.menu_button_browse_audio)).setOnClickListener(new OnClickListener(){
    //            @Override
    //            public void onClick(View v) {
    //                Intent intent = new Intent(MainActivity.this, ResourceRepositoryActivity.class);
    //                startActivity(intent);    
    //            }
    //        });

    ((ImageButton) findViewById(R.id.menu_button_audio)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, MusicActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivity(intent);
        }
    });

    ((ImageButton) findViewById(R.id.menu_button_browse_resources)).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, MusicActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivity(intent);
        }
    });

    headerTitleText = (Button) findViewById(R.id.header_title);
    headerTitleText.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/" + "Ubuntu-R.ttf"),
            Typeface.NORMAL);

    headerTitleText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Editor editor = getSharedPreferences("APP SETTINGS", Context.MODE_PRIVATE).edit();
            editor.putString(SharedPreferencesHelper.CURRENT_TAB, mTabHost.getCurrentTabTag());
            editor.commit();

            //TODO: can we pass the actual BibleText?
            Intent intent = new Intent(MainActivity.this, ChapterSelectionActivity.class);
            intent.putExtra("Book", bibleText.getBook());
            intent.putExtra("Chapter", bibleText.getChapter());
            intent.putExtra("Translation", bibleText.getTranslation().getInitials());
            startActivityForResult(intent, CHAPTER_SELECT_CODE);
        }
    });

    final ActionItem settingsAction = new ActionItem();

    settingsAction.setTitle("Settings");
    settingsAction.setIcon(getResources().getDrawable(R.drawable.ic_sysbar_quicksettings));

    final ActionItem accAction = new ActionItem();

    accAction.setTitle("Share");
    accAction.setIcon(getResources().getDrawable(R.drawable.kontak));

    final ActionItem upAction = new ActionItem();

    upAction.setTitle("Star");
    upAction.setIcon(getResources().getDrawable(R.drawable.kontak));

    findViewById(R.id.title_bar_icon).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mQuickAction = new QuickActionHorizontal(findViewById(R.id.title_bar_icon));

            final String text;

            settingsAction.setOnClickListener(new OnClickListener() {

                //Copy text action item
                @Override
                public void onClick(View v) {
                    startActivityForResult(new Intent(MainActivity.this, PreferencesFromXml.class),
                            SETTINGS_CODE);
                    mQuickAction.dismiss();
                }
            });

            accAction.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mQuickAction.dismiss();
                }
            });

            upAction.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mQuickAction.dismiss();
                }
            });

            mQuickAction.addActionItem(settingsAction);
            mQuickAction.addActionItem(accAction);
            mQuickAction.addActionItem(upAction);

            mQuickAction.setAnimStyle(QuickActionVertical.ANIM_AUTO);

            mQuickAction.setOnDismissListener(new OnDismissListener() {
                @Override
                public void onDismiss() {
                }
            });
            mQuickAction.show();
        }
    });

    //        if (Build.VERSION.SDK_INT >=  HONEYCOMB) {
    //            // If has holo theme use holo themed buttons
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), NoteManagerBibleNotesFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), BookmanagerBibleFragment.class, null);

    //            mTabsAdapter.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
    //                LoaderCursorSupport.CursorLoaderListFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"), LoaderCustomSupport.AppListFragment.class, null);
    //            mTabsAdapter.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
    //                LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
    //        } else {
    // Use custom tab style
    setupTab(new TextView(this), AUDIO_TAG, R.drawable.ico_audio, AudioBibleFragment.class);
    setupTab(new TextView(this), BIBLE_TAG, R.drawable.ico_bible, BibleTextFragment.class);
    setupTab(new TextView(this), NOTES_TAG, R.drawable.ico_notes, NotesEditorFragment.class);
    setupTab(new TextView(this), RESOURCE_TAG, R.drawable.ic_action_microphone, ResourceFragment.class);

    //            setupTab(new TextView(this), "Tab 3", LoaderCustomSupport.AppListFragment.class);
    //            setupTab(new TextView(this), "Tab 4", LoaderThrottleSupport.ThrottledLoaderListFragment.class);
    //        }

    //Set starting tab
    if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString(DEFAULT_TAB));
    } else {
        mTabHost.setCurrentTabByTag(BIBLE_TAG);
    }
}

From source file:com.physphil.android.restaurantroulette.RestaurantSelectorFragment.java

/**
 * Set fonts for all text views in layout
 * @param v parent view containing all views which need font to be set
 *//*from w w w  .  j a v a2s . c o  m*/
private void setFonts(View v) {

    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), Constants.FONT_DEFAULT);
    btnSelectRestaurant.setTypeface(tf);
    btnGetDirections.setTypeface(tf);
    tvHeader.setTypeface(tf);
    tvAnswer.setTypeface(tf);
    tvLastVisit.setTypeface(tf);
    tvNumberOfVisits.setTypeface(tf);

    // change font of static text
    ((TextView) v.findViewById(R.id.selector_filter_text)).setTypeface(tf);
    ((TextView) v.findViewById(R.id.restaurant_genre_text)).setTypeface(tf);
    ((TextView) v.findViewById(R.id.answer_summary_last_visit_text)).setTypeface(tf);
    ((TextView) v.findViewById(R.id.answer_summary_number_visits_text)).setTypeface(tf);
    ((TextView) v.findViewById(R.id.answer_summary_rating_text)).setTypeface(tf);
    ((TextView) v.findViewById(R.id.answer_summary_price_text)).setTypeface(tf);
}

From source file:key.secretkey.crypto.PgpHandler.java

public void editPassword() {
    // if in encrypt or in decrypt and password is invisible
    // (because !showPassword, so this will instantly close), do nothing
    if (findViewById(R.id.crypto_password_show) == null
            || findViewById(R.id.crypto_container).getVisibility() != View.VISIBLE)
        return;/*www  . j av  a  2  s .co  m*/

    CharSequence category = ((TextView) findViewById(R.id.crypto_password_category)).getText();
    CharSequence file = ((TextView) findViewById(R.id.crypto_password_file)).getText();
    CharSequence password = ((TextView) findViewById(R.id.crypto_password_show)).getText();
    CharSequence extra = ((TextView) findViewById(R.id.crypto_extra_show)).getText();

    setContentView(R.layout.encrypt_layout);
    Typeface monoTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
    ((EditText) findViewById(R.id.crypto_password_edit)).setTypeface(monoTypeface);
    ((EditText) findViewById(R.id.crypto_extra_edit)).setTypeface(monoTypeface);

    ((TextView) findViewById(R.id.crypto_password_category)).setText(category);
    ((EditText) findViewById(R.id.crypto_password_file_edit)).setText(file);
    ((EditText) findViewById(R.id.crypto_password_edit)).setText(password);
    ((EditText) findViewById(R.id.crypto_extra_edit)).setText(extra);

    // strictly editing only i.e. can't save this password's info to another file by changing name
    findViewById(R.id.crypto_password_file_edit).setEnabled(false);

    // the original intent was to decrypt so FILE_PATH will have the file, not enclosing dir
    // PgpCallback expects the dir when encrypting
    String filePath = getIntent().getExtras().getString("FILE_PATH");
    String directoryPath = filePath.substring(0, filePath.lastIndexOf(File.separator));
    Intent intent = new Intent(this, PgpHandler.class);
    intent.putExtra("FILE_PATH", directoryPath);
    intent.putExtra("Operation", "ENCRYPT");
    intent.putExtra("fromDecrypt", true);
    setIntent(intent);

    // recreate the options menu to be the encrypt one
    invalidateOptionsMenu();
}

From source file:com.digitalvotingpass.camera.CameraFragment.java

/**
 * Setup the layout and setup the actions associated with the button.
 *//*  w w  w .  j a  va  2 s .  c om*/
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
    mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);
    scanSegment = (ImageView) view.findViewById(R.id.scan_segment);
    manualInput = (Button) view.findViewById(R.id.manual_input_button);
    overlay = (Overlay) view.findViewById(R.id.overlay);
    manualInput.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), ManualInputActivity.class);
            getActivity().startActivityForResult(intent, MainActivity.GET_DOC_INFO);
        }
    });

    toggleTorchButton = (FloatingActionButton) view.findViewById(R.id.toggle_torch_button);
    toggleTorchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mCameraHandler.toggleTorch();
        }
    });

    infoText = (TextView) view.findViewById(R.id.info_text);
    Typeface typeFace = Typeface.createFromAsset(getActivity().getAssets(), "fonts/ro.ttf");
    infoText.setTypeface(typeFace);
    manualInput.setTypeface(typeFace);
    controlPanel = view.findViewById(R.id.control);
    final ViewTreeObserver observer = view.findViewById(R.id.control).getViewTreeObserver();
    observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            // Set the margins when the view is available.
            overlay.setMargins(0, 0, 0, controlPanel.getHeight());
            view.findViewById(R.id.control).getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
}

From source file:ir.actfun.toofan.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Initialize the associated SharedPreferences file with default values
    PreferenceManager.setDefaultValues(this, R.xml.prefs, false);

    darkTheme = false;/*  w  w w .ja v  a2s .c om*/
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (prefs.getString("theme", "fresh").equals("dark")) {
        setTheme(R.style.AppTheme_NoActionBar_Dark);
        darkTheme = true;
    } else if (prefs.getString("theme", "fresh").equals("transparent")) {
        setTheme(R.style.AppTheme_NoActionBar_transparent);
    }

    // Initiate activity
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrolling);
    appView = findViewById(R.id.viewApp);

    progressDialog = new ProgressDialog(MainActivity.this);

    // Load toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (darkTheme) {
        toolbar.setPopupTheme(R.style.AppTheme_PopupOverlay_Dark);
    }

    YoYo.with(Techniques.ZoomIn).duration(2000).playOn(findViewById(R.id.todayIcon));

    // Initialize textboxes
    todayTemperature = (TextView) findViewById(R.id.todayTemperature);
    todayDescription = (TextView) findViewById(R.id.todayDescription);
    todayWind = (TextView) findViewById(R.id.todayWind);
    todayPressure = (TextView) findViewById(R.id.todayPressure);
    todayHumidity = (TextView) findViewById(R.id.todayHumidity);
    todaySunrise = (TextView) findViewById(R.id.todaySunrise);
    todaySunset = (TextView) findViewById(R.id.todaySunset);
    lastUpdate = (TextView) findViewById(R.id.lastUpdate);
    todayIcon = (TextView) findViewById(R.id.todayIcon);
    weatherFont = Typeface.createFromAsset(this.getAssets(), "fonts/weather.ttf");
    todayIcon.setTypeface(weatherFont);

    // Initialize viewPager
    viewPager = (ViewPager) findViewById(R.id.viewPager);
    tabLayout = (TabLayout) findViewById(R.id.tabs);

    //setting view pager animations
    viewPager.setPageTransformer(true, new RotateUpTransformer());

    destroyed = false;

    initMappings();

    // Preload data from cache
    preloadWeather();
    updateLastUpdateTime();

    // Set autoupdater
    AlarmReceiver.setRecurringAlarm(this);

    //implementing the side bar
    crossfadeDrawerLayout = new CrossfadeDrawerLayout(this);

    //Create the drawer
    result = new DrawerBuilder().withActivity(this).withToolbar(toolbar)
            .withSliderBackgroundDrawableRes(R.drawable.weather)
            //provide the custom crossfadeDrawerLaoyout
            .withDrawerLayout(crossfadeDrawerLayout).withHasStableIds(true)
            //define the width to the width of our smaller view
            .withDrawerWidthDp(72)
            //generate the MiniDrawer which is used for the smaller view
            .withGenerateMiniDrawer(true)
            //add some items, those are alo automatically added to the MiniDrawer
            .addDrawerItems(
                    new PrimaryDrawerItem().withIdentifier(1).withName(R.string.today_weather)
                            .withIcon(R.drawable.today_weather_icon).withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(
                                    getApplicationContext().getAssets(), "fonts/iransans_light.ttf")),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withIdentifier(2).withName(R.string.forecast_weather)
                            .withIcon(R.drawable.forecast_weather_icon)
                            .withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(
                                    getApplicationContext().getAssets(), "fonts/iransans_light.ttf")),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withIdentifier(3).withName(R.string.gps_finder)
                            .withIcon(R.drawable.gps_finder_icon).withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(
                                    getApplicationContext().getAssets(), "fonts/iransans_light.ttf")),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withIdentifier(4).withName(R.string.manual_search)
                            .withIcon(R.drawable.serach_city_icon).withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(
                                    getApplicationContext().getAssets(), "fonts/iransans_light.ttf")),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withIdentifier(5).withName(R.string.settings)
                            .withIcon(R.drawable.settings_icon).withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(
                                    getApplicationContext().getAssets(), "fonts/iransans_light.ttf")),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withIdentifier(6).withName(R.string.about_dev)
                            .withIcon(R.drawable.aboud_dev_icon).withTextColorRes(R.color.menu_text_color)
                            .withTypeface(Typeface.createFromAsset(getApplicationContext().getAssets(),
                                    "fonts/iransans_light.ttf"))

            ).withSelectedItem(2)
            //the listener which is called when an item inside the drawer or miniDrawer is clicked
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null) {

                        if (drawerItem.getIdentifier() == 1) { //NowWeatherPage
                            Intent intent = new Intent(MainActivity.this, NowWeatherPage.class);
                            startActivity(intent);
                            result.setSelection(2);

                        } else if (drawerItem.getIdentifier() == 2) {

                        } else if (drawerItem.getIdentifier() == 3) {
                            getCityByLocation();
                            result.setSelection(2);
                        } else if (drawerItem.getIdentifier() == 4) {
                            searchCities();
                            universal_flag = true;
                            result.setSelection(2);

                        } else if (drawerItem.getIdentifier() == 5) {
                            Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
                            startActivity(intent);
                            result.setSelection(2);

                        } else if (drawerItem.getIdentifier() == 6) {
                            aboutDialog();
                            result.setSelection(2);
                        }

                    }
                    return false;
                }
            }).withCloseOnClick(true).withSavedInstance(savedInstanceState).build();
    result.setSelection(2, false);
    result.addItem(new DividerDrawerItem());
    result.addStickyFooterItem(new PrimaryDrawerItem().withName("         Developed By Methoz").withTypeface(
            Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/copperplate.ttf")));

    //define maxDrawerWidth (this is the width in the complete opened state)
    crossfadeDrawerLayout.setMaxWidthPx(DrawerUIUtils.getOptimalDrawerWidth(this));

    //add second view (which is the miniDrawer)
    MiniDrawer miniResult = result.getMiniDrawer();
    //build the view for the MiniDrawer
    View view = miniResult.build(this);
    //set the background of the MiniDrawer as this would be transparent
    view.setBackgroundColor(getResources().getColor(R.color.mini_drawer_static_color));
    //we do not have the MiniDrawer view during CrossfadeDrawerLayout creation so we will add it here
    crossfadeDrawerLayout.getSmallView().addView(view, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);

    //define the crossfader to be used with the miniDrawer. This is required to be able to automatically toggle open / close
    miniResult.withCrossFader(new ICrossfader() {
        @Override
        public void crossfade() {
            crossfadeDrawerLayout.crossfade(400);
            //only close the drawer if we were already faded and want to close it now
            if (isCrossfaded()) {
                result.getDrawerLayout().closeDrawer(GravityCompat.START);
            }
        }

        @Override
        public boolean isCrossfaded() {
            return crossfadeDrawerLayout.isCrossfaded();
        }
    });

    //End of OnCreate Method.

}

From source file:codepath.watsiapp.utils.Util.java

public static void applyPrimaryFont(Context ctx, PagerSlidingTabStrip view) {
    Typeface typeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/" + PRIMARY_FONT);
    view.setTypeface(typeface, Typeface.BOLD);
}