GithubHelp home page GithubHelp logo

chathurahettiarachchi / typefaced Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 1.31 MB

This library allow developer to create textView, button, edittextView and etc, with custom type face.

License: Apache License 2.0

Java 100.00%
textview font face ttf android-view android-textview android-edittext switch toggle toggle-switches

typefaced's Introduction

TypeFaced Download

TypeFaced is a library which allow developers to easily create widely used Android UI controls such as TextView, Button, EditTextView, etc with custom typefaces (Link to definition of typeface). Without TypeFaced, developer has to bind any non-default font programmatically to his/her application rather than configuring it in layout.xml.

libintro

With TypeFaced, you could customize following UI controls in your Android application

  • TypeFacedTextView
  • TypeFacedEditText
  • TypeFacedButton
  • TypeFacedRadioButton
  • TypeFacedCheckBox
  • TypeFacedToggleButton
  • TypeFacedSwitch

####How to configure TypeFaced in your project

In your Android project, just include the following dependency to build.gradle's dependency list.

Gradle

repositories {
  jcenter()
}

dependencies {
    ...
    compile 'com.chootdev:typefaced:1.1.7'
}

if you using maven use following

Maven

<dependency>
  <groupId>com.chootdev</groupId>
  <artifactId>typefaced</artifactId>
  <version>1.1.7</version>
  <type>pom</type>
</dependency>

Assets

Font files you are planning to use should be added to project's assets folder as shown below.

screen shot 2017-01-26 at 4 57 20 pm

Under your assets folder, create a new folder called "fonts", and place all your font (ttf) files inside that.

After configuring the TypeFaced library in your project, it is ready to use in your layout.xml and controls will have the configured typeface.

Usage

TextView (TypeFacedTextView)

<com.chootdev.typefaced.TypeFacedTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:textView_font="YOUR_FONT_NAME.ttf/>

Button (TypeFacedButton)

<com.chootdev.typefaced.TypeFacedButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

EditText (TypeFacedEditText)

<com.chootdev.typefaced.TypeFacedEditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

RadioButton (TypeFacedRadioButton)

<com.chootdev.typefaced.TypeFacedRadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

CheckBox (TypeFacedCheckbox)

<com.chootdev.typefaced.TypeFacedCheckbox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

ToggleButton (TypeFacedToggleButton)

<com.chootdev.typefaced.TypeFacedToggleButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

Switch (TypeFacedSwitch)

<com.chootdev.typefaced.TypeFacedSwitch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:button_font="YOUR_FONT_NAME.ttf"/>

As you have noticed above, it is matter of specify the font name with the font tile extension .ttf to each custom view. TypeFaced has tested for .otf, .eot font file types as well.

NOTE

TypeFaced also contains some pre-added fonts with the library,

Roboto-Bold.ttf
Roboto-Italic.ttf
Roboto-Light.ttf
Roboto-LightItalic.ttf
Roboto-Medium.ttf
Roboto-Regular.ttf
Roboto-Thin.ttf
Roboto-ThinItalic.ttf

Limitations

  • Currently min SDK is set to 14 due to customization of android.widget.Switch

Output Generated

screenshot_20170126-170154

Changelog

  • 1.1.7
    • Added sample project with all customizations
  • 1.1.6
    • Support for Switch
  • 1.1.5
    • Fixed change on android ToggleButton
  • 1.1.4
    • Support for EditText
  • 1.1.3
    • Support for RadioButton
  • 1.1.2
    • Fixed crash with adding custom exception and added support for Checkbox
  • 1.1.1
    • Support for TextView
  • 1.0.0
    • Initial release

Author

Chathura Hettiarachchi, [email protected]

Checkout my other contributions, https://github.com/ChathuraHettiarachchi?tab=repositories

License

Copyright 2017 Chathura Hettiarachchi

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.

typefaced's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.