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:app.sunstreak.yourpisd.MainActivity.java

private void setUpTroll() {
    MyTextView.typeface = Typeface.createFromAsset(getAssets(), "Comic-Sans.ttf");
}

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  a2s  .  co  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.lt.adamlee.aagame.GameView.java

public GameView(Context context, AttributeSet attrs) {
    super(context, attrs);
    ctx = context;//from ww w. j  av  a  2s .c  o  m
    getHolder().addCallback(this);
    setFocusable(true);
    DisplayMetrics DisplayMetrics = new DisplayMetrics();
    DisplayMetrics = context.getResources().getDisplayMetrics();
    screenW = DisplayMetrics.widthPixels;
    screenH = DisplayMetrics.heightPixels;
    this.mainpageimage = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.mainpageimage);
    this.mainpageimage = Bitmap.createScaledBitmap(this.mainpageimage, screenW, screenH, true);
    this.play = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.play);
    this.play = Bitmap.createScaledBitmap(this.play, (int) F.wf(90.0f), (int) F.wf(90.0f), true);
    this.cartoonbomb = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.cartoonbomb);
    this.cartoonbomb = Bitmap.createScaledBitmap(this.cartoonbomb, (int) F.hf(20.0f), (int) F.hf(20.0f), true);
    this.leaderboard = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.leaderboard);
    this.leaderboard = Bitmap.createScaledBitmap(this.leaderboard, (int) F.wf(70.0f), (int) F.wf(70.0f), true);
    this.moreapps = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.moreapps);
    this.moreapps = Bitmap.createScaledBitmap(this.moreapps, (int) F.wf(70.0f), (int) F.wf(70.0f), true);
    this.help = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.help);
    this.help = Bitmap.createScaledBitmap(this.help, (int) F.wf(70.0f), (int) F.wf(70.0f), true);
    this.about = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.about);
    this.about = Bitmap.createScaledBitmap(this.about, (int) F.wf(70.0f), (int) F.wf(70.0f), true);
    this.localAd = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.addimagebottom);
    view = new Circle();
    paint2 = new Paint();
    paint3 = new Paint();
    paint4 = new Paint();
    paint5 = new Paint();
    paint6 = new Paint();
    paint7 = new Paint();
    paint13 = new Paint();
    this.paint10 = new Paint();
    this.level = new LevelPage();
    circledrawboolean = new boolean[100];
    this.innercircletext = new Paint();
    this.innercircletext.setColor(-1);
    this.textsizetext = 10.0f;
    this.innercircletext.setTextSize(F.hf(this.textsizetext));
    this.innercircletext.setTypeface(tf);
    this.innercircletext.setTextAlign(Paint.Align.CENTER);
    this.innercircletext.setAntiAlias(true);
    this.innercircletext.setFilterBitmap(true);
    this.p9 = new Paint();
    this.paint20 = new Paint();
    this.paint21 = new Paint();
    this.pp = new Paint();
    this.eg = new ExitGame();
    paint4.setColor(ViewCompat.MEASURED_STATE_MASK);
    paint4.setAntiAlias(true);
    paint4.setFilterBitmap(true);
    paint4.setPathEffect(new DashPathEffect(new float[] { 30.0f, 0.0f }, 0.0f));
    paint4.setStrokeWidth(2.0f);
    paint4.setColor(ViewCompat.MEASURED_STATE_MASK);
    paint3.setColor(ViewCompat.MEASURED_STATE_MASK);
    paint3.setAntiAlias(true);
    paint3.setFilterBitmap(true);
    counter = 0;
    linecounter = -1;
    blinedraw = new boolean[100];
    blinedraw1 = new boolean[100];
    circleanimation = new boolean[100];
    savex = new int[100];
    savey = new int[100];
    rotation = new float[100];
    textsize = 20;
    a2 = 1200;
    tf = Typeface.createFromAsset(ctx.getAssets(), "Russo_One.ttf");
    textsize4 = 20;
    this.paint21.setTextSize(F.hf((float) textsize4));
    paint2.setTextSize(F.hf((float) textsize));
    textsize = 25;
    tf = Typeface.createFromAsset(ctx.getAssets(), "Russo_One.ttf");
    paint6.setTextSize(F.hf((float) textsize));
    this.textsize3 = 22;
    tf = Typeface.createFromAsset(ctx.getAssets(), "Russo_One.ttf");
    this.pp.setTextSize(F.hf((float) this.textsize3));
    a1 = MotionEventCompat.ACTION_MASK;
    changeangle = 2.0d;
    this.directioncounter = 1;
    NoOfInitialLines = 6;
    holdcounter = 0;
    hcm = 0;
    this.anim = new Levelfailedanimation();
    levelcounter = 1;
    textdisplayboolean = true;
    if (levelcounter > 0 && levelcounter < 4) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 3 && levelcounter < 7) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 6 && levelcounter < 10) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 9 && levelcounter < 13) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 12 && levelcounter < 16) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 15 && levelcounter < 19) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 18 && levelcounter < 22) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 21 && levelcounter < 25) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 24 && levelcounter < 28) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 27 && levelcounter < 31) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 30 && levelcounter < 34) {
        NoOfInitialLines = 1;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 33 && levelcounter < 37) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 36 && levelcounter < 40) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 39 && levelcounter < 43) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 42 && levelcounter < 46) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 45 && levelcounter < 49) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 48 && levelcounter < 52) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 51 && levelcounter < 55) {
        NoOfInitialLines = 7;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 54 && levelcounter < 58) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 57 && levelcounter < 61) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 606 && levelcounter < 64) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 63 && levelcounter < 67) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 66 && levelcounter < 70) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 69 && levelcounter < 73) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 72 && levelcounter < 76) {
        NoOfInitialLines = 9;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 75 && levelcounter < 79) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 78 && levelcounter < 82) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 81 && levelcounter < 85) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 84 && levelcounter < 88) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 87 && levelcounter < 91) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 90 && levelcounter < 94) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 93 && levelcounter < 97) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 96 && levelcounter < 101) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 100 && levelcounter < 105) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 104 && levelcounter < 108) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 107 && levelcounter < 111) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 110 && levelcounter < 114) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 113 && levelcounter < 117) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 116 && levelcounter < 121) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 120 && levelcounter < 124) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 123 && levelcounter < TransportMediator.KEYCODE_MEDIA_PAUSE) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > TransportMediator.KEYCODE_MEDIA_PLAY && levelcounter < 131) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > TransportMediator.KEYCODE_MEDIA_RECORD && levelcounter < 134) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 133 && levelcounter < 137) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 136 && levelcounter < 140) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 139 && levelcounter < 144) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 143 && levelcounter < 146) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 146 && levelcounter < 151) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 150 && levelcounter < 155) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 154 && levelcounter < 158) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 157 && levelcounter < 161) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 160 && levelcounter < 164) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 163 && levelcounter < 167) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 166 && levelcounter < 171) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 170 && levelcounter < 174) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 173 && levelcounter < 177) {
        NoOfInitialLines = 5;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 176 && levelcounter < 180) {
        NoOfInitialLines = 4;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 179 && levelcounter < 184) {
        NoOfInitialLines = 2;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 183 && levelcounter < 187) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 186 && levelcounter < 191) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 190 && levelcounter < 194) {
        NoOfInitialLines = 3;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 193 && levelcounter < 197) {
        NoOfInitialLines = 6;
        saveline = NoOfInitialLines;
    }
    if (levelcounter > 196 && levelcounter < 202) {
        NoOfInitialLines = 8;
        saveline = NoOfInitialLines;
    }
}

