Skip to content

Commit 21615e1

Browse files
committed
First commit
0 parents  commit 21615e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1254
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

.idea/compiler.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# android-rx-flux-example
2+
3+
![RxFluxApp](rxfluxapp.png)
4+
5+
## About Flux
6+
7+
![Flux](flux.png)
8+
> https://facebook.github.io/flux/docs/overview.html
9+
10+
## Using library
11+
12+
- [Dagger 2 (ver 2.7)](https://github.com/google/dagger)
13+
- [RxJava (ver 1.2.1)](https://github.com/ReactiveX/RxJava)
14+
- [RxAndroid (ver 1.2.1)](https://github.com/ReactiveX/RxAndroid)
15+
- [Gradle Retrolambda Plugin (ver 3.3.0)](https://github.com/evant/gradle-retrolambda)
16+
- [Butter Knife (ver 8.4.0)](https://github.com/JakeWharton/butterknife)
17+
18+
> This project uses Java 8 and [Retrolambda](https://github.com/orfjackal/retrolambda).
19+
20+
## License
21+
22+
MIT

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'me.tatarka.retrolambda'
3+
4+
android {
5+
compileSdkVersion 24
6+
buildToolsVersion "24.0.3"
7+
defaultConfig {
8+
applicationId "io.github.hkusu.rxflux"
9+
minSdkVersion 21
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "0.0.0"
13+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
}
15+
buildTypes {
16+
release {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19+
}
20+
}
21+
compileOptions {
22+
sourceCompatibility JavaVersion.VERSION_1_8
23+
targetCompatibility JavaVersion.VERSION_1_8
24+
}
25+
}
26+
27+
dependencies {
28+
compile fileTree(dir: 'libs', include: ['*.jar'])
29+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
30+
exclude group: 'com.android.support', module: 'support-annotations'
31+
})
32+
compile 'com.android.support:appcompat-v7:24.2.1'
33+
compile "com.android.support:support-v4:24.2.1"
34+
compile "com.android.support:support-annotations:24.2.1"
35+
compile 'com.google.dagger:dagger:2.7'
36+
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
37+
provided 'javax.annotation:jsr250-api:1.0'
38+
compile 'io.reactivex:rxjava:1.2.1'
39+
compile 'io.reactivex:rxandroid:1.2.1'
40+
compile 'com.jakewharton:butterknife:8.4.0'
41+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
42+
testCompile 'junit:junit:4.12'
43+
}

app/proguard-rules.pro

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/h_kusu/Library/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Retrolambda
20+
-dontwarn java.lang.invoke.*
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.github.hkusu.rxflux;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.assertEquals;
11+
12+
/**
13+
* Instrumentation test, which will execute observe an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("io.github.hkusu.rxflux", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
package="io.github.hkusu.rxflux"
5+
>
6+
7+
<application
8+
android:name=".RxFluxApplication"
9+
android:allowBackup="false"
10+
android:icon="@mipmap/ic_launcher"
11+
android:label="@string/app_name"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme"
14+
>
15+
<activity
16+
android:name=".ui.main.MainActivity"
17+
android:screenOrientation="portrait"
18+
>
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
</manifest>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package io.github.hkusu.rxflux;
2+
3+
public interface AppAction {
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.github.hkusu.rxflux;
2+
3+
import javax.inject.Inject;
4+
5+
import io.github.hkusu.rxflux.lib.flux.ActionCreator;
6+
import io.github.hkusu.rxflux.lib.flux.Dispatcher;
7+
8+
// NOTE: アプリケーション全体で共有するアクションはここに書く
9+
public class AppActionCreator extends ActionCreator {
10+
@Inject
11+
public AppActionCreator(Dispatcher dispatcher) {
12+
super(dispatcher);
13+
}
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.hkusu.rxflux;
2+
3+
import javax.inject.Inject;
4+
import javax.inject.Singleton;
5+
6+
import io.github.hkusu.rxflux.lib.flux.Dispatcher;
7+
import io.github.hkusu.rxflux.lib.flux.Store;
8+
9+
// NOTE: アプリケーション全体で共有する状態はここに書く
10+
@Singleton
11+
public class AppStore extends Store {
12+
@Inject
13+
public AppStore(Dispatcher dispatcher) {
14+
super(dispatcher);
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.github.hkusu.rxflux;
2+
3+
import android.app.Application;
4+
5+
import io.github.hkusu.rxflux.di.AppComponent;
6+
import io.github.hkusu.rxflux.di.AppModule;
7+
import io.github.hkusu.rxflux.di.DaggerAppComponent;
8+
9+
public class RxFluxApplication extends Application {
10+
private AppComponent appComponent;
11+
12+
public AppComponent getAppComponent() {
13+
return appComponent;
14+
}
15+
16+
@Override
17+
public void onCreate() {
18+
super.onCreate();
19+
20+
appComponent = DaggerAppComponent
21+
.builder()
22+
.appModule(new AppModule(this))
23+
.build();
24+
}
25+
}

app/src/main/java/io/github/hkusu/rxflux/def/.gitkeep

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.hkusu.rxflux.di;
2+
3+
import javax.inject.Singleton;
4+
5+
import dagger.Component;
6+
import io.github.hkusu.rxflux.lib.rx.SubscriptionManager;
7+
import io.github.hkusu.rxflux.ui.main.MainActionCreator;
8+
import io.github.hkusu.rxflux.ui.main.MainStore;
9+
10+
@Singleton
11+
@Component(modules = AppModule.class)
12+
public interface AppComponent {
13+
MainStore mainStore();
14+
MainActionCreator mainAction();
15+
SubscriptionManager subscriptionManager();
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.github.hkusu.rxflux.di;
2+
3+
import android.app.Application;
4+
5+
import javax.inject.Singleton;
6+
7+
import dagger.Module;
8+
import dagger.Provides;
9+
10+
@Singleton
11+
@Module
12+
public class AppModule {
13+
private final Application application;
14+
15+
public AppModule(Application application) {
16+
this.application = application;
17+
}
18+
19+
@Provides
20+
@Singleton
21+
public Application application() {
22+
return application;
23+
}
24+
}

0 commit comments

Comments
 (0)