diff --git a/README.md b/README.md
index b6ecc52..a9f6c83 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
# kotlin-pluralizer
[](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!
## Usage
@@ -30,7 +29,7 @@ repositories {
maven { url "https://jitpack.io" }
}
dependencies {
- compile 'com.github.cesarferreira:kotlin-pluralizer:0.2.2'
+ compile 'com.github.cesarferreira:kotlin-pluralizer:0.2.4'
}
```
diff --git a/build.gradle b/build.gradle
index cbb251d..f750bae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
ext {
ext_groupId = 'com.cesarferreira'
ext_artifactId = 'kotlin-pluralizer'
- ext_version = '0.2.2'
+ ext_version = '0.2.4'
ext_url = 'https://github.com/cesarferreira/kotlin-pluralizer'
ext_vcsUrl = 'https://github.com/cesarferreira/kotlin-pluralizer.git'
ext_description = 'Kotlin extension to pluralize and singularize strings'
diff --git a/library/build.gradle b/library/build.gradle
index 52ecec2..79f89cf 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,43 +1,18 @@
buildscript {
repositories {
- mavenCentral()
- }
-
- dependencies {
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
+ jcenter()
+ mavenLocal()
}
}
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-
-android {
- compileSdkVersion 24
- buildToolsVersion "24.0.2"
-
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 24
- versionCode 1
- versionName "1.0"
-
- }
-
- lintOptions {
- abortOnError false
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- }
+plugins {
+ id 'com.jfrog.bintray' version '1.6'
}
+apply plugin: 'java'
+apply plugin: 'kotlin'
+apply plugin: 'maven-publish'
+
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
diff --git a/library/publish.gradle b/library/publish.gradle
index a294eae..e6b8b08 100644
--- a/library/publish.gradle
+++ b/library/publish.gradle
@@ -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) {
- from android.sourceSets.main.java.srcDirs
+ from sourceSets.main.java.srcDirs
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) {
classifier = 'javadoc'
from javadoc.destinationDir
}
+
artifacts {
- archives sourcesJar
archives javadocJar
+ archives sourcesJar
}
-//
-//bintray {
-// user = System.getenv('BINTRAY_USER')
-// key = System.getenv('BINTRAY_API_KEY')
-//
-// dryRun = false
-// publish = true
-//
-// publications = ['MyPublication']
-// pkg {
-// repo = 'maven'
-// name = "$ext_artifactId"
-// licenses = ['Apache-2.0']
-// labels = ['android', 'gradle-plugin']
-//
-// publicDownloadNumbers = true
-// vcsUrl = "$ext_vcsUrl"
-//
-// version {
-// name = "$ext_version"
-// desc = "$ext_description"
-// released = new Date()
-// gpg {
-// sign = true // Determines whether to GPG sign the files.
-// }
-// }
-// }
-//}
+bintray {
+ user = System.getenv('BINTRAY_USER')
+ key = System.getenv('BINTRAY_API_KEY')
+
+ dryRun = false
+ publish = true
+
+ publications = ['MyPublication']
+ pkg {
+ repo = 'maven'
+ name = "$ext_artifactId"
+ licenses = ['Apache-2.0']
+ labels = ['android', 'gradle-plugin']
+
+ publicDownloadNumbers = true
+ vcsUrl = "$ext_vcsUrl"
+
+ version {
+ name = "$ext_version"
+ desc = "$ext_description"
+ released = new Date()
+ gpg {
+ sign = true // Determines whether to GPG sign the files.
+ }
+ }
+ }
+}
diff --git a/sample/build.gradle b/sample/build.gradle
index b81014f..fa4a664 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,5 +1,15 @@
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
+ }
+}
+
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 24
diff --git a/sample/src/main/java/com/cesarferreira/pluralize/sample/HelloActivity.kt b/sample/src/main/java/com/cesarferreira/pluralize/sample/HelloActivity.kt
index 2b3fe72..525867a 100644
--- a/sample/src/main/java/com/cesarferreira/pluralize/sample/HelloActivity.kt
+++ b/sample/src/main/java/com/cesarferreira/pluralize/sample/HelloActivity.kt
@@ -1,12 +1,11 @@
package com.cesarferreira.pluralize.sample
import android.os.Bundle
-import android.support.design.widget.FloatingActionButton
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
-import android.util.Log
import com.cesarferreira.pluralize.pluralize
import com.cesarferreira.pluralize.singularize
+import kotlinx.android.synthetic.main.content_hello.*
class HelloActivity : AppCompatActivity() {
@@ -16,15 +15,24 @@ class HelloActivity : AppCompatActivity() {
val toolbar = findViewById(R.id.toolbar) as Toolbar
setSupportActionBar(toolbar)
- val fab = findViewById(R.id.fab) as FloatingActionButton
- fab.setOnClickListener({
- view ->
- Log.d("TAG", "person".pluralize())
- Log.d("TAG", "banana".pluralize())
- Log.d("TAG", "woman".pluralize())
- Log.d("TAG", "women".singularize())
+ val singulars = arrayOf("person", "banana", "woman")
- })
+ 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")
}
}
diff --git a/sample/src/main/res/layout/activity_hello.xml b/sample/src/main/res/layout/activity_hello.xml
index 48bfd3d..2b31fab 100644
--- a/sample/src/main/res/layout/activity_hello.xml
+++ b/sample/src/main/res/layout/activity_hello.xml
@@ -5,8 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:fitsSystemWindows="true"
- tools:context="com.cesarferreira.supposedlibrary.com.cesarferreira.pluralize.sample.HelloActivity">
+ android:fitsSystemWindows="true">
-
-
diff --git a/sample/src/main/res/layout/content_hello.xml b/sample/src/main/res/layout/content_hello.xml
index 9ab9f39..104dfc2 100644
--- a/sample/src/main/res/layout/content_hello.xml
+++ b/sample/src/main/res/layout/content_hello.xml
@@ -11,7 +11,11 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
- tools:showIn="@layout/activity_hello"
- tools:context="com.cesarferreira.supposedlibrary.com.cesarferreira.pluralize.sample.HelloActivity">
+ tools:showIn="@layout/activity_hello">
+
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index 58e23dd..38e7cf4 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
Pluralize
- HelloActivity
+ Pluralize