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.xplink.android.carchecklist.CarCheckListActivity.java

/** Called when the activity is first created. */
@Override//w w  w.j a  v a 2s  .c  o m
public void onCreate(Bundle savedInstanceState) { // end 480
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // deleteAllData();
    // ************************************************************************************
    listValue = restoreCheckList();
    if (listValue != null) {
        SharedPreferences restoreShared = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
        Editor edit = restoreShared.edit();

        Map<String, Boolean> mapList = listValue.get(0);
        Map<String, Integer> mapSetting = listValue.get(1);
        int countChecknum = 0;
        int numPowerChecked = 0;
        int numEngineChecked = 0;
        int numExteriorChecked = 0;
        int numInteriorChecked = 0;
        int numDocumentChecked = 0;

        for (Map.Entry<String, Boolean> entry : mapList.entrySet()) {

            String[] tmp = entry.getKey().split("\\_");
            Log.i("checkkeyvalue", tmp[0] + " : " + tmp[1]);
            String key = tmp[0];

            if ("inside".equals(key)) {
                if (entry.getValue()) {
                    getTotalInterior(true);
                    numInteriorChecked++;
                    Log.i("checkbox", "numInteriorChecked : " + numInteriorChecked);
                }
            } else if ("power".equals(key)) {
                if (entry.getValue()) {
                    getTotalPower(true);
                    numPowerChecked++;
                    Log.i("checkbox", "numPowerChecked : " + numPowerChecked);
                }
            } else if ("engine".equals(key)) {
                if (entry.getValue()) {
                    getTotalEngine(true);
                    numEngineChecked++;
                    Log.i("checkbox", "numEngineChecked : " + numEngineChecked);
                }
            } else if ("outside".equals(key)) {
                if (entry.getValue()) {
                    getTotalExterior(true);
                    numExteriorChecked++;
                    Log.i("checkbox", "numExteriorChecked : " + numExteriorChecked);
                }
            } else if ("doc".equals(key)) {
                if (entry.getValue()) {
                    getTotalDocument(true);
                    numDocumentChecked++;
                    Log.i("checkbox", "numDocumentChecked : " + numDocumentChecked);
                }
            }
            edit.putBoolean(entry.getKey(), entry.getValue());
            // println(entry.getKey() + " : " + entry.getValue());
        }
        Checknum = countChecknum;

        edit.putInt("CheckPowerTotal", numPowerChecked);
        edit.putInt("CheckEngineTotal", numEngineChecked);
        edit.putInt("CheckExteriorTotal", numExteriorChecked);
        edit.putInt("CheckInteriorTotal", numInteriorChecked);
        edit.putInt("CheckDocumentTotal", numDocumentChecked);

        edit.commit();

        CheckPowerTotal = restoreShared.getInt("CheckPowerTotal", 0);
        CheckEngineTotal = restoreShared.getInt("CheckEngineTotal", 0);
        CheckExteriorTotal = restoreShared.getInt("CheckExteriorTotal", 0);
        CheckInteriorTotal = restoreShared.getInt("CheckInteriorTotal", 0);
        CheckDocumentTotal = restoreShared.getInt("CheckDocumentTotal", 0);

        Log.i("checklist", "in listValue - numPowerChecked : " + numPowerChecked);
        Log.i("checklist", "numEngineChecked : " + numEngineChecked);
        Log.i("checklist", "numExteriorChecked : " + numExteriorChecked);
        Log.i("checklist", "numInteriorChecked : " + numInteriorChecked);
        Log.i("checklist", "numDocumentChecked : " + numDocumentChecked);

        Log.i("checklist", "CheckPowerTotal : " + CheckPowerTotal);
        Log.i("checklist", "CheckEngineTotal : " + CheckEngineTotal);
        Log.i("checklist", "CheckExteriorTotal : " + CheckExteriorTotal);
        Log.i("checklist", "CheckInteriorTotal : " + CheckInteriorTotal);
        Log.i("checklist", "CheckDocumentTotal : " + CheckDocumentTotal);

        //edit.commit();
        for (Map.Entry<String, Integer> entry : mapSetting.entrySet()) {

            if ("interior".equals(entry.getKey())) {
                edit.putInt("Interiorbar", entry.getValue());
            } else if ("power".equals(entry.getKey())) {
                edit.putInt("Powerbar", entry.getValue());
            } else if ("engine".equals(entry.getKey())) {
                edit.putInt("Enginebar", entry.getValue());
            } else if ("exterior".equals(entry.getKey())) {
                edit.putInt("Exteriorbar", entry.getValue());
            } else {
                edit.putInt("Documentbar", entry.getValue());
            }
            // Log.i("checkSettingsName", "checkSettingsName : " +
            // entry.getKey());
        }
        edit.commit();

        /*
         * ProgressBar PowerProgress, EngineProgress, ExteriorProgress,
         * InteriorProgress, DocumentProgress, RatioProgress; TextView
         * percenpower, percenengine, percenexterior, perceninterior,
         * percendocument, Ratiotext;
         */
    }
    // ************************************************************************************
    // isSaveCheckBox();
    store = new Bundle();
    db = new DBCarCheckList(this);

    intent = new Intent(getApplicationContext(), RecordActivity.class);

    // getSettingShared();

    // Log.i("dbcarchecklist", "create object DBCarCheckList");

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    float height = metrics.heightPixels;
    float width = metrics.widthPixels;

    Log.d("height", "" + height);
    Log.d("width", "" + width);

    int left195 = (int) ((width / 100) * 15.3);
    int left200 = (int) ((width / 100) * 16.25);
    int leftt200 = (int) ((width / 100) * 17);
    int left230 = (int) ((width / 100) * 18);
    int left475 = (int) ((width / 100) * 37.1);
    int left480 = (int) ((width / 100) * 38);
    int left495 = (int) ((width / 100) * 38.7);
    int left500 = (int) ((width / 100) * 40.5);
    int left510 = (int) ((width / 100) * 39.7);
    int left530 = (int) ((width / 100) * 41.2);
    int left865 = (int) ((width / 100) * 67.6);
    int left870 = (int) ((width / 100) * 69.5);
    int leftt870 = (int) ((width / 100) * 68);
    int leftt900 = (int) ((width / 100) * 70);
    int left950 = (int) ((width / 100) * 75);
    int left1150 = (int) ((width / 100) * 93);
    int left1180 = (int) ((width / 100) * 92);

    int top10 = (int) ((height / 100) * 3);
    int top20 = (int) ((height / 100) * 6.5);
    int top40 = (int) ((height / 100) * 5);
    int top95 = (int) ((height / 100) * 12);
    int top100 = (int) ((height / 100) * 12.5);
    int top110 = (int) ((height / 100) * 16.5);
    int top130 = (int) ((height / 100) * 19);
    int top135 = (int) ((height / 100) * 17.5);
    int top225 = (int) ((height / 100) * 28.8);
    int top390 = (int) ((height / 100) * 53);
    int top410 = (int) ((height / 100) * 51.5);
    int top480 = (int) ((height / 100) * 64.5);
    int top500 = (int) ((height / 100) * 63);
    int top505 = (int) ((height / 100) * 63.8);
    int top595 = (int) ((height / 100) * 75);
    int top610 = (int) ((height / 100) * 76);

    Intent intent = getIntent();
    PercenPower = intent.getIntExtra("power", PercenPower);
    PercenEngine = intent.getIntExtra("engine", PercenEngine);
    PercenExterior = intent.getIntExtra("exterior", PercenExterior);
    PercenInterior = intent.getIntExtra("interior", PercenInterior);
    PercenDocument = intent.getIntExtra("document", PercenDocument);

    // follow : get data from shared preferences
    /*
     * SharedPreferences memo = getSharedPreferences("mysettings",
     * Context.MODE_PRIVATE); PercenPower = memo.getInt("PercenPower", 0);
     * PercenEngine = memo.getInt("PercenEngine", 0); PercenExterior =
     * memo.getInt("PercenExterior", 0); PercenInterior =
     * memo.getInt("PercenInterior", 0); PercenDocument =
     * memo.getInt("PercenDocument", 0);
     */

    CheckPowerTotal = intent.getIntExtra("numpower", CheckPowerTotal);
    CheckEngineTotal = intent.getIntExtra("numengine", CheckEngineTotal);
    CheckExteriorTotal = intent.getIntExtra("numexterior", CheckExteriorTotal);
    CheckInteriorTotal = intent.getIntExtra("numinterior", CheckInteriorTotal);
    CheckDocumentTotal = intent.getIntExtra("numdocument", CheckDocumentTotal);

    // Log.d("percen", "" + PercenPower);

    type = Typeface.createFromAsset(getAssets(), "Circular.ttf");

    MyCustomPanel view = new MyCustomPanel(this);

    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(1200, 800);
    params.width = 1200;
    params.height = 800;

    addContentView(view, params);

    RelativeLayout.LayoutParams imgpower = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imgpower.setMargins(left480, top20, 0, 0);
    RelativeLayout.LayoutParams bdpower = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    bdpower.setMargins(left475, top40, 0, 0);
    RelativeLayout.LayoutParams txtpower = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtpower.setMargins(left510, top135, 0, 0);

    ImageView borderpower = (ImageView) findViewById(R.id.powerborder);
    borderpower.setLayoutParams(bdpower);
    percenpower = (TextView) findViewById(R.id.percenpower);
    percenpower.setLayoutParams(txtpower);
    percenpower.setTypeface(type);
    percenpower.setText("" + PercenPower + "%");
    PowerProgress = (ProgressBar) findViewById(R.id.PowerProgressbar);
    PowerProgress.setMax(100);
    PowerProgress.setProgress(PercenPower);
    headpower = (ImageView) findViewById(R.id.headpower);
    btnPower = (ImageButton) findViewById(R.id.battery_button);
    btnPower.setLayoutParams(imgpower);
    btnPower.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            // startAnimation
            SlidePowerLayout();
        }
    });

    RelativeLayout.LayoutParams imgengine = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imgengine.setMargins(left200, top110, 0, 0);
    RelativeLayout.LayoutParams bdengine = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    bdengine.setMargins(left195, top110, 0, 0);
    RelativeLayout.LayoutParams txtengine = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtengine.setMargins(left230, top225, 0, 0);

    ImageView borderengine = (ImageView) findViewById(R.id.engineborder);
    borderengine.setLayoutParams(bdengine);
    percenengine = (TextView) findViewById(R.id.percenengine);
    percenengine.setLayoutParams(txtengine);
    percenengine.setTypeface(type);
    percenengine.setText("" + PercenEngine + "%");
    EngineProgress = (ProgressBar) findViewById(R.id.EngineProgressbar);
    EngineProgress.setMax(100);
    EngineProgress.setProgress(PercenEngine);
    headengine = (ImageView) findViewById(R.id.headengine);
    btnEngine = (ImageButton) findViewById(R.id.engine_button);
    btnEngine.setLayoutParams(imgengine);
    btnEngine.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // startAnimation
            SlideEngineLayout();
        }
    });

    RelativeLayout.LayoutParams imgexterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imgexterior.setMargins(leftt200, top390, 0, 0);
    RelativeLayout.LayoutParams bdexterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    bdexterior.setMargins(left195, top410, 0, 0);
    RelativeLayout.LayoutParams txtexterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtexterior.setMargins(left230, top505, 0, 0);

    ImageView borderexterior = (ImageView) findViewById(R.id.exteriorborder);
    borderexterior.setLayoutParams(bdexterior);
    percenexterior = (TextView) findViewById(R.id.percenexterior);
    percenexterior.setLayoutParams(txtexterior);
    percenexterior.setTypeface(type);
    percenexterior.setText("" + PercenExterior + "%");
    ExteriorProgress = (ProgressBar) findViewById(R.id.ExteriorProgressbar);
    ExteriorProgress.setMax(100);
    ExteriorProgress.setProgress(PercenExterior);
    headexterior = (ImageView) findViewById(R.id.headexterior);
    btnExterior = (ImageButton) findViewById(R.id.outside_button);
    btnExterior.setLayoutParams(imgexterior);

    btnExterior.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // startAnimation
            SlideExteriorLayout();
        }
    });

    RelativeLayout.LayoutParams imginterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imginterior.setMargins(left500, top480, 0, 0);
    RelativeLayout.LayoutParams bdinterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    bdinterior.setMargins(left495, top500, 0, 0);
    RelativeLayout.LayoutParams txtinterior = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtinterior.setMargins(left530, top595, 0, 0);

    ImageView borderinterior = (ImageView) findViewById(R.id.interiorborder);
    borderinterior.setLayoutParams(bdinterior);
    perceninterior = (TextView) findViewById(R.id.perceninterior);
    perceninterior.setLayoutParams(txtinterior);
    perceninterior.setTypeface(type);
    perceninterior.setText("" + PercenInterior + "%");
    InteriorProgress = (ProgressBar) findViewById(R.id.InteriorProgressbar);
    InteriorProgress.setMax(100);
    InteriorProgress.setProgress(PercenInterior);
    headinterior = (ImageView) findViewById(R.id.headinterior);
    btnInterior = (ImageButton) findViewById(R.id.inside_button);
    btnInterior.setLayoutParams(imginterior);
    btnInterior.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // startAnimation
            SlideInteriorLayout();
        }
    });

    RelativeLayout.LayoutParams imgdocument = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imgdocument.setMargins(left870, top480, 0, 0);
    RelativeLayout.LayoutParams bddocument = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    bddocument.setMargins(left865, top500, 0, 0);
    RelativeLayout.LayoutParams txtdocument = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtdocument.setMargins(leftt900, top595, 0, 0);
    RelativeLayout.LayoutParams progdocument = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    progdocument.setMargins(leftt870, top610, 0, 0);

    ImageView borderdocument = (ImageView) findViewById(R.id.documentborder);
    borderdocument.setLayoutParams(bddocument);
    percendocument = (TextView) findViewById(R.id.percendocument);
    percendocument.setLayoutParams(txtdocument);
    percendocument.setTypeface(type);
    percendocument.setText("" + PercenDocument + "%");
    DocumentProgress = (ProgressBar) findViewById(R.id.DocumentProgressbar);
    DocumentProgress.setMax(100);
    DocumentProgress.setProgress(PercenDocument);
    headdocument = (ImageView) findViewById(R.id.headdocument);
    btnDocument = (ImageButton) findViewById(R.id.document_button);
    btnDocument.setLayoutParams(imgdocument);
    btnDocument.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            SlideDocumentLayout();

        }
    });

    RelativeLayout.LayoutParams imgsetting = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    imgsetting.setMargins(left1180, top10, 0, 0);
    RelativeLayout.LayoutParams txtratio = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    txtratio.setMargins(left950, top95, 0, 0);
    RelativeLayout.LayoutParams ratioprog = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    ratioprog.setMargins(left1150, top100, 0, 0);

    Ratiotext = (TextView) findViewById(R.id.ratiotext);
    Ratiotext.setLayoutParams(txtratio);
    RatioProgress = (ProgressBar) findViewById(R.id.ratio);
    RatioProgress.setLayoutParams(ratioprog);
    RatioProgress.setMax(100);
    headsetting = (ImageView) findViewById(R.id.headsetting);
    btnSetting = (ImageButton) findViewById(R.id.setting_button);
    btnSetting.setLayoutParams(imgsetting);
    btnSetting.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            SlideSettingLayout();

        }
    });

    // addMob
    LinearLayout layout = (LinearLayout) findViewById(R.id.admob);
    adView = new AdView(getApplicationContext());
    adView.setAdSize(AdSize.LEADERBOARD);
    adView.setAdUnitId(admonId);
    //adView.setAdUnitId("C17E5F3A146EC7E805175C72634D8098");
    // Add the adView to it
    layout.addView(adView);
    // Initiate a generic request to load it with an ad
    AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
    adRequestBuilder.addTestDevice("C17E5F3A146EC7E805175C72634D8098");
    // adRequestBuilder.addTestDevice("9F5DF3C9768A51CB506B68902F766B40");
    adView.loadAd(adRequestBuilder.build());
    // adView.loadAd(new AdRequest.Builder().build());
    SharedPreferences shared = getSharedPreferences("mysettings", Context.MODE_PRIVATE);
    // Log.i("checksum",
    // "before call CheckRatio : " + shared.getInt("checknum", 0));
    CheckRatio();
    // Log.i("checklist", "checking percenpower : " +
    // shared.getInt("PercenPower", -1));

    // restoreProgressCheckList();
}

