├── app
├── .gitignore
├── gif
│ ├── room.gif
│ ├── splash.gif
│ └── rxjava2.gif
├── 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
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_splash.xml
│ │ │ │ ├── activity_timing.xml
│ │ │ │ ├── activity_lastknown_location.xml
│ │ │ │ ├── repo_item.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_networking.xml
│ │ │ │ ├── activity_rx_downloader.xml
│ │ │ │ ├── item.xml
│ │ │ │ └── activity_room_playground.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── mahmoud
│ │ │ │ ├── networking
│ │ │ │ ├── state
│ │ │ │ │ ├── RequestState.java
│ │ │ │ │ └── ApiRequest.java
│ │ │ │ ├── endpoint
│ │ │ │ │ └── GithubReposApi.java
│ │ │ │ ├── model
│ │ │ │ │ └── Repo.java
│ │ │ │ ├── ApiClient.java
│ │ │ │ ├── adapter
│ │ │ │ │ └── RepoAdapter.java
│ │ │ │ ├── NetworkingActivity.java
│ │ │ │ └── NetworkingRequestState.java
│ │ │ │ ├── caching
│ │ │ │ ├── datasource
│ │ │ │ │ ├── UserDataSource.java
│ │ │ │ │ └── LocalUserDataSource.java
│ │ │ │ ├── Converters.java
│ │ │ │ ├── Injection.java
│ │ │ │ ├── dao
│ │ │ │ │ └── UserDao.java
│ │ │ │ ├── ViewModelFactory.java
│ │ │ │ ├── AppDB.java
│ │ │ │ ├── entity
│ │ │ │ │ ├── Task.java
│ │ │ │ │ ├── Reminder.java
│ │ │ │ │ └── User.java
│ │ │ │ ├── UserViewModel.java
│ │ │ │ └── RoomPlayground.java
│ │ │ │ ├── samples
│ │ │ │ ├── AppInfo.java
│ │ │ │ ├── Utils.java
│ │ │ │ ├── AppsAdapter.java
│ │ │ │ ├── secondexample
│ │ │ │ │ └── FormOperatorSample.java
│ │ │ │ ├── firstexample
│ │ │ │ │ └── MainActivity.java
│ │ │ │ ├── thirdexample
│ │ │ │ │ └── FilterOPeratorSample.java
│ │ │ │ ├── sixthexample
│ │ │ │ │ └── FirstOperatorSample.java
│ │ │ │ ├── fouthexample
│ │ │ │ │ └── TakeOperatorSample.java
│ │ │ │ ├── eighthexample
│ │ │ │ │ └── MapOPeratorSample.java
│ │ │ │ ├── seventhexample
│ │ │ │ │ └── SkipOperatorSample.java
│ │ │ │ ├── ninthexample
│ │ │ │ │ └── ScanOPeratorSample.java
│ │ │ │ ├── fivethexample
│ │ │ │ │ └── DistinctOperatorSample.java
│ │ │ │ └── AppRichInfo.java
│ │ │ │ ├── timing
│ │ │ │ ├── SplashScreen.java
│ │ │ │ └── TimingActivity.java
│ │ │ │ └── location
│ │ │ │ └── LastKnownLocationActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── mahmoud
│ │ │ └── samples
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── mahmoud
│ │ └── samples
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── .idea
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── contributing.md
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/gif/room.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/gif/room.gif
--------------------------------------------------------------------------------
/app/gif/splash.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/gif/splash.gif
--------------------------------------------------------------------------------
/app/gif/rxjava2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/gif/rxjava2.gif
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrabelwahed/RxjavaSamples/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/networking/state/RequestState.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.networking.state;
2 |
3 | /**
4 | * Created by mahmoud on 21/03/18.
5 | */
6 |
7 | public enum RequestState {
8 | IDLE,LOADING,COMPLETED,ERROR;
9 | }
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Mar 08 10:57:56 EET 2018
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/datasource/UserDataSource.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching.datasource;
2 |
3 | import com.example.mahmoud.caching.entity.User;
4 |
5 | import io.reactivex.Flowable;
6 |
7 | /**
8 | * Created by mahmoud on 04/04/18.
9 | */
10 |
11 | public interface UserDataSource {
12 | Flowable getUser();
13 |
14 | void insertOrUpdate(User user);
15 |
16 | void deleteAllUsers();
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RxSamples
3 | Location Permission
4 | OK
5 | NO Location Detected
6 | App need this permission to get current location
7 | Settings
8 | Update user
9 |
10 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/mahmoud/samples/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.samples;
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 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/networking/endpoint/GithubReposApi.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.networking.endpoint;
2 |
3 | import com.example.mahmoud.networking.model.Repo;
4 |
5 | import java.util.List;
6 |
7 | import io.reactivex.Observable;
8 | import retrofit2.http.GET;
9 | import retrofit2.http.Path;
10 |
11 | /**
12 | * Created by Mahmoud Ramadan on 12/23/17.
13 | */
14 |
15 | public interface GithubReposApi {
16 | @GET("users/{user}/repos")
17 | Observable> getUserRepos(@Path("user") String username);
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/Converters.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching;
2 |
3 | import android.arch.persistence.room.TypeConverter;
4 |
5 | import java.util.Date;
6 |
7 | /**
8 | * Created by mahmoud on 27/03/18.
9 | */
10 |
11 | public class Converters {
12 |
13 | @TypeConverter
14 | public static Long fromDateToTimeStamp(Date date){
15 | return date==null? null:date.getTime();
16 | }
17 |
18 |
19 | @TypeConverter
20 | public static Date fromTimeToDate(Long time){
21 | return time==null? null: new Date(time);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/networking/model/Repo.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.networking.model;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | /**
6 | * Created by mahmoud on 20/03/18.
7 | */
8 |
9 |
10 | public class Repo{
11 | @SerializedName("id")
12 | private String id;
13 | @SerializedName("name")
14 | private String name;
15 |
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | public void setId(String id) {
21 | this.id = id;
22 | }
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_timing.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/Injection.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching;
2 |
3 | import android.content.Context;
4 |
5 | import com.example.mahmoud.caching.datasource.LocalUserDataSource;
6 | import com.example.mahmoud.caching.datasource.UserDataSource;
7 |
8 | /**
9 | * Created by mahmoud on 04/04/18.
10 | */
11 |
12 | public class Injection {
13 | public static UserDataSource provideUserDataSource(Context context){
14 | AppDB appDB = AppDB.getInstance(context);
15 | return new LocalUserDataSource(appDB.userDao());
16 | }
17 |
18 | public static ViewModelFactory provideViewModelFactory(Context context){
19 | UserDataSource userDataSource = provideUserDataSource(context);
20 | return new ViewModelFactory(userDataSource);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_lastknown_location.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/repo_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/datasource/LocalUserDataSource.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching.datasource;
2 |
3 | import com.example.mahmoud.caching.dao.UserDao;
4 | import com.example.mahmoud.caching.entity.User;
5 |
6 | import io.reactivex.Flowable;
7 |
8 | /**
9 | * Created by mahmoud on 04/04/18.
10 | */
11 |
12 | public class LocalUserDataSource implements UserDataSource {
13 | private final UserDao userDao;
14 |
15 | public LocalUserDataSource(UserDao userDao) {
16 | this.userDao = userDao;
17 | }
18 |
19 | @Override
20 | public Flowable getUser() {
21 | return userDao.getUser();
22 | }
23 |
24 | @Override
25 | public void insertOrUpdate(User user) {
26 | userDao.insert(user);
27 | }
28 |
29 | @Override
30 | public void deleteAllUsers() {
31 | userDao.deleteAllUsers();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching.dao;
2 |
3 | import android.arch.persistence.room.Dao;
4 | import android.arch.persistence.room.Insert;
5 | import android.arch.persistence.room.OnConflictStrategy;
6 | import android.arch.persistence.room.Query;
7 | import android.arch.persistence.room.Update;
8 |
9 | import com.example.mahmoud.caching.entity.User;
10 |
11 | import io.reactivex.Flowable;
12 |
13 | /**
14 | * Created by mahmoud on 27/03/18.
15 | */
16 |
17 | @Dao
18 | public interface UserDao {
19 | @Insert(onConflict = OnConflictStrategy.REPLACE)
20 | void insert(User user);
21 |
22 | @Query("DELETE FROM Users")
23 | void deleteAllUsers();
24 |
25 | @Update(onConflict = OnConflictStrategy.REPLACE)
26 | void update(User user);
27 |
28 | @Query("SELECT * FROM Users LIMIT 1")
29 | Flowable getUser();
30 |
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/mahmoud/samples/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.samples;
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.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
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("com.example.mahmoud.rxinstalledapps", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/ViewModelFactory.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching;
2 |
3 | import android.arch.lifecycle.ViewModel;
4 | import android.arch.lifecycle.ViewModelProvider;
5 | import android.support.annotation.NonNull;
6 |
7 | import com.example.mahmoud.caching.datasource.UserDataSource;
8 |
9 | /**
10 | * Created by mahmoud on 04/04/18.
11 | */
12 |
13 | public class ViewModelFactory implements ViewModelProvider.Factory {
14 | private final UserDataSource mDataSource;
15 |
16 | public ViewModelFactory(UserDataSource dataSource){
17 | mDataSource = dataSource;
18 | }
19 |
20 | @NonNull
21 | @Override
22 | public T create(@NonNull Class modelClass) {
23 | if (modelClass.isAssignableFrom(UserViewModel.class)){
24 | return (T) new UserViewModel(mDataSource);
25 | }
26 | throw new IllegalArgumentException("unknown view model");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_networking.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_rx_downloader.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributor Guidelines
2 |
3 | We welcome contributions from other developers to help us make the Repo even better.
4 | Before you contribute there are a number of things that you should know.
5 |
6 | Firstly, please familiarise yourself with the [Github Contribution flow](https://guides.github.com/introduction/flow/).
7 |
8 | 1. Create a new issue for the feature
9 | 2. Fork the project
10 | 3. Create a branch
11 | 4. Add commits
12 | 5. Open a pull request
13 | 6. Code review
14 | 7. Merge with master
15 |
16 | Every feature should follow this procedure.
17 |
18 | At this point you're waiting on us. We like to at least comment on, if not accept, pull requests within three business days (and, typically, one business day). We may suggest some changes or improvements or alternatives.
19 |
20 | Some things that will increase the chance that your pull request is accepted, taken straight from community guidelines and best practices:
21 |
22 | # Syntax:
23 |
24 | Two spaces, no tabs.
25 | No trailing whitespace.
26 | Blank lines should not have any space.
27 | Follow the conventions you see used in the source already.
28 | And in case we didn't emphasize it enough: we love tests!
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/caching/AppDB.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.caching;
2 |
3 | import android.arch.persistence.room.Database;
4 | import android.arch.persistence.room.Room;
5 | import android.arch.persistence.room.RoomDatabase;
6 | import android.content.Context;
7 |
8 | import com.example.mahmoud.caching.dao.UserDao;
9 | import com.example.mahmoud.caching.entity.User;
10 |
11 | /**
12 | * Created by mahmoud on 27/03/18.
13 | */
14 |
15 | @Database(entities = {User.class}, version = 1)
16 | public abstract class AppDB extends RoomDatabase {
17 |
18 | private static final String DATABASE_NAME = "sample.db";
19 | private static volatile AppDB INSTANCE;
20 |
21 | public static AppDB getInstance(Context context){
22 | if (INSTANCE == null){
23 | synchronized (AppDB.class){
24 | if (INSTANCE == null) {
25 | INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
26 | AppDB.class, DATABASE_NAME)
27 | .build();
28 | }
29 | }
30 |
31 | }
32 | return INSTANCE;
33 | }
34 |
35 | public abstract UserDao userDao();
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/mahmoud/samples/AppInfo.java:
--------------------------------------------------------------------------------
1 | package com.example.mahmoud.samples;
2 |
3 | import android.support.annotation.NonNull;
4 |
5 | /**
6 | * Created by mahmoud on 08/03/18.
7 | */
8 |
9 | public class AppInfo implements Comparable