Search in sources :

Example 36 with BasePresenter

use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.

the class StudioFavouriteFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null)
        userId = getArguments().getLong(KeyUtil.arg_id);
    setPresenter(new BasePresenter(getContext()));
    mColumnSize = R.integer.grid_list_x2;
    isPager = true;
    setViewModel(true);
}
Also used : BasePresenter(com.mxt.anitrend.presenter.base.BasePresenter)

Example 37 with BasePresenter

use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.

the class AiringListFragment method onCreate.

/**
 * Override and set presenter, mColumnSize, and fetch argument/s
 *
 * @param savedInstanceState
 */
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setPresenter(new BasePresenter(getContext()));
    isPager = true;
    mColumnSize = R.integer.grid_list_x2;
    setViewModel(true);
}
Also used : BasePresenter(com.mxt.anitrend.presenter.base.BasePresenter)

Example 38 with BasePresenter

use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.

the class SharedContentActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_share_content);
    bottomSheetBehavior = BottomSheetBehavior.from(binding.designBottomSheet);
    setPresenter(new BasePresenter(getApplicationContext()));
    ButterKnife.bind(this);
    setViewModel(true);
}
Also used : BasePresenter(com.mxt.anitrend.presenter.base.BasePresenter)

Example 39 with BasePresenter

use of com.mxt.anitrend.presenter.base.BasePresenter in project anitrend-app by AniTrend.

the class TagGenreService method onHandleIntent.

@Override
protected void onHandleIntent(@Nullable Intent intent) {
    try {
        initAnalytics();
        BasePresenter basePresenter = new BasePresenter(getApplicationContext());
        BaseModel baseModel = WebFactory.createService(BaseModel.class, getApplicationContext());
        if (basePresenter.getDatabase().getBoxStore(MediaTag.class).count() < 1) {
            Response<List<MediaTag>> tagsResponse = baseModel.getTags(GraphUtil.getDefaultQuery(false)).execute();
            if (tagsResponse.isSuccessful() && tagsResponse.body() != null)
                basePresenter.getDatabase().saveMediaTags(tagsResponse.body());
            else
                Log.e(ServiceName, ErrorUtil.getError(tagsResponse));
        }
        if (basePresenter.getDatabase().getBoxStore(Genre.class).count() < 1) {
            Response<List<String>> genreResponse = baseModel.getGenres(GraphUtil.getDefaultQuery(false)).execute();
            List<String> genres;
            if (genreResponse.isSuccessful() && (genres = genreResponse.body()) != null) {
                List<Genre> genreList = Stream.of(genres).map(Genre::new).toList();
                basePresenter.getDatabase().saveGenreCollection(genreList);
            } else
                Log.e(ServiceName, ErrorUtil.getError(genreResponse));
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : BaseModel(com.mxt.anitrend.model.api.retro.anilist.BaseModel) List(java.util.List) Genre(com.mxt.anitrend.model.entity.anilist.Genre) IOException(java.io.IOException) BasePresenter(com.mxt.anitrend.presenter.base.BasePresenter)

Aggregations

BasePresenter (com.mxt.anitrend.presenter.base.BasePresenter)39 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 CommonPresenter (com.mxt.anitrend.base.custom.presenter.CommonPresenter)1 BaseModel (com.mxt.anitrend.model.api.retro.anilist.BaseModel)1 UserModel (com.mxt.anitrend.model.api.retro.anilist.UserModel)1 Genre (com.mxt.anitrend.model.entity.anilist.Genre)1 ApplicationPref (com.mxt.anitrend.util.ApplicationPref)1 IOException (java.io.IOException)1 List (java.util.List)1