From source file:com.projecty.sleepgroundbox.activity.HomeActivity.java

private void setUP() {
    TextView userId = (TextView) findViewById(R.id.user_id);
    TextView bjName = (TextView) findViewById(R.id.bj_name);
    Typeface custom_font = Typeface.createFromAsset(getAssets(), "NotoSans.otf");
    userId.setTypeface(custom_font);//from  w w w. j ava 2 s .c  o  m
    bjName.setTypeface(custom_font);

}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

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

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    mFontAwesomeTypeFace = Typeface.createFromAsset(getAssets(), "FontAwesome.ttf");
}

From source file:de.enlightened.peris.MessageActivity.java

private void renderMessage(final Message message) {
    final Context context = this.getApplicationContext();
    final SharedPreferences appPreferences = context.getSharedPreferences("prefs", 0);
    final boolean useShading = appPreferences.getBoolean("use_shading", false);
    final boolean useOpenSans = appPreferences.getBoolean("use_opensans", false);
    final int fontSize = appPreferences.getInt("font_size", DEFAULT_FONT_SIZE);
    final boolean currentAvatarSetting = appPreferences.getBoolean("show_images", true);
    final Typeface opensans = Typeface.createFromAsset(context.getAssets(), "fonts/opensans.ttf");

    final View view = this.findViewById(R.id.message_layout);
    final TextView poAuthor = (TextView) view.findViewById(R.id.message_author);
    final TextView poTimestamp = (TextView) view.findViewById(R.id.message_timestamp);
    final TextView tvOnline = (TextView) view.findViewById(R.id.message_online_status);

    final LinearLayout llBorderBackground = (LinearLayout) view.findViewById(R.id.ll_border_background);
    final LinearLayout llColorBackground = (LinearLayout) view.findViewById(R.id.ll_color_background);

    String textColor = context.getString(R.string.default_text_color);
    if (this.application.getSession().getServer().serverTextColor.contains("#")) {
        textColor = this.application.getSession().getServer().serverTextColor;
    }/*from  w ww .ja v  a 2 s  . c  o  m*/

    String boxColor = context.getString(R.string.default_element_background);
    if (this.application.getSession().getServer().serverBoxColor != null) {
        boxColor = this.application.getSession().getServer().serverBoxColor;
    }

    if (boxColor.contains("#")) {
        llColorBackground.setBackgroundColor(Color.parseColor(boxColor));
    } else {
        llColorBackground.setBackgroundColor(Color.TRANSPARENT);
    }

    //TODO: remove border?
    String boxBorder = context.getString(R.string.default_element_border);
    if (this.application.getSession().getServer().serverBoxBorder != null) {
        boxBorder = this.application.getSession().getServer().serverBoxBorder;
    }

    if (boxBorder.contentEquals("1")) {
        llBorderBackground.setBackgroundResource(R.drawable.element_border);
    } else {
        llBorderBackground.setBackgroundColor(Color.TRANSPARENT);
    }

    if (useOpenSans) {
        poAuthor.setTypeface(opensans);
        poTimestamp.setTypeface(opensans);
        tvOnline.setTypeface(opensans);
    }

    if (useShading) {
        poAuthor.setShadowLayer(2, 0, 0, Color.parseColor("#66000000"));
        tvOnline.setShadowLayer(2, 0, 0, Color.parseColor("#66000000"));
    }

    final LinearLayout llPostBodyHolder = (LinearLayout) view.findViewById(R.id.message_body_holder);
    llPostBodyHolder.removeAllViews();

    final ImageView poAvatar = (ImageView) view.findViewById(R.id.message_avatar);

    if (boxColor != null && boxColor.contains("#") && boxColor.length() == 7) {
        final ImageView postAvatarFrame = (ImageView) view.findViewById(R.id.message_avatar_frame);
        postAvatarFrame.setColorFilter(Color.parseColor(boxColor));
    } else {
        final ImageView postAvatarFrame = (ImageView) view.findViewById(R.id.message_avatar_frame);
        postAvatarFrame.setVisibility(View.GONE);
    }

    if (message.isAuthorOnline()) {
        tvOnline.setText("ONLINE");
        tvOnline.setVisibility(View.VISIBLE);
    } else {
        tvOnline.setVisibility(View.GONE);
    }

    poAuthor.setText(message.getAuthor());
    poTimestamp.setText(DateTimeUtils.getTimeAgo(message.getTimestamp()));

    final String postContent = message.getBody();
    // TODO: add attachments
    BBCodeParser.parseCode(context, llPostBodyHolder, postContent, opensans, useOpenSans, useShading,
            new ArrayList<PostAttachment>(), fontSize, true, textColor, this.application);

    poAuthor.setTextColor(Color.parseColor(textColor));
    poTimestamp.setTextColor(Color.parseColor(textColor));

    if (currentAvatarSetting) {
        if (Net.isUrl(message.getAuthorAvatar())) {
            final String imageUrl = message.getAuthorAvatar();
            ImageLoader.getInstance().displayImage(imageUrl, poAvatar);
        } else {
            poAvatar.setImageResource(R.drawable.no_avatar);
        }
    } else {
        poAvatar.setVisibility(View.GONE);
    }
}

