1
0
Fork 0
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:
Cesar Ferreira 2016-09-04 23:31:25 +01:00
parent d0f22d0f40
commit 075acc0c94
9 changed files with 92 additions and 98 deletions

View file

@ -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

View file

@ -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")
}
}

View file

@ -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>

View file

@ -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>

View file

@ -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>