All Projects → EngrAhsanAli → AACustomFont

EngrAhsanAli / AACustomFont

Licence: MIT license
[UNMAINTAINED] AACustomFont is a lightweight custom font binder in XML directly in TextView, Button, EditText, RadioButton, CheckBox tags. The library is aimed to avoid custom views for custom fonts in XML and to minimize the JAVA code for setting the TypeFaces for each view.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to AACustomFont

double-avatar-view
Instagram-like double avatar view with cropping
Stars: ✭ 31 (-59.21%)
Mutual labels:  custom-view, customview
Colorseekbar
A colorful SeekBar for picking color
Stars: ✭ 249 (+227.63%)
Mutual labels:  custom-view, customview
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+884.21%)
Mutual labels:  custom-view, customview
WechatPopupWindow
高仿微信聊天界面长按弹框样式
Stars: ✭ 71 (-6.58%)
Mutual labels:  custom-view, customview
Testleavesloading
Android 自定义 View 之 LeavesLoading
Stars: ✭ 55 (-27.63%)
Mutual labels:  custom-view, customview
Android-Code-Demos
📦 Android learning code demos.
Stars: ✭ 41 (-46.05%)
Mutual labels:  custom-view, databinding
Acy-Font
自制手写字体。A hand-writing font set.
Stars: ✭ 20 (-73.68%)
Mutual labels:  fonts
SquaresLoadingView
A SquaresLoadingView based on android.View, nicely rotation、easy to use.
Stars: ✭ 26 (-65.79%)
Mutual labels:  custom-view
react-native-custom-fonts
React Native Custom Fonts 📚
Stars: ✭ 19 (-75%)
Mutual labels:  fonts
fontproof
A font design testing class for SILE
Stars: ✭ 23 (-69.74%)
Mutual labels:  fonts
FooterNavigationView
FooterNavigationView helps to show a footer inside the NavigationView
Stars: ✭ 30 (-60.53%)
Mutual labels:  customview
Anybody
3 axes/variable/sans/super compressed to super extended
Stars: ✭ 73 (-3.95%)
Mutual labels:  fonts
PaymentCardView
Custom Credit/Debit card view
Stars: ✭ 62 (-18.42%)
Mutual labels:  customview
Custom-Grid-View
Custom Drag and Drop Grid for Home Assistant
Stars: ✭ 103 (+35.53%)
Mutual labels:  custom-view
FlickOff
A lite movie guide app, with MVVM architecture, that lets you discover movies from TMDb.
Stars: ✭ 31 (-59.21%)
Mutual labels:  databinding
password-view
Android password animation
Stars: ✭ 43 (-43.42%)
Mutual labels:  custom-view
MsFontsFuzz
OpenType font file format fuzzer for Windows
Stars: ✭ 49 (-35.53%)
Mutual labels:  fonts
sysfont
Golang identification and matching of system fonts
Stars: ✭ 29 (-61.84%)
Mutual labels:  fonts
eyepetizer kotlin
一款仿开眼短视频App,分别采用MVP、MVVM两种模式实现。一、组件化 + Kotlin + MVP + RxJava + Retrofit + OkHttp 二、组件化 + Kotlin + MVVM + LiveData + DataBinding + Coroutines + RxJava + Retrofit + OkHttp
Stars: ✭ 83 (+9.21%)
Mutual labels:  databinding
Trispace
2 axes/variable/mostly monospace
Stars: ✭ 49 (-35.53%)
Mutual labels:  fonts

Android Arsenal

Table of Contents

AACustomFont

Description

AACustomFont is a lightweight custom font binder in XML directly in TextView, Button, EditText, RadioButton, CheckBox tags. The library is aimed to avoid custom views for custom fonts in XML and to minimize the JAVA code for setting the TypeFaces for each view.

Demonstration

You can use AACustomFont in any view that's extended from TextView. For example, TextView Button EditText RadioButton CheckBox

Requirements

  • Android Studio
  • Android 2.3+
  • JAVA 7+
  • Gradle 3.0

Installation

AACustomFont can be installed using Maven, Gradle, or manually.

Maven

Step 1. Add the JitPack repository to your build file

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 2. Add the dependency

<dependency>
      <groupId>com.github.EngrAhsanAli</groupId>
      <artifactId>AACustomFont</artifactId>
      <version>1.1</version>
</dependency>

Gradle

Step 1. Add the JitPack repository to your build file

allprojects {
    repositories {
      ...
      maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
  compile 'com.github.EngrAhsanAli:AACustomFont:1.1'
}

Manual Installation

If you prefer not to use either of the above mentioned dependency managers, you can integrate AACustomFont into your project manually by adding the files contained in the java folder to your project.

#Getting Started

Enable data binding

You need to enable data binding in order to bind custom fonts with your views. Add the following in your build.gradle.

android {
  dataBinding {
        enabled = true
    }
}

Add font files

You can add the font files in assets/fonts directory. AACustomFont will automatically grab your fonts from that directory, automatically. The font files may have .ttf or .otf extensions.

Start embedding the fonts!

You need to change your layout parent tag to layout tag and put the rest in that tag.

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <!-- Put the layouts here -->


</layout>

Now set your fonts like:

<TextView
    <!-- other properties -->
    app:font="@{`budidaya-italic`}" />

Note that the font name will always be in lowercase. If no font specified, it will get the default font in app:font="@{``}.

Bind the views!

You need to bind the views in java:

DataBindingUtil.setContentView(this, R.layout.your_layout);

// Using LayoutInflator
DataBindingUtil.inflate(inflater, R.layout.your_layout, this, true);

You can set alias to your font name using the following method

AACustomFont.getInstance(this)
                .setAlias("myfont", "Font-File.otf")
                .setDefaultFontName("myfont");

You can override typefaces with your font name using the following method

// For all typefaces in given activity context with default font
AACustomFont.getInstance(this).overrideFonts(this);

// For all typefaces in given activity context with specified font
AACustomFont.getInstance(this).overrideFonts(this, "my_font");

// For all typefaces in given viewgroup with specified font
AACustomFont.overrideFonts(button, "myfont");

Contributions & License

AACustomFont is available under the MIT license. See the LICENSE file for more info.

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using AACustomFont in your app, send an email to Engr. Ahsan Ali

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].