Java Code Examples for uk.co.chrisjenx.calligraphy.CalligraphyConfig#initDefault()

The following examples show how to use uk.co.chrisjenx.calligraphy.CalligraphyConfig#initDefault() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: MvpApp.java    From android-mvp-architecture with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    mApplicationComponent = DaggerApplicationComponent.builder()
            .applicationModule(new ApplicationModule(this)).build();

    mApplicationComponent.inject(this);

    AppLogger.init();

    AndroidNetworking.initialize(getApplicationContext());
    if (BuildConfig.DEBUG) {
        AndroidNetworking.enableLogging(Level.BODY);
    }

    CalligraphyConfig.initDefault(mCalligraphyConfig);
}
 
Example 8
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 9
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 10
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()
    );
}
 
Example 11
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 12
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 13
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 14
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 15
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 16
Source File: BaseActivity.java    From africastalking-android with MIT License 4 votes vote down vote up
protected void includeCalligraphy(String font) {
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath(font)
            .setFontAttrId(R.attr.fontPath)
            .build());
}
 
Example 17
Source File: Luhn.java    From Luhn with MIT License 4 votes vote down vote up
private void includeCalligraphy(String font) {
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath(font)
            .setFontAttrId(R.attr.fontPath)
            .build());
}
 
Example 18
Source File: CodeUIApp.java    From From-design-to-Android-part1 with Apache License 2.0 4 votes vote down vote up
private void configureDefaultFont(String robotoSlab) {
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
        .setDefaultFontPath(robotoSlab)
        .setFontAttrId(R.attr.fontPath)
        .build());
}
 
Example 19
Source File: MainApplication.java    From edx-app-android with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes the request manager, image cache,
 * all third party integrations and shared components.
 */
private void init() {
    application = this;
    // FIXME: Disable RoboBlender to avoid annotation processor issues for now, as we already have plans to move to some other DI framework. See LEARNER-1687.
    // ref: https://github.com/roboguice/roboguice/wiki/RoboBlender-wiki#disabling-roboblender
    // ref: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration
    RoboGuice.setUseAnnotationDatabases(false);
    injector = RoboGuice.getOrCreateBaseApplicationInjector((Application) this, RoboGuice.DEFAULT_STAGE,
            (Module) RoboGuice.newDefaultRoboModule(this), (Module) new EdxDefaultModule(this));

    injector.injectMembers(this);

    EventBus.getDefault().register(new CrashlyticsCrashReportObserver());

    if (config.getNewRelicConfig().isEnabled()) {
        EventBus.getDefault().register(new NewRelicObserver());
    }

    // initialize NewRelic with crash reporting disabled
    if (config.getNewRelicConfig().isEnabled()) {
        //Crash reporting for new relic has been disabled
        NewRelic.withApplicationToken(config.getNewRelicConfig().getNewRelicKey())
                .withCrashReportingEnabled(false)
                .start(this);
    }

    // Add Segment as an analytics provider if enabled in the config
    if (config.getSegmentConfig().isEnabled()) {
        analyticsRegistry.addAnalyticsProvider(injector.getInstance(SegmentAnalytics.class));
    }
    if (config.getFirebaseConfig().isAnalyticsSourceFirebase()) {
        // Only add Firebase as an analytics provider if enabled in the config and Segment is disabled
        // because if Segment is enabled, we'll be using Segment's implementation for Firebase
        analyticsRegistry.addAnalyticsProvider(injector.getInstance(FirebaseAnalytics.class));
    }

    if (config.getFirebaseConfig().isEnabled()) {
        // Firebase notification needs to initialize the FirebaseApp before
        // subscribe/unsubscribe to/from the topics
        FirebaseApp.initializeApp(this);
        if (config.areFirebasePushNotificationsEnabled()) {
            NotificationUtil.subscribeToTopics(config);
        } else if (!config.areFirebasePushNotificationsEnabled()) {
            NotificationUtil.unsubscribeFromTopics(config);
        }
    }

    registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));

    checkIfAppVersionUpgraded(this);

    // Register Font Awesome module in android-iconify library
    Iconify.with(new FontAwesomeModule());

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

    // Init Branch
    if (config.getBranchConfig().isEnabled()) {
        Branch.getAutoInstance(this);
    }

    // Force Glide to use our version of OkHttp which now supports TLS 1.2 out-of-the-box for
    // Pre-Lollipop devices
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        Glide.get(this).getRegistry().replace(GlideUrl.class, InputStream.class,
                new OkHttpUrlLoader.Factory(injector.getInstance(OkHttpClientProvider.class).get()));
    }

    // Initialize Facebook SDK
    boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext(), config);
    if (!isOnZeroRatedNetwork && config.getFacebookConfig().isEnabled()) {
        // Facebook sdk should be initialized through AndroidManifest meta data declaration but
        // we are generating the meta data through gradle script due to which it is necessary
        // to manually initialize the sdk here.
        FacebookSdk.setApplicationId(config.getFacebookConfig().getFacebookAppId());
        FacebookSdk.sdkInitialize(getApplicationContext());
    }

    if (PermissionsUtil.checkPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE, this)) {
        deleteExtraDownloadedFiles();
    }
}
 
Example 20
Source File: MainApplication.java    From Capstone-Project with MIT License 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    // Initialize stetho.
    Stetho.initializeWithDefaults(getApplicationContext());

    // Initialize Predator Database.
    PredatorDatabase.init(getApplicationContext());

    // Initialize fresco.
    Fresco.initialize(this);

    // Initialize calligraphy.
    String currentFont = PredatorSharedPreferences.getCurrentFont(getApplicationContext());
    if (!TextUtils.isEmpty(currentFont) &&
            !TextUtils.equals(currentFont, getString(R.string.settings_change_font_system))) {

        // Check if current font belongs in the available list.
        boolean fontAvailable = false;
        for (String fontValue : getResources().getStringArray(R.array.settings_change_font_entry_values)) {
            if (TextUtils.equals(fontValue, currentFont)) {
                fontAvailable = true;
                break;
            }
        }
        if (fontAvailable) {
            CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath(String.format("fonts/%s", currentFont))
                    .setFontAttrId(R.attr.fontPath)
                    .build()
            );
        } else {
            CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                    .setDefaultFontPath(String.format("fonts/%s", PredatorSharedPreferences.restoreDefaultFont(getApplicationContext())))
                    .setFontAttrId(R.attr.fontPath)
                    .build()
            );
        }
    } else {
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
                .setDefaultFontPath(String.format("fonts/%s", getString(R.string.settings_change_font_default_value)))
                .setFontAttrId(R.attr.fontPath)
                .build()
        );
    }
}