├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── 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 │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── ic_profile.xml │ │ │ │ ├── ic_login.xml │ │ │ │ ├── ic_register.xml │ │ │ │ ├── ic_logout.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── menu │ │ │ │ └── navigation.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── ir │ │ │ │ └── oveissi │ │ │ │ └── androidmodularization │ │ │ │ ├── MainActivityComponent.java │ │ │ │ ├── BaseApplication.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── androidmodularization │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── ir │ │ └── oveissi │ │ └── androidmodularization │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── core ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ └── colors.xml │ │ │ └── layout │ │ │ │ └── toolbar.xml │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── core │ │ │ ├── navigation │ │ │ ├── HasNavigatorManager.java │ │ │ ├── SearchEntryPoint.java │ │ │ ├── MainEntryPoint.java │ │ │ ├── EntryPointHolder.java │ │ │ ├── AuthEntryPoint.java │ │ │ ├── NavigationManager.java │ │ │ └── Navigator.java │ │ │ ├── utils │ │ │ └── Constants.java │ │ │ ├── bases │ │ │ ├── AppComponentHolder.java │ │ │ ├── BaseFragment.java │ │ │ └── BaseActivity.java │ │ │ ├── pojo │ │ │ ├── Pagination.java │ │ │ ├── RegisterBody.java │ │ │ ├── Token.java │ │ │ ├── Metadata.java │ │ │ ├── Register.java │ │ │ ├── UserInfo.java │ │ │ └── Movie.java │ │ │ ├── di │ │ │ ├── AcitvityScope.java │ │ │ ├── FragmentScope.java │ │ │ ├── ActivityContext.java │ │ │ ├── UserManagerProvider.java │ │ │ ├── AppComponent.java │ │ │ ├── AndroidModule.java │ │ │ └── NavigationProvider.java │ │ │ ├── BaseApplication.java │ │ │ ├── user │ │ │ ├── User.java │ │ │ └── UserManager.java │ │ │ ├── network │ │ │ ├── TokenInterceptor.java │ │ │ ├── ApiInterface.java │ │ │ ├── ApiModule.java │ │ │ ├── ClientModule.java │ │ │ └── TokenAuthenticator.java │ │ │ └── local │ │ │ └── SettingsManager.java │ ├── test │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── core │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── ir │ │ └── oveissi │ │ └── core │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── main ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ └── ic_search.xml │ │ │ └── layout │ │ │ │ ├── fragment_movies.xml │ │ │ │ ├── fragment_movie_detail.xml │ │ │ │ └── row_movie.xml │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── main │ │ │ ├── MainEntryPointImpl.java │ │ │ ├── MoviesComponent.java │ │ │ ├── MovieDetailComponent.java │ │ │ ├── MoviesAdapter.java │ │ │ ├── EndlessLinearLayoutRecyclerview.java │ │ │ ├── MovieDetailFragment.java │ │ │ └── MoviesFragment.java │ ├── test │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── main │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── ir │ │ └── oveissi │ │ └── main │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── search ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ └── ic_search.xml │ │ │ └── layout │ │ │ │ ├── row_suggestion.xml │ │ │ │ └── fragment_movie_search.xml │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── search │ │ │ ├── SearchEntryPointImpl.java │ │ │ ├── db │ │ │ ├── AppDatabase.java │ │ │ ├── AppDatabaseSingleton.java │ │ │ ├── SuggestionDAO.java │ │ │ └── Suggestion.java │ │ │ ├── MovieSearchComponent.java │ │ │ ├── MovieSearchAdapter.java │ │ │ ├── EndlessLinearLayoutRecyclerview.java │ │ │ └── MovieSearchFragment.java │ ├── test │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── search │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── ir │ │ └── oveissi │ │ └── search │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── authentication ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ ├── activity_auth_main.xml │ │ │ │ ├── fragment_auth_register.xml │ │ │ │ └── fragment_auth_login.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── authentication │ │ │ ├── di │ │ │ ├── FragmentSubcomponent.java │ │ │ └── AuthComponent.java │ │ │ ├── AuthNavigator.java │ │ │ ├── AuthMainActivity.java │ │ │ ├── RegisterFragment.java │ │ │ └── LoginFragment.java │ ├── test │ │ └── java │ │ │ └── ir │ │ │ └── oveissi │ │ │ └── authentication │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── ir │ │ └── oveissi │ │ └── authentication │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── gradle.properties ├── gradlew.bat ├── libraries.gradle ├── gradlew └── .gitignore /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /main/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /search/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /authentication/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /core/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /main/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /search/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':core', ':main', ':search', ':authentication' 2 | -------------------------------------------------------------------------------- /main/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | main 3 | 4 | -------------------------------------------------------------------------------- /search/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | search 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android Modularization 3 | 4 | -------------------------------------------------------------------------------- /authentication/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | authentication 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /core/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | core 3 | core 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbas-oveissi/AndroidModularization/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/abbas-oveissi/AndroidModularization/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/abbas-oveissi/AndroidModularization/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/abbas-oveissi/AndroidModularization/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/abbas-oveissi/AndroidModularization/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/navigation/HasNavigatorManager.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.navigation; 2 | 3 | public interface HasNavigatorManager { 4 | Navigator provideNavigator(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.utils; 2 | 3 | public class Constants { 4 | public static final String BASE_URL = "http://moviesapi.ir"; 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/navigation/SearchEntryPoint.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.navigation; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | public interface SearchEntryPoint { 6 | Fragment openMain(); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/bases/AppComponentHolder.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.bases; 2 | 3 | 4 | import ir.oveissi.core.di.AppComponent; 5 | 6 | public interface AppComponentHolder { 7 | AppComponent getAppComponent(); 8 | } 9 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/navigation/MainEntryPoint.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.navigation; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | public interface MainEntryPoint { 6 | Fragment openMain(String query); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/navigation/EntryPointHolder.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.navigation; 2 | 3 | public interface EntryPointHolder { 4 | SearchEntryPoint getSearchEntryPoint(); 5 | 6 | MainEntryPoint getMainEntryPoint(); 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /core/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/Pagination.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Pagination { 7 | public List data = new ArrayList<>(); 8 | public Metadata metadata; 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/RegisterBody.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by Abbas on 25/05/2016. 5 | */ 6 | public class RegisterBody { 7 | public String email; 8 | public String password; 9 | public String name; 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 10 16:38:32 IRDT 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.4-all.zip 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Modularizing Android application - WIP 2 | 3 | This project is an example of modular app. It is an ongoing project and it's gonna modified by time. 4 | 5 | you can find out more information in persian in the links below: 6 | 7 | [link 1](http://abbas.oveissi.ir/2018/08/22/android-modularization/) 8 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/bases/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.bases; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | 6 | public class BaseFragment extends Fragment { 7 | 8 | @Override 9 | public void onStart() { 10 | super.onStart(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/navigation/AuthEntryPoint.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.navigation; 2 | 3 | import android.content.Intent; 4 | import android.support.v4.app.Fragment; 5 | 6 | public interface AuthEntryPoint { 7 | 8 | Intent openMain(); 9 | 10 | Fragment openFrag3(); 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/AcitvityScope.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Scope 10 | public @interface AcitvityScope { 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/FragmentScope.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Scope 10 | public @interface FragmentScope { 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/Token.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by Abbas on 25/05/2016. 5 | */ 6 | public class Token { 7 | public String token_type; 8 | public String access_token; 9 | public String refresh_token; 10 | public Integer expires_in; 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/Metadata.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by abbas on 3/12/17. 5 | */ 6 | 7 | public class Metadata { 8 | public Integer current_page; 9 | public Integer per_page; 10 | public Integer page_count; 11 | public Integer total_count; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/Register.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by Abbas on 25/05/2016. 5 | */ 6 | public class Register { 7 | public String email; 8 | public String updated_at; 9 | public String created_at; 10 | public Integer id; 11 | public String name; 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/UserInfo.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by Abbas on 25/05/2016. 5 | */ 6 | public class UserInfo { 7 | public String name; 8 | public String email; 9 | public String updated_at; 10 | public String created_at; 11 | public Integer id; 12 | } 13 | -------------------------------------------------------------------------------- /authentication/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/ActivityContext.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | @Qualifier 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface ActivityContext { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/bases/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.bases; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | public class BaseActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | } 12 | } -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/SearchEntryPointImpl.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | import ir.oveissi.core.navigation.SearchEntryPoint; 6 | 7 | public class SearchEntryPointImpl implements SearchEntryPoint { 8 | @Override 9 | public Fragment openMain() { 10 | return MovieSearchFragment.newInstance(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /main/src/main/java/ir/oveissi/main/MainEntryPointImpl.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.main; 2 | 3 | 4 | import android.support.v4.app.Fragment; 5 | 6 | import ir.oveissi.core.navigation.MainEntryPoint; 7 | 8 | public class MainEntryPointImpl implements MainEntryPoint { 9 | @Override 10 | public Fragment openMain(String query) { 11 | return MoviesFragment.newInstance(query); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/db/AppDatabase.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search.db; 2 | 3 | import android.arch.persistence.room.Database; 4 | import android.arch.persistence.room.RoomDatabase; 5 | 6 | @Database(entities = {Suggestion.class}, version = 3, exportSchema = false) 7 | public abstract class AppDatabase extends RoomDatabase { 8 | public abstract SuggestionDAO suggestionDAO(); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /main/src/main/java/ir/oveissi/main/MoviesComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.main; 2 | 3 | import dagger.Component; 4 | import ir.oveissi.core.di.AppComponent; 5 | import ir.oveissi.core.di.FragmentScope; 6 | import ir.oveissi.core.di.NavigationProvider; 7 | 8 | @FragmentScope 9 | @Component(dependencies = { 10 | AppComponent.class 11 | }, modules = { 12 | NavigationProvider.class 13 | }) 14 | public interface MoviesComponent { 15 | 16 | void inject(MoviesFragment __); 17 | } 18 | -------------------------------------------------------------------------------- /core/src/test/java/ir/oveissi/core/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /main/src/test/java/ir/oveissi/main/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.main; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_login.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_register.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /main/src/main/java/ir/oveissi/main/MovieDetailComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.main; 2 | 3 | import dagger.Component; 4 | import ir.oveissi.core.di.AppComponent; 5 | import ir.oveissi.core.di.FragmentScope; 6 | import ir.oveissi.core.di.NavigationProvider; 7 | 8 | @FragmentScope 9 | @Component(dependencies = { 10 | AppComponent.class 11 | }, modules = { 12 | NavigationProvider.class 13 | }) 14 | public interface MovieDetailComponent { 15 | 16 | void inject(MovieDetailFragment __); 17 | } 18 | -------------------------------------------------------------------------------- /search/src/test/java/ir/oveissi/search/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/MovieSearchComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search; 2 | 3 | import dagger.Component; 4 | import ir.oveissi.core.di.AppComponent; 5 | import ir.oveissi.core.di.FragmentScope; 6 | import ir.oveissi.core.di.NavigationProvider; 7 | 8 | @FragmentScope 9 | @Component(dependencies = { 10 | AppComponent.class 11 | }, modules = { 12 | NavigationProvider.class 13 | }) 14 | public interface MovieSearchComponent { 15 | 16 | void inject(MovieSearchFragment __); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_logout.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /authentication/src/test/java/ir/oveissi/authentication/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.authentication; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/test/java/ir/oveissi/androidmodularization/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.androidmodularization; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 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() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/ir/oveissi/androidmodularization/MainActivityComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.androidmodularization; 2 | 3 | 4 | import dagger.Component; 5 | import ir.oveissi.core.di.AcitvityScope; 6 | import ir.oveissi.core.di.AppComponent; 7 | import ir.oveissi.core.di.NavigationProvider; 8 | 9 | @AcitvityScope 10 | @Component(dependencies = { 11 | AppComponent.class 12 | }, modules = { 13 | NavigationProvider.class, 14 | }) 15 | public interface MainActivityComponent { 16 | void inject(MainActivity __); 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/UserManagerProvider.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | 4 | import javax.inject.Singleton; 5 | 6 | import dagger.Module; 7 | import dagger.Provides; 8 | import ir.oveissi.core.local.SettingsManager; 9 | import ir.oveissi.core.user.UserManager; 10 | 11 | @Module 12 | public class UserManagerProvider { 13 | 14 | @Singleton 15 | @Provides 16 | public UserManager provideUserManager(SettingsManager settingsManager) { 17 | return new UserManager(settingsManager); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /authentication/src/main/java/ir/oveissi/authentication/di/FragmentSubcomponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.authentication.di; 2 | 3 | import dagger.Module; 4 | import dagger.android.ContributesAndroidInjector; 5 | import ir.oveissi.authentication.LoginFragment; 6 | import ir.oveissi.authentication.RegisterFragment; 7 | 8 | @Module 9 | public abstract class FragmentSubcomponent { 10 | 11 | @ContributesAndroidInjector 12 | abstract LoginFragment provideSub1(); 13 | 14 | @ContributesAndroidInjector 15 | abstract RegisterFragment provideSub2(); 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /main/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /search/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /search/src/main/res/layout/row_suggestion.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /main/src/main/res/layout/fragment_movies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /authentication/src/main/java/ir/oveissi/authentication/AuthNavigator.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.authentication; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.support.v4.app.Fragment; 6 | 7 | import ir.oveissi.core.navigation.AuthEntryPoint; 8 | 9 | 10 | public class AuthNavigator implements AuthEntryPoint { 11 | 12 | 13 | @Override 14 | public Intent openMain() { 15 | return new Intent(Intent.ACTION_VIEW, Uri.parse("dsvs://dsfood/main")); 16 | } 17 | 18 | 19 | @Override 20 | public Fragment openFrag3() { 21 | return RegisterFragment.newInstance(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/db/AppDatabaseSingleton.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search.db; 2 | 3 | import android.arch.persistence.room.Room; 4 | import android.content.Context; 5 | 6 | public class AppDatabaseSingleton { 7 | 8 | private static AppDatabase instance; 9 | 10 | public static AppDatabase getIntance(Context appContext) { 11 | if (instance == null) { 12 | instance = Room.databaseBuilder(appContext, 13 | AppDatabase.class, "suggestiondb") 14 | .fallbackToDestructiveMigration() 15 | .build(); 16 | } 17 | return instance; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/AppComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | 4 | import javax.inject.Singleton; 5 | 6 | import dagger.Component; 7 | import ir.oveissi.core.network.ApiInterface; 8 | import ir.oveissi.core.network.ApiModule; 9 | import ir.oveissi.core.network.ClientModule; 10 | import ir.oveissi.core.user.UserManager; 11 | 12 | @Singleton 13 | @Component(modules = { 14 | ApiModule.class, 15 | AndroidModule.class, 16 | ClientModule.class, 17 | UserManagerProvider.class 18 | }) 19 | public interface AppComponent { 20 | 21 | UserManager getUserManager(); 22 | 23 | ApiInterface wqegetApiInterface(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /authentication/src/main/res/layout/activity_auth_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /authentication/src/main/java/ir/oveissi/authentication/di/AuthComponent.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.authentication.di; 2 | 3 | import dagger.Component; 4 | import dagger.android.support.AndroidSupportInjectionModule; 5 | import ir.oveissi.authentication.AuthMainActivity; 6 | import ir.oveissi.core.di.AcitvityScope; 7 | import ir.oveissi.core.di.AppComponent; 8 | import ir.oveissi.core.di.NavigationProvider; 9 | 10 | @AcitvityScope 11 | @Component(dependencies = { 12 | AppComponent.class 13 | }, modules = { 14 | AndroidSupportInjectionModule.class, 15 | FragmentSubcomponent.class, 16 | NavigationProvider.class 17 | }) 18 | public interface AuthComponent { 19 | 20 | void inject(AuthMainActivity __); 21 | } 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/pojo/Movie.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.pojo; 2 | 3 | /** 4 | * Created by Abbas on 25/05/2016. 5 | */ 6 | public class Movie { 7 | public Integer id; 8 | public String title; 9 | public String poster; 10 | public String year; 11 | public String country; 12 | public String imdb_rating; 13 | public String[] genres; 14 | public String[] images; 15 | public String rated; 16 | public String released; 17 | public String runtime; 18 | public String director; 19 | public String writer; 20 | public String actors; 21 | public String plot; 22 | public String awards; 23 | public String metascore; 24 | public String imdb_votes; 25 | public String imdb_id; 26 | public String type; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core; 2 | 3 | import android.app.Application; 4 | 5 | import ir.oveissi.core.bases.AppComponentHolder; 6 | import ir.oveissi.core.di.AndroidModule; 7 | import ir.oveissi.core.di.AppComponent; 8 | import ir.oveissi.core.di.DaggerAppComponent; 9 | 10 | public class BaseApplication extends Application implements AppComponentHolder { 11 | 12 | 13 | private AppComponent appCommponent; 14 | 15 | @Override 16 | public void onCreate() { 17 | super.onCreate(); 18 | 19 | appCommponent = DaggerAppComponent.builder() 20 | .androidModule(new AndroidModule(this)) 21 | .build(); 22 | } 23 | 24 | 25 | @Override 26 | public AppComponent getAppComponent() { 27 | return appCommponent; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /core/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 | -------------------------------------------------------------------------------- /main/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 | -------------------------------------------------------------------------------- /search/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 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/user/User.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.user; 2 | 3 | public class User { 4 | private String username; 5 | private String name; 6 | private String accessToken; 7 | private String refreshToken; 8 | 9 | public User(String name, String username, String accessToken, String refreshToken) { 10 | this.name = name; 11 | this.username = username; 12 | this.accessToken = accessToken; 13 | this.refreshToken = refreshToken; 14 | } 15 | 16 | public String getUsername() { 17 | return username; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public String getAccessToken() { 25 | return accessToken; 26 | } 27 | 28 | public String getRefreshToken() { 29 | return refreshToken; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /authentication/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/java/ir/oveissi/androidmodularization/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.androidmodularization; 2 | 3 | 4 | import ir.oveissi.core.navigation.EntryPointHolder; 5 | import ir.oveissi.core.navigation.MainEntryPoint; 6 | import ir.oveissi.core.navigation.SearchEntryPoint; 7 | import ir.oveissi.main.MainEntryPointImpl; 8 | import ir.oveissi.search.SearchEntryPointImpl; 9 | 10 | public class BaseApplication extends ir.oveissi.core.BaseApplication implements EntryPointHolder { 11 | 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | } 17 | 18 | @Override 19 | public SearchEntryPoint getSearchEntryPoint() { 20 | return new SearchEntryPointImpl(); 21 | } 22 | 23 | @Override 24 | public MainEntryPoint getMainEntryPoint() { 25 | return new MainEntryPointImpl(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/androidTest/java/ir/oveissi/core/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.core.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/androidTest/java/ir/oveissi/main/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.main; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.main.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /search/src/androidTest/java/ir/oveissi/search/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.search.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/db/SuggestionDAO.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search.db; 2 | 3 | import android.arch.persistence.room.Dao; 4 | import android.arch.persistence.room.Delete; 5 | import android.arch.persistence.room.Insert; 6 | import android.arch.persistence.room.Query; 7 | import android.arch.persistence.room.Update; 8 | 9 | import java.util.List; 10 | 11 | import io.reactivex.Flowable; 12 | 13 | @Dao 14 | public interface SuggestionDAO { 15 | @Query("SELECT * FROM suggestion") 16 | Flowable> getAll(); 17 | 18 | @Query("SELECT * FROM suggestion WHERE title LIKE :title Order by count") 19 | Flowable> getAllOrderByCount(String title); 20 | 21 | @Insert 22 | void insertAll(Suggestion... suggestions); 23 | 24 | @Delete 25 | void delete(Suggestion suggestion); 26 | 27 | @Update 28 | void update(Suggestion suggestion); 29 | } -------------------------------------------------------------------------------- /authentication/src/androidTest/java/ir/oveissi/authentication/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.authentication; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.authentication.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/androidTest/java/ir/oveissi/androidmodularization/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.androidmodularization; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.abbas.androidmodularize", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /search/src/main/java/ir/oveissi/search/db/Suggestion.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.search.db; 2 | 3 | import android.arch.persistence.room.ColumnInfo; 4 | import android.arch.persistence.room.Entity; 5 | import android.arch.persistence.room.PrimaryKey; 6 | 7 | @Entity 8 | public class Suggestion { 9 | @PrimaryKey(autoGenerate = true) 10 | private int uid; 11 | 12 | @ColumnInfo(name = "title") 13 | private String title; 14 | 15 | @ColumnInfo(name = "count") 16 | private Integer count; 17 | 18 | public int getUid() { 19 | return uid; 20 | } 21 | 22 | public void setUid(int uid) { 23 | this.uid = uid; 24 | } 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public void setTitle(String title) { 31 | this.title = title; 32 | } 33 | 34 | public Integer getCount() { 35 | return count; 36 | } 37 | 38 | public void setCount(Integer count) { 39 | this.count = count; 40 | } 41 | } -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/AndroidModule.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | import android.preference.PreferenceManager; 7 | 8 | import javax.inject.Singleton; 9 | 10 | import dagger.Module; 11 | import dagger.Provides; 12 | import ir.oveissi.core.BaseApplication; 13 | 14 | /** 15 | * Created by Abbas on 5/17/16. 16 | */ 17 | @Module 18 | public class AndroidModule { 19 | 20 | 21 | private BaseApplication baseApplication; 22 | 23 | public AndroidModule(BaseApplication baseApplication) { 24 | this.baseApplication = baseApplication; 25 | } 26 | 27 | @Provides 28 | @Singleton 29 | public Context provideAppContext() { 30 | return baseApplication; 31 | } 32 | 33 | @Provides 34 | @Singleton 35 | public SharedPreferences provideSharedPreferences() { 36 | return PreferenceManager.getDefaultSharedPreferences(provideAppContext()); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/network/TokenInterceptor.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.network; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.inject.Inject; 6 | 7 | import ir.oveissi.core.local.SettingsManager; 8 | import okhttp3.Interceptor; 9 | import okhttp3.Request; 10 | import okhttp3.Response; 11 | 12 | 13 | public class TokenInterceptor implements Interceptor { 14 | 15 | private SettingsManager uspm; 16 | 17 | @Inject 18 | public TokenInterceptor(SettingsManager uspm) { 19 | this.uspm = uspm; 20 | } 21 | 22 | 23 | @Override 24 | public Response intercept(Interceptor.Chain chain) throws IOException { 25 | Request request = chain.request(); 26 | 27 | if (uspm.getAccessToken().length() > 0) { 28 | request = request.newBuilder() 29 | .addHeader("Authorization", "Bearer " + uspm.getAccessToken()) 30 | .build(); 31 | } 32 | Response response = chain.proceed(request); 33 | return response; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /main/src/main/res/layout/fragment_movie_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/network/ApiInterface.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.network; 2 | 3 | 4 | import java.util.Map; 5 | 6 | import io.reactivex.Flowable; 7 | import ir.oveissi.core.pojo.Movie; 8 | import ir.oveissi.core.pojo.Pagination; 9 | import ir.oveissi.core.pojo.Register; 10 | import ir.oveissi.core.pojo.RegisterBody; 11 | import ir.oveissi.core.pojo.Token; 12 | import ir.oveissi.core.pojo.UserInfo; 13 | import retrofit2.http.Body; 14 | import retrofit2.http.FieldMap; 15 | import retrofit2.http.FormUrlEncoded; 16 | import retrofit2.http.GET; 17 | import retrofit2.http.POST; 18 | import retrofit2.http.Path; 19 | import retrofit2.http.Query; 20 | 21 | /** 22 | * Created by Abbas on 24/05/2016. 23 | */ 24 | public interface ApiInterface { 25 | 26 | @GET("/api/v1/movies") 27 | Flowable> getMoviesByTitle(@Query("q") String query, @Query("page") Integer page); 28 | 29 | @GET("/api/v1/movies/{id}") 30 | Flowable getMovieById(@Path("id") String id); 31 | 32 | @FormUrlEncoded 33 | @POST("/oauth/token") 34 | Flowable getToken(@FieldMap Map params); 35 | 36 | @POST("/api/v1/register") 37 | Flowable register(@Body RegisterBody registerBody); 38 | 39 | @GET("/api/user") 40 | Flowable getUserInfo(); 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/ir/oveissi/core/di/NavigationProvider.java: -------------------------------------------------------------------------------- 1 | package ir.oveissi.core.di; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import dagger.Module; 7 | import dagger.Provides; 8 | import ir.oveissi.core.navigation.EntryPointHolder; 9 | import ir.oveissi.core.navigation.MainEntryPoint; 10 | import ir.oveissi.core.navigation.NavigationManager; 11 | import ir.oveissi.core.navigation.SearchEntryPoint; 12 | 13 | @Module 14 | public class NavigationProvider { 15 | 16 | 17 | private AppCompatActivity activity; 18 | 19 | public NavigationProvider(AppCompatActivity activity) { 20 | this.activity = activity; 21 | } 22 | 23 | public NavigationProvider(Fragment fragment) { 24 | this.activity = (AppCompatActivity) fragment.getActivity(); 25 | } 26 | 27 | @Provides 28 | public NavigationManager provideManager() { 29 | return new NavigationManager(activity); 30 | } 31 | 32 | 33 | @Provides 34 | public MainEntryPoint provideMainEntryPoint() { 35 | return ((EntryPointHolder) activity.getApplicationContext()).getMainEntryPoint(); 36 | } 37 | 38 | @Provides 39 | public SearchEntryPoint provideSearchEntryPoint() { 40 | return ((EntryPointHolder) activity.getApplicationContext()).getSearchEntryPoint(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /authentication/src/main/res/layout/fragment_auth_register.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 19 | 20 | 26 | 27 | 33 | 34 | 35 |