/*
 * Copyright 2012 GitHub Inc.
 *
 * 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.github.mobile.ui.issue;

import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.MenuItem;
import com.github.mobile.R.drawable;
import com.github.mobile.R.id;
import com.github.mobile.R.layout;
import com.github.mobile.R.string;
import com.github.mobile.ui.user.HomeActivity;
import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity;
import com.viewpagerindicator.TitlePageIndicator;

import roboguice.inject.InjectView;

/**
 * Dashboard activity for issues
 */
public class IssueDashboardActivity extends RoboSherlockFragmentActivity {

    @InjectView(id.tpi_header)
    private TitlePageIndicator indicator;

    @InjectView(id.vp_pages)
    private ViewPager pager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(layout.pager_with_title);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setTitle(string.dashboard_issues_title);
        actionBar.setIcon(drawable.action_dashboard);
        actionBar.setDisplayHomeAsUpEnabled(true);

        pager.setAdapter(new IssueDashboardPagerAdapter(getResources(),
                getSupportFragmentManager()));
        indicator.setViewPager(pager);
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            Intent intent = new Intent(this, HomeActivity.class);
            intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intent);
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
}

@@ -807,50 +807,8 @@
 dle;
-%0Aimport android.support.v4.view.ViewPager;
 %0A%0Aim
@@ -934,74 +934,8 @@
 le;%0A
-import com.github.mobile.R.id;%0Aimport com.github.mobile.R.layout;%0A
 impo
@@ -997,17 +997,16 @@
 .ui.
-user.Home
+TabPager
 Acti
@@ -1033,417 +1033,177 @@
 hub.
-rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity;%0Aimport com.viewpagerindicator.TitlePageIndicator;%0A%0Aimport roboguice.inject.InjectView;%0A%0A/**%0A * Dashboard activity for issues%0A */%0Apublic class IssueDashboardActivity extends RoboSherlockFragmentActivity %7B%0A%0A    @InjectView(id.tpi_header)%0A    private TitlePageIndicator indicator;%0A%0A    @InjectView(id.vp_pages)%0A    private ViewPager pager;
+mobile.ui.user.HomeActivity;%0A%0A/**%0A * Dashboard activity for issues%0A */%0Apublic class IssueDashboardActivity extends%0A        TabPagerActivity%3CIssueDashboardPagerAdapter%3E %7B
 %0A%0A  
@@ -1320,58 +1320,8 @@
 );%0A%0A
-        setContentView(layout.pager_with_title);%0A%0A
     
@@ -1546,164 +1546,46 @@
     
-pager.setAdapter(new IssueDashboardPagerAdapter(getResources(),
+createTabPager();
 %0A    
+%7D%0A%0A
     
-        getSupportFragmentManager()));%0A        indicator.setViewPager(pager);%0A    %7D%0A
+@Override
 %0A   
@@ -2000,11 +2000,199 @@
  %7D%0A    %7D
+%0A%0A    @Override%0A    protected IssueDashboardPagerAdapter createAdapter() %7B%0A        return new IssueDashboardPagerAdapter(getResources(),%0A                getSupportFragmentManager());%0A    %7D
 %0A%7D%0A

Use tabbed pager in IssueDashboardActivity