Skip to content

Commit

Permalink
Update README.md for documentation moved to wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
kirtan403 authored Nov 21, 2017
1 parent b4efaa3 commit bce05fe
Showing 1 changed file with 4 additions and 142 deletions.
146 changes: 4 additions & 142 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,149 +42,11 @@ compile 'com.github.kirtan403.k4kotlin:k4kotlin:0.3.0'

Then, additionally you can add as many other modules you might need.

## Usage
## [Usage / Documentaion](https://github.com/kirtan403/K4Kotlin/wiki)

For `k4kotlin-retrofit` module's documentation, [click here](https://github.com/kirtan403/K4Kotlin/wiki/Retrofit)

### View

#### Set View's visibility to visible

Instead of

myView.setVisibility(View.VISIBLE);

use:

myView.show()


#### Set View's visibility to gone

Instead of

myView.setVisibility(View.GONE);

use:

myView.hide()


#### Set View's visibility to invsible

Instead of

myView.setVisibility(View.INVISIBLE);

use:

myView.invisible()


#### Toggle View's visibility between `VISIBLE` and `GONE`

Instead of

if(myView.getVisibility() == View.VISIBLE)
myView.setVisibility(View.GONE);
else
myView.setVisibility(View.VISIBLE);

use:

myView.toggleVisibility()

#### To fade in a view

myView.fadeIn()
myView.fadeIn(1000) // Optional duration

#### To fade out a view

myView.fadeOut()
myView.fadeOut(1000) // Optional duration

#### Fade to specific alpha of a view

myView.fadeTo(0.5f)
myView.fadeTo(0.5f,1000) // Optional duration
Check out the wiki for detailed documentation and usage examples.

#### View Animations

Enter and exit animations for views

mView.enterFromTop()
mView.enterFromLeft()
mView.enterFromBottom()
mView.enterFromRight()

mView.exitToTop()
mView.exitToLeft()
mView.exitToBottom()
mView.exitToRight()

// with optional duration
mView.enterFromTop(1000)

### Activity

#### Hide the keyboard

hideKeyboard() // Anywhere inside your activity

### Context

#### hide/show multiple views

hideViews(myView1,myView2,myView3,.. myViewN) // Sets all views visibility to GONE
showViews(myView1,myView2,myView3,.. myViewN) // Sets all views visibility to VISIBLE

#### dpToPx

dpToPx(14) // returns px equal to 14dp

#### pxToDp

pxToDp(14) // returns dp equal to 14px

### Number

#### Number?.orZero() method for all number types

if(myNumberVar.orZero()) // return 0 if variable is null

### Boolean

#### Boolean?.orFalse() method

if(myBooleanVar.orFalse()) // return false if variable is null

### EditText

#### Text watcher

var textWatcher = myEditText.addTextWatcher {
Log.d(TAG, "text changed!")
}

### Spinner

#### setItems - Set spinner list

Generates the adapter from the ArrayList of Object and accepts layout file resource and Object to String conversion method.

spinner.setItems(items) { it.name + " (" + it.code + ")" } // function that converts item instance to string for spinner

#### onItemChanged - simpler callback method for OnItemSelectedListener

mBinding.spinner.onItemSelected { _, _, position, _ ->
val (name, _) = countries[position.orZero()]
toast("You selected : $name")
}

### Any - helpers for all classes
For `k4kotlin` core module [click here](https://github.com/kirtan403/K4Kotlin/wiki/K4Kotlin)
For `k4kotlin-retrofit` module's documentation, [click here](https://github.com/kirtan403/K4Kotlin/wiki/Retrofit)

#### TAG - a property helpful for Log Tags

You don't need to declare a TAG everytime you want to use the `Log.d(TAG,"My log")`. It is declared globally for all classes, and can be used without declaring TAG in class.

0 comments on commit bce05fe

Please sign in to comment.