From source file:com.aujur.ebookreader.Configuration.java

private FontFamily loadFamilyFromAssets(String key, String baseName) {
    Typeface basic = Typeface.createFromAsset(context.getAssets(), baseName + ".otf");
    Typeface boldFace = Typeface.createFromAsset(context.getAssets(), baseName + "-Bold.otf");
    Typeface italicFace = Typeface.createFromAsset(context.getAssets(), baseName + "-Italic.otf");
    Typeface biFace = Typeface.createFromAsset(context.getAssets(), baseName + "-BoldItalic.otf");

    FontFamily fam = new FontFamily(key, basic);
    fam.setBoldTypeface(boldFace);/*from ww  w  . ja  v a2s. c  om*/
    fam.setItalicTypeface(italicFace);
    fam.setBoldItalicTypeface(biFace);

    return fam;
}

From source file:cn.oddcloud.www.navigationtabbar.ntb.NavigationTabBar.java

public void setTypeface(final String typeface) {
    if (TextUtils.isEmpty(typeface))
        return;//from  w  ww.j a v  a2 s.co  m

    Typeface tempTypeface;
    try {
        tempTypeface = Typeface.createFromAsset(getContext().getAssets(), typeface);
    } catch (Exception e) {
        tempTypeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL);
        e.printStackTrace();
    }

    setTypeface(tempTypeface);
}

