/*
 * Copyright 2015 Uwe Trottmann
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.battlelancer.seriesguide.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.view.MenuItem;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.ui.streams.UserEpisodeStreamFragment;

/**
 * Displays history of watched episodes.
 */
public class HistoryActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_singlepane);
        setupActionBar();

        if (savedInstanceState == null) {
            Fragment f = new UserEpisodeStreamFragment();
            f.setArguments(getIntent().getExtras());
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.content_frame, f)
                    .commit();
        }
    }

    @Override
    protected void setupActionBar() {
        super.setupActionBar();
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.user_stream);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();
        if (itemId == android.R.id.home) {
            onBackPressed();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

@@ -850,147 +850,441 @@
 ide.
-ui.streams.UserEpisodeStreamFragment;%0A%0A/**%0A * Displays history of watched episodes.%0A */%0Apublic class HistoryActivity extends BaseActivity %7B
+items.SearchResult;%0Aimport com.battlelancer.seriesguide.ui.dialogs.AddShowDialogFragment;%0Aimport com.battlelancer.seriesguide.ui.streams.UserEpisodeStreamFragment;%0Aimport com.battlelancer.seriesguide.util.TaskManager;%0A%0A/**%0A * Displays history of watched episodes.%0A */%0Apublic class HistoryActivity extends BaseActivity implements%0A        AddShowDialogFragment.OnAddShowListener %7B%0A%0A    public static final int EPISODES_LOADER_ID = 100;
 %0A%0A  
@@ -2303,11 +2303,223 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Called if the user adds a show from a trakt stream fragment.%0A     */%0A    @Override%0A    public void onAddShow(SearchResult show) %7B%0A        TaskManager.getInstance(this).performAddTask(show);%0A    %7D
 %0A%7D%0A

Support adding shows from HistoryActivity.