/*
 * Copyright (C) 2015 Mateusz Widuch. All rights reserved.
 */

package eu.redray.trevie;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import static com.facebook.stetho.Stetho.initializeWithDefaults;

/**
 * Starts the application.
 */
public class MainActivity extends AppCompatActivity implements MovieGridFragment.Callback {
    private static final String TAG = "TREVIE";
    private static final String DETAILFRAGMENT_TAG = "DFTAG";
    private boolean mTwoPane;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Initialise Stetho debug bridge
        initializeWithDefaults(this);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        Log.v(TAG, "onCreate");

        if (findViewById(R.id.movie_detail_container) != null) {
            mTwoPane = true;
        } else {
            mTwoPane = false;
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.v(TAG, "onStart");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.v(TAG, "onPause");
    }


    @Override
    protected void onResume() {
        super.onResume();
        Log.v(TAG, "onResume");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.v(TAG, "onRestart");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.v(TAG, "onDestroy");
    }

    @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_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        /*if (id == R.id.action_settings) {
            return true;
        }*/

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onItemSelected(Movie movie) {
        if (mTwoPane) {
            // In two-pane mode, show the detail view in this activity by
            // adding or replacing the detail fragment using a
            // fragment transaction.
            Bundle args = new Bundle();
            args.putParcelable(Movie.EXTRA_DETAILS, movie);

            MovieDetailsFragment fragment = new MovieDetailsFragment();
            fragment.setArguments(args);

            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.movie_detail_container, fragment, DETAILFRAGMENT_TAG)
                    .commit();
        } else {
            Intent intent = new Intent(this, MovieDetailsActivity.class);
            intent.putExtra(Movie.EXTRA_DETAILS, movie);
            startActivity(intent);
        }
    }
}

@@ -239,33 +239,8 @@
 ar;%0A
-import android.util.Log;%0A
 impo
@@ -489,56 +489,8 @@
 k %7B%0A
-    private static final String TAG = %22TREVIE%22;%0A
     
@@ -923,24 +923,25 @@
 olbar);%0A
+%0A
         
 Log.v(TA
@@ -936,32 +936,51 @@
     
-Log.v(TAG, %22onCreate%22);%0A
+// Determine if app is one or two pane mode
 %0A   
@@ -1138,564 +1138,8 @@
  %7D%0A%0A
-    @Override%0A    protected void onStart() %7B%0A        super.onStart();%0A        Log.v(TAG, %22onStart%22);%0A    %7D%0A%0A    @Override%0A    protected void onPause() %7B%0A        super.onPause();%0A        Log.v(TAG, %22onPause%22);%0A    %7D%0A%0A%0A    @Override%0A    protected void onResume() %7B%0A        super.onResume();%0A        Log.v(TAG, %22onResume%22);%0A    %7D%0A%0A    @Override%0A    protected void onRestart() %7B%0A        super.onRestart();%0A        Log.v(TAG, %22onRestart%22);%0A    %7D%0A%0A    @Override%0A    protected void onDestroy() %7B%0A        super.onDestroy();%0A        Log.v(TAG, %22onDestroy%22);%0A    %7D%0A%0A
     

Remove redundant log messages