From source file:org.petero.droidfish.DroidFish.java

/** Called when the activity is first created. */
@Override//ww  w.j  a v  a 2s  . co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Pair<String, String> pair = getPgnOrFenIntent();
    String intentPgnOrFen = pair.first;
    String intentFilename = pair.second;

    createDirectories();

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    settings = PreferenceManager.getDefaultSharedPreferences(this);
    settings.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            handlePrefsChange();
        }
    });

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    setWakeLock(false);
    wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "droidfish");
    wakeLock.setReferenceCounted(false);

    custom1ButtonActions = new ButtonActions("custom1", CUSTOM1_BUTTON_DIALOG, R.string.select_action);
    custom2ButtonActions = new ButtonActions("custom2", CUSTOM2_BUTTON_DIALOG, R.string.select_action);
    custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG, R.string.select_action);

    figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
    setPieceNames(PGNOptions.PT_LOCAL);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    initUI();

    gameTextListener = new PgnScreenText(this, pgnOptions);
    if (ctrl != null)
        ctrl.shutdownEngine();
    ctrl = new DroidChessController(this, gameTextListener, pgnOptions);
    egtbForceReload = true;
    readPrefs();
    TimeControlData tcData = new TimeControlData();
    tcData.setTimeControl(timeControl, movesPerSession, timeIncrement);
    ctrl.newGame(gameMode, tcData);
    setAutoMode(AutoMode.OFF);
    {
        byte[] data = null;
        int version = 1;
        if (savedInstanceState != null) {
            data = savedInstanceState.getByteArray("gameState");
            version = savedInstanceState.getInt("gameStateVersion", version);
        } else {
            String dataStr = settings.getString("gameState", null);
            version = settings.getInt("gameStateVersion", version);
            if (dataStr != null)
                data = strToByteArr(dataStr);
        }
        if (data != null)
            ctrl.fromByteArray(data, version);
    }
    ctrl.setGuiPaused(true);
    ctrl.setGuiPaused(false);
    ctrl.startGame();
    if (intentPgnOrFen != null) {
        try {
            ctrl.setFENOrPGN(intentPgnOrFen);
            setBoardFlip(true);
        } catch (ChessParseError e) {
            // If FEN corresponds to illegal chess position, go into edit board mode.
            try {
                TextIO.readFEN(intentPgnOrFen);
            } catch (ChessParseError e2) {
                if (e2.pos != null)
                    startEditBoard(intentPgnOrFen);
            }
        }
    } else if (intentFilename != null) {
        if (intentFilename.toLowerCase(Locale.US).endsWith(".fen")
                || intentFilename.toLowerCase(Locale.US).endsWith(".epd"))
            loadFENFromFile(intentFilename);
        else
            loadPGNFromFile(intentFilename);
    }
}

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

