Giter VIP home page Giter VIP logo

simplestylinglibrary's Introduction

SimpleStylingLibrary

Simple Library for styling text in a textEditor (EditText) in android

enter image description here

Ever wondered if there was just simple lightweight and efficent font styling library for a quick text editor .Well you've come to the right place with just [BOLD ,ITALLIC ,UNDERLINE ,HIGHLIGHTING AND TEXTSIZE] this library has whats neccessary for a basic clean text formatting

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	        implementation 'com.github.OmarBoshra:SimpleStylingLibrary:1.0'
}

Usage

Just this one method

  SimpleStyling.Format(TypeOrSize,SelectionStart,SelectionEnd, EditTextName ,TextSizeIncrement ,HighLightColor);

PARAMETERS

TypeOrSize: required operation to be performed on the selected text

-1 makes text bold
-2 Highlights text provided the color is in integer 'HighLightColor'
-3 underline
-4 italic
0 Incremental increase/decrease of text size by amount of 'TextSizeIncrement'
(any size) changes text to a specific size

SelectionStart : start of selection

SelectionEnd : end of selection

EditTextName : name of the editText View

TextSizeIncrement : required incremental increase/decrease of text size +ve for increase and -ve for decrease

HighLightColor : required highlightColor of the text set to anything if the operation isn't highLight

The function

SimpleStyling.autoselection(TestEditText);

returns an array with the starting and ending indexies so a button click can be used this way:-

            SimpleStyling.Format(0, SimpleStyling.autoselection(TestEditText)[0], SimpleStyling.autoselection(TestEditText)[1],TestEditText,6,0);

#If you want to be sure you can see the underline, disable the textAutoCorrection this way:-

            m.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_CLASS_TEXT);

This is an app with a full implementation here :-

https://github.com/OmarBoshra/Simple-text-styling-Android/blob/master/README.md

Good luck

simplestylinglibrary's People

Contributors

omarboshra avatar

Stargazers

 avatar

Watchers

James Cloos 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.