uk.co.chrisjenx.calligraphy.CalligraphyConfig Java Examples

The following examples show how to use uk.co.chrisjenx.calligraphy.CalligraphyConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiApplication.java    From hipda with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    registerActivityLifecycleCallbacks(this);

    if (!BuildConfig.DEBUG)
        Fabric.with(this, new Crashlytics());

    updated = UpdateHelper.updateApp();

    String font = HiSettingsHelper.getInstance().getFont();
    if (new File(font).exists()) {
        fontSet = true;
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath(font)
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    } else {
        HiSettingsHelper.getInstance().setFont("");
    }
    HiUtils.updateBaseUrls();
}
 
Example #2
Source File: StartupActions.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * detect language and set font type face
 */
private void languageDetection(SharedPreferences sharedPreferences) {

    String language = sharedPreferences.getString(SHP_SETTING.KEY_LANGUAGE, Locale.getDefault().getDisplayLanguage());

    switch (language) {
        case "فارسی":
            selectedLanguage = "fa";
            HelperCalander.isPersianUnicode = true;
            G.isAppRtl = true;
            break;
        case "English":
            selectedLanguage = "en";
            HelperCalander.isPersianUnicode = false;
            G.isAppRtl = false;
            break;
        case "العربی":
            selectedLanguage = "ar";
            HelperCalander.isPersianUnicode = true;
            G.isAppRtl = true;
            break;
    }

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/IRANSansMobile.ttf").setFontAttrId(R.attr.fontPath).build());
}
 
Example #3
Source File: JianShiApplication.java    From jianshi with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();

  appComponent = DaggerAppComponent.builder()
      .appModule(new AppModule(JianShiApplication.this))
      .build();

  final Fabric fabric = new Fabric.Builder(this)
      .kits(new Crashlytics())
      .debuggable(true)
      .build();
  Fabric.with(fabric);
  Stetho.initializeWithDefaults(this);
  instance = this;
  FlowManager.init(new FlowConfig.Builder(this).openDatabasesOnInit(true).build());

  initLog();

  CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
      .setDefaultFontPath("fonts/jianshi_default.otf")
      .setFontAttrId(R.attr.fontPath)
      .build()
  );
}
 
Example #4
Source File: BankTextInputLayout.java    From africastalking-android with MIT License 6 votes vote down vote up
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);

    adjustBounds();
    if (!hasUpdated) {
        try {
            Typeface face = Typeface.createFromAsset(getEditText().getContext().getAssets(), CalligraphyConfig.get().getFontPath());
            setTypeface(face);
            getEditText().setTypeface(face);
        } catch (Exception e) {
            e.printStackTrace();
        }
        hasUpdated = true;
    }

}
 
Example #5
Source File: SplashScreen.java    From Android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        /*Window w = getWindow(); // in Activity's onCreate() for instance
        w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);*/
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

    }

    setContentView(R.layout.activity_splash);

    mContext = this.getApplicationContext();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/airbnb.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build());
    remmber_me();
    if (savedInstanceState == null){
        home_splash_fragment();
    }
}
 
Example #6
Source File: HeartbeatFixerForGcmApp.java    From HeartbeatFixerForGCM with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/GothamRnd-Book.otf")
            .setFontAttrId(R.attr.fontPath)
            .build());
    mCheckoutInternal = new CheckoutInternal(this, Products.create().add(ProductTypes.IN_APP,
            IabProducts.PRODUCT_LIST));
    Once.initialise(this);
    initFirebaseRemoteConfig();
}
 
Example #7
Source File: CalligraphyApplication.java    From Calligraphy with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/Roboto-ThinItalic.ttf")
            .setFontAttrId(R.attr.fontPath)
            .addCustomViewWithSetTypeface(CustomViewWithTypefaceSupport.class)
            .addCustomStyle(TextField.class, R.attr.textFieldStyle)
            .build()
    );
}
 
Example #8
Source File: App.java    From juda with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    FirebaseAnalytics.getInstance(this);

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/font.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );

    Realm.init(this);

}
 