private void initdata() {

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

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

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

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

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

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

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

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

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

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

    loginwithfacebook.setTypeface(segoeuiregular);
}

From source file:net.zorgblub.typhon.Configuration.java

private FontFamily loadFamilyFromAssets(String key, String baseName, boolean skipVariants) {
    Typeface basic = Typeface.createFromAsset(context.getAssets(), baseName + ".otf");
    Typeface boldFace = basic;/*from ww w .ja v a2  s .  co  m*/
    Typeface italicFace = basic;
    Typeface biFace = basic;

    if (!skipVariants) {
        boldFace = Typeface.createFromAsset(context.getAssets(), baseName + "-Bold.otf");
        italicFace = Typeface.createFromAsset(context.getAssets(), baseName + "-Italic.otf");
        biFace = Typeface.createFromAsset(context.getAssets(), baseName + "-BoldItalic.otf");
    }

    FontFamily fam = new FontFamily(key, basic);
    fam.setBoldTypeface(boldFace);
    fam.setItalicTypeface(italicFace);
    fam.setBoldItalicTypeface(biFace);

    return fam;
}

From source file:net.quduo.pixel.interfaces.android.activity.MainActivity.java

private void initViews() {

    // ?//from  w ww  . j  av a 2  s .  c  o m
    ChatFragment chatFragment = new ChatFragment();
    ContactFragment contactFragment = new ContactFragment();
    DiscoveryFragment discoveryFragment = new DiscoveryFragment();
    NearbyFragment nearbyFragment = new NearbyFragment();
    UserFragment userFragment = new UserFragment();

    mFragments.add(chatFragment);
    mFragments.add(contactFragment);
    mFragments.add(discoveryFragment);
    mFragments.add(nearbyFragment);
    mFragments.add(userFragment);

    typeface = Typeface.createFromAsset(getAssets(), "font/icon/iconfont.ttf");

    //  Action ??
    mActionTitle = (TextView) findViewById(R.id.action_title);
    mActionTitle.setVisibility(View.VISIBLE);
    mActionTitle.setText("(18)");
    mActionTitle.setPadding(8, 0, 0, 0);

    // mSearchActionitem = (Button) mActionBar.getCustomView().findViewById(R.id.search_action_item);
    mSearchActionitem = (Button) findViewById(R.id.search_action_item);
    mSearchActionitem.setTypeface(typeface);
    mSearchActionitem.setVisibility(View.VISIBLE);
    mSearchActionitem.setOnClickListener(mOnClickListener);
    // mPlusActionItem = (Button) mActionBar.getCustomView().findViewById(R.id.plus_action_item);
    mPlusActionItem = (Button) findViewById(R.id.plus_action_item);
    mPlusActionItem.setTypeface(typeface);
    mPlusActionItem.setVisibility(View.VISIBLE);
    mPlusActionItem.setOnClickListener(mOnClickListener);

    mChatMenuItem = (RelativeLayout) findViewById(R.id.chat_menu_item);
    mContactMenuItem = (RelativeLayout) findViewById(R.id.contact_menu_item);
    mDiscoveryMenuItem = (RelativeLayout) findViewById(R.id.discovery_menu_item);
    mNearbyMenuItem = (RelativeLayout) findViewById(R.id.nearby_menu_item);
    mUserMenuItem = (RelativeLayout) findViewById(R.id.user_menu_item);

    mChatMenuItem.setOnClickListener(mOnClickListener);
    mContactMenuItem.setOnClickListener(mOnClickListener);
    mDiscoveryMenuItem.setOnClickListener(mOnClickListener);
    mNearbyMenuItem.setOnClickListener(mOnClickListener);
    mUserMenuItem.setOnClickListener(mOnClickListener);

    // ?? Item
    mChatMenuIcon = (TextView) findViewById(R.id.chat_menu_icon);
    mChatMenuIconSelected = (TextView) findViewById(R.id.chat_menu_icon_selected);
    mContactMenuIcon = (TextView) findViewById(R.id.contact_menu_icon);
    mContactMenuIconSelected = (TextView) findViewById(R.id.contact_menu_icon_selected);
    mDiscoveryMenuIcon = (TextView) findViewById(R.id.discovery_menu_icon);
    mDiscoveryMenuIconSelected = (TextView) findViewById(R.id.discovery_menu_icon_selected);
    mNearbyMenuIcon = (TextView) findViewById(R.id.nearby_menu_icon);
    mNearbyMenuIconSelected = (TextView) findViewById(R.id.nearby_menu_icon_selected);
    mUserMenuIcon = (TextView) findViewById(R.id.user_menu_icon);
    mUserMenuIconSelected = (TextView) findViewById(R.id.user_menu_icon_selected);

    // 
    mChatMenuIcon.setTypeface(typeface);
    mChatMenuIconSelected.setTypeface(typeface);
    mContactMenuIcon.setTypeface(typeface);
    mContactMenuIconSelected.setTypeface(typeface);
    mDiscoveryMenuIcon.setTypeface(typeface);
    mDiscoveryMenuIconSelected.setTypeface(typeface);
    mNearbyMenuIcon.setTypeface(typeface);
    mNearbyMenuIconSelected.setTypeface(typeface);
    mUserMenuIcon.setTypeface(typeface);
    mUserMenuIconSelected.setTypeface(typeface);

    mToolbarMenuSelectedItems.add(mChatMenuIconSelected);
    mToolbarMenuSelectedItems.add(mContactMenuIconSelected);
    mToolbarMenuSelectedItems.add(mDiscoveryMenuIconSelected);
    mToolbarMenuSelectedItems.add(mNearbyMenuIconSelected);
    mToolbarMenuSelectedItems.add(mUserMenuIconSelected);

    mViewPager = (FragmentViewPager) findViewById(R.id.view_pager);
    mViewPager.setAdapter(mFragmentPagerAdapter);
    mViewPager.setOnPageChangeListener(mSimpleOnPageChangeListener);
    /*
    mViewPager.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
            
        if (mViewPager.findViewFromObject(position) instanceof ContactFragment) {
            ((ContactFragment) mViewPager.findViewFromObject(position)).mLetterQueryView.setVisibility(View.GONE);
        } else if (mViewPager.findViewFromObject(position + 1) instanceof ContactFragment) {
            ((ContactFragment) mViewPager.findViewFromObject(position + 1)).mLetterQueryView.setVisibility(View.GONE);
        }
        return true;
    }
    });
    */
}