From source file:com.casin.activity.HomeDrawerActivity.java

public void initHeaderLayout(String name, String balancePoints) {
    Typeface snapFont = Typeface.createFromAsset(getAssets(), "SNAP.TTF");
    TextView headrTitleTextView = (TextView) findViewById(R.id.headerTitle);
    headrTitleTextView.setTypeface(snapFont);
    headrTitleTextView.setText(name);/*from ww w. j  a  va2  s .  co m*/

    TextView scoreTitleTextView = (TextView) findViewById(R.id.score);
    scoreTitleTextView.setText(balancePoints);

    ImageView leftMenuBarImageView = (ImageView) findViewById(R.id.leftMenuBar);
    leftMenuBarImageView.setVisibility(View.VISIBLE);
    leftMenuBarImageView.setOnClickListener(leftMenuBarClickListener);
}

From source file:com.usertaxi.TaxiOntheWay_Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_taxiontheway);

    taxiOntheWay_activity_instance = this;
    AppPreferences.setApprequestTaxiScreen(TaxiOntheWay_Activity.this, true);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.BLACK);
    setSupportActionBar(toolbar);//from w w  w .j av  a 2s.co  m
    String title = getString(R.string.title_activity_taxidetail);
    getSupportActionBar().setTitle(title);
    fab_menu = (FloatingActionsMenu) findViewById(R.id.fab_menu);
    FloatingActionButton fab_msg = (FloatingActionButton) findViewById(R.id.fab_message);
    FloatingActionButton fab_call = (FloatingActionButton) findViewById(R.id.fab_call);
    FloatingActionButton fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);

    textheader = (TextView) findViewById(R.id.textheader);
    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);
    mdriverlicense = (TextView) findViewById(R.id.driverlicense);
    medriverinsurance = (TextView) findViewById(R.id.driverinsurance);
    mdriverimage = (ImageView) findViewById(R.id.driver_image);

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

    getLocation();

    Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
    textheader.setTypeface(tf);
    mtextnamehead.setTypeface(tf);
    mtextcompanyhead.setTypeface(tf);
    mtextmobilehead.setTypeface(tf);
    mtexttexinumhead.setTypeface(tf);
    textname.setTypeface(tf);
    textmobilenumber.setTypeface(tf);
    textcompanyname.setTypeface(tf);
    texttaxinumber.setTypeface(tf);
    mdriverlicense.setTypeface(tf);
    medriverinsurance.setTypeface(tf);

    Intent intent = getIntent();
    String data = intent.getStringExtra("data");
    Log.d("data value", data + "");

    //caceldialog();
    JSONObject jsonObject = null;
    try {
        jsonObject = new JSONObject(data);
        AppPreferences.setAcceptdriverId(TaxiOntheWay_Activity.this, jsonObject.getString("driverId"));
        Log.d("driverid---", AppPreferences.getAcceptdriverId(TaxiOntheWay_Activity.this));
        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");
        SourceAddress = jsonObject.getString("source_address");
        sourcelatitude = jsonObject.getDouble("source_latitude");
        sourcelongitude = jsonObject.getDouble("source_longitude");
        driverlicense = jsonObject.getString("driverlicense");
        driverinsurance = jsonObject.getString("driverinsurance");

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

        final LatLng loc = new LatLng(new Double(sourcelatitude), new Double(sourcelongitude));
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 15));
        final MarkerOptions marker = new MarkerOptions().position(loc).title(SourceAddress);
        //  marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));

        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_three));
        map.addMarker(marker);

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

        if (mdriverlicense.length() == 0) {
            mdriverlicense.setVisibility(View.GONE);
        }
        if (medriverinsurance.length() == 0) {
            medriverinsurance.setVisibility(View.GONE);
        }
        //taxiname.setText(drivertaxiname);

        Intent intent1 = new Intent(TaxiOntheWay_Activity.this, DriverService.class);
        intent1.putExtra("driverId", jsonObject.getString("driverId"));
        startService(intent1);

        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(TaxiOntheWay_Activity.this)),
                                new Double(AppPreferences.getCurrentlong(TaxiOntheWay_Activity.this)));

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

                        }
                        animateMarker(marker1, loc2, false);

                        /* try{
                             String url = Function.getDirectionsUrl(new LatLng(Double.parseDouble(AppPreferences.getPreviouslat(getApplicationContext())),
                                     Double.parseDouble(AppPreferences.getPreviouslong(getApplicationContext()))),
                                     new LatLng(Double.parseDouble(AppPreferences.getCurrentlat(getApplicationContext())),
                                             Double.parseDouble(AppPreferences.getCurrentlong(getApplicationContext()))));
                             RoutesDownloadTask downloadTask = new RoutesDownloadTask(TaxiOntheWay_Activity.this);
                             downloadTask.execute(url);
                         }catch(Exception e)
                         {
                             e.printStackTrace();
                         }*/
                    }
                });
            }
        }, delay, period);

    } catch (JSONException e) {
        e.printStackTrace();
    }
    /////////////notification dataend///////////////

    fab_cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowcanceltaxi();

        }
    });
    fab_msg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            initiatePopupWindowsendmesage();
        }
    });
    fab_call.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:" + drivermobile));
            startActivity(callIntent);
        }
    });

    moveMarkerList = new ArrayList<LatLng>();
    //        moveRoadMarker();
}