Example #9
Source File: MainApplication.java    From Capstone-Project with MIT License 5 votes vote down vote up
public static void reInitializeCalligraphy(Context context, String fontName) {
    if (!TextUtils.equals(fontName, context.getString(R.string.settings_change_font_system))) {
        Logger.d(TAG, "re initializing calligraphy");
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath(String.format("fonts/%s", fontName))
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    }
}
 
Example #10
Source File: MainApplication.java    From Capstone-Project with MIT License 5 votes vote down vote up
public static void reInitializeCalligraphy(Context context, String fontName) {
    if (!TextUtils.equals(fontName, context.getString(R.string.settings_change_font_system))) {
        Logger.d(TAG, "re initializing calligraphy");
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath(String.format("fonts/%s", fontName))
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    }
}
 
Example #11
Source File: CandyBarApplication.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Database.get(this).openDatabase();

    if (!ImageLoader.getInstance().isInited())
        ImageLoader.getInstance().init(ImageConfig.getImageLoaderConfiguration(this));

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/Font-Regular.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build());

    //Enable or disable logging
    LogUtil.setLoggingTag(getString(R.string.app_name));
    LogUtil.setLoggingEnabled(true);

    mConfiguration = onInit();

    if (mConfiguration.mIsCrashReportEnabled) {
        mHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this::handleUncaughtException);
    }

    if (Preferences.get(this).isTimeToSetLanguagePreference()) {
        Preferences.get(this).setLanguagePreference();
        return;
    }

    LocaleHelper.setLocale(this);
}
 
Example #12
Source File: Application.java    From UPMiss with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/FZLanTingHeiS-L-GB-Regular.TTF")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );

    registerActivityLifecycleCallbacks(mLifecycleCallbacks);

    AppPresenter.setApplication(this);
}
 
Example #13
Source File: LeisureReadApp.java    From LeisureRead with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化字体管理库
 */
private void initFont() {

  CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
      .setDefaultFontPath("fonts/Lobster-1.4.otf")
      .setFontAttrId(R.attr.fontPath)
      .build()
  );
}
 
Example #14
Source File: CalligraphyApplication.java    From Dashboard with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath("fonts/Roboto-Regular.ttf")
                    .setFontAttrId(R.attr.fontPath)
                    .build()
    );
}
 
Example #15
Source File: Citrus.java    From citrus with Apache License 2.0 5 votes vote down vote up
private void initCalligraphy() {
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath(getString(R.string.font_roboto_light))
                    .setFontAttrId(R.attr.fontPath)
                    .build()
    );
}
 
Example #16
Source File: BarterLiApplication.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {

    CalligraphyConfig.initDefault(R.attr.fontPath);

    sStaticContext = getApplicationContext();
    if (!SharedPreferenceHelper
            .getBoolean(R.string.pref_migrated_from_alpha)
            && (SharedPreferenceHelper
            .getInt(R.string.pref_last_version_code) == 0)) {
        doMigrationFromAlpha();
        SharedPreferenceHelper.set(R.string.pref_migrated_from_alpha, true);
    }
    /*
     * Saves the current app version into shared preferences so we can use
     * it in a future update if necessary
     */
    saveCurrentAppVersionIntoPreferences();
    if (BuildConfig.USE_CRASHLYTICS) {
        startCrashlytics();
    }

    overrideHardwareMenuButton();
    VolleyLog.sDebug = BuildConfig.DEBUG_MODE;

    mRequestQueue = Volley.newRequestQueue(this);
    // Picasso.with(this).setDebugging(true);
    UserInfo.INSTANCE.setDeviceId(Secure.getString(this
            .getContentResolver(), Secure.ANDROID_ID));
    readUserInfoFromSharedPref();
    Utils.setupNetworkInfo(this);
    if (DeviceInfo.INSTANCE.isNetworkConnected()) {
        startChatService();
    }
}
 
Example #17
Source File: BaseActivity.java    From particle-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void attachBaseContext(Context newBase) {
    if (!customFontInitDone) {
        CalligraphyConfig.initDefault(
                new CalligraphyConfig.Builder()
                        .setDefaultFontPath(newBase.getString(R.string.normal_text_font_name))
                        .setFontAttrId(R.attr.fontPath)
                        .build());
        customFontInitDone = true;
    }
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
    SDKGlobals.init(this);
}
 