From source file:net.ddns.mlsoftlaberge.trycorder.TryviscamFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mFile = new File(getActivity().getExternalFilesDir(null), "pic.jpg");
    Typeface face = Typeface.createFromAsset(getActivity().getAssets(), "sonysketchef.ttf");
    Typeface face2 = Typeface.createFromAsset(getActivity().getAssets(), "finalold.ttf");
    Typeface face3 = Typeface.createFromAsset(getActivity().getAssets(), "finalnew.ttf");
    // top buttons
    mBackButton.setTypeface(face2);//from w  w  w . j  a  va2 s  .  com
    mSettingsButton.setTypeface(face2);
    mTextstatus_top.setTypeface(face);
    // bottom buttons
    mEffectButton.setTypeface(face2);
    mSceneButton.setTypeface(face2);
    mTextstatus_bottom.setTypeface(face3);
}

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

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

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

From source file:org.appcelerator.titanium.util.TiUIHelper.java

@SuppressLint("DefaultLocale")
private static Typeface loadTypeface(final Context context, final String fontFamily) {
    if (context == null) {
        return null;
    }/*from  w  w  w  .j  ava2  s  . co  m*/
    if (mCustomTypeFaces.containsKey(fontFamily)) {
        return mCustomTypeFaces.get(fontFamily);
    }
    if (mCustomTypeFacesList == null) {
        AssetManager mgr = context.getAssets();
        try {
            ArrayList<String> fileList = new ArrayList<String>(Arrays.asList(mgr.list(customFontPath)));
            Iterator it = fileList.iterator();
            while (it.hasNext()) {
                String text = (String) it.next();
                if (!text.endsWith(".ttf") && !text.endsWith(".otf")) {
                    it.remove();
                }
            }
            mCustomTypeFacesList = fileList.toArray(new String[] {});
        } catch (Exception e) {
            Log.e(TAG, "Unable to load 'fonts' assets. Perhaps doesn't exist? " + e.getMessage());
        }
    }
    if (mCustomTypeFacesList != null) {
        Typeface tf = null;
        AssetManager mgr = context.getAssets();
        for (String f : mCustomTypeFacesList) {
            if (f.equals(fontFamily) || f.startsWith(fontFamily + ".") || f.startsWith(fontFamily + "-")) {
                tf = Typeface.createFromAsset(mgr, customFontPath + "/" + f);
                synchronized (mCustomTypeFaces) {
                    mCustomTypeFaces.put(fontFamily, tf);
                }
                return tf;
            }
        }
        tf = Typeface.create(fontFamily, Typeface.NORMAL);
        if (tf != null) {
            synchronized (mCustomTypeFaces) {
                mCustomTypeFaces.put(fontFamily, tf);
            }
            return tf;
        }
    }

    mCustomTypeFaces.put(fontFamily, null);
    return null;
}