From source file:com.crossconnect.activity.main.BibleTextFragment.java

private void loadSettings() {
    SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    // Now, we're going to check for the Text size variable and set the text
    // size/*from   ww w  .  java  2  s.  c  o m*/

    bibleTextView.setTextSize(
            Float.parseFloat(appPreferences.getString(getActivity().getString(R.string.text_size_key), "18")));

    int color = appPreferences.getInt(getActivity().getString(R.string.text_color_key), Color.BLACK);
    bibleTextView.setTextColor(color);

    try {
        //Set Custom font
        bibleTextView
                .setTypeface(
                        Typeface.createFromAsset(getActivity().getAssets(),
                                "fonts/" + appPreferences.getString(
                                        getActivity().getString(R.string.text_font_key), "Ubuntu-R.ttf")),
                        Typeface.NORMAL);
        //            this.setTypeface(Typeface.createFromAsset(ctx.getAssets(), "fonts/" + "Ubuntu-B.ttf"), Typeface.BOLD);
    } catch (Exception e) {
        //Custom font not found
        Log.e(TAG, "Font not found!", e);
    }

}

From source file:pro.jariz.reisplanner.fragments.PlannerFragment.java

void Render(NSStation[] nsStations, final View x, final Context context) {

    AutoCompleteTextView auto = (AutoCompleteTextView) x.findViewById(R.id.AutoCompleteTextView1);
    AutoCompleteTextView auto2 = (AutoCompleteTextView) x.findViewById(R.id.AutoCompleteTextView2);
    AutoCompleteTextView auto3 = (AutoCompleteTextView) x.findViewById(R.id.AutoCompleteTextView3);

    ArrayList<String> fullnames = new ArrayList<String>();
    CardUI mCardView = (CardUI) x.findViewById(R.id.cardsview);
    mCardView.setSwipeable(true);//from  w w  w .  j  a  va2  s  . c o m
    CardStack stack = new CardStack();
    stack.setTitle("Recentelijke stations");

    for (Integer i = 0; i < nsStations.length; i++) {
        fullnames.add((nsStations[i]).Namen.Lang);
        if (i < 5)
            stack.add(new StationCard((nsStations[i]).Namen.Lang));
    }
    mCardView.addStack(stack);

    //draw time
    auto.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, fullnames));
    auto2.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, fullnames));
    auto3.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, fullnames));
    mCardView.refresh();

    //stacktitle, do you even #HOLO?
    stack.setTitleTypeFace(Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-ThinItalic.ttf"));
}