Example #18
Source File: ElectricityApplication.java    From android-things-electricity-monitor with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(
            new CalligraphyConfig.Builder().setDefaultFontPath("minyna.ttf").setFontAttrId(R.attr.fontPath)
                    .build());
    AndroidThreeTen.init(this);
    FirebaseApp.initializeApp(this);
    FirebaseMessaging.getInstance().subscribeToTopic("Power_Notifications");
}
 
Example #19
Source File: BaseActivity.java    From spark-setup-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void attachBaseContext(Context newBase) {
    if (!customFontInitDone) {
        // FIXME: make actually customizable via resources
        // (see file extension string formatting nonsense)
        CalligraphyConfig.initDefault(
                new CalligraphyConfig.Builder()
                        .setDefaultFontPath(newBase.getString(R.string.normal_text_font_name))
                        .setFontAttrId(R.attr.fontPath)
                        .build());
        customFontInitDone = true;
    }
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
    SDKGlobals.init(this);
}
 
Example #20
Source File: CalligraphyApplication.java    From Dashboard with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath("fonts/Roboto-Regular.ttf")
                    .setFontAttrId(R.attr.fontPath)
                    .build()
    );
}
 
Example #21
Source File: DemoApp.java    From mobihelp-android with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
	super.onCreate();
	CalligraphyConfig calligraphyConfig = new CalligraphyConfig.Builder()
			.setDefaultFontPath("fonts/CursiveSans.ttf")
			.setFontAttrId(R.attr.fontPath)
			.build();

	CalligraphyConfig.initDefault(calligraphyConfig);
}
 
Example #22
Source File: BaseActivity.java    From giraff-android with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath("fonts/Roboto-Medium.ttf")
                    .setFontAttrId(R.attr.fontPath)
                    .build()
    );
}
 
Example #23
Source File: ApplicationImpl.java    From android-atleap with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath("fonts/Roboto-Regular.ttf")
                    .setFontAttrId(R.attr.fontPath)
                    .build()
    );
}
 
Example #24
Source File: SampleApplication.java    From ParallaxPager with MIT License 5 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();

  CalligraphyConfig.initDefault(
  new CalligraphyConfig.Builder()
      .setDefaultFontPath("Bitter-Bold.ttf")
      .build()
  );
}
 
Example #25
Source File: ApplicationTestModule.java    From android-mvp-interactor-architecture with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
CalligraphyConfig provideCalligraphyDefaultConfig() {
    return new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/source-sans-pro/SourceSansPro-Regular.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build();
}
 
Example #26
Source File: WatchActivity.java    From Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
    );
    setContentView(R.layout.watch_activity);


    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath("fonts/Lato-Regular.ttf")
                    .setFontAttrId(R.attr.fontPath)
                    .build());

    mContext = getApplicationContext();
    Bundle extras = getIntent().getExtras();
    String[] arrayInB = extras.getStringArray("url");


    //PlayVideo(arrayInB[0],arrayInB[1],arrayInB[2]);
    try{
        Stream =arrayInB[0] ;
        title = arrayInB[1];
        thumbnail = arrayInB[2];
    }catch (Exception e){
        Log.e("TAG","Hello world");
    }
    PlayVideo_bettervideoplayer();



}
 
Example #27
Source File: MyApplication.java    From PersianDateRangePicker with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
  super.onCreate();
  CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
    .setDefaultFontPath("fonts/DroidNaskh-Regular.ttf")
    .setFontAttrId(R.attr.fontPath)
    .build()
  );
}
 
Example #28
Source File: AppSSForms.java    From SSForms with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {

    super.onCreate();
    sSingleton = this;
    applicationContext = getApplicationContext();

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/SegoeUI.ttf")
            .setFontAttrId(it.starksoftware.ssform.R.attr.fontPath)
            .build()
    );

}
 
Example #29
Source File: Ariana.java    From Ariana with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/pacifico.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );
}
 
Example #30
Source File: Oblique.java    From Oblique with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/Roboto-Light.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );
}