mirror of
https://github.com/ethauvin/kotlin-pluralizer.git
synced 2025-04-28 01:48:12 -07:00
it's now a kotlin library and not an android library
This commit is contained in:
parent
d0f22d0f40
commit
075acc0c94
9 changed files with 92 additions and 98 deletions
|
@ -1,7 +1,6 @@
|
||||||
# kotlin-pluralizer
|
# kotlin-pluralizer
|
||||||
[](https://travis-ci.org/cesarferreira/kotlin-pluralizer) [](https://jitpack.io/#cesarferreira/kkotlin-pluralizer) [  ](https://bintray.com/cesarferreira/maven/kotlin-pluralizer/_latestVersion)
|
[](https://travis-ci.org/cesarferreira/kotlin-pluralizer) [](https://jitpack.io/#cesarferreira/kkotlin-pluralizer) [  ](https://bintray.com/cesarferreira/maven/kotlin-pluralizer/_latestVersion)
|
||||||
|
|
||||||
|
|
||||||
**kotlin extension** to **pluralize** and **singularize** strings!
|
**kotlin extension** to **pluralize** and **singularize** strings!
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -30,7 +29,7 @@ repositories {
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.github.cesarferreira:kotlin-pluralizer:0.2.2'
|
compile 'com.github.cesarferreira:kotlin-pluralizer:0.2.4'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
||||||
ext {
|
ext {
|
||||||
ext_groupId = 'com.cesarferreira'
|
ext_groupId = 'com.cesarferreira'
|
||||||
ext_artifactId = 'kotlin-pluralizer'
|
ext_artifactId = 'kotlin-pluralizer'
|
||||||
ext_version = '0.2.2'
|
ext_version = '0.2.4'
|
||||||
ext_url = 'https://github.com/cesarferreira/kotlin-pluralizer'
|
ext_url = 'https://github.com/cesarferreira/kotlin-pluralizer'
|
||||||
ext_vcsUrl = 'https://github.com/cesarferreira/kotlin-pluralizer.git'
|
ext_vcsUrl = 'https://github.com/cesarferreira/kotlin-pluralizer.git'
|
||||||
ext_description = 'Kotlin extension to pluralize and singularize strings'
|
ext_description = 'Kotlin extension to pluralize and singularize strings'
|
||||||
|
|
|
@ -1,42 +1,17 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
jcenter()
|
||||||
}
|
mavenLocal()
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
plugins {
|
||||||
apply plugin: 'kotlin-android'
|
id 'com.jfrog.bintray' version '1.6'
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 24
|
|
||||||
buildToolsVersion "24.0.2"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 16
|
|
||||||
targetSdkVersion 24
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
apply plugin: 'java'
|
||||||
abortOnError false
|
apply plugin: 'kotlin'
|
||||||
}
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceSets {
|
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
|
@ -1,52 +1,59 @@
|
||||||
// build a jar with source files
|
|
||||||
|
group "$ext_groupId"
|
||||||
|
version "$ext_version"
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
MyPublication(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
artifact sourcesJar
|
||||||
|
groupId "$ext_groupId"
|
||||||
|
artifactId "$ext_artifactId"
|
||||||
|
version "$ext_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from android.sourceSets.main.java.srcDirs
|
from sourceSets.main.java.srcDirs
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadoc(type: Javadoc) {
|
|
||||||
failOnError false
|
|
||||||
source = android.sourceSets.main.java.sourceFiles
|
|
||||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
||||||
classpath += configurations.compile
|
|
||||||
}
|
|
||||||
|
|
||||||
// build a jar with javadoc
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives sourcesJar
|
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
|
archives sourcesJar
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
bintray {
|
||||||
//bintray {
|
user = System.getenv('BINTRAY_USER')
|
||||||
// user = System.getenv('BINTRAY_USER')
|
key = System.getenv('BINTRAY_API_KEY')
|
||||||
// key = System.getenv('BINTRAY_API_KEY')
|
|
||||||
//
|
dryRun = false
|
||||||
// dryRun = false
|
publish = true
|
||||||
// publish = true
|
|
||||||
//
|
publications = ['MyPublication']
|
||||||
// publications = ['MyPublication']
|
pkg {
|
||||||
// pkg {
|
repo = 'maven'
|
||||||
// repo = 'maven'
|
name = "$ext_artifactId"
|
||||||
// name = "$ext_artifactId"
|
licenses = ['Apache-2.0']
|
||||||
// licenses = ['Apache-2.0']
|
labels = ['android', 'gradle-plugin']
|
||||||
// labels = ['android', 'gradle-plugin']
|
|
||||||
//
|
publicDownloadNumbers = true
|
||||||
// publicDownloadNumbers = true
|
vcsUrl = "$ext_vcsUrl"
|
||||||
// vcsUrl = "$ext_vcsUrl"
|
|
||||||
//
|
version {
|
||||||
// version {
|
name = "$ext_version"
|
||||||
// name = "$ext_version"
|
desc = "$ext_description"
|
||||||
// desc = "$ext_description"
|
released = new Date()
|
||||||
// released = new Date()
|
gpg {
|
||||||
// gpg {
|
sign = true // Determines whether to GPG sign the files.
|
||||||
// sign = true // Determines whether to GPG sign the files.
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 24
|
compileSdkVersion 24
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package com.cesarferreira.pluralize.sample
|
package com.cesarferreira.pluralize.sample
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.design.widget.FloatingActionButton
|
|
||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
import android.support.v7.widget.Toolbar
|
import android.support.v7.widget.Toolbar
|
||||||
import android.util.Log
|
|
||||||
import com.cesarferreira.pluralize.pluralize
|
import com.cesarferreira.pluralize.pluralize
|
||||||
import com.cesarferreira.pluralize.singularize
|
import com.cesarferreira.pluralize.singularize
|
||||||
|
import kotlinx.android.synthetic.main.content_hello.*
|
||||||
|
|
||||||
class HelloActivity : AppCompatActivity() {
|
class HelloActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
@ -16,15 +15,24 @@ class HelloActivity : AppCompatActivity() {
|
||||||
val toolbar = findViewById(R.id.toolbar) as Toolbar
|
val toolbar = findViewById(R.id.toolbar) as Toolbar
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
|
|
||||||
val fab = findViewById(R.id.fab) as FloatingActionButton
|
val singulars = arrayOf("person", "banana", "woman")
|
||||||
fab.setOnClickListener({
|
|
||||||
view ->
|
|
||||||
Log.d("TAG", "person".pluralize())
|
|
||||||
Log.d("TAG", "banana".pluralize())
|
|
||||||
Log.d("TAG", "woman".pluralize())
|
|
||||||
Log.d("TAG", "women".singularize())
|
|
||||||
|
|
||||||
})
|
for (item in singulars) {
|
||||||
|
concat("$item -> pluralize -> ${item.pluralize()}")
|
||||||
|
}
|
||||||
|
|
||||||
|
concat("")
|
||||||
|
concat("")
|
||||||
|
|
||||||
|
val plurals = arrayOf("words", "octopi", "sheep")
|
||||||
|
|
||||||
|
for (item in plurals) {
|
||||||
|
concat("$item -> singularize -> ${item.singularize()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun concat(str: String) {
|
||||||
|
centerTextView.append(str + "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true">
|
||||||
tools:context="com.cesarferreira.supposedlibrary.com.cesarferreira.pluralize.sample.HelloActivity">
|
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -24,12 +23,4 @@
|
||||||
|
|
||||||
<include layout="@layout/content_hello"/>
|
<include layout="@layout/content_hello"/>
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
|
||||||
android:id="@+id/fab"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:layout_margin="@dimen/fab_margin"
|
|
||||||
app:srcCompat="@android:drawable/ic_dialog_email"/>
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -11,7 +11,11 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:showIn="@layout/activity_hello"
|
tools:showIn="@layout/activity_hello">
|
||||||
tools:context="com.cesarferreira.supposedlibrary.com.cesarferreira.pluralize.sample.HelloActivity">
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/centerTextView"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Pluralize</string>
|
<string name="app_name">Pluralize</string>
|
||||||
<string name="title_activity_hello">HelloActivity</string>
|
<string name="title_activity_hello">Pluralize</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue