Android Enlarged Numbers

Easily enlarge/bold numbers within a SpannableString

License

License

GroupId

GroupId

com.klinkerapps
ArtifactId

ArtifactId

enlarged_numbers
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

Android Enlarged Numbers
Easily enlarge/bold numbers within a SpannableString
Project URL

Project URL

https://github.com/klinker24/Android-EnlargedNumbers-Spannable
Source Code Management

Source Code Management

https://github.com/klinker24/Android-EnlargedNumbers-Spannable

Download enlarged_numbers

How to add to project

<!-- https://jarcasting.com/artifacts/com.klinkerapps/enlarged_numbers/ -->
<dependency>
    <groupId>com.klinkerapps</groupId>
    <artifactId>enlarged_numbers</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.klinkerapps/enlarged_numbers/
implementation 'com.klinkerapps:enlarged_numbers:1.0.0'
// https://jarcasting.com/artifacts/com.klinkerapps/enlarged_numbers/
implementation ("com.klinkerapps:enlarged_numbers:1.0.0")
'com.klinkerapps:enlarged_numbers:aar:1.0.0'
<dependency org="com.klinkerapps" name="enlarged_numbers" rev="1.0.0">
  <artifact name="enlarged_numbers" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.klinkerapps', module='enlarged_numbers', version='1.0.0')
)
libraryDependencies += "com.klinkerapps" % "enlarged_numbers" % "1.0.0"
[com.klinkerapps/enlarged_numbers "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Enlarged Numbers Spannable

Screenshot

This is a little library for enlarging the size of numbers, compared to the rest of the text in your TextView.

It is good for demonstraiting the usage of Spannable and how they can be combined to create very different text effects. Spannable can be very helpful in Android. I use a similar idea in my TextView-LinkBuilder project.

I would like to a blog post, in the future, about this type of thing.

Features

This libary enlarges the size of numbers within a CharSequence/String. Basically, you pass a string of text, through the Factory, and it will output a SpannableString that doubles the text size of numbers, as well as bolds them.

This can create nice effects, especially when you have a number, along with a representation, such as 12 MB or 1.57 dB.

The goal of this library is just to make that effect very simple to work with and to show how Spannable can be used within your own project, in other ways.

Installation

There are two ways to use this library:

As a Gradle dependency

This is the preferred way. Simply add:

dependencies {
    compile 'com.klinkerapps:enlarged_numbers:1.0.0'
}

to your project dependencies and run gradle build or gradle assemble.

As a library project

Download the source code and import it as a library project in Eclipse. The project is available in the folder library. For more information on how to do this, read here.

Example Usage

Functionality can be found in the example's MainActivity. It is extremely simple to use:

EnlargedNumbersString str = EnlargedNumbersFactory.build(getString(R.string.test_string), 1.5, false);
textView.setText(str);

The build method accepts a required CharSequence, then an optional number scale multiplier and flag for whether or not the number should be bolded.

Contributing

Please fork this repository and contribute back using pull requests. Features can be requested using issues. All code, comments, and critiques are greatly appreciated.

Changelog

The full changelog for the library can be found here.

License

Copyright 2015 Luke Klinker

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.

Versions

Version
1.0.0