AACustomFont


Source link: https://github.com/EngrAhsanAli/AACustomFont

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

Resources

Want to detect human faces on a camera preview stream in real time? Well, you came to the right place.

FaceDetector is a library which:

  • detects faces
  • works on Android
  • very simple to use
  • comes with Fotoapparat integration (but you can use it with whatever you like)
  • with a C++ core which can easily be ported to iOS (we have plans for that)

A cute day night switch for android.

Android library to use android utils with annotations.

Combined both TedBottomPicker and Camera View, to get the View Similar to ImagePickers of Olx.

We can Pick Images From Gallery and Camera in two modes (Single, Multi), and pick multiple images from both Camera and Gallery.

This is the RxJava2 port of the RxGroups project developed by AirBnb. The branch rx-2.0 has the Rx2 changes. The changes have been done on master branch of RxGroups. The following documentation written for RxGroups by AirBnb applies to Rx2Groups as well. All the API and package names originally written by AirBnb remains as it is. I have transitioned all the RxJava APIs(including the unit tests) to RxJava2.

RxGroups lets you group RxJava Observables together in groups and tie them to your Android lifecycle. This is especially useful when used with Retrofit.

Logger is simple library, which will help you to find your logs easily, just clicking on log.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes