/AndroidFontsManager

help you change the module font easily.(方便快速的为应用内所有组件更换字体)

Primary LanguageJavaEclipse Public License 1.0EPL-1.0

FontsManager

Android Arsenal License Maven Central

Author's weibo: @攻城师sloop

Overview

Android FontsManager, It can help you change the module font easily.

Demo

fontsmanagerpic

Prepare

1.Add this in your Project's build.gradle

 //sloop's maven
  maven {url "http://dl.bintray.com/gcssloop/maven"}

Example:

allprojects {
    repositories {
        jcenter()
        //sloop's maven
        maven {url "http://dl.bintray.com/gcssloop/maven"}
    }
}

2.Add this in your Module's build.gradle

    //fontsmanager
    compile 'com.sloop.view.fonts:fontsmanager:1.2.3'

Example:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    //fontsmanager
    compile 'com.sloop.view.fonts:fontsmanager:1.2.3'
}

Usage

Initialization the fontsmanager before use

You can use any of the following four methods to initialize the FontManager.

	// NO.1
	FontsManager.init(typeface);                     // use typeface
	// NO.2
	FontsManager.initFormAssets(context, fontPath);  // use context and path(file in Assets)
	// NO.3
	FontsManager.initFormFile(fontFile);             // use font file in sdcard
	// NO.4
	FontsManager.initFormFile(fontFilePath);         // use font filePath in sdcard

Change Activity font

	FontsManager.changeFonts(activity);

Change View font

	FontsManager.changeFonts(view);

Change ViewGroup font

	FontsManager.changeFonts(viewGroup);

Complete example

	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		FontsManager.initFormAssets(this, "fonts/sao.ttf");	//initialization
		FontsManager.changeFonts(this);		                //Change Activity font
	}

Release Notes

Version Notes
v1.2.3 Fix a bug with ActionBar
v1.2.2 Fix a bug with ActionBar
v1.2.1 Support Gradle build, Logic Optimization
v1.2.0 Support change ActionBar fonts
v1.0.1 Fix error log
v1.0.0 Support change View ViewGroup Activity's font

About Me

License

Copyright (c) 2015 GcsSloop

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.