├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── appIcon-web.png
│ │ ├── app_launcher-web.png
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── app_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── app_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── app_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── app_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── app_launcher.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── menu
│ │ │ │ └── menu_main.xml
│ │ │ ├── layout
│ │ │ │ ├── fragment_setting_list.xml
│ │ │ │ ├── fragment_itemlist_list.xml
│ │ │ │ ├── fragment_itemlist_github_repo.xml
│ │ │ │ ├── activity_feed_detail.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ └── content_feed_detail.xml
│ │ │ └── values-w820dp
│ │ │ │ └── dimens.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── mrpeak
│ │ │ │ ├── trimdata
│ │ │ │ ├── dal
│ │ │ │ │ ├── DalBase.java
│ │ │ │ │ ├── IDalBase.java
│ │ │ │ │ ├── rawModel
│ │ │ │ │ │ ├── RawModelBase.java
│ │ │ │ │ │ └── GitHubRepository.java
│ │ │ │ │ ├── DalModule.java
│ │ │ │ │ ├── IGitHubRepoDal.java
│ │ │ │ │ ├── EventSource.java
│ │ │ │ │ ├── DalFactory.java
│ │ │ │ │ └── imp
│ │ │ │ │ │ └── GitHubRepoDalImp.java
│ │ │ │ ├── service
│ │ │ │ │ ├── ServiceBase.java
│ │ │ │ │ ├── cache
│ │ │ │ │ │ ├── FeedStreamServiceCache.java
│ │ │ │ │ │ └── GitHubServiceCache.java
│ │ │ │ │ ├── network
│ │ │ │ │ │ ├── PPHttpRequestDelegate.java
│ │ │ │ │ │ ├── github
│ │ │ │ │ │ │ ├── GitHubRequestProvider.java
│ │ │ │ │ │ │ ├── GitHubRepositoryListRequest.java
│ │ │ │ │ │ │ └── GitHubRequest.java
│ │ │ │ │ │ ├── retrofitModel
│ │ │ │ │ │ │ └── RfRepository.java
│ │ │ │ │ │ └── PPHttpRequest.java
│ │ │ │ │ ├── IFeedStreamService.java
│ │ │ │ │ ├── imp
│ │ │ │ │ │ ├── FeedStreamServiceImp.java
│ │ │ │ │ │ └── GitHubServiceImp.java
│ │ │ │ │ ├── test
│ │ │ │ │ │ ├── GitHubServiceTest.java
│ │ │ │ │ │ └── FeedStreamServiceTest.java
│ │ │ │ │ ├── IGitHubService.java
│ │ │ │ │ ├── ServiceModule.java
│ │ │ │ │ └── ServiceFactory.java
│ │ │ │ ├── application
│ │ │ │ │ ├── feed
│ │ │ │ │ │ ├── feedDetail
│ │ │ │ │ │ │ ├── IFeedDetailBO.java
│ │ │ │ │ │ │ ├── FeedDetailBO.java
│ │ │ │ │ │ │ ├── IFeedDetailDH.java
│ │ │ │ │ │ │ ├── model
│ │ │ │ │ │ │ │ ├── FeedDetail.java
│ │ │ │ │ │ │ │ └── FeedDetailGitHubRepo.java
│ │ │ │ │ │ │ ├── FeedDetailDH.java
│ │ │ │ │ │ │ └── FeedDetailActivity.java
│ │ │ │ │ │ └── feedStream
│ │ │ │ │ │ │ ├── IFeedStreamBO.java
│ │ │ │ │ │ │ ├── IFeedStreamDH.java
│ │ │ │ │ │ │ ├── view
│ │ │ │ │ │ │ ├── FeedItemVH.java
│ │ │ │ │ │ │ └── FeedItemGitHubRepoVH.java
│ │ │ │ │ │ │ ├── model
│ │ │ │ │ │ │ ├── FeedItem.java
│ │ │ │ │ │ │ └── FeedItemGitHubRepo.java
│ │ │ │ │ │ │ ├── FeedStreamDH.java
│ │ │ │ │ │ │ ├── FeedStreamFragment.java
│ │ │ │ │ │ │ ├── FeedStreamAdapter.java
│ │ │ │ │ │ │ └── FeedStreamBO.java
│ │ │ │ │ ├── common
│ │ │ │ │ │ ├── BaseDataHandler.java
│ │ │ │ │ │ ├── BaseBusinessObject.java
│ │ │ │ │ │ ├── BaseActivity.java
│ │ │ │ │ │ ├── BaseViewHolder.java
│ │ │ │ │ │ ├── BaseFragment.java
│ │ │ │ │ │ ├── MyRoboFragment.java
│ │ │ │ │ │ ├── MyRoboActivity.java
│ │ │ │ │ │ ├── BaseRecyclerViewAdapter.java
│ │ │ │ │ │ └── ItemListFragment.java
│ │ │ │ │ ├── setting
│ │ │ │ │ │ └── SettingListFragment.java
│ │ │ │ │ └── MainTabActivity.java
│ │ │ │ └── core
│ │ │ │ │ └── TrimApplication.java
│ │ │ │ └── ppkit
│ │ │ │ └── android
│ │ │ │ └── ObservableUtil.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── mrpeak
│ │ │ └── trimdata
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── mrpeak
│ │ └── trimdata
│ │ └── ApplicationTest.java
├── build.gradle
├── proguard-rules.pro
└── app.iml
├── settings.gradle
├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── libraries
│ ├── jsr305_1_3_9.xml
│ ├── junit_4_12.xml
│ ├── okio_1_6_0.xml
│ ├── gson_2_6_2.xml
│ ├── rxjava_1_1_1.xml
│ ├── okhttp_3_2_0.xml
│ ├── roboguice_3_0_1.xml
│ ├── hamcrest_core_1_3.xml
│ ├── support_annotations_23_2_0.xml
│ ├── retrofit_2_0_0_beta4.xml
│ ├── design_23_2_0.xml
│ ├── rxandroid_1_1_0.xml
│ ├── activeandroid_3_1_0_SNAPSHOT.xml
│ ├── converter_gson_2_0_0_beta4.xml
│ ├── appcompat_v7_23_2_0.xml
│ ├── recyclerview_v7_23_2_0.xml
│ ├── support_vector_drawable_23_2_0.xml
│ ├── animated_vector_drawable_23_2_0.xml
│ └── support_v4_23_2_0.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── TrimData.iml
├── Data-Driven-Architecture-Android.iml
├── LICENSE
├── gradlew.bat
├── gradlew
└── README.md
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Data-Driven-Architecture-Android
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/appIcon-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/appIcon-web.png
--------------------------------------------------------------------------------
/app/src/main/app_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/app_launcher-web.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/app_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/res/mipmap-hdpi/app_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/app_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/res/mipmap-mdpi/app_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/app_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/res/mipmap-xhdpi/app_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/app_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/res/mipmap-xxhdpi/app_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/app_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/music4kid/Data-Driven-Architecture-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/app_launcher.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/DalBase.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/3.
5 | */
6 | public class DalBase {
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/IDalBase.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/5.
5 | */
6 | public interface IDalBase {
7 | }
8 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/ServiceBase.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/3.
5 | */
6 | public class ServiceBase {
7 | void clearCache(){}
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedDetail/IFeedDetailBO.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedDetail;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/11.
5 | */
6 | public interface IFeedDetailBO {
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 21 11:34:03 PDT 2015
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/BaseDataHandler.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by gaofeng on 16/3/2.
7 | */
8 | public class BaseDataHandler {
9 | public Context mContext;
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedStream/IFeedStreamBO.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedStream;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/2.
5 | */
6 | public interface IFeedStreamBO {
7 | void loadFeedsFromServer();
8 | void gotoFeedDetail(Long feedItemId);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/cache/FeedStreamServiceCache.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.cache;
2 |
3 | import com.mrpeak.trimdata.service.imp.FeedStreamServiceImp;
4 |
5 | /**
6 | * Created by gaofeng on 16/3/2.
7 | */
8 | public class FeedStreamServiceCache extends FeedStreamServiceImp {
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/network/PPHttpRequestDelegate.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.network;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/3.
5 | */
6 | public interface PPHttpRequestDelegate {
7 | void onRequestSuccess(PPHttpRequest req, int code);
8 | void onRequestFail(String msg);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/rawModel/RawModelBase.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal.rawModel;
2 |
3 | import com.activeandroid.Model;
4 |
5 | /**
6 | * Created by gaofeng on 16/3/6.
7 | */
8 | public abstract class RawModelBase extends Model {
9 | public abstract void saveEntity();
10 |
11 | public RawModelBase() {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.idea/libraries/jsr305_1_3_9.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Trim
3 | Settings
4 |
5 |
6 | Hello blank fragment
7 | FeedDetailActivity
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/BaseBusinessObject.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 | import android.content.Context;
4 |
5 | import rx.subscriptions.CompositeSubscription;
6 |
7 | /**
8 | * Created by gaofeng on 16/3/2.
9 | */
10 | public class BaseBusinessObject {
11 | public Object dh;
12 | public Context mContext;
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/IFeedStreamService.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service;
2 |
3 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
4 | import com.mrpeak.trimdata.service.network.PPHttpRequestDelegate;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by gaofeng on 16/3/2.
11 | */
12 | public interface IFeedStreamService {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 8dp
4 |
5 | 16dp
6 | 16dp
7 | 16dp
8 |
9 |
--------------------------------------------------------------------------------
/app/src/test/java/com/mrpeak/trimdata/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/mrpeak/trimdata/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/DalModule.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 | import com.google.inject.AbstractModule;
4 | import com.mrpeak.trimdata.dal.imp.GitHubRepoDalImp;
5 |
6 | /**
7 | * Created by gaofeng on 16/3/5.
8 | */
9 | public class DalModule extends AbstractModule {
10 | @Override
11 | protected void configure() {
12 | bind(IGitHubRepoDal.class).to(GitHubRepoDalImp.class);
13 | }
14 |
15 | public DalModule() {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/IGitHubRepoDal.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/5.
10 | */
11 | public interface IGitHubRepoDal extends IDalBase {
12 | void insertOrUpdateGitHubRepo(GitHubRepository repo);
13 | GitHubRepository getRepoById(Long repoId);
14 | List loadAll();
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedStream/IFeedStreamDH.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedStream;
2 |
3 | import com.mrpeak.trimdata.application.feed.feedStream.model.FeedItem;
4 |
5 | import java.util.ArrayList;
6 |
7 | /**
8 | * Created by gaofeng on 16/3/2.
9 | */
10 | public interface IFeedStreamDH {
11 | ArrayList getmItems();
12 | void setmItems(ArrayList items);
13 | void addItem(T item);
14 | }
15 |
--------------------------------------------------------------------------------
/.idea/libraries/junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 |
28 | # Android Studio Navigation editor temp files
29 | .navigation/
30 |
31 | # Android Studio captures folder
32 | captures/
33 |
--------------------------------------------------------------------------------
/.idea/libraries/okio_1_6_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/gson_2_6_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/rxjava_1_1_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import roboguice.RoboGuice;
7 | import roboguice.activity.RoboActivity;
8 |
9 | public class BaseActivity extends RoboActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 |
15 | RoboGuice.setUseAnnotationDatabases(false);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedDetail/FeedDetailBO.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedDetail;
2 |
3 | import android.content.Context;
4 |
5 | import com.google.inject.Inject;
6 | import com.mrpeak.trimdata.application.common.BaseBusinessObject;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/11.
10 | */
11 | public class FeedDetailBO extends BaseBusinessObject implements IFeedDetailBO {
12 |
13 | @Inject
14 | public FeedDetailBO(Context mContext) {
15 | this.mContext = mContext;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.idea/libraries/okhttp_3_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/roboguice_3_0_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/hamcrest_core_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/network/github/GitHubRequestProvider.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.network.github;
2 |
3 | import com.mrpeak.trimdata.service.network.retrofitModel.RfRepository;
4 |
5 | import java.util.List;
6 |
7 | import retrofit2.Call;
8 | import retrofit2.http.GET;
9 | import retrofit2.http.Path;
10 |
11 | /**
12 | * Created by gaofeng on 16/3/4.
13 | */
14 | public interface GitHubRequestProvider {
15 | @GET("users/{username}/repos?type=owner")
16 | Call> userReposList(@Path("username") String username);
17 | }
18 |
--------------------------------------------------------------------------------
/.idea/libraries/support_annotations_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedStream/view/FeedItemVH.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedStream.view;
2 |
3 | import android.view.View;
4 |
5 | import com.mrpeak.trimdata.application.common.BaseViewHolder;
6 | import com.mrpeak.trimdata.application.feed.feedStream.model.*;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/2.
10 | */
11 | public class FeedItemVH extends BaseViewHolder {
12 |
13 |
14 | public FeedItemVH(View itemView) {
15 | super(itemView);
16 | }
17 | public void bindFeedItem(FeedItem item) {
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/.idea/libraries/retrofit_2_0_0_beta4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_setting_list.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/libraries/design_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/libraries/rxandroid_1_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/imp/FeedStreamServiceImp.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.imp;
2 |
3 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
4 | import com.mrpeak.trimdata.service.IFeedStreamService;
5 | import com.mrpeak.trimdata.service.ServiceBase;
6 | import com.mrpeak.trimdata.service.network.PPHttpRequestDelegate;
7 | import com.mrpeak.trimdata.service.network.github.GitHubRepositoryListRequest;
8 |
9 | import java.util.ArrayList;
10 |
11 | /**
12 | * Created by gaofeng on 16/3/2.
13 | */
14 | public class FeedStreamServiceImp extends ServiceBase implements IFeedStreamService {
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/.idea/libraries/activeandroid_3_1_0_SNAPSHOT.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/converter_gson_2_0_0_beta4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/test/GitHubServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.test;
2 |
3 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
4 | import com.mrpeak.trimdata.service.cache.GitHubServiceCache;
5 |
6 | import java.util.ArrayList;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/11.
10 | */
11 |
12 | public class GitHubServiceTest extends GitHubServiceCache {
13 | @Override
14 | public ArrayList loadAllRepositories() {
15 | ArrayList repos = super.loadAllRepositories();
16 | //run some tests here...
17 | return repos;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/appcompat_v7_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedDetail/IFeedDetailDH.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedDetail;
2 |
3 | import com.mrpeak.trimdata.application.feed.feedDetail.model.FeedDetailGitHubRepo;
4 | import com.mrpeak.trimdata.application.feed.feedStream.model.FeedItem;
5 | import com.mrpeak.trimdata.application.feed.feedStream.model.FeedItemGitHubRepo;
6 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/11.
10 | */
11 | public interface IFeedDetailDH {
12 | void setFeedDetailItem(FeedDetailGitHubRepo repo);
13 | FeedDetailGitHubRepo getFeedDetailItem();
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/IGitHubService.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service;
2 |
3 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
4 | import com.mrpeak.trimdata.service.network.PPHttpRequestDelegate;
5 |
6 | import java.util.ArrayList;
7 |
8 | /**
9 | * Created by gaofeng on 16/3/4.
10 | */
11 | public interface IGitHubService {
12 | public ArrayList loadAllRepositories();
13 | public void loadAllRepositoriesFromServer(PPHttpRequestDelegate delegate);
14 |
15 | public GitHubRepository getRepositoryById(Long repoId);
16 | public void updateOrInsertRepository(GitHubRepository repo);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/.idea/libraries/recyclerview_v7_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 | 64dp
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/test/FeedStreamServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service.test;
2 |
3 | import com.mrpeak.trimdata.dal.EventSource;
4 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
5 | import com.mrpeak.trimdata.service.ServiceFactory;
6 | import com.mrpeak.trimdata.service.cache.FeedStreamServiceCache;
7 | import com.mrpeak.trimdata.service.network.PPHttpRequestDelegate;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Collections;
11 | import java.util.List;
12 | import java.util.concurrent.TimeUnit;
13 |
14 | /**
15 | * Created by gaofeng on 16/3/2.
16 | */
17 | public class FeedStreamServiceTest extends FeedStreamServiceCache {
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/support_vector_drawable_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/libraries/animated_vector_drawable_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedDetail/model/FeedDetail.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedDetail.model;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/11.
5 | */
6 | public class FeedDetail {
7 | public static final int FeedItemNormal = 0;
8 | public static final int FeedItemGitHubRepo = 1;
9 | public static final int FeedItemUnknown = 1000;
10 |
11 | private int itemType;
12 | private Long itemId;
13 |
14 | public FeedDetail(int itemType, Long itemId) {
15 | this.itemType = itemType;
16 | this.itemId = itemId;
17 | }
18 |
19 | public int getItemType() {
20 | return itemType;
21 | }
22 |
23 | public Long getItemId() {
24 | return itemId;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/libraries/support_v4_23_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/ServiceModule.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service;
2 |
3 | import com.google.inject.AbstractModule;
4 | import com.mrpeak.trimdata.service.cache.GitHubServiceCache;
5 | import com.mrpeak.trimdata.service.imp.FeedStreamServiceImp;
6 | import com.mrpeak.trimdata.service.imp.GitHubServiceImp;
7 | import com.mrpeak.trimdata.service.test.FeedStreamServiceTest;
8 |
9 | /**
10 | * Created by gaofeng on 16/3/2.
11 | */
12 | public class ServiceModule extends AbstractModule {
13 |
14 | @Override
15 | protected void configure() {
16 | bind(IFeedStreamService.class).to(FeedStreamServiceImp.class);
17 | bind(IGitHubService.class).to(GitHubServiceCache.class);
18 | }
19 |
20 | public ServiceModule() {
21 |
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/BaseViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by gaofeng on 16/3/2.
8 | */
9 | public class BaseViewHolder extends RecyclerView.ViewHolder {
10 | public Object bo = null;
11 |
12 | public BaseViewHolder(View itemView) {
13 | super(itemView);
14 |
15 | itemView.setOnClickListener(new View.OnClickListener() {
16 | @Override
17 | public void onClick(View v) {
18 | onViewHolderClick();
19 | }
20 | });
21 | }
22 |
23 | public void onDetachFromWindow() {
24 | }
25 | public void onAttachToWindow() {
26 | }
27 | public void onViewHolderClick() {
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedStream/model/FeedItem.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedStream.model;
2 |
3 | /**
4 | * Created by gaofeng on 16/3/1.
5 | */
6 |
7 |
8 | public class FeedItem {
9 | public static final int FeedItemNormal = 0;
10 | public static final int FeedItemGitHubRepo = 1;
11 | public static final int FeedItemUnknown = 1000;
12 |
13 | private int itemType;
14 | private Long itemId;
15 | private int displayHeight;
16 |
17 | public FeedItem(int itemType, Long itemId) {
18 | this.itemType = itemType;
19 | this.itemId = itemId;
20 | }
21 |
22 | public int getItemType() {
23 | return itemType;
24 | }
25 |
26 | public Long getItemId() {
27 | return itemId;
28 | }
29 |
30 | public int getDisplayHeight() {
31 | return displayHeight;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/EventSource.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 |
4 | import com.mrpeak.trimdata.dal.rawModel.GitHubRepository;
5 |
6 | import java.util.ArrayList;
7 |
8 | import rx.Observable;
9 | import rx.Subscriber;
10 | import rx.subjects.PublishSubject;
11 |
12 | /**
13 | * Created by gaofeng on 16/3/3.
14 | */
15 |
16 |
17 | public class EventSource {
18 | private static EventSource ourInstance = new EventSource();
19 | public static EventSource getInstance() {
20 | return ourInstance;
21 | }
22 |
23 | private EventSource() {
24 | githubEvent = new DataEvent<>();
25 | }
26 |
27 | public DataEvent githubEvent;
28 |
29 | public class DataEvent {
30 | public PublishSubject insert = PublishSubject.create();
31 | public PublishSubject delete = PublishSubject.create();
32 | public PublishSubject update = PublishSubject.create();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/TrimData.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedDetail/FeedDetailDH.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedDetail;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.IntDef;
5 |
6 | import com.google.inject.Inject;
7 | import com.mrpeak.trimdata.application.common.BaseDataHandler;
8 | import com.mrpeak.trimdata.application.feed.feedDetail.model.FeedDetailGitHubRepo;
9 | import com.mrpeak.trimdata.application.feed.feedStream.model.FeedItemGitHubRepo;
10 |
11 | /**
12 | * Created by gaofeng on 16/3/11.
13 | */
14 | public class FeedDetailDH extends BaseDataHandler implements IFeedDetailDH {
15 | private FeedDetailGitHubRepo mRepo;
16 |
17 | @Inject
18 | public FeedDetailDH(Context context) {
19 | mContext = context;
20 | }
21 |
22 | @Override
23 | public void setFeedDetailItem(FeedDetailGitHubRepo repo) {
24 | mRepo = repo;
25 | }
26 |
27 | @Override
28 | public FeedDetailGitHubRepo getFeedDetailItem() {
29 | return mRepo;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Data-Driven-Architecture-Android.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | import com.mrpeak.trimdata.R;
12 |
13 | import roboguice.fragment.RoboFragment;
14 | import rx.subscriptions.CompositeSubscription;
15 |
16 | /**
17 | * A simple {@link Fragment} subclass.
18 | */
19 | public class BaseFragment extends RoboFragment {
20 |
21 | public BaseFragment() {
22 | }
23 |
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
26 | Bundle savedInstanceState) {
27 | TextView textView = new TextView(getActivity());
28 | textView.setText(R.string.hello_blank_fragment);
29 | return textView;
30 | }
31 |
32 | @Override
33 | public void onDestroy() {
34 | super.onDestroy();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_itemlist_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/common/MyRoboFragment.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.common;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.annotation.CallSuper;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | import com.mrpeak.trimdata.R;
13 |
14 | import roboguice.RoboGuice;
15 |
16 | /**
17 | * A simple {@link Fragment} subclass.
18 | */
19 | public class MyRoboFragment extends Fragment {
20 |
21 | @Override
22 | @CallSuper
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | RoboGuice.getInjector(getActivity()).injectMembersWithoutViews(this);
26 | }
27 |
28 | @Override
29 | @CallSuper
30 | public void onViewCreated(View view, Bundle savedInstanceState) {
31 | super.onViewCreated(view, savedInstanceState);
32 | RoboGuice.getInjector(getActivity()).injectViewMembers(this);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/dal/DalFactory.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.dal;
2 |
3 | import android.app.Application;
4 | import android.database.sqlite.SQLiteDatabase;
5 |
6 | import com.activeandroid.*;
7 | import com.google.inject.Guice;
8 | import com.google.inject.Inject;
9 | import com.google.inject.Injector;
10 |
11 | /**
12 | * Created by gaofeng on 16/2/29.
13 | */
14 | public class DalFactory {
15 | private static DalFactory ourInstance = null;
16 | static {
17 | Injector injector = Guice.createInjector(new DalModule());
18 | ourInstance = injector.getInstance(DalFactory.class);
19 | }
20 | public static DalFactory getInstance() {
21 | return ourInstance;
22 | }
23 |
24 |
25 | private SQLiteDatabase db;
26 |
27 | @Inject
28 | public IGitHubRepoDal gitHubRepoDal;
29 |
30 | public void initDB(Application application) {
31 | ActiveAndroid.initialize(application);
32 | Configuration dbConfiguration = new Configuration.Builder(application).setDatabaseName("trim.db").create();
33 | ActiveAndroid.initialize(dbConfiguration);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 gao feng
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/application/feed/feedStream/FeedStreamDH.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.application.feed.feedStream;
2 |
3 | import android.content.Context;
4 |
5 | import com.google.inject.Inject;
6 | import com.mrpeak.trimdata.application.common.BaseDataHandler;
7 | import com.mrpeak.trimdata.application.feed.feedStream.model.FeedItem;
8 |
9 | import java.util.ArrayList;
10 |
11 | /**
12 | * Created by gaofeng on 16/2/29.
13 | */
14 | public class FeedStreamDH extends BaseDataHandler implements IFeedStreamDH {
15 | private final Context context;
16 |
17 | private ArrayList mItems = new ArrayList<>();
18 |
19 | @Inject
20 | public FeedStreamDH(final Context context) {
21 | this.context = context;
22 | }
23 |
24 | public ArrayList getmItems() {
25 | return mItems;
26 | }
27 | public void setmItems(ArrayList items) {
28 | this.mItems.clear();
29 | for (FeedItem item : items) {
30 | this.mItems.add(item);
31 | }
32 | }
33 |
34 | public void addItem(T item) {
35 | this.mItems.add(item);
36 | }
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_itemlist_github_repo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/core/TrimApplication.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.core;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import android.content.res.Configuration;
6 |
7 | import com.mrpeak.trimdata.service.ServiceFactory;
8 |
9 | /**
10 | * Created by gaofeng on 16/3/5.
11 | */
12 | public class TrimApplication extends Application {
13 | private static Context context;
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 |
19 | TrimApplication.context = getApplicationContext();
20 |
21 | ServiceFactory.getInstance().initEnv(this);
22 | }
23 |
24 | public static Context getAppContext() {
25 | return TrimApplication.context;
26 | }
27 |
28 | @Override
29 | public void onTerminate() {
30 | super.onTerminate();
31 | }
32 |
33 | @Override
34 | public void onConfigurationChanged(Configuration newConfig) {
35 | super.onConfigurationChanged(newConfig);
36 | }
37 |
38 | @Override
39 | public void onLowMemory() {
40 | super.onLowMemory();
41 | }
42 |
43 | @Override
44 | public void onTrimMemory(int level) {
45 | super.onTrimMemory(level);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_feed_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/trimdata/service/ServiceFactory.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.trimdata.service;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import com.google.inject.Guice;
7 | import com.google.inject.Inject;
8 | import com.google.inject.Injector;
9 | import com.mrpeak.trimdata.dal.DalFactory;
10 |
11 | import java.util.concurrent.Executors;
12 | import java.util.concurrent.ScheduledExecutorService;
13 |
14 | /**
15 | * Created by gaofeng on 16/2/29.
16 | */
17 | public class ServiceFactory {
18 | private static ServiceFactory ourInstance = null;
19 | static {
20 | Injector injector = Guice.createInjector(new ServiceModule());
21 | ourInstance = injector.getInstance(ServiceFactory.class);
22 | }
23 | public static ServiceFactory getInstance() {
24 | return ourInstance;
25 | }
26 |
27 | public static final ScheduledExecutorService serviceExecutor = Executors.newSingleThreadScheduledExecutor();
28 |
29 | @Inject
30 | public IFeedStreamService feedStreamService;
31 | @Inject
32 | public IGitHubService gitHubService;
33 |
34 |
35 | public void initEnv(Application application) {
36 | DalFactory.getInstance().initDB(application);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrpeak/ppkit/android/ObservableUtil.java:
--------------------------------------------------------------------------------
1 | package com.mrpeak.ppkit.android;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 |
6 | import rx.Observable;
7 | import rx.Subscription;
8 | import rx.android.schedulers.AndroidSchedulers;
9 | import rx.functions.Action1;
10 |
11 | /**
12 | * Created by gaofeng on 16/3/3.
13 | */
14 | public class ObservableUtil {
15 | private static HashMap