package com.loosli.christian.popularmovieapp.android.app;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;

import com.loosli.christian.popularmovieapp.android.app.entity.Movie;

public class MovieDetailsActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_detail);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        if (savedInstanceState == null) {
            // Create the detail fragment and add it to the activity
            // using a fragment transaction.

            MovieDetailsFragment fragment = MovieDetailsFragment.newInstance((Movie)getIntent().getParcelableExtra(BundleKeys.MOVIE));
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.movie_detail_container, fragment)
                    .commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_detail, menu);
        return true;
    }
}

@@ -71,17 +71,129 @@
 oid.
-os.Bundle
+content.Intent;%0Aimport android.os.Bundle;%0Aimport android.support.v4.app.NavUtils;%0Aimport android.support.v7.app.ActionBar
 ;%0Aim
@@ -306,16 +306,46 @@
 ew.Menu;
+%0Aimport android.view.MenuItem;
 %0A%0Aimport
@@ -409,16 +409,254 @@
 Movie;%0A%0A
+/**%0A * An activity representing a single Movie detail screen. This%0A * activity is only used narrow width devices. On tablet-size devices,%0A * item details are presented side-by-side with a list of items%0A * in a %7B@link MoviesActivity%7D.%0A */%0A
 public c
@@ -1059,690 +1059,2128 @@
     
-if (savedInstanceState == null) %7B%0A            // Create the detail fragment and add it to the activity%0A            // using a fragment transaction.%0A%0A            MovieDetailsFragment fragment = MovieDetailsFragment.newInstance((Movie)getIntent().getParcelableExtra(BundleKeys.MOVIE));%0A            getSupportFragmentManager().beginTransaction()%0A                    .add(R.id.movie_detail_container, fragment)%0A                    .commit();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        // Inflate the menu; this adds items to the action bar if it is present.%0A        getMenuInflater().inflate(R.menu.menu_detail, menu);%0A        return true
+// Show the Up button in the action bar.%0A        ActionBar actionBar = getSupportActionBar();%0A        if (actionBar != null) %7B%0A            actionBar.setDisplayHomeAsUpEnabled(true);%0A        %7D%0A%0A        // savedInstanceState is non-null when there is fragment state%0A        // saved from previous configurations of this activity%0A        // (e.g. when rotating the screen from portrait to landscape).%0A        // In this case, the fragment will automatically be re-added%0A        // to its container so we don't need to manually add it.%0A        // For more information, see the Fragments API guide at:%0A        //%0A        // http://developer.android.com/guide/components/fragments.html%0A        //%0A        if (savedInstanceState == null) %7B%0A            // Create the detail fragment and add it to the activity%0A            // using a fragment transaction.%0A%0A            MovieDetailsFragment fragment = MovieDetailsFragment.newInstance((Movie)getIntent().getParcelableExtra(BundleKeys.MOVIE));%0A            getSupportFragmentManager().beginTransaction()%0A                    .add(R.id.movie_detail_container, fragment)%0A                    .commit();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        // Inflate the menu; this adds items to the action bar if it is present.%0A        getMenuInflater().inflate(R.menu.menu_detail, menu);%0A        return true;%0A    %7D%0A%0A    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        int id = item.getItemId();%0A        if (id == android.R.id.home) %7B%0A            // This ID represents the Home or Up button. In the case of this%0A            // activity, the Up button is shown. Use NavUtils to allow users%0A            // to navigate up one level in the application structure. For%0A            // more details, see the Navigation pattern on Android Design:%0A            //%0A            // http://developer.android.com/design/patterns/navigation.html#up-vs-back%0A            //%0A            NavUtils.navigateUpTo(this, new Intent(this, MoviesActivity.class));%0A            return true;%0A        %7D%0A        return super.onOptionsItemSelected(item)
 ;%0A  

fix the Up button in the action bar