├── sample ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values │ │ │ │ │ ├── styles.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── dimens.xml │ │ │ │ │ └── themes.xml │ │ │ │ ├── drawable │ │ │ │ │ ├── ic_done_white_24dp.xml │ │ │ │ │ ├── ic_delete_black_24dp.xml │ │ │ │ │ ├── ic_check_circle_black_24dp.xml │ │ │ │ │ └── ic_edit_black_24dp.xml │ │ │ │ ├── menu │ │ │ │ │ └── menu_edit.xml │ │ │ │ └── layout │ │ │ │ │ ├── view_list_item.xml │ │ │ │ │ ├── content_list.xml │ │ │ │ │ ├── activity_edit.xml │ │ │ │ │ ├── activity_list.xml │ │ │ │ │ └── activity_detail.xml │ │ │ ├── kotlin │ │ │ │ └── me │ │ │ │ │ └── retty │ │ │ │ │ └── reduxkt │ │ │ │ │ └── sample │ │ │ │ │ ├── data │ │ │ │ │ └── Todo.kt │ │ │ │ │ ├── redux │ │ │ │ │ ├── state │ │ │ │ │ │ └── ApplicationState.kt │ │ │ │ │ ├── action │ │ │ │ │ │ ├── TodoAction.kt │ │ │ │ │ │ └── creatorproducer │ │ │ │ │ │ │ └── TodoActionCreatorProducer.kt │ │ │ │ │ ├── middleware │ │ │ │ │ │ └── Logger.kt │ │ │ │ │ ├── reducer │ │ │ │ │ │ ├── RootReducerSet.kt │ │ │ │ │ │ └── TodoReducerSet.kt │ │ │ │ │ ├── Aliases.kt │ │ │ │ │ └── store │ │ │ │ │ │ └── Store.kt │ │ │ │ │ ├── extend │ │ │ │ │ └── Extensions.kt │ │ │ │ │ ├── ListItemView.kt │ │ │ │ │ ├── EditActivity.kt │ │ │ │ │ ├── ListActivity.kt │ │ │ │ │ └── DetailActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── me │ │ │ │ └── retty │ │ │ │ └── reduxkt │ │ │ │ └── sample │ │ │ │ ├── ExampleUnitTest.java │ │ │ │ └── TodoReducerTest.kt │ │ └── androidTest │ │ │ └── java │ │ │ └── me │ │ │ └── retty │ │ │ └── reduxkt │ │ │ └── sample │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── bootstrap.sh ├── README.md ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── redux-kt-core ├── src │ └── main │ │ └── kotlin │ │ └── me │ │ └── retty │ │ └── reduxkt │ │ ├── StateType.kt │ │ ├── Action.kt │ │ ├── Middleware.kt │ │ ├── ActionCreator.kt │ │ ├── Reducer.kt │ │ ├── internal │ │ └── utils │ │ │ └── Function.kt │ │ └── Store.kt └── pom.xml ├── .gitignore ├── redux-kt-rxjava-bindings ├── README.md ├── pom.xml └── src │ └── main │ └── kotlin │ └── me │ └── retty │ └── reduxkt │ └── bindings │ └── rxjava │ └── RxJavaBindings.kt ├── LICENSE ├── pom.xml └── README.md /sample/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' -------------------------------------------------------------------------------- /sample/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /redux-kt-core/src/main/kotlin/me/retty/reduxkt/StateType.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt 2 | 3 | /** 4 | * Created by yusaka on 3/15/17. 5 | */ 6 | interface StateType -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RettyEng/redux-kt/HEAD/sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sample/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if type mvn 1>/dev/null 2>&1; then 4 | cd $(dirname $0)/.. && mvn install 5 | else 6 | echo 'Firstly, you need to install maven to install snapshot into local cache.' 7 | fi 8 | -------------------------------------------------------------------------------- /redux-kt-core/src/main/kotlin/me/retty/reduxkt/Action.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt 2 | 3 | import kotlin.properties.Delegates 4 | 5 | /** 6 | * Created by yusaka on 3/15/17. 7 | */ 8 | 9 | interface Action 10 | 11 | 12 | -------------------------------------------------------------------------------- /redux-kt-core/src/main/kotlin/me/retty/reduxkt/Middleware.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt 2 | 3 | /** 4 | * Created by yusaka on 3/15/17. 5 | */ 6 | internal typealias Dispatcher = (Action) -> Unit 7 | typealias Middleware = (State) -> (Dispatcher) -> Dispatcher 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.war 8 | *.ear 9 | 10 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 11 | hs_err_pid* 12 | 13 | target/ 14 | .idea/ 15 | *.iml 16 | -------------------------------------------------------------------------------- /sample/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 25 13:52:55 JST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /redux-kt-core/src/main/kotlin/me/retty/reduxkt/ActionCreator.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt 2 | 3 | /** 4 | * Created by yusaka on 3/15/17. 5 | */ 6 | 7 | typealias ActionCreator = (State, Store) -> Action 8 | typealias AsyncActionCreator = (State, Store, (ActionCreator) -> Unit) -> Unit -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/data/Todo.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.data 2 | 3 | /** 4 | * Created by atsukofukui on 2017/08/25. 5 | */ 6 | data class Todo( 7 | val id: Long, 8 | val name: String, 9 | val memo: String, 10 | val isDone: Boolean 11 | ) -------------------------------------------------------------------------------- /sample/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | sample 3 | Settings 4 | Done 5 | 6 | Name 7 | Memo 8 | 9 | -------------------------------------------------------------------------------- /sample/README.md: -------------------------------------------------------------------------------- 1 | # Building sample app and installing via adb 2 | 3 | Execute following commands. 4 | 5 | ```sh 6 | ./bootstrap.sh 7 | # Create apk 8 | ./gradlew assembleDebug 9 | # Install sample to connected android device 10 | ./gradlew installDebug 11 | ``` 12 | 13 | WARNING: bootstrap.sh will install redux-kt into your maven locale cache. 14 | 15 | -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/redux/state/ApplicationState.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.redux.state 2 | 3 | import me.retty.reduxkt.StateType 4 | import me.retty.reduxkt.sample.data.Todo 5 | 6 | /** 7 | * Created by atsukofukui on 2017/08/23. 8 | */ 9 | data class ApplicationState constructor(val todos: List = emptyList()) : StateType 10 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | @color/colorAccent 8 | #33111111 9 | 10 | -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/redux/action/TodoAction.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.redux.action 2 | 3 | import me.retty.reduxkt.Action 4 | 5 | /** 6 | * Created by atsukofukui on 2017/08/23. 7 | */ 8 | interface TodoAction : Action { 9 | class OnCreateTodoAction(val name: String, val memo: String) : TodoAction 10 | class OnToggleCompletedTodoAction(val id: Long) : TodoAction 11 | } -------------------------------------------------------------------------------- /sample/app/src/main/res/drawable/ic_done_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /sample/app/src/main/res/drawable/ic_delete_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /redux-kt-core/src/main/kotlin/me/retty/reduxkt/Reducer.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt 2 | 3 | import me.retty.reduxkt.internal.utils.comp 4 | import me.retty.reduxkt.internal.utils.curry 5 | 6 | /** 7 | * Created by yusaka on 3/14/17. 8 | */ 9 | 10 | typealias Reducer = (Action, StateType) -> StateType 11 | 12 | infix fun Reducer.compose(reducer: Reducer): Reducer = { action, state -> 13 | ((this curry action) comp (reducer curry (action)))(state) 14 | } 15 | 16 | -------------------------------------------------------------------------------- /sample/app/src/main/res/drawable/ic_check_circle_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /sample/app/src/test/java/me/retty/reduxkt/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | 14 | @Test 15 | public void addition_isCorrect() throws Exception { 16 | assertEquals(4, 2 + 2); 17 | } 18 | } -------------------------------------------------------------------------------- /sample/app/src/main/res/drawable/ic_edit_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /redux-kt-rxjava-bindings/README.md: -------------------------------------------------------------------------------- 1 | // TODO: Write it without slacking 2 | 3 | Add it as a dependency. 4 | 5 | ``` 6 | compile 'com.github.rettyeng.redux-kt:redux-kt-core:0.0.2-SNAPSHOT' 7 | ``` 8 | 9 | Write codes like below 10 | 11 | ``` 12 | val store = RxJavaBindings.newStore( 13 | initialState, 14 | { action, state -> /* reducer */ }, 15 | /* middlewares */ listOf()) 16 | 17 | /* Store<*>.observable is an Observable of RxJava */ 18 | store.observable.subscribe { 19 | /* procedures */ 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/redux/middleware/Logger.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.redux.middleware 2 | 3 | import android.util.Log 4 | import me.retty.reduxkt.Middleware 5 | import me.retty.reduxkt.sample.redux.state.ApplicationState 6 | 7 | /** 8 | * Created by atsukofukui on 2017/08/23. 9 | */ 10 | val logger: Middleware = { 11 | { dispatch -> 12 | { action -> 13 | Log.d("Logger", "dispatching action: ${action.javaClass.canonicalName}") 14 | dispatch(action) 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /sample/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | 4dp 5 | 8dp 6 | 12dp 7 | 16dp 8 | 24dp 9 | 20sp 10 | 16sp 11 | 14sp 12 | 12sp 13 | 11sp 14 | 15 | 16 | -------------------------------------------------------------------------------- /sample/app/src/main/res/menu/menu_edit.xml: -------------------------------------------------------------------------------- 1 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /redux-kt-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.github.rettyeng.redux-kt 8 | redux-kt 9 | 0.0.2-SNAPSHOT 10 | 11 | 12 | redux-kt-core 13 | redux-kt-core 14 | http://maven.apache.org 15 | 16 | -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/redux/reducer/RootReducerSet.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.redux.reducer 2 | 3 | import me.retty.reduxkt.sample.redux.Reducer 4 | import me.retty.reduxkt.sample.redux.action.TodoAction 5 | 6 | /** 7 | * Created by atsukofukui on 2017/08/23. 8 | */ 9 | class RootReducerSet { 10 | companion object { 11 | val aggregatedReducer: Reducer = { action, state -> 12 | when (action) { 13 | is TodoAction -> TodoReducerSet.aggregatedReducer(action, state) 14 | else -> state 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/extend/Extensions.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.extend 2 | 3 | import android.app.Activity 4 | import android.view.View 5 | 6 | /** 7 | * Created by atsukofukui on 2017/08/25. 8 | */ 9 | inline fun Activity.bindView(resId: Int, 10 | noinline onClick: ((View) -> Unit)? = null): Lazy = 11 | lazy { 12 | this.findViewById(resId).apply { 13 | onClick?.let { 14 | this.setOnClickListener(it) 15 | } 16 | } as T 17 | } 18 | 19 | @Suppress("UNCHECKED_CAST") 20 | fun View.findAndCast(id: Int): T = this.findViewById(id) as T 21 | -------------------------------------------------------------------------------- /sample/app/src/main/kotlin/me/retty/reduxkt/sample/redux/Aliases.kt: -------------------------------------------------------------------------------- 1 | package me.retty.reduxkt.sample.redux 2 | 3 | /** 4 | * Created by atsukofukui on 2017/08/23. 5 | */ 6 | import me.retty.reduxkt.ActionCreator 7 | import me.retty.reduxkt.AsyncActionCreator 8 | import me.retty.reduxkt.Middleware 9 | import me.retty.reduxkt.Reducer 10 | import me.retty.reduxkt.StateSubscriber 11 | import me.retty.reduxkt.sample.redux.state.ApplicationState 12 | 13 | typealias Subscriber = StateSubscriber 14 | typealias AsyncActionCreator = AsyncActionCreator 15 | typealias ActionCreator = ActionCreator 16 | typealias Reducer = Reducer 17 | typealias Middleware = Middleware -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.1.4-2' 5 | repositories { 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:2.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | mavenLocal() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /sample/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |