Android Open Source - EffectiveAndroidUI Tv Shows Application






From Project

Back to project page EffectiveAndroidUI.

License

The source code is released under:

Apache License

If you think the Android project EffectiveAndroidUI 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

/*
 * Copyright (C) 2014 Pedro Vicente Gmez Snchez.
 */*from   w w  w.jav a 2s.  co  m*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.pedrovgs.effectiveandroidui;

import android.app.Application;
import com.github.pedrovgs.effectiveandroidui.di.RootModule;
import dagger.ObjectGraph;
import java.util.List;

/**
 * Android Application extension created to get the control of the application lifecycle.
 * <p/>
 * This project is using Dependency Injection based on Dagger as dependency injector. The
 * ObjectGraph field used in this class is the dependency container that is going to provide every
 * dependency declared in Dagger modules. Take a look to BaseActivit to see how the Activity scope
 * injection works using the plus method implemented here.
 *
 * @author Pedro Vicente Gmez Snchez
 */
public class TvShowsApplication extends Application {

  private ObjectGraph objectGraph;

  @Override
  public void onCreate() {
    super.onCreate();
    initializeDependencyInjector();
  }

  /*
   * We could use this code to enable or disable night mode or eve use a auto night mode.
   * But to use this feature we have to enable car mode and the UX is not the expected :S
   * If you enable car mode the application is going to show a persistent notification!
   *
   * Use this method inside the onCreate and create a new "values-night" directory with some
   * color changes to show how it works.
   *
   */
  private void initializeUiManager() {
    /*
     * UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
     * uiModeManager.enableCarMode(0);
     * uiModeManager.setNightMode(UiModeManager.MODE_NIGHT_AUTO);
    */
  }

  /**
   * Inject every dependency declared in the object with the @Inject annotation if the dependency
   * has been already declared in a module and already initialized by Dagger.
   *
   * @param object to inject.
   */
  public void inject(Object object) {
    objectGraph.inject(object);
  }

  /**
   * Extend the dependency container graph will new dependencies provided by the modules passed as
   * arguments.
   *
   * @param modules used to populate the dependency container.
   */
  public ObjectGraph plus(List<Object> modules) {
    if (modules == null) {
      throw new IllegalArgumentException(
          "You can't plus a null module, review your getModules() implementation");
    }
    return objectGraph.plus(modules.toArray());
  }

  private void initializeDependencyInjector() {
    objectGraph = ObjectGraph.create(new RootModule(this));
    objectGraph.inject(this);
    objectGraph.injectStatics();
  }
}




Java Source Code List

com.github.pedrovgs.effectiveandroidui.TvShowsApplication.java
com.github.pedrovgs.effectiveandroidui.di.ActivityContext.java
com.github.pedrovgs.effectiveandroidui.di.ActivityModule.java
com.github.pedrovgs.effectiveandroidui.di.RootModule.java
com.github.pedrovgs.effectiveandroidui.domain.GetTvShowByIdInteractor.java
com.github.pedrovgs.effectiveandroidui.domain.GetTvShowById.java
com.github.pedrovgs.effectiveandroidui.domain.GetTvShowsInteractor.java
com.github.pedrovgs.effectiveandroidui.domain.GetTvShows.java
com.github.pedrovgs.effectiveandroidui.domain.TvShowsModule.java
com.github.pedrovgs.effectiveandroidui.domain.exception.TvShowNotFoundException.java
com.github.pedrovgs.effectiveandroidui.domain.tvshow.Catalog.java
com.github.pedrovgs.effectiveandroidui.domain.tvshow.ChapterCollection.java
com.github.pedrovgs.effectiveandroidui.domain.tvshow.Chapter.java
com.github.pedrovgs.effectiveandroidui.domain.tvshow.TvShow.java
com.github.pedrovgs.effectiveandroidui.executor.ExecutorModule.java
com.github.pedrovgs.effectiveandroidui.executor.Executor.java
com.github.pedrovgs.effectiveandroidui.executor.Interactor.java
com.github.pedrovgs.effectiveandroidui.executor.MainThreadImpl.java
com.github.pedrovgs.effectiveandroidui.executor.MainThread.java
com.github.pedrovgs.effectiveandroidui.executor.ThreadExecutor.java
com.github.pedrovgs.effectiveandroidui.ui.activity.BaseActivity.java
com.github.pedrovgs.effectiveandroidui.ui.activity.MainActivity.java
com.github.pedrovgs.effectiveandroidui.ui.activity.Navigator.java
com.github.pedrovgs.effectiveandroidui.ui.activity.TvShowActivity.java
com.github.pedrovgs.effectiveandroidui.ui.fragment.BaseFragment.java
com.github.pedrovgs.effectiveandroidui.ui.fragment.TvShowCatalogFragment.java
com.github.pedrovgs.effectiveandroidui.ui.fragment.TvShowDraggableFragment.java
com.github.pedrovgs.effectiveandroidui.ui.fragment.TvShowFragment.java
com.github.pedrovgs.effectiveandroidui.ui.presenter.Presenter.java
com.github.pedrovgs.effectiveandroidui.ui.presenter.TvShowCatalogPresenter.java
com.github.pedrovgs.effectiveandroidui.ui.presenter.TvShowPresenter.java
com.github.pedrovgs.effectiveandroidui.ui.presenter.TvShowUIModule.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterAdapteeCollection.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRendererAdapterFactory.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRendererAdapter.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRendererBuilder.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapter.ChapterRenderer.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapterviewmodel.ChapterViewModelCollection.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapterviewmodel.ChapterViewModelRendererAdapterFactory.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapterviewmodel.ChapterViewModelRendererAdapter.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapterviewmodel.ChapterViewModelRendererBuilder.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.chapterviewmodel.ChapterViewModelRenderer.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowCollection.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowRendererAdapterFactory.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowRendererBuilder.java
com.github.pedrovgs.effectiveandroidui.ui.renderer.tvshow.TvShowRenderer.java
com.github.pedrovgs.effectiveandroidui.ui.viewmodel.ChapterViewModel.java
com.github.pedrovgs.effectiveandroidui.ui.viewmodel.TvShowViewModel.java
com.github.pedrovgs.effectiveandroidui.ui.viewmodel.action.ActionCommand.java
com.github.pedrovgs.effectiveandroidui.ui.viewmodel.action.ShowTvShowOnBrowserActionCommand.java
com.github.pedrovgs.effectiveandroidui.util.RandomUtils.java
com.github.pedrovgs.effectiveandroidui.util.StringUtils.java
com.github.pedrovgs.effectiveandroidui.util.TimeMachine.java
com.github.pedrovgs.effectiveandroidui.util.ToastUtils.java