-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,667 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'com.neenbedankt.android-apt' | ||
apply plugin: 'me.tatarka.retrolambda' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.agna.ferro.sample" | ||
minSdkVersion 16 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile project(":ferro-mvp-rx") | ||
compile 'com.android.support:appcompat-v7:23.4.0' | ||
compile 'com.android.support:recyclerview-v7:23.4.0' | ||
compile 'com.android.support:cardview-v7:23.4.0' | ||
|
||
compile 'io.reactivex:rxjava:1.1.6' | ||
compile 'io.reactivex:rxandroid:1.2.1' | ||
compile 'com.annimon:stream:1.0.9' | ||
|
||
apt 'com.google.dagger:dagger-compiler:2.2' | ||
compile 'com.google.dagger:dagger:2.2' | ||
provided 'javax.annotation:jsr250-api:1.0' | ||
|
||
compile 'com.github.bumptech.glide:glide:3.7.0' | ||
compile 'com.jakewharton.timber:timber:4.1.2' | ||
|
||
testCompile 'junit:junit:4.12' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in J:\Android\sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
sample/src/androidTest/java/com/agna/ferro/sample/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.agna.ferro.sample; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.agna.ferro.sample"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<application | ||
android:name=".app.App" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".ui.screen.catalog.CatalogActivityView" | ||
android:label="Ferro MVP Rx Sample"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name=".ui.screen.book.BookActivity" | ||
android:label="Book" /> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.agna.ferro.sample.app; | ||
|
||
import android.app.Application; | ||
|
||
import timber.log.Timber; | ||
|
||
public class App extends Application { | ||
|
||
private AppComponent appComponent; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
initInjector(); | ||
initLog(); | ||
} | ||
|
||
private void initLog() { | ||
Timber.plant(new Timber.DebugTree()); | ||
} | ||
|
||
private void initInjector() { | ||
appComponent = DaggerAppComponent.builder() | ||
.appModule(new AppModule(this)) | ||
.build(); | ||
} | ||
|
||
public AppComponent getAppComponent() { | ||
return this.appComponent; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sample/src/main/java/com/agna/ferro/sample/app/AppComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (C) 2015 Fernando Cejas Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.agna.ferro.sample.app; | ||
|
||
import android.content.Context; | ||
|
||
import com.agna.ferro.mvp.dagger.scope.PerApplication; | ||
import com.agna.ferro.sample.module.book.BookRepository; | ||
|
||
import dagger.Component; | ||
|
||
/** | ||
* Application-level component | ||
*/ | ||
@PerApplication | ||
@Component(modules = AppModule.class) | ||
public interface AppComponent { | ||
|
||
//Exposed to sub-graphs. | ||
Context context(); | ||
|
||
BookRepository bookRepository(); | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
sample/src/main/java/com/agna/ferro/sample/app/AppModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright (C) 2015 Fernando Cejas Open Source Project | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.agna.ferro.sample.app; | ||
|
||
import android.content.Context; | ||
|
||
import com.agna.ferro.mvp.dagger.scope.PerApplication; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
/** | ||
* Application-level module, which provides appContext | ||
*/ | ||
@Module | ||
public class AppModule { | ||
private final Context applicationContext; | ||
|
||
public AppModule(Context applicationContext) { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
@Provides | ||
@PerApplication | ||
Context provideApplicationContext() { | ||
return this.applicationContext; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
sample/src/main/java/com/agna/ferro/sample/domain/entity/Book.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.agna.ferro.sample.domain.entity; | ||
|
||
/** | ||
* Book entity | ||
*/ | ||
public class Book { | ||
private String id; | ||
private String name; | ||
private int downloadProgress; | ||
private String imageUrl; | ||
|
||
public Book(String id, String name, String imageUrl) { | ||
this.id = id; | ||
this.name = name; | ||
this.imageUrl = imageUrl; | ||
this.downloadProgress = -1; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getImageUrl() { | ||
return imageUrl; | ||
} | ||
|
||
public boolean isDownloaded() { | ||
return downloadProgress == 100; | ||
} | ||
|
||
public boolean isDownloading() { | ||
return downloadProgress >= 0; | ||
} | ||
|
||
public int getDownloadProgress() { | ||
return downloadProgress; | ||
} | ||
|
||
public void setDownloadProgress(int downloadProgress) { | ||
this.downloadProgress = downloadProgress; | ||
} | ||
} |
Oops, something went wrong.