Android Open Source - NerdRoll Main Screen






From Project

Back to project page NerdRoll.

License

The source code is released under:

Apache License

If you think the Android project NerdRoll listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bignerdranch.android.nerdroll.screen;
//from   w w w . jav  a 2 s.co m
import com.bignerdranch.android.nerdroll.MainApplicationModule;
import com.bignerdranch.android.nerdroll.android.ActionBarOwner;
import com.bignerdranch.android.nerdroll.util.FlowOwner;
import com.bignerdranch.android.nerdroll.view.MainView;
import com.bignerdranch.android.nerdroll.android.ActionBarModule;
import com.bignerdranch.android.nerdroll.util.MainScope;

import javax.inject.Inject;
import javax.inject.Singleton;

import dagger.Provides;
import flow.Flow;
import flow.HasParent;
import flow.Parcer;
import mortar.Blueprint;

public class MainScreen implements Blueprint {

    @Override
    public String getMortarScopeName() {
        return getClass().getName();
    }

    @Override
    public Object getDaggerModule() {
        return new Module();
    }

    @dagger.Module(
            includes = ActionBarModule.class,
            injects = MainView.class,
            addsTo = MainApplicationModule.class,
            library = true
    )
    public static class Module {

        @Provides
        @MainScope
        Flow provideFlow(Presenter presenter) {
            return presenter.getFlow();
        }

    }

    @Singleton
    public static class Presenter extends FlowOwner<Blueprint, MainView> {

        private final ActionBarOwner mActionBarOwner;
        private String mTitle;

        @Inject
        public Presenter(Parcer<Object> flowParcer, ActionBarOwner actionBarOwner) {
            super(flowParcer);
            this.mActionBarOwner = actionBarOwner;
        }

        @Override
        public void showScreen(Blueprint newScreen, Flow.Direction direction) {
            boolean hasUp = newScreen instanceof HasParent;
            ActionBarOwner.MenuAction menu = null;
            mActionBarOwner.setConfig(new ActionBarOwner.Config(false, hasUp, mTitle, menu));
            super.showScreen(newScreen, direction);
        }

        @Override
        protected Blueprint getFirstScreen() {
            return new DieListScreen();
        }

        public void setTitle(String title) {
            mTitle = title;
        }

    }

}




Java Source Code List

com.bignerdranch.android.nerdroll.ApplicationTest.java
com.bignerdranch.android.nerdroll.ApplicationTest.java
com.bignerdranch.android.nerdroll.MainActivity.java
com.bignerdranch.android.nerdroll.MainActivity.java
com.bignerdranch.android.nerdroll.MainApplicationModule.java
com.bignerdranch.android.nerdroll.MainApplicationModule.java
com.bignerdranch.android.nerdroll.MainApplication.java
com.bignerdranch.android.nerdroll.MainApplication.java
com.bignerdranch.android.nerdroll.android.ActionBarModule.java
com.bignerdranch.android.nerdroll.android.ActionBarOwner.java
com.bignerdranch.android.nerdroll.controller.DieFragment.java
com.bignerdranch.android.nerdroll.controller.DieListFragment.java
com.bignerdranch.android.nerdroll.model.DieList.java
com.bignerdranch.android.nerdroll.model.DieList.java
com.bignerdranch.android.nerdroll.model.Die.java
com.bignerdranch.android.nerdroll.model.Die.java
com.bignerdranch.android.nerdroll.screen.DieListScreen.java
com.bignerdranch.android.nerdroll.screen.DieScreen.java
com.bignerdranch.android.nerdroll.screen.MainScreen.java
com.bignerdranch.android.nerdroll.util.CanShowScreen.java
com.bignerdranch.android.nerdroll.util.FlowOwner.java
com.bignerdranch.android.nerdroll.util.GsonParcer.java
com.bignerdranch.android.nerdroll.util.MainScope.java
com.bignerdranch.android.nerdroll.util.ScreenConductor.java
com.bignerdranch.android.nerdroll.view.DieListView.java
com.bignerdranch.android.nerdroll.view.DieView.java
com.bignerdranch.android.nerdroll.view.MainView.java