Code Monkey home page Code Monkey logo

coffeetextview's Introduction

coffeetextview

Android Arsenal

A simple TextView library that lets developer easily set custom attributes through xml, programmatically or both

Step 1. Add the JitPack repository to your build file
allprojects {
	repositories {
		...
		maven { 
		url 'https://jitpack.io' 
		}
	}
}
Step 2. Add the dependency
dependencies {
        implementation 'com.github.devmike01:coffeetextview:v1.0.0'
}

Usage

Create an Asset folder. In the Asset folder, create another folder called fonts. Download and import font to the fonts folder you just created (Download free fonts here 1000freefonts ). Create a new string resources and set the font's name including its extension(e.g .otf) as the value. Then use the string resource id in the CoffeeTextView. Also, you can use the animations and fonts that are already available in the library.

    <devmike.com.coffeetextview.CoffeeTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:ct_caption_shadow_color="@color/colorAccent"
        app:ct_title_shadow_color="@color/colorPrimaryDark"
        app:ct_title_shadowDx="3"
        app:ct_title_typeface="@string/coffeefont_4"
        app:ct_caption_shadowDy="3"
        app:ct_title_animation="@anim/bounce_in"
        app:ct_title_shadowDy="3"
        app:ct_title_shadowRadius="1"
        app:ct_caption_shadowRadius="3"
        android:id="@+id/text_5"
        app:ct_caption_shadowDx="3"
        app:ct_title_size="12dp"
        app:ct_caption_color="@color/colorPrimaryDark"
        app:ct_caption_size="5dp"
        app:ct_caption_text="@string/app_name"
        app:ct_title_text="@string/app_name"/>

You can create an instance of CoffeeTextView in your kotlin or java file in order to set the textview properties programmatically.

Kotlin sample

    private fun doAnimation(v :CoffeeTextView, anim :Int,  view :Button){
        val animation : Animation = v.animateCaption(anim)
        animation.duration =400
        v.animateTitle(anim)
        v.setCaptionText("Hello you click on: " + view.text.toString())
        v.setCaptionShadow(2f, 2f, 2f, Color.MAGENTA)
        v.setTitleColor(Color.RED)
        v.setTitleShadow(2f, 1f, 2f, Color.YELLOW)
    }

Java Sample

    private fun doAnimation(CoffeeTextView v, int anim,  Button view){
        Animation animation = v.animateCaption(anim)
        animation.setDuration(400)
        v.animateTitle(anim)
        v.setCaptionText("Hello you click on: " + view.text.toString())
        v.setCaptionShadow(2f, 2f, 2f, Color.MAGENTA)
        v.setTitleColor(Color.RED)
        v.setTitleShadow(2f, 1f, 2f, Color.YELLOW)
    }

Licence

Copyright [2018] [Oladipupo Gbenga]

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.

coffeetextview's People

Contributors

devmike01 avatar

Watchers

 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.