Maniaplanet Style Parser

Maniaplanet dollar style android parser can be used to convert Maniaplanetstyles to spannablestrings that you can use in styled spannable textviews.

License

License

MIT
Categories

Categories

Net ORM Data
GroupId

GroupId

net.tvalk.mpformatter
ArtifactId

ArtifactId

mpformatter
Last Version

Last Version

1.3.6
Release Date

Release Date

Type

Type

aar
Description

Description

Maniaplanet Style Parser
Maniaplanet dollar style android parser can be used to convert Maniaplanetstyles to spannablestrings that you can use in styled spannable textviews.
Project URL

Project URL

https://github.com/tomvlk/MPFormatter_android
Source Code Management

Source Code Management

https://github.com/tomvlk/MPFormatter_android

Download mpformatter

How to add to project

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

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.

Build Status

MPFormatter_android

A ManiaPlanet Color Style parser and formatter for Android. Currently basicly only working with all the styles. But in future it can also strip styles, links and colors and have more options. It will output a Spanned object that can be used in TextViews and more Android controls that support Spanned Strings.

Installation

You can use gradle to compile it, it's in the jCentral repository and in the Maven Central.

dependencies {
    compile 'net.tvalk.mpformatter:mpformatter:1.3.6'
}

If you want to stay updated, replace the '1.3.6' with '1.+'. But can break things when there is a new version. Maybe you need to change your repositories for gradle:

repositories {
	mavenCentral()
	jcenter()
}

Usage

To get the Spanned from a styled nickname for example, use:

String nickname = "$F80$i$o$SToffe$z$06FSmurf $z$n$l[http://goo.gl/y4M9VK][App]$l";
Spanned styledNickname = new MPFormatter(nickname).parse().getSpannable();

This will result in: Example result from above code

You can also strip the colors, links or styles with the functions stripColors(), stripLinks() and stripStyles() on the parse() return to strip it. You can also get a string without any styles, colors or links with getString() on the parse() return

For example, to strip the links in this nickname:

String nickname = "$F80$i$o$SToffe$z$06FSmurf $z$n$l[http://goo.gl/y4M9VK][App]$l";
Spanned styledNickname = new MPFormatter(nickname).parse().stripLinks().getSpannable();

Licence

See LICENCE file for MIT licence.

Versions

Version
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0