Back to project page UpcomingMoviesMVP.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Defi...
If you think the Android project UpcomingMoviesMVP listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jlmd.android.newfilmsmvp.ui.activity; // www .ja v a 2 s . co m import android.content.Intent; import android.os.Bundle; import com.jlmd.android.newfilmsmvp.R; import com.jlmd.android.newfilmsmvp.bus.event.MovieSelectedEvent; import com.jlmd.android.newfilmsmvp.domain.model.Movie; import com.jlmd.android.newfilmsmvp.utils.Constants; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import javax.inject.Inject; /** * @author jlmd */ public class MainActivity extends BaseActivity { @Inject protected Bus bus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onResume() { super.onResume(); registerBus(); } @Override protected void onPause() { super.onPause(); unRegisterBus(); } private void registerBus() { bus.register(this); } private void unRegisterBus() { bus.unregister(this); } @Subscribe public void onItemSelectedEvent(MovieSelectedEvent event) { launchMovieDetailsActivity(event.getMovie()); } private void launchMovieDetailsActivity(Movie movie) { Intent detailsActivityIntent = new Intent(this, MovieDetailsActivity.class); detailsActivityIntent.putExtra(Constants.KEY_MOVIE_DETAILS, movie); detailsActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(detailsActivityIntent); } }