Skip to content

SanthoshDhandapani/Print

 
 

Repository files navigation

Print

Android Arsenal

A lightweight Android library for use iconic fonts.

image

Get it on Google Play

Download

Gradle:

compile 'com.github.johnkil.print:print:1.2.1'

Maven:

<dependency>
    <groupId>com.github.johnkil.print</groupId>
    <artifactId>print</artifactId>
    <version>1.2.1</version>
    <type>aar</type>
</dependency>

Usage

First, you need to initialize the default iconic font in Application.onCreate() method. If the font is not specified, then the font is used by default.

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();                
        PrintConfig.initDefault(getAssets(), "fonts/iconic-font.ttf");
    }

}

PrintView

Use PrintView as single icon in your layout.

<com.github.johnkil.print.PrintView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        print:iconColor="@color/icon_color"
        print:iconSize="@dimen/icon_size"
        print:iconFont="fonts/iconic-font.ttf"
        print:iconText="@string/ic_android"
        android:contentDescription="@string/ic_android_description"/>

PrintButton

Use PrintButton to create a button with an icon.

<com.github.johnkil.print.PrintButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        print:iconColor="@color/icon_color"
        print:iconSize="@dimen/icon_size"
        print:iconFont="fonts/iconic-font.ttf"
        print:iconText="@string/ic_android"
        android:contentDescription="@string/ic_android_description"/>

PrintDrawable

If you need an icon in ImageView or in ActionBar, then you should use PrintDrawable.

ImageView imageView = (ImageView) findViewById(R.id.image);
// Set an icon in the ImageView
imageView.setImageDrawable(
    new PrintDrawable.Builder(context)
            .iconText(R.string.ic_info)
            .iconColor(R.color.icon_color)
            .iconSize(R.dimen.icon_size)
            .iconFont("fonts/iconic-font.ttf")
            .build()
);
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    // Set an icon in the ActionBar
    menu.findItem(R.id.action_info).setIcon(
            new PrintDrawable.Builder(context)
                    .iconText(R.string.ic_info)
                    .iconColor(R.color.ab_icon_color)
                    .iconSize(R.dimen.ab_icon_size)
                    .iconFont("fonts/iconic-font.ttf")
                    .build()
    );
    return true;
}

Links

License

Copyright 2014 Evgeny Shishkin

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.

About

A lightweight Android library for use iconic fonts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%