login(String username, String password);
12 | }
13 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/README.md:
--------------------------------------------------------------------------------
1 | # Flow-Alpha-Master-Detail
2 | An initial implementation of Master-Detail layout with Flowless 1.0-alpha.
3 |
4 | 
5 | 
6 | 
7 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/test/java/com/zhuinden/examplegithubclient/util/PresenterUtils.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | /**
4 | * Created by Zhuinden on 2016.12.21..
5 | */
6 |
7 | public class PresenterUtils {
8 | public static , V extends BasePresenter.ViewContract> void setView(P presenter, V viewContract) {
9 | presenter.view = viewContract;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/Layout.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowtransitions;
2 |
3 | import android.support.annotation.LayoutRes;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.12.03..
10 | */
11 |
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface Layout {
14 | @LayoutRes int value();
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/extracted/LayoutKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example.extracted;
2 |
3 | import android.os.Parcelable;
4 | import android.support.annotation.LayoutRes;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.06.27..
8 | */
9 | public interface LayoutKey
10 | extends Parcelable {
11 | @LayoutRes int layout();
12 |
13 | FlowAnimation animation();
14 | }
15 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/ActivityScope.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | import javax.inject.Scope;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 | @Scope
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface ActivityScope {
14 | }
15 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/drawable/drawer_button_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/test/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginTestSuite.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import org.junit.runner.RunWith;
4 | import org.junit.runners.Suite;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.12.21..
8 | */
9 |
10 | @RunWith(Suite.class)
11 | @Suite.SuiteClasses({LoginPresenterTest.class, LoginKeyTest.class})
12 | public class LoginTestSuite {
13 | }
14 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/IsChildOf.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import java.lang.annotation.Inherited;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.12.18..
9 | */
10 |
11 | @Inherited
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface IsChildOf {
14 | Class>[] value();
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/java/com/zhuinden/flowless_dispatcher_sample/extracted/LayoutKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_dispatcher_sample.extracted;
2 |
3 | import android.os.Parcelable;
4 | import android.support.annotation.LayoutRes;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.06.27..
8 | */
9 | public interface LayoutKey
10 | extends Parcelable {
11 | @LayoutRes
12 | int layout();
13 |
14 | FlowAnimation animation();
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/GithubRepoRepository.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.data.repository;
2 |
3 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
4 |
5 | /**
6 | * Created by Zhuinden on 2017.01.02..
7 | */
8 |
9 | public interface GithubRepoRepository
10 | extends Repository {
11 | GithubRepo findByUrl(String url);
12 | }
13 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/extracted/LayoutKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.extracted;
2 |
3 | import android.os.Parcelable;
4 | import android.support.annotation.LayoutRes;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.12.03..
8 | */
9 |
10 | public interface LayoutKey
11 | extends Parcelable {
12 | @LayoutRes
13 | int layout();
14 |
15 | FlowAnimation animation();
16 | }
17 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/KeyScope.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | import javax.inject.Scope;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 | @Scope
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface KeyScope {
14 | Class> value();
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/test/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesTestSuite.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositories;
2 |
3 | import org.junit.runner.RunWith;
4 | import org.junit.runners.Suite;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.12.21..
8 | */
9 |
10 | @RunWith(Suite.class)
11 | @Suite.SuiteClasses({RepositoriesPresenterTest.class})
12 | public class RepositoriesTestSuite {
13 | }
14 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/LeftDrawerEnabled.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import java.lang.annotation.Inherited;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.12.18..
9 | */
10 | @Inherited
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface LeftDrawerEnabled {
13 | boolean value() default true;
14 | }
15 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/drawable/normal_button_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/ToolbarButtonVisibility.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import java.lang.annotation.Inherited;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.12.18..
9 | */
10 | @Inherited
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface ToolbarButtonVisibility {
13 | boolean value() default true;
14 | }
15 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/layout_master_detail_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/test/java/com/zhuinden/flow_alpha_master_detail/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail;
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()
13 | throws Exception {
14 | assertEquals(4, 2 + 2);
15 | }
16 | }
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/test/java/com/zhuinden/flowless_dispatcher_sample/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_dispatcher_sample;
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()
13 | throws Exception {
14 | assertEquals(4, 2 + 2);
15 | }
16 | }
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/test/java/com/zhuinden/flowless_viewpager_example/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
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()
13 | throws Exception {
14 | assertEquals(4, 2 + 2);
15 | }
16 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/BundleFactory.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * Created by Zhuinden on 2016.12.20..
7 | */
8 |
9 | public class BundleFactory {
10 | public interface Provider {
11 | Bundle create();
12 | }
13 |
14 | static Provider provider = Bundle::new;
15 |
16 | public static Bundle create() {
17 | return provider.create();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/Title.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import android.support.annotation.StringRes;
4 |
5 | import java.lang.annotation.Inherited;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.10..
11 | */
12 |
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Inherited
15 | public @interface Title {
16 | @StringRes int value();
17 | }
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/Layout.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 |
4 | import android.support.annotation.LayoutRes;
5 |
6 | import java.lang.annotation.Inherited;
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.12.03..
12 | */
13 |
14 | @Inherited
15 | @Retention(RetentionPolicy.RUNTIME)
16 | public @interface Layout {
17 | @LayoutRes int value();
18 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/GetRepositoriesInteractor.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.interactor;
2 |
3 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
4 |
5 | import java.util.List;
6 |
7 | import io.reactivex.Single;
8 |
9 | /**
10 | * Created by Owner on 2016.12.10.
11 | */
12 |
13 | public interface GetRepositoriesInteractor {
14 | Single> getRepositories(String user, int page);
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/androidTest/java/com/zhuinden/flow_alpha_master_detail/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest
10 | extends ApplicationTestCase {
11 | public ApplicationTest() {
12 | super(Application.class);
13 | }
14 | }
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/androidTest/java/com/zhuinden/flowless_dispatcher_sample/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_dispatcher_sample;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest
10 | extends ApplicationTestCase {
11 | public ApplicationTest() {
12 | super(Application.class);
13 | }
14 | }
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/androidTest/java/com/zhuinden/flowless_viewpager_example/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest
10 | extends ApplicationTestCase {
11 | public ApplicationTest() {
12 | super(Application.class);
13 | }
14 | }
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/test/java/com/zhuinden/flowtransitions/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowtransitions;
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()
15 | throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/res/layout/path_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/test/java/com/zhuinden/examplegithubclient/UnitTestSuite.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient;
2 |
3 | import com.zhuinden.examplegithubclient.presentation.paths.login.LoginTestSuite;
4 | import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesTestSuite;
5 |
6 | import org.junit.runner.RunWith;
7 | import org.junit.runners.Suite;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.19..
11 | */
12 |
13 | @RunWith(Suite.class)
14 | @Suite.SuiteClasses({LoginTestSuite.class, RepositoriesTestSuite.class})
15 | public class UnitTestSuite {
16 | }
17 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/path_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/layout/path_repositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/java/com/zhuinden/flowless_dispatcher_sample/FirstKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_dispatcher_sample;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flowless_dispatcher_sample.extracted.FlowAnimation;
5 | import com.zhuinden.flowless_dispatcher_sample.extracted.LayoutKey;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.06.28..
9 | */
10 | @AutoValue
11 | public abstract class FirstKey
12 | implements LayoutKey {
13 | public static FirstKey create() {
14 | return new AutoValue_FirstKey(R.layout.path_first, FlowAnimation.NONE);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesPage.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositories;
2 |
3 | import android.support.test.espresso.Espresso;
4 | import android.support.test.espresso.ViewInteraction;
5 | import android.support.test.espresso.matcher.ViewMatchers;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.12.19..
9 | */
10 |
11 | public class RepositoriesPage {
12 | public ViewInteraction repositoriesView() {
13 | return Espresso.onView(ViewMatchers.isAssignableFrom(RepositoriesView.class));
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/ComponentFactory.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import android.content.Context;
4 |
5 | import java.lang.annotation.Inherited;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 |
9 | /**
10 | * Created by Owner on 2016.12.10.
11 | */
12 | @Inherited
13 | @Retention(RetentionPolicy.RUNTIME)
14 | public @interface ComponentFactory {
15 | Class extends FactoryMethod>> value();
16 |
17 | interface FactoryMethod {
18 | T createComponent(Context context);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/java/com/zhuinden/flowless_dispatcher_sample/SecondKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_dispatcher_sample;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flowless_dispatcher_sample.extracted.FlowAnimation;
5 | import com.zhuinden.flowless_dispatcher_sample.extracted.LayoutKey;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.06.28..
9 | */
10 | @AutoValue
11 | public abstract class SecondKey
12 | implements LayoutKey {
13 | public static SecondKey create() {
14 | return new AutoValue_SecondKey(R.layout.path_second, FlowAnimation.SEGUE);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/FirstKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flowless_viewpager_example.extracted.FlowAnimation;
5 | import com.zhuinden.flowless_viewpager_example.extracted.LayoutKey;
6 |
7 |
8 | /**
9 | * Created by Zhuinden on 2016.07.17..
10 | */
11 | @AutoValue
12 | public abstract class FirstKey
13 | implements LayoutKey {
14 | public static FirstKey create() {
15 | return new AutoValue_FirstKey(R.layout.path_first, FlowAnimation.SEGUE);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponent.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.KeyScope;
4 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
5 |
6 | import dagger.Component;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 | @KeyScope(LoginKey.class)
12 | @Component(dependencies = MainComponent.class)
13 | public interface LoginComponent {
14 | LoginPresenter loginPresenter();
15 |
16 | void inject(LoginView loginView);
17 | }
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/ServiceModule.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection.modules;
2 |
3 | import com.zhuinden.examplegithubclient.domain.service.GithubService;
4 | import com.zhuinden.examplegithubclient.domain.service.impl.GithubServiceImpl;
5 |
6 | import dagger.Module;
7 | import dagger.Provides;
8 |
9 | /**
10 | * Created by Owner on 2016.12.10.
11 | */
12 |
13 | @Module
14 | public class ServiceModule {
15 | @Provides
16 | GithubService githubService(GithubServiceImpl githubService) {
17 | return githubService;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/KeyContextWrapper.java:
--------------------------------------------------------------------------------
1 | package flowless;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Created by Zhuinden on 2016.12.18..
7 | */
8 |
9 | public interface KeyContextWrapper {
10 | public static final String KEY_SERVICE_TAG = "flowless.KEY";
11 |
12 | public class Methods {
13 | private Methods() {
14 | }
15 |
16 | @SuppressWarnings("unchecked")
17 | public static T getKey(Context context) {
18 | //noinspection ResourceType
19 | return (T) context.getSystemService(KEY_SERVICE_TAG);
20 | }
21 | }
22 |
23 | T getKey();
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_second_detail_third.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/GithubService.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.service;
2 |
3 | import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization;
4 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
5 |
6 | import java.util.List;
7 |
8 | import io.reactivex.Single;
9 |
10 |
11 | /**
12 | * Created by Owner on 2016.12.10.
13 | */
14 |
15 | public interface GithubService {
16 | Single> getOrganizations(String user);
17 |
18 | Single> getRepositories(String user, int page);
19 | }
20 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_fourth_detail_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/DataSource.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.data.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Zhuinden on 2017.01.02..
7 | */
8 |
9 | public interface DataSource {
10 | interface ChangeListener {
11 | void onChange(List repositories);
12 | }
13 |
14 | interface Unbinder {
15 | void unbind();
16 | }
17 |
18 | public interface Modify {
19 | R modify(List mutableRepositories);
20 | }
21 |
22 | public interface Search {
23 | R search(List immutableRepositories);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/res/layout/path_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
11 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/preset/FlowContainerLifecycleListener.java:
--------------------------------------------------------------------------------
1 | package flowless.preset;
2 |
3 | /**
4 | * Created by Zhuinden on 2016.07.01..
5 | */
6 | public interface FlowContainerLifecycleListener
7 | extends FlowLifecycles.ActivityResultListener, //
8 | FlowLifecycles.BackPressListener, //
9 | FlowLifecycles.CreateDestroyListener, //
10 | FlowLifecycles.StartStopListener, //
11 | FlowLifecycles.ResumePauseListener, //
12 | FlowLifecycles.ViewStatePersistenceListener, //
13 | FlowLifecycles.PreSaveViewStateListener, //
14 | FlowLifecycles.PermissionRequestListener, //
15 | FlowLifecycles.ViewLifecycleListener {
16 | }
17 |
--------------------------------------------------------------------------------
/flow-sample-basic/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.about;
2 |
3 | import android.os.Parcelable;
4 |
5 | import com.google.auto.value.AutoValue;
6 | import com.zhuinden.examplegithubclient.R;
7 | import com.zhuinden.examplegithubclient.util.Layout;
8 | import com.zhuinden.examplegithubclient.util.Title;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.12.10..
12 | */
13 |
14 | @AutoValue
15 | @Title(R.string.title_about)
16 | @Layout(R.layout.path_about)
17 | public abstract class AboutKey
18 | implements Parcelable {
19 | public static AboutKey create() {
20 | return new AutoValue_AboutKey();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/RepositoryModule.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection.modules;
2 |
3 | import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository;
4 | import com.zhuinden.examplegithubclient.data.repository.impl.GithubRepoRepositoryInMemoryImpl;
5 |
6 | import dagger.Module;
7 | import dagger.Provides;
8 |
9 | /**
10 | * Created by Zhuinden on 2017.01.02..
11 | */
12 |
13 | @Module
14 | public class RepositoryModule {
15 | @Provides
16 | GithubRepoRepository repositoryRepository(GithubRepoRepositoryInMemoryImpl repositoryRepositoryInMemory) {
17 | return repositoryRepositoryInMemory;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_fourth_master.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_third_fullscreen.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponent.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.KeyScope;
4 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
5 |
6 | import dagger.Component;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 | @KeyScope(RepositoryDetailsKey.class)
12 | @Component(dependencies = MainComponent.class)
13 | public interface RepositoryDetailsComponent {
14 | RepositoryDetailsPresenter repositoryDetailsPresenter();
15 |
16 | void inject(RepositoryDetailsView repositoryDetailsView);
17 | }
18 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in G:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_second_master.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
--------------------------------------------------------------------------------
/flowless-library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/InstrumentationSuite.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient;
2 |
3 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainInstrumentedTest;
4 | import com.zhuinden.examplegithubclient.presentation.paths.login.LoginInstrumentedTest;
5 | import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesInstrumentedTest;
6 |
7 | import org.junit.runner.RunWith;
8 | import org.junit.runners.Suite;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.12.19..
12 | */
13 | @RunWith(Suite.class)
14 | @Suite.SuiteClasses({MainInstrumentedTest.class, LoginInstrumentedTest.class, RepositoriesInstrumentedTest.class})
15 | public class InstrumentationSuite {
16 | }
17 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/idlingresource/FlowlessIdlingResource.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util.idlingresource;
2 |
3 |
4 | import flowless.FlowIdlingResource;
5 |
6 | /**
7 | * Created by Zhuinden on 2016.07.30..
8 | */
9 | public class FlowlessIdlingResource
10 | implements FlowIdlingResource {
11 | public static final FlowlessIdlingResource INSTANCE = new FlowlessIdlingResource();
12 |
13 | private FlowlessIdlingResource() {
14 | }
15 |
16 | @Override
17 | public void increment() {
18 | EspressoIdlingResource.increment();
19 | }
20 |
21 | @Override
22 | public void decrement() {
23 | EspressoIdlingResource.decrement();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FirstKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsFullScreen;
5 | import com.zhuinden.flow_alpha_master_detail.R;
6 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
8 |
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class FirstKey
15 | implements LayoutKey, IsFullScreen {
16 | public static FirstKey create() {
17 | return new AutoValue_FirstKey(R.layout.path_first, FlowAnimation.SEGUE);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/conditionwatcher/Instruction.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util.conditionwatcher;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.zhuinden.examplegithubclient.util.BundleFactory;
6 |
7 | /**
8 | * Created by F1sherKK on 16/12/15.
9 | */
10 | public abstract class Instruction {
11 |
12 | private Bundle dataContainer = BundleFactory.create();
13 |
14 | public final void setData(Bundle dataContainer) {
15 | this.dataContainer = dataContainer;
16 | }
17 |
18 | public final Bundle getDataContainer() {
19 | return dataContainer;
20 | }
21 |
22 | public abstract String getDescription();
23 |
24 | public abstract boolean checkCondition();
25 | }
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_second_detail_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/repository/Repository.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.data.repository;
2 |
3 | import com.zhuinden.examplegithubclient.data.model.DataSource;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by Zhuinden on 2017.01.02..
10 | */
11 |
12 | interface Repository {
13 | DataSource.Unbinder subscribe(DataSource.ChangeListener changeListener);
14 |
15 | M findOne(ID id);
16 |
17 | List findAll();
18 |
19 | M saveOrUpdate(M m);
20 |
21 | List saveOrUpdate(List items);
22 |
23 | M delete(M m);
24 |
25 | M delete(ID id);
26 |
27 | List delete(List items);
28 |
29 | long count();
30 | }
31 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthMasterKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
5 | import com.zhuinden.flow_alpha_master_detail.R;
6 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.04.16..
11 | */
12 | @AutoValue
13 | public abstract class FourthMasterKey
14 | implements LayoutKey, IsMaster {
15 | public static FourthMasterKey create() {
16 | return new AutoValue_FourthMasterKey(R.layout.path_fourth_master, FlowAnimation.SEGUE);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondMasterKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
5 | import com.zhuinden.flow_alpha_master_detail.R;
6 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.04.16..
11 | */
12 | @AutoValue
13 | public abstract class SecondMasterKey
14 | implements LayoutKey, IsMaster {
15 | public static SecondMasterKey create() {
16 | return new AutoValue_SecondMasterKey(R.layout.path_second_master, FlowAnimation.SEGUE);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/CustomApplication.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application;
2 |
3 | import android.app.Application;
4 |
5 | import com.zhuinden.examplegithubclient.util.idlingresource.FlowlessIdlingResource;
6 |
7 | import flowless.Flow;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.09..
11 | */
12 |
13 | public class CustomApplication extends Application {
14 | private static CustomApplication INSTANCE;
15 |
16 | @Override
17 | public void onCreate() {
18 | super.onCreate();
19 | INSTANCE = this;
20 | Flow.setFlowIdlingResource(FlowlessIdlingResource.INSTANCE);
21 | }
22 |
23 | public static CustomApplication get() {
24 | return INSTANCE;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Flow Basic Sample
19 |
20 |
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.1"
6 |
7 | defaultConfig {
8 | applicationId "flow.sample.orientation"
9 | minSdkVersion 14
10 | targetSdkVersion 24
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:24.1.1'
26 | compile project(':flowless-library')
27 | }
28 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/ThirdFullScreenKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsFullScreen;
5 | import com.zhuinden.flow_alpha_master_detail.R;
6 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.04.16..
11 | */
12 | @AutoValue
13 | public abstract class ThirdFullScreenKey
14 | implements LayoutKey, IsFullScreen {
15 | public static ThirdFullScreenKey create() {
16 | return new AutoValue_ThirdFullScreenKey(R.layout.path_third_fullscreen, FlowAnimation.SEGUE);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/OkHttpModule.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection.modules;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 | import com.zhuinden.examplegithubclient.domain.networking.HeaderInterceptor;
5 |
6 | import dagger.Module;
7 | import dagger.Provides;
8 | import okhttp3.OkHttpClient;
9 |
10 | /**
11 | * Created by Owner on 2016.12.10.
12 | */
13 | @Module
14 | public class OkHttpModule {
15 | @Provides
16 | @ActivityScope
17 | OkHttpClient okHttpClient(HeaderInterceptor headerInterceptor) {
18 | return new OkHttpClient.Builder() //
19 | .addInterceptor(headerInterceptor) //
20 | .build();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/Direction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | public enum Direction {
20 | FORWARD,
21 | BACKWARD,
22 | REPLACE
23 | }
24 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Flow Orientation Sample
19 |
20 |
--------------------------------------------------------------------------------
/flow-sample-basic/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.1"
6 |
7 | defaultConfig {
8 | applicationId "flow.sample.basic"
9 | minSdkVersion 14
10 | targetSdkVersion 24
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:24.1.1'
26 | compile "com.android.support:design:24.1.1"
27 | compile project(':flowless-library')
28 | }
29 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/layout/path_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponent.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositories;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.KeyScope;
4 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
5 |
6 | import dagger.Component;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 | @KeyScope(RepositoriesKey.class)
12 | @Component(dependencies = MainComponent.class)
13 | public interface RepositoriesComponent {
14 | RepositoriesPresenter repositoriesPresenter();
15 |
16 | void inject(RepositoriesView repositoriesView);
17 |
18 | void inject(RepositoriesAdapter repositoriesAdapter);
19 |
20 | void inject(RepositoriesAdapter.ViewHolder repositoriesViewHolder);
21 | }
22 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginWaitForDialogInstruction.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import com.zhuinden.examplegithubclient.util.conditionwatcher.Instruction;
4 |
5 | /**
6 | * Created by F1sherKK on 15/04/16.
7 | */
8 | public class LoginWaitForDialogInstruction
9 | extends Instruction {
10 | LoginPresenter loginPresenter;
11 |
12 | public LoginWaitForDialogInstruction(LoginPresenter loginPresenter) {
13 | this.loginPresenter = loginPresenter;
14 | }
15 |
16 | @Override
17 | public String getDescription() {
18 | return "Loading dialog shouldn't be in view hierarchy";
19 | }
20 |
21 | @Override
22 | public boolean checkCondition() {
23 | return !LoginPresenter.isLoading;
24 | }
25 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/LoginInteractorImpl.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.interactor.impl;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 | import com.zhuinden.examplegithubclient.domain.interactor.LoginInteractor;
5 |
6 | import java.util.concurrent.TimeUnit;
7 |
8 | import javax.inject.Inject;
9 |
10 | import io.reactivex.Single;
11 |
12 | /**
13 | * Created by Zhuinden on 2016.12.18..
14 | */
15 |
16 | @ActivityScope
17 | public class LoginInteractorImpl
18 | implements LoginInteractor {
19 | @Inject
20 | public LoginInteractorImpl() {
21 | }
22 |
23 | @Override
24 | public Single login(String username, String password) {
25 | return Single.just(true).delay(3250, TimeUnit.MILLISECONDS);
26 | }
27 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/NavigationModule.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection.modules;
2 |
3 | import dagger.Module;
4 | import dagger.Provides;
5 | import flowless.Flow;
6 | import flowless.KeyManager;
7 | import flowless.ServiceProvider;
8 |
9 | /**
10 | * Created by Owner on 2017. 01. 18..
11 | */
12 |
13 | @Module
14 | public class NavigationModule {
15 | private Flow flow;
16 |
17 | public NavigationModule(Flow flow) {
18 | this.flow = flow;
19 | }
20 |
21 | @Provides
22 | Flow flow() {
23 | return flow;
24 | }
25 |
26 | @Provides
27 | ServiceProvider serviceProvider() {
28 | return flow.getServices();
29 | }
30 |
31 | @Provides
32 | KeyManager keyManager() {
33 | return flow.getStates();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginComponentFactory.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import android.content.Context;
4 |
5 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
6 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
7 | import com.zhuinden.examplegithubclient.util.DaggerService;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.18..
11 | */
12 |
13 | public class LoginComponentFactory
14 | implements ComponentFactory.FactoryMethod {
15 | @Override
16 | public LoginComponent createComponent(Context context) {
17 | MainComponent mainComponent = DaggerService.getGlobalComponent(context);
18 | return DaggerLoginComponent.builder().mainComponent(mainComponent).build();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/retrofit/RetrofitGithubService.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.service.retrofit;
2 |
3 | import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization;
4 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
5 |
6 | import java.util.List;
7 |
8 | import io.reactivex.Single;
9 | import retrofit2.http.GET;
10 | import retrofit2.http.Path;
11 | import retrofit2.http.Query;
12 |
13 | /**
14 | * Created by Owner on 2016.12.10.
15 | */
16 |
17 | public interface RetrofitGithubService {
18 | @GET("orgs/{user}/repos")
19 | Single> getOrganizations(@Path("user") String user);
20 |
21 | @GET("users/{user}/repos")
22 | Single> getRepositories(@Path("user") String user, @Query("page") int page);
23 | }
24 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/layout/view_repositories_load_more_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
18 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/data/model/GithubRepoDataSource.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.data.model;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
5 |
6 | import java.util.ArrayList;
7 | import java.util.Collections;
8 | import java.util.List;
9 |
10 | import javax.inject.Inject;
11 |
12 | /**
13 | * Created by Owner on 2016.12.26.
14 | */
15 | @ActivityScope
16 | public class GithubRepoDataSource
17 | extends BaseDataSource {
18 | @Inject
19 | public GithubRepoDataSource() {
20 | }
21 |
22 | private List repositories = Collections.synchronizedList(new ArrayList<>());
23 |
24 | @Override
25 | protected List getData() {
26 | return repositories;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositories;
2 |
3 | import android.os.Parcelable;
4 |
5 | import com.google.auto.value.AutoValue;
6 | import com.zhuinden.examplegithubclient.R;
7 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
8 | import com.zhuinden.examplegithubclient.util.Layout;
9 | import com.zhuinden.examplegithubclient.util.Title;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.12.10..
13 | */
14 |
15 | @AutoValue
16 | @Title(R.string.title_repositories)
17 | @Layout(R.layout.path_repositories)
18 | @ComponentFactory(RepositoriesComponentFactory.class)
19 | public abstract class RepositoriesKey
20 | implements Parcelable {
21 | public static RepositoriesKey create() {
22 | return new AutoValue_RepositoriesKey();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/DaggerService.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | import android.content.Context;
4 |
5 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainKey;
6 |
7 | import flowless.ServiceProvider;
8 |
9 | /**
10 | * Created by Owner on 2016.12.10.
11 | */
12 |
13 | public class DaggerService {
14 | public static final String TAG = "DaggerService";
15 |
16 | @SuppressWarnings("unchecked")
17 | public static T getComponent(Context context) {
18 | //noinspection ResourceType
19 | return (T) ServiceProvider.get(context).getService(context, TAG);
20 | }
21 |
22 | @SuppressWarnings("unchecked")
23 | public static T getGlobalComponent(Context context) {
24 | //noinspection ResourceType
25 | return (T) ServiceProvider.get(context).getService(MainKey.KEY, TAG);
26 | }
27 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositories/RepositoriesComponentFactory.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositories;
2 |
3 | import android.content.Context;
4 |
5 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
6 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
7 | import com.zhuinden.examplegithubclient.util.DaggerService;
8 |
9 | /**
10 | * Created by Owner on 2016.12.10.
11 | */
12 |
13 | public class RepositoriesComponentFactory
14 | implements ComponentFactory.FactoryMethod {
15 | @Override
16 | public RepositoriesComponent createComponent(Context context) {
17 | MainComponent mainComponent = DaggerService.getGlobalComponent(context);
18 | return DaggerRepositoriesComponent.builder().mainComponent(mainComponent).build();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #3F51B5
20 | #303F9F
21 | #FF4081
22 |
23 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/networking/HeaderInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.networking;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 |
5 | import java.io.IOException;
6 |
7 | import javax.inject.Inject;
8 |
9 | import okhttp3.Interceptor;
10 | import okhttp3.Response;
11 |
12 | /**
13 | * Created by Owner on 2016.12.10.
14 | */
15 | @ActivityScope
16 | public class HeaderInterceptor
17 | implements Interceptor {
18 | @Inject
19 | public HeaderInterceptor() {
20 | }
21 |
22 | @Override
23 | public Response intercept(Chain chain)
24 | throws IOException {
25 | return chain.proceed( //
26 | chain.request().newBuilder() //
27 | .addHeader("Accept", "application/vnd.github.v3+json") //
28 | .build()); //
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #3F51B5
20 | #303F9F
21 | #FF4081
22 |
23 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Zh-Github
3 | REPOSITORIES
4 | ABOUT
5 | LOGOUT
6 | Open
7 | Close
8 | LOGIN
9 | REPO DETAILS
10 | This project is meant to serve as an example of using Flow.\n\n\n\nCreated by Zhuinden
11 | Username
12 | Password
13 | LOGIN
14 | Failed to log in.
15 | Please wait…
16 | Loading…
17 |
18 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthDetailKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsDetail;
5 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
6 | import com.zhuinden.flow_alpha_master_detail.R;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
8 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class FourthDetailKey
15 | implements LayoutKey, IsDetail {
16 | @Override
17 | public IsMaster getMaster() {
18 | return FourthMasterKey.create();
19 | }
20 |
21 | public static FourthDetailKey create() {
22 | return new AutoValue_FourthDetailKey(R.layout.path_fourth_detail, FlowAnimation.SEGUE);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondDetailKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsDetail;
5 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
6 | import com.zhuinden.flow_alpha_master_detail.R;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
8 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class SecondDetailKey
15 | implements LayoutKey, IsDetail {
16 | @Override
17 | public IsMaster getMaster() {
18 | return SecondMasterKey.create();
19 | }
20 |
21 | public static SecondDetailKey create() {
22 | return new AutoValue_SecondDetailKey(R.layout.path_second_detail, FlowAnimation.SEGUE);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_fourth_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsComponentFactory.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails;
2 |
3 | import android.content.Context;
4 |
5 | import com.zhuinden.examplegithubclient.presentation.activity.main.MainComponent;
6 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
7 | import com.zhuinden.examplegithubclient.util.DaggerService;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.19..
11 | */
12 |
13 | public class RepositoryDetailsComponentFactory
14 | implements ComponentFactory.FactoryMethod {
15 | @Override
16 | public RepositoryDetailsComponent createComponent(Context context) {
17 | MainComponent mainComponent = DaggerService.getGlobalComponent(context);
18 | return DaggerRepositoryDetailsComponent.builder().mainComponent(mainComponent).build();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/util/BasePresenter.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.util;
2 |
3 | /**
4 | * Created by Owner on 2016.12.10.
5 | */
6 |
7 | public abstract class BasePresenter
8 | implements Presenter {
9 | protected V view;
10 |
11 | protected final boolean hasView() {
12 | return view != null;
13 | }
14 |
15 | public V getView() {
16 | return view;
17 | }
18 |
19 | @Override
20 | public final void attachView(V view) {
21 | this.view = view;
22 | onAttach();
23 | initializeView(view);
24 | }
25 |
26 | protected abstract void initializeView(V view);
27 |
28 | @Override
29 | public final void detachView() {
30 | onDetach();
31 | this.view = null;
32 | }
33 |
34 | protected void onAttach() {
35 | }
36 |
37 | protected void onDetach() {
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/androidTest/java/com/zhuinden/flowtransitions/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowtransitions;
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 | * Instrumentation 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 | throws Exception {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getTargetContext();
24 |
25 | assertEquals("com.zhuinden.flowtransitions", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondDetailThirdKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsDetail;
5 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
6 | import com.zhuinden.flow_alpha_master_detail.R;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
8 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class SecondDetailThirdKey
15 | implements LayoutKey, IsDetail {
16 | @Override
17 | public IsMaster getMaster() {
18 | return SecondMasterKey.create();
19 | }
20 |
21 | public static SecondDetailThirdKey create() {
22 | return new AutoValue_SecondDetailThirdKey(R.layout.path_second_detail_third, FlowAnimation.SEGUE);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthDetailSecondKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsDetail;
5 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
6 | import com.zhuinden.flow_alpha_master_detail.R;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
8 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class FourthDetailSecondKey
15 | implements LayoutKey, IsDetail {
16 | @Override
17 | public IsMaster getMaster() {
18 | return FourthMasterKey.create();
19 | }
20 |
21 | public static FourthDetailSecondKey create() {
22 | return new AutoValue_FourthDetailSecondKey(R.layout.path_fourth_detail_second, FlowAnimation.SEGUE);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondDetailSecondKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import com.google.auto.value.AutoValue;
4 | import com.zhuinden.flow_alpha_master_detail.IsDetail;
5 | import com.zhuinden.flow_alpha_master_detail.IsMaster;
6 | import com.zhuinden.flow_alpha_master_detail.R;
7 | import com.zhuinden.flow_alpha_master_detail.extracted.FlowAnimation;
8 | import com.zhuinden.flow_alpha_master_detail.extracted.LayoutKey;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.04.16..
12 | */
13 | @AutoValue
14 | public abstract class SecondDetailSecondKey
15 | implements LayoutKey, IsDetail {
16 | @Override
17 | public IsMaster getMaster() {
18 | return SecondMasterKey.create();
19 | }
20 |
21 | public static SecondDetailSecondKey create() {
22 | return new AutoValue_SecondDetailSecondKey(R.layout.path_second_detail_second, FlowAnimation.SEGUE);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout-land/layout_master_detail_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
15 |
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #673AB7
5 | #512DA8
6 | #D1C4E9
7 | #536DFE
8 | #758FFF
9 | #212121
10 | #757575
11 | #FFFFFF
12 | #BDBDBD
13 |
14 |
17 | @color/primary
18 | @color/primary_dark
19 | @color/accent
20 |
21 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/pager_view_one.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/pager_view_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/res/layout/path_second_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
13 |
14 |
20 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/pager_view_five.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/pager_view_four.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/res/layout/pager_view_three.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
20 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/ActivityUtils.java:
--------------------------------------------------------------------------------
1 | package flowless;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.ContextWrapper;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.05.26..
9 | */
10 | public class ActivityUtils {
11 | public static Activity getActivity(Context context) {
12 | if (context instanceof Activity) {
13 | return (Activity) context;
14 | } else if (context instanceof ContextWrapper) {
15 | Context contextWrapper = context;
16 | while (contextWrapper instanceof ContextWrapper && ((ContextWrapper) context).getBaseContext() != null) {
17 | contextWrapper = ((ContextWrapper) contextWrapper).getBaseContext();
18 | if (contextWrapper instanceof Activity) {
19 | return (Activity) contextWrapper;
20 | }
21 | }
22 | }
23 | throw new IllegalStateException("No activity could be found in [" + context + "]");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/res/layout/scene_main_default.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
14 |
15 |
22 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/androidTest/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginPage.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import android.support.test.espresso.Espresso;
4 | import android.support.test.espresso.ViewInteraction;
5 | import android.support.test.espresso.matcher.ViewMatchers;
6 |
7 | import com.zhuinden.examplegithubclient.R;
8 |
9 | /**
10 | * Created by Zhuinden on 2016.12.19..
11 | */
12 |
13 | public class LoginPage {
14 | public ViewInteraction loginView() {
15 | return Espresso.onView(ViewMatchers.isAssignableFrom(LoginView.class));
16 | }
17 |
18 | public ViewInteraction username() {
19 | return Espresso.onView(ViewMatchers.withId(R.id.login_username));
20 | }
21 |
22 | public ViewInteraction password() {
23 | return Espresso.onView(ViewMatchers.withId(R.id.login_password));
24 | }
25 |
26 | public ViewInteraction loginButton() {
27 | return Espresso.onView(ViewMatchers.withId(R.id.login_login));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/res/layout/scene_main_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
14 |
15 |
22 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/application/injection/modules/InteractorModule.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.application.injection.modules;
2 |
3 | import com.zhuinden.examplegithubclient.domain.interactor.GetRepositoriesInteractor;
4 | import com.zhuinden.examplegithubclient.domain.interactor.LoginInteractor;
5 | import com.zhuinden.examplegithubclient.domain.interactor.impl.GetRepositoriesInteractorImpl;
6 | import com.zhuinden.examplegithubclient.domain.interactor.impl.LoginInteractorImpl;
7 |
8 | import dagger.Module;
9 | import dagger.Provides;
10 |
11 | /**
12 | * Created by Owner on 2016.12.10.
13 | */
14 |
15 | @Module
16 | public class InteractorModule {
17 | @Provides
18 | GetRepositoriesInteractor getRepositoriesInteractor(GetRepositoriesInteractorImpl getRepositoriesInteractor) {
19 | return getRepositoriesInteractor;
20 | }
21 |
22 | @Provides
23 | LoginInteractor loginInteractor(LoginInteractorImpl loginInteractor) {
24 | return loginInteractor;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/login/LoginKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.login;
2 |
3 | import android.os.Parcelable;
4 |
5 | import com.google.auto.value.AutoValue;
6 | import com.zhuinden.examplegithubclient.R;
7 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
8 | import com.zhuinden.examplegithubclient.util.Layout;
9 | import com.zhuinden.examplegithubclient.util.LeftDrawerEnabled;
10 | import com.zhuinden.examplegithubclient.util.Title;
11 | import com.zhuinden.examplegithubclient.util.ToolbarButtonVisibility;
12 |
13 |
14 | /**
15 | * Created by Zhuinden on 2016.12.10..
16 | */
17 |
18 | @AutoValue
19 | @Title(R.string.title_login)
20 | @Layout(R.layout.path_login)
21 | @ComponentFactory(LoginComponentFactory.class)
22 | @LeftDrawerEnabled(false)
23 | @ToolbarButtonVisibility(false)
24 | public abstract class LoginKey
25 | implements Parcelable {
26 | public static LoginKey create() {
27 | return new AutoValue_LoginKey();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/layout/view_repositories_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
24 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/res/layout/basic_activity_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/layout/orientation_activity_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/ClassKey.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | /**
20 | * Convenience base class for keys. All instances of a given subclass are equal.
21 | */
22 | public abstract class ClassKey {
23 |
24 | @Override
25 | public boolean equals(Object o) {
26 | return this == o || (o != null && getClass() == o.getClass());
27 | }
28 |
29 | @Override
30 | public int hashCode() {
31 | return getClass().hashCode();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/NotPersistent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package flowless;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * Applied to a state object, indicates that it should not be persisted with the history.
25 | */
26 | @Target(ElementType.TYPE)
27 | @Retention(RetentionPolicy.RUNTIME)
28 | public @interface NotPersistent {
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/KeyParceler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | import android.os.Parcelable;
20 | import android.support.annotation.NonNull;
21 |
22 | /**
23 | * Used by History to convert your key objects to and from instances of
24 | * {@link android.os.Parcelable}.
25 | */
26 | public interface KeyParceler {
27 | @NonNull
28 | Parcelable toParcelable(@NonNull Object key);
29 |
30 | @NonNull
31 | Object toKey(@NonNull Parcelable parcelable);
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/activity/main/MainKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.activity.main;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import flowless.ClassKey;
7 |
8 | /**
9 | * Created by Owner on 2016.12.10.
10 | */
11 |
12 | public class MainKey
13 | extends ClassKey
14 | implements Parcelable {
15 | public static final MainKey KEY = new MainKey();
16 |
17 | private MainKey() {
18 | }
19 |
20 | protected MainKey(Parcel in) {
21 | }
22 |
23 | public static final Creator CREATOR = new Creator() {
24 | @Override
25 | public MainKey createFromParcel(Parcel in) {
26 | return new MainKey(in);
27 | }
28 |
29 | @Override
30 | public MainKey[] newArray(int size) {
31 | return new MainKey[size];
32 | }
33 | };
34 |
35 | @Override
36 | public int describeContents() {
37 | return 0;
38 | }
39 |
40 | @Override
41 | public void writeToParcel(Parcel dest, int flags) {
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondDetailThirdView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.widget.LinearLayout;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.04.16..
10 | */
11 | public class SecondDetailThirdView
12 | extends LinearLayout {
13 | public SecondDetailThirdView(Context context) {
14 | super(context);
15 | }
16 |
17 | public SecondDetailThirdView(Context context, AttributeSet attrs) {
18 | super(context, attrs);
19 | }
20 |
21 | public SecondDetailThirdView(Context context, AttributeSet attrs, int defStyleAttr) {
22 | super(context, attrs, defStyleAttr);
23 | }
24 |
25 | @TargetApi(21)
26 | public SecondDetailThirdView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
27 | super(context, attrs, defStyleAttr, defStyleRes);
28 | }
29 |
30 | @Override
31 | protected void onFinishInflate() {
32 | super.onFinishInflate();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthDetailSecondView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.widget.LinearLayout;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.04.16..
10 | */
11 | public class FourthDetailSecondView
12 | extends LinearLayout {
13 | public FourthDetailSecondView(Context context) {
14 | super(context);
15 | }
16 |
17 | public FourthDetailSecondView(Context context, AttributeSet attrs) {
18 | super(context, attrs);
19 | }
20 |
21 | public FourthDetailSecondView(Context context, AttributeSet attrs, int defStyleAttr) {
22 | super(context, attrs, defStyleAttr);
23 | }
24 |
25 | @TargetApi(21)
26 | public FourthDetailSecondView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
27 | super(context, attrs, defStyleAttr, defStyleRes);
28 | }
29 |
30 | @Override
31 | protected void onFinishInflate() {
32 | super.onFinishInflate();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/res/layout/view_left_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/about/AboutView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.about;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.widget.RelativeLayout;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.12.10..
10 | */
11 |
12 | public class AboutView
13 | extends RelativeLayout {
14 | public AboutView(Context context) {
15 | super(context);
16 | init();
17 | }
18 |
19 | public AboutView(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | init();
22 | }
23 |
24 | public AboutView(Context context, AttributeSet attrs, int defStyleAttr) {
25 | super(context, attrs, defStyleAttr);
26 | init();
27 | }
28 |
29 | @TargetApi(21)
30 | public AboutView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | init();
33 | }
34 |
35 | public void init() {
36 | if(!isInEditMode()) {
37 | // .
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/TraversalCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | /**
20 | * Supplied by Flow to the Listener, which is responsible for calling onComplete().
21 | */
22 | public interface TraversalCallback {
23 | /**
24 | * Must be called exactly once to indicate that the corresponding transition has completed.
25 | *
26 | * If not called, the history will not be updated and further calls to Flow will not execute.
27 | * Calling more than once will result in an exception.
28 | */
29 | void onTraversalCompleted();
30 | }
31 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/Dispatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | import android.support.annotation.NonNull;
20 |
21 | public interface Dispatcher {
22 | /**
23 | * Called when the history is about to change. Note that Flow does not consider the
24 | * Traversal to be finished, and will not actually update the history, until the callback is
25 | * triggered. Traversals cannot be canceled.
26 | *
27 | * @param callback Must be called to indicate completion of the traversal.
28 | */
29 | void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback);
30 | }
31 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainSecondKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowtransitions;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import flowless.ClassKey;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.12.03..
10 | */
11 |
12 | @Layout(R.layout.scene_main_second)
13 | public class SceneMainSecondKey
14 | extends ClassKey
15 | implements Parcelable {
16 | public static SceneMainSecondKey create() {
17 | return new SceneMainSecondKey();
18 | }
19 |
20 | private SceneMainSecondKey() {
21 | }
22 |
23 | protected SceneMainSecondKey(Parcel in) {
24 | }
25 |
26 | public static final Creator CREATOR = new Creator() {
27 | @Override
28 | public SceneMainSecondKey createFromParcel(Parcel in) {
29 | return new SceneMainSecondKey(in);
30 | }
31 |
32 | @Override
33 | public SceneMainSecondKey[] newArray(int size) {
34 | return new SceneMainSecondKey[size];
35 | }
36 | };
37 |
38 | @Override
39 | public int describeContents() {
40 | return 0;
41 | }
42 |
43 | @Override
44 | public void writeToParcel(Parcel dest, int flags) {
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/flowless-sample-transitions/src/main/java/com/zhuinden/flowtransitions/SceneMainDefaultKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowtransitions;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import flowless.ClassKey;
7 |
8 | /**
9 | * Created by Zhuinden on 2016.12.03..
10 | */
11 |
12 | @Layout(R.layout.scene_main_default)
13 | public class SceneMainDefaultKey
14 | extends ClassKey
15 | implements Parcelable {
16 | public static SceneMainDefaultKey create() {
17 | return new SceneMainDefaultKey();
18 | }
19 |
20 | private SceneMainDefaultKey() {
21 | }
22 |
23 | protected SceneMainDefaultKey(Parcel in) {
24 | }
25 |
26 | public static final Creator CREATOR = new Creator() {
27 | @Override
28 | public SceneMainDefaultKey createFromParcel(Parcel in) {
29 | return new SceneMainDefaultKey(in);
30 | }
31 |
32 | @Override
33 | public SceneMainDefaultKey[] newArray(int size) {
34 | return new SceneMainDefaultKey[size];
35 | }
36 | };
37 |
38 | @Override
39 | public int describeContents() {
40 | return 0;
41 | }
42 |
43 | @Override
44 | public void writeToParcel(Parcel dest, int flags) {
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/flowless-library/src/test/java/flowless/TestKey.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless;
18 |
19 | class TestKey {
20 | final String name;
21 |
22 | TestKey(String name) {
23 | this.name = name;
24 | }
25 |
26 | @Override
27 | public boolean equals(Object o) {
28 | if (this == o) return true;
29 | if (o == null || getClass() != o.getClass()) return false;
30 | TestKey key = (TestKey) o;
31 | return name.equals(key.name);
32 | }
33 |
34 | @Override
35 | public int hashCode() {
36 | return name.hashCode();
37 | }
38 |
39 | @Override public String toString() {
40 | return String.format("%s{%h}", name, this);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/interactor/impl/GetRepositoriesInteractorImpl.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.interactor.impl;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 | import com.zhuinden.examplegithubclient.data.repository.GithubRepoRepository;
5 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
6 | import com.zhuinden.examplegithubclient.domain.interactor.GetRepositoriesInteractor;
7 | import com.zhuinden.examplegithubclient.domain.service.GithubService;
8 |
9 | import java.util.List;
10 |
11 | import javax.inject.Inject;
12 |
13 | import io.reactivex.Single;
14 |
15 | /**
16 | * Created by Owner on 2016.12.10.
17 | */
18 | @ActivityScope
19 | public class GetRepositoriesInteractorImpl
20 | implements GetRepositoriesInteractor {
21 | @Inject
22 | GithubService githubService;
23 |
24 | @Inject
25 | GithubRepoRepository githubRepoRepository;
26 |
27 | @Inject
28 | public GetRepositoriesInteractorImpl() {
29 | }
30 |
31 | @Override
32 | public Single> getRepositories(final String user, int page) {
33 | return githubService.getRepositories(user, page).map(repositories -> githubRepoRepository.saveOrUpdate(repositories));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsKey.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails;
2 |
3 | import android.os.Parcelable;
4 |
5 | import com.google.auto.value.AutoValue;
6 | import com.zhuinden.examplegithubclient.R;
7 | import com.zhuinden.examplegithubclient.presentation.paths.repositories.RepositoriesKey;
8 | import com.zhuinden.examplegithubclient.util.ComponentFactory;
9 | import com.zhuinden.examplegithubclient.util.IsChildOf;
10 | import com.zhuinden.examplegithubclient.util.Layout;
11 | import com.zhuinden.examplegithubclient.util.LeftDrawerEnabled;
12 | import com.zhuinden.examplegithubclient.util.Title;
13 |
14 | /**
15 | * Created by Zhuinden on 2016.12.10..
16 | */
17 |
18 | @AutoValue
19 | @Title(R.string.title_repository_details)
20 | @Layout(R.layout.path_repositorydetails)
21 | @ComponentFactory(RepositoryDetailsComponentFactory.class)
22 | @LeftDrawerEnabled(false)
23 | @IsChildOf(RepositoriesKey.class)
24 | public abstract class RepositoryDetailsKey
25 | implements Parcelable {
26 | abstract RepositoriesKey parent();
27 |
28 | abstract String url();
29 |
30 | public static RepositoryDetailsKey create(RepositoriesKey parent, String url) {
31 | return new AutoValue_RepositoryDetailsKey(parent, url);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/presentation/paths/repositorydetails/RepositoryDetailsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.presentation.paths.repositorydetails;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.KeyScope;
4 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
5 | import com.zhuinden.examplegithubclient.util.BasePresenter;
6 | import com.zhuinden.examplegithubclient.util.Presenter;
7 |
8 | import javax.inject.Inject;
9 |
10 | /**
11 | * Created by Zhuinden on 2016.12.19..
12 | */
13 |
14 | @KeyScope(RepositoryDetailsKey.class)
15 | public class RepositoryDetailsPresenter
16 | extends BasePresenter {
17 | public interface ViewContract
18 | extends Presenter.ViewContract {
19 | GithubRepo getSelectedGithubRepo();
20 |
21 | void setupView(GithubRepo githubRepo);
22 | }
23 |
24 | @Inject
25 | public RepositoryDetailsPresenter() {
26 | }
27 |
28 | GithubRepo selectedGithubRepo;
29 |
30 | @Override
31 | protected void initializeView(ViewContract view) {
32 | selectedGithubRepo = view.getSelectedGithubRepo();
33 | if(selectedGithubRepo != null) { // proper persistence would fix this across process death
34 | view.setupView(selectedGithubRepo);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/Error.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.data.response.error;
2 |
3 | import com.bluelinelabs.logansquare.annotation.JsonField;
4 | import com.bluelinelabs.logansquare.annotation.JsonObject;
5 |
6 | @JsonObject
7 | public class Error {
8 | @JsonField(name = "resource")
9 | private String resource;
10 |
11 | @JsonField(name = "field")
12 | private String field;
13 |
14 | @JsonField(name = "code")
15 | private String code;
16 |
17 | /**
18 | * @return The resource
19 | */
20 | public String getResource() {
21 | return resource;
22 | }
23 |
24 | /**
25 | * @param resource The resource
26 | */
27 | public void setResource(String resource) {
28 | this.resource = resource;
29 | }
30 |
31 | /**
32 | * @return The field
33 | */
34 | public String getField() {
35 | return field;
36 | }
37 |
38 | /**
39 | * @param field The field
40 | */
41 | public void setField(String field) {
42 | this.field = field;
43 | }
44 |
45 | /**
46 | * @return The code
47 | */
48 | public String getCode() {
49 | return code;
50 | }
51 |
52 | /**
53 | * @param code The code
54 | */
55 | public void setCode(String code) {
56 | this.code = code;
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/google/auto/value/AutoValue.java:
--------------------------------------------------------------------------------
1 | package com.google.auto.value;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.SOURCE)
9 | @Target(ElementType.TYPE)
10 | public @interface AutoValue {
11 |
12 | /**
13 | * Specifies that AutoValue should generate an implementation of the annotated class or interface,
14 | * to serve as a builder for the value-type class it is nested within. As a simple example,
15 | * here is an alternative way to write the {@code Person} class mentioned in the {@link AutoValue}
16 | * example:
17 | *
18 | * @AutoValue
19 | * abstract class Person {
20 | * static Builder builder() {
21 | * return new AutoValue_Person.Builder();
22 | * }
23 | *
24 | * abstract String name();
25 | * abstract int id();
26 | *
27 | * @AutoValue.Builder
28 | * interface Builder {
29 | * Builder name(String x);
30 | * Builder id(int x);
31 | * Person build();
32 | * }
33 | * }
34 | *
35 | * @author Éamonn McManus
36 | */
37 | @Retention(RetentionPolicy.SOURCE)
38 | @Target(ElementType.TYPE)
39 | public @interface Builder {
40 | }
41 | }
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/google/auto/value/AutoValue.java:
--------------------------------------------------------------------------------
1 | package com.google.auto.value;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.SOURCE)
9 | @Target(ElementType.TYPE)
10 | public @interface AutoValue {
11 |
12 | /**
13 | * Specifies that AutoValue should generate an implementation of the annotated class or interface,
14 | * to serve as a builder for the value-type class it is nested within. As a simple example,
15 | * here is an alternative way to write the {@code Person} class mentioned in the {@link AutoValue}
16 | * example:
17 | *
18 | * @AutoValue
19 | * abstract class Person {
20 | * static Builder builder() {
21 | * return new AutoValue_Person.Builder();
22 | * }
23 | *
24 | * abstract String name();
25 | * abstract int id();
26 | *
27 | * @AutoValue.Builder
28 | * interface Builder {
29 | * Builder name(String x);
30 | * Builder id(int x);
31 | * Person build();
32 | * }
33 | * }
34 | *
35 | * @author Éamonn McManus
36 | */
37 | @Retention(RetentionPolicy.SOURCE)
38 | @Target(ElementType.TYPE)
39 | public @interface Builder {
40 | }
41 | }
--------------------------------------------------------------------------------
/flowless-sample-single-root/src/main/java/com/google/auto/value/AutoValue.java:
--------------------------------------------------------------------------------
1 | package com.google.auto.value;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.SOURCE)
9 | @Target(ElementType.TYPE)
10 | public @interface AutoValue {
11 |
12 | /**
13 | * Specifies that AutoValue should generate an implementation of the annotated class or interface,
14 | * to serve as a builder for the value-type class it is nested within. As a simple example,
15 | * here is an alternative way to write the {@code Person} class mentioned in the {@link AutoValue}
16 | * example:
17 | *
18 | * @AutoValue
19 | * abstract class Person {
20 | * static Builder builder() {
21 | * return new AutoValue_Person.Builder();
22 | * }
23 | *
24 | * abstract String name();
25 | * abstract int id();
26 | *
27 | * @AutoValue.Builder
28 | * interface Builder {
29 | * Builder name(String x);
30 | * Builder id(int x);
31 | * Person build();
32 | * }
33 | * }
34 | *
35 | * @author Éamonn McManus
36 | */
37 | @Retention(RetentionPolicy.SOURCE)
38 | @Target(ElementType.TYPE)
39 | public @interface Builder {
40 | }
41 | }
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/google/auto/value/AutoValue.java:
--------------------------------------------------------------------------------
1 | package com.google.auto.value;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.SOURCE)
9 | @Target(ElementType.TYPE)
10 | public @interface AutoValue {
11 |
12 | /**
13 | * Specifies that AutoValue should generate an implementation of the annotated class or interface,
14 | * to serve as a builder for the value-type class it is nested within. As a simple example,
15 | * here is an alternative way to write the {@code Person} class mentioned in the {@link AutoValue}
16 | * example:
17 | *
18 | * @AutoValue
19 | * abstract class Person {
20 | * static Builder builder() {
21 | * return new AutoValue_Person.Builder();
22 | * }
23 | *
24 | * abstract String name();
25 | * abstract int id();
26 | *
27 | * @AutoValue.Builder
28 | * interface Builder {
29 | * Builder name(String x);
30 | * Builder id(int x);
31 | * Person build();
32 | * }
33 | * }
34 | *
35 | * @author Éamonn McManus
36 | */
37 | @Retention(RetentionPolicy.SOURCE)
38 | @Target(ElementType.TYPE)
39 | public @interface Builder {
40 | }
41 | }
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/preset/BaseDispatcher.java:
--------------------------------------------------------------------------------
1 | package flowless.preset;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.view.ViewGroup;
6 |
7 | import flowless.Dispatcher;
8 | import flowless.Traversal;
9 | import flowless.TraversalCallback;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.01..
13 | */
14 | public abstract class BaseDispatcher
15 | implements Dispatcher, FlowLifecycles {
16 | public static class RootHolder {
17 | protected ViewGroup root;
18 |
19 | public RootHolder() {
20 | }
21 |
22 | public ViewGroup getRoot() {
23 | return root;
24 | }
25 |
26 | public void setRoot(ViewGroup root) {
27 | this.root = root;
28 | }
29 | }
30 |
31 | protected Context baseContext;
32 | protected final RootHolder rootHolder;
33 |
34 | public BaseDispatcher() {
35 | this.rootHolder = createRootHolder();
36 | }
37 |
38 | protected RootHolder createRootHolder() {
39 | return new RootHolder();
40 | }
41 |
42 | public void setBaseContext(Context baseContext) {
43 | this.baseContext = baseContext;
44 | }
45 |
46 | public RootHolder getRootHolder() {
47 | return rootHolder;
48 | }
49 |
50 | @Override
51 | public abstract void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback);
52 | }
53 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/service/impl/GithubServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.service.impl;
2 |
3 | import com.zhuinden.examplegithubclient.application.injection.ActivityScope;
4 | import com.zhuinden.examplegithubclient.domain.data.response.organization.Organization;
5 | import com.zhuinden.examplegithubclient.domain.data.response.repositories.GithubRepo;
6 | import com.zhuinden.examplegithubclient.domain.service.GithubService;
7 | import com.zhuinden.examplegithubclient.domain.service.retrofit.RetrofitGithubService;
8 |
9 | import java.util.List;
10 |
11 | import javax.inject.Inject;
12 |
13 | import io.reactivex.Single;
14 |
15 | /**
16 | * Created by Owner on 2016.12.10.
17 | */
18 | @ActivityScope
19 | public class GithubServiceImpl
20 | implements GithubService {
21 | private RetrofitGithubService retrofitGithubService;
22 |
23 | @Inject
24 | public GithubServiceImpl(RetrofitGithubService retrofitGithubService) {
25 | this.retrofitGithubService = retrofitGithubService;
26 | }
27 |
28 | @Override
29 | public Single> getOrganizations(String user) {
30 | return retrofitGithubService.getOrganizations(user);
31 | }
32 |
33 | @Override
34 | public Single> getRepositories(String user, int page) {
35 | return retrofitGithubService.getRepositories(user, page);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/PagerViewOne.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.widget.RelativeLayout;
8 |
9 | import flowless.preset.FlowLifecycles;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.17..
13 | */
14 | public class PagerViewOne extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener {
15 | private static final String TAG = "PagerViewOne";
16 |
17 | public PagerViewOne(Context context) {
18 | super(context);
19 | }
20 |
21 | public PagerViewOne(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public PagerViewOne(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @TargetApi(21)
30 | public PagerViewOne(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 | @Override
35 | public void onViewRestored() {
36 | Log.i(TAG, "View restored in [" + TAG + "]");
37 | }
38 |
39 | @Override
40 | public void onViewDestroyed(boolean removedByFlow) {
41 | Log.i(TAG, "View destroyed in [" + TAG + "]");
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/PagerViewTwo.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.widget.RelativeLayout;
8 |
9 | import flowless.preset.FlowLifecycles;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.17..
13 | */
14 | public class PagerViewTwo extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener {
15 | private static final String TAG = "PagerViewTwo";
16 |
17 | public PagerViewTwo(Context context) {
18 | super(context);
19 | }
20 |
21 | public PagerViewTwo(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public PagerViewTwo(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @TargetApi(21)
30 | public PagerViewTwo(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 |
35 | @Override
36 | public void onViewRestored() {
37 | Log.i(TAG, "View restored in [" + TAG + "]");
38 | }
39 |
40 | @Override
41 | public void onViewDestroyed(boolean removedByFlow) {
42 | Log.i(TAG, "View destroyed in [" + TAG + "]");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/organization/Permission.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.data.response.organization;
2 |
3 | import com.bluelinelabs.logansquare.annotation.JsonField;
4 | import com.bluelinelabs.logansquare.annotation.JsonObject;
5 |
6 | /**
7 | * Created by Owner on 2016.12.10.
8 | */
9 | @JsonObject
10 | public class Permission {
11 | @JsonField(name = "admin")
12 | private Boolean admin;
13 | @JsonField(name = "push")
14 | private Boolean push;
15 | @JsonField(name = "pull")
16 | private Boolean pull;
17 |
18 | /**
19 | * @return The admin
20 | */
21 | public Boolean getAdmin() {
22 | return admin;
23 | }
24 |
25 | /**
26 | * @param admin The admin
27 | */
28 | public void setAdmin(Boolean admin) {
29 | this.admin = admin;
30 | }
31 |
32 | /**
33 | * @return The push
34 | */
35 | public Boolean getPush() {
36 | return push;
37 | }
38 |
39 | /**
40 | * @param push The push
41 | */
42 | public void setPush(Boolean push) {
43 | this.push = push;
44 | }
45 |
46 | /**
47 | * @return The pull
48 | */
49 | public Boolean getPull() {
50 | return pull;
51 | }
52 |
53 | /**
54 | * @param pull The pull
55 | */
56 | public void setPull(Boolean pull) {
57 | this.pull = pull;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/layout/landscape_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
34 |
35 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/PagerViewFive.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.widget.RelativeLayout;
8 |
9 | import flowless.preset.FlowLifecycles;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.17..
13 | */
14 | public class PagerViewFive extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener {
15 | private static final String TAG = "PagerViewFive";
16 |
17 | public PagerViewFive(Context context) {
18 | super(context);
19 | }
20 |
21 | public PagerViewFive(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public PagerViewFive(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @TargetApi(21)
30 | public PagerViewFive(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 |
35 | @Override
36 | public void onViewRestored() {
37 | Log.i(TAG, "View restored in [" + TAG + "]");
38 | }
39 |
40 | @Override
41 | public void onViewDestroyed(boolean removedByFlow) {
42 | Log.i(TAG, "View destroyed in [" + TAG + "]");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/PagerViewFour.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.widget.RelativeLayout;
8 |
9 | import flowless.preset.FlowLifecycles;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.17..
13 | */
14 | public class PagerViewFour extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener {
15 | private static final String TAG = "PagerViewFour";
16 |
17 | public PagerViewFour(Context context) {
18 | super(context);
19 | }
20 |
21 | public PagerViewFour(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public PagerViewFour(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @TargetApi(21)
30 | public PagerViewFour(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 |
35 | @Override
36 | public void onViewRestored() {
37 | Log.i(TAG, "View restored in [" + TAG + "]");
38 | }
39 |
40 | @Override
41 | public void onViewDestroyed(boolean removedByFlow) {
42 | Log.i(TAG, "View destroyed in [" + TAG + "]");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/src/main/java/com/zhuinden/flowless_viewpager_example/PagerViewThree.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flowless_viewpager_example;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.widget.RelativeLayout;
8 |
9 | import flowless.preset.FlowLifecycles;
10 |
11 | /**
12 | * Created by Zhuinden on 2016.07.17..
13 | */
14 | public class PagerViewThree extends RelativeLayout implements FlowLifecycles.ViewLifecycleListener {
15 | private static final String TAG = "PagerViewThree";
16 |
17 | public PagerViewThree(Context context) {
18 | super(context);
19 | }
20 |
21 | public PagerViewThree(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public PagerViewThree(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @TargetApi(21)
30 | public PagerViewThree(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 | @Override
35 | public void onViewRestored() {
36 | Log.i(TAG, "View restored in [" + TAG + "]");
37 | }
38 |
39 | @Override
40 | public void onViewDestroyed(boolean removedByFlow) {
41 | Log.i(TAG, "View destroyed in [" + TAG + "]");
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FirstView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class FirstView
17 | extends LinearLayout {
18 | public FirstView(Context context) {
19 | super(context);
20 | }
21 |
22 | public FirstView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public FirstView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public FirstView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.first_button).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(SecondMasterKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/res/layout/loose_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
27 |
35 |
36 |
--------------------------------------------------------------------------------
/flowless-library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | group='com.github.Zhuinden'
5 |
6 | android {
7 | compileSdkVersion 24
8 | buildToolsVersion "24.0.2"
9 |
10 | defaultConfig {
11 | minSdkVersion 14
12 | targetSdkVersion 24
13 | versionCode 1
14 | versionName "1.0-RC1"
15 | }
16 | }
17 |
18 | dependencies {
19 | compile fileTree(dir: 'libs', include: ['*.jar'])
20 | compile 'com.android.support:support-annotations:24.1.1'
21 |
22 | testCompile 'junit:junit:4.12'
23 | testCompile 'org.assertj:assertj-core:1.7.1'
24 | testCompile 'org.mockito:mockito-core:1.10.19'
25 | testCompile 'org.robolectric:robolectric:3.0'
26 | testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
27 | }
28 |
29 | // build a jar with source files
30 | task sourcesJar(type: Jar) {
31 | from android.sourceSets.main.java.srcDirs
32 | classifier = 'sources'
33 | }
34 |
35 | task javadoc(type: Javadoc) {
36 | failOnError false
37 | source = android.sourceSets.main.java.sourceFiles
38 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
39 | classpath += configurations.compile
40 | }
41 |
42 | // build a jar with javadoc
43 | task javadocJar(type: Jar, dependsOn: javadoc) {
44 | classifier = 'javadoc'
45 | from javadoc.destinationDir
46 | }
47 |
48 | artifacts {
49 | archives sourcesJar
50 | archives javadocJar
51 | }
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/preset/FlowLifecycles.java:
--------------------------------------------------------------------------------
1 | package flowless.preset;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.NonNull;
6 |
7 | /**
8 | * Created by Zhuinden on 2016.07.01..
9 | */
10 | public interface FlowLifecycles {
11 | public interface BackPressListener {
12 | boolean onBackPressed();
13 | }
14 |
15 | public interface CreateDestroyListener {
16 | void onCreate(Bundle bundle);
17 |
18 | void onDestroy();
19 | }
20 |
21 | public interface StartStopListener {
22 | void onStart();
23 |
24 | void onStop();
25 | }
26 |
27 | public interface ResumePauseListener {
28 | void onResume();
29 |
30 | void onPause();
31 | }
32 |
33 | public interface ViewLifecycleListener {
34 | void onViewRestored();
35 |
36 | void onViewDestroyed(boolean removedByFlow);
37 | }
38 |
39 | public interface PreSaveViewStateListener {
40 | void preSaveViewState();
41 | }
42 |
43 | public interface ViewStatePersistenceListener {
44 | void onSaveInstanceState(@NonNull Bundle outState);
45 | }
46 |
47 | public interface ActivityResultListener {
48 | void onActivityResult(int requestCode, int resultCode, Intent data);
49 | }
50 |
51 | public interface PermissionRequestListener {
52 | void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondMasterView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class SecondMasterView
17 | extends LinearLayout {
18 | public SecondMasterView(Context context) {
19 | super(context);
20 | }
21 |
22 | public SecondMasterView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public SecondMasterView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public SecondMasterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.second_master_button).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(SecondDetailKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthMasterView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class FourthMasterView
17 | extends LinearLayout {
18 | public FourthMasterView(Context context) {
19 | super(context);
20 | }
21 |
22 | public FourthMasterView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public FourthMasterView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public FourthMasterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.fourth_master_start_detail).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(FourthDetailKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/FourthDetailView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class FourthDetailView
17 | extends LinearLayout {
18 | public FourthDetailView(Context context) {
19 | super(context);
20 | }
21 |
22 | public FourthDetailView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public FourthDetailView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public FourthDetailView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.fourth_detail_start_detail).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(FourthDetailSecondKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flowless-mvp-example/src/main/java/com/zhuinden/examplegithubclient/domain/data/response/error/ErrorResponse.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.examplegithubclient.domain.data.response.error;
2 |
3 | /**
4 | * Created by Owner on 2016.12.10.
5 | */
6 |
7 | import com.bluelinelabs.logansquare.annotation.JsonField;
8 | import com.bluelinelabs.logansquare.annotation.JsonObject;
9 |
10 | import java.util.List;
11 |
12 | @JsonObject
13 | public class ErrorResponse {
14 | @JsonField(name = "message")
15 | private String message;
16 | @JsonField(name = "errors")
17 | private List errors = null;
18 | @JsonField(name = "documentation_url")
19 | private String documentationUrl;
20 |
21 | /**
22 | * @return The message
23 | */
24 | public String getMessage() {
25 | return message;
26 | }
27 |
28 | /**
29 | * @param message The message
30 | */
31 | public void setMessage(String message) {
32 | this.message = message;
33 | }
34 |
35 | /**
36 | * @return The errors
37 | */
38 | public List getErrors() {
39 | return errors;
40 | }
41 |
42 | /**
43 | * @param errors The errors
44 | */
45 | public void setErrors(List errors) {
46 | this.errors = errors;
47 | }
48 |
49 | public String getDocumentationUrl() {
50 | return documentationUrl;
51 | }
52 |
53 | public void setDocumentationUrl(String documentationUrl) {
54 | this.documentationUrl = documentationUrl;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/ThirdFullScreenView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class ThirdFullScreenView
17 | extends LinearLayout {
18 | public ThirdFullScreenView(Context context) {
19 | super(context);
20 | }
21 |
22 | public ThirdFullScreenView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public ThirdFullScreenView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public ThirdFullScreenView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.third_full_screen_button).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(FourthMasterKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LooseView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flow.sample.orientation;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.view.View;
22 | import android.widget.LinearLayout;
23 |
24 | import flowless.Flow;
25 |
26 | public final class LooseView
27 | extends LinearLayout {
28 |
29 | public LooseView(Context context, AttributeSet attrs) {
30 | super(context, attrs);
31 | setOrientation(VERTICAL);
32 | }
33 |
34 | @Override
35 | protected void onFinishInflate() {
36 | super.onFinishInflate();
37 | findViewById(R.id.loose_text).setOnClickListener(new OnClickListener() {
38 | @Override
39 | public void onClick(View v) {
40 | Flow.get(getContext()).set(LandscapeScreen.INSTANCE);
41 | }
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/res/layout/welcome_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
30 |
31 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/flowless-sample-master-detail/src/main/java/com/zhuinden/flow_alpha_master_detail/paths/SecondDetailSecondView.java:
--------------------------------------------------------------------------------
1 | package com.zhuinden.flow_alpha_master_detail.paths;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 | import android.widget.LinearLayout;
8 |
9 | import com.zhuinden.flow_alpha_master_detail.R;
10 |
11 | import flowless.Flow;
12 |
13 | /**
14 | * Created by Zhuinden on 2016.04.16..
15 | */
16 | public class SecondDetailSecondView
17 | extends LinearLayout {
18 | public SecondDetailSecondView(Context context) {
19 | super(context);
20 | }
21 |
22 | public SecondDetailSecondView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public SecondDetailSecondView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @TargetApi(21)
31 | public SecondDetailSecondView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
32 | super(context, attrs, defStyleAttr, defStyleRes);
33 | }
34 |
35 | @Override
36 | protected void onFinishInflate() {
37 | super.onFinishInflate();
38 | findViewById(R.id.second_detail_second_button).setOnClickListener(new OnClickListener() {
39 | @Override
40 | public void onClick(View v) {
41 | Flow.get(v).set(SecondDetailThirdKey.create());
42 | }
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/java/flow/sample/orientation/LandscapeView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flow.sample.orientation;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 | import android.view.View;
22 | import android.widget.LinearLayout;
23 |
24 | import flowless.Flow;
25 |
26 | public final class LandscapeView
27 | extends LinearLayout {
28 |
29 | public LandscapeView(Context context, AttributeSet attrs) {
30 | super(context, attrs);
31 | setOrientation(VERTICAL);
32 | }
33 |
34 | @Override
35 | protected void onFinishInflate() {
36 | super.onFinishInflate();
37 | findViewById(R.id.landscape_text).setOnClickListener(new OnClickListener() {
38 | @Override
39 | public void onClick(View v) {
40 | Flow.get(getContext()).set(LooseScreen.INSTANCE);
41 | }
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/flowless-viewpager-example/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.neenbedankt.android-apt'
3 |
4 |
5 | android {
6 | compileSdkVersion 24
7 | buildToolsVersion "24.0.1"
8 |
9 | defaultConfig {
10 | applicationId "com.zhuinden.flowless_viewpager_example"
11 | minSdkVersion 14
12 | targetSdkVersion 24
13 | versionCode 1
14 | versionName "1.0"
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | packagingOptions {
23 | // Exclude file to avoid
24 | // Error: Duplicate files during packaging of APK
25 | exclude 'META-INF/DEPENDENCIES'
26 | exclude 'META-INF/LICENSE'
27 | exclude 'META-INF/LICENSE.txt'
28 | exclude 'META-INF/license.txt'
29 | exclude 'META-INF/NOTICE'
30 | exclude 'META-INF/NOTICE.txt'
31 | exclude 'META-INF/notice.txt'
32 | exclude 'META-INF/ASL2.0'
33 | exclude 'META-INF/services/javax.annotation.processing.Processor'
34 | }
35 | }
36 |
37 | dependencies {
38 | compile fileTree(dir: 'libs', include: ['*.jar'])
39 | compile project(':flowless-library')
40 | testCompile 'junit:junit:4.12'
41 | compile 'com.android.support:appcompat-v7:24.1.1'
42 | compile 'com.jakewharton:butterknife:8.2.1'
43 | apt 'com.jakewharton:butterknife-compiler:8.2.1'
44 | apt 'frankiesardo:auto-parcel:1.0.1'
45 | }
46 |
--------------------------------------------------------------------------------
/flow-sample-orientation-lock/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
21 |
22 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/flowless-library/src/main/java/flowless/Preconditions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Guava Authors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 |
15 | package flowless;
16 |
17 | /*final*/ class Preconditions {
18 | private Preconditions() {
19 | throw new AssertionError();
20 | }
21 |
22 | /**
23 | * @throws java.lang.IllegalArgumentException if condition is false.
24 | */
25 | static void checkArgument(boolean condition, String errorMessage) {
26 | if(!condition) {
27 | throw new IllegalArgumentException(errorMessage);
28 | }
29 | }
30 |
31 | /**
32 | * @param reference an object reference
33 | * @return the non-null reference that was validated
34 | * @throws NullPointerException if {@code reference} is null
35 | */
36 | static T checkNotNull(T reference, String errorMessage, Object... args) {
37 | if(reference == null) {
38 | throw new NullPointerException(String.format(errorMessage, args));
39 | }
40 | return reference;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/flow-sample-basic/src/main/java/flowless/sample/basic/WelcomeScreen.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Square Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package flowless.sample.basic;
18 |
19 | import android.os.Parcel;
20 | import android.os.Parcelable;
21 |
22 | final class WelcomeScreen
23 | implements Parcelable {
24 | @Override
25 | public void writeToParcel(Parcel dest, int flags) {
26 | }
27 |
28 | @Override
29 | public int describeContents() {
30 | return 0;
31 | }
32 |
33 | public static final Creator CREATOR = new Creator() {
34 | @Override
35 | public WelcomeScreen createFromParcel(Parcel in) {
36 | return new WelcomeScreen();
37 | }
38 |
39 | @Override
40 | public WelcomeScreen[] newArray(int size) {
41 | return new WelcomeScreen[size];
42 | }
43 | };
44 |
45 | @Override
46 | public boolean equals(Object o) {
47 | return o != null && o instanceof WelcomeScreen;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------