mirror of
https://github.com/ethauvin/kotlin-pluralizer.git
synced 2025-04-25 16:57: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
|
||||
[](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'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -24,12 +23,4 @@
|
|||
|
||||
<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>
|
||||
|
|
|
@ -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">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/centerTextView"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<resources>
|
||||
<string name="app_name">Pluralize</string>
|
||||
<string name="title_activity_hello">HelloActivity</string>
|
||||
<string name="title_activity_hello">Pluralize</string>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue