Search in sources :

Example 1 with MoviesDiscoverLink

use of com.battlelancer.seriesguide.enums.MoviesDiscoverLink in project SeriesGuide by UweTrottmann.

the class MoviesDiscoverAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder instanceof LinkViewHolder) {
        LinkViewHolder holderActual = (LinkViewHolder) holder;
        MoviesDiscoverLink link = getLink(position);
        holderActual.link = link;
        holderActual.title.setText(link.titleRes);
    } else if (holder instanceof HeaderViewHolder) {
        HeaderViewHolder holderActual = (HeaderViewHolder) holder;
        holderActual.header.setText(DISCOVER_LINK_DEFAULT.titleRes);
    } else {
        super.onBindViewHolder(holder, position);
    }
}
Also used : MoviesDiscoverLink(com.battlelancer.seriesguide.enums.MoviesDiscoverLink)

Example 2 with MoviesDiscoverLink

use of com.battlelancer.seriesguide.enums.MoviesDiscoverLink in project SeriesGuide by UweTrottmann.

the class MoviesSearchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movies_search);
    setupNavDrawer();
    int linkId = getIntent().getIntExtra(EXTRA_ID_LINK, MoviesDiscoverAdapter.DISCOVER_LINK_DEFAULT.id);
    MoviesDiscoverLink link = MoviesDiscoverLink.fromId(linkId);
    showSearchView = link == MoviesDiscoverAdapter.DISCOVER_LINK_DEFAULT;
    if (savedInstanceState != null) {
        showSearchView = savedInstanceState.getBoolean(STATE_SEARCH_VISIBLE, showSearchView);
    }
    ButterKnife.bind(this);
    setupActionBar(link);
    if (savedInstanceState == null) {
        if (showSearchView) {
            Utils.showSoftKeyboardOnSearchView(this, searchView);
        }
        getSupportFragmentManager().beginTransaction().add(R.id.containerMoviesSearchFragment, MoviesSearchFragment.newInstance(link)).commit();
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            postponeEnterTransition();
            containerMoviesSearchFragment.post(new Runnable() {

                @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void run() {
                    // allow the adapter to repopulate during the next layout pass
                    // before starting the transition animation
                    startPostponedEnterTransition();
                }
            });
        }
    }
}
Also used : MoviesDiscoverLink(com.battlelancer.seriesguide.enums.MoviesDiscoverLink) TargetApi(android.annotation.TargetApi)

Aggregations

MoviesDiscoverLink (com.battlelancer.seriesguide.enums.MoviesDiscoverLink)2 TargetApi (android.annotation.TargetApi)1