package fi.metacity.klmobi;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.astuetz.viewpager.extensions.PagerSlidingTabStrip;
import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.App;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.Extra;
import com.googlecode.androidannotations.annotations.ViewById;

@EActivity(R.layout.activity_routes)
public class RoutesActivity extends SherlockFragmentActivity {
	
	@App
	MHApp mGlobals;
	
	@ViewById(R.id.pager)
	ViewPager mPager;
	
	@ViewById(R.id.tabs)
	PagerSlidingTabStrip mTabs;
	
	@Extra(Constants.EXTRA_DATE)
	String mDate;
	
	@Extra(Constants.EXTRA_TIME)
	String mTime;
	
	private Bundle mExtras; 
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		mExtras = getIntent().getExtras();
		if (savedInstanceState == null) {
			showResultsFragment(mExtras);
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		//getSupportMenuInflater().inflate(R.menu.routes, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
			case android.R.id.home:
				NavUtils.navigateUpFromSameTask(this);
				return true;
		}
		return super.onOptionsItemSelected(item);
	}
	
	@AfterViews
	public void showViewPagerIfNeeded() {
		if (mPager != null && mTabs != null) {
			/*DetailsPagerAdapter adapter = new DetailsPagerAdapter(
					getSupportFragmentManager(), new String[] { "Reittitiedot", "Vaihtokuvat", "Kartta" }, -1);
			mPager.setAdapter(adapter);
			mTabs.setViewPager(mPager);*/
		}
	}
	
	private void showResultsFragment(Bundle args) {
		Fragment routeResultsFrag = new RouteResultsFragment_();
		routeResultsFrag.setArguments(args);
		getSupportFragmentManager().beginTransaction().
			replace(R.id.route_results_container, routeResultsFrag).commit();
	}

}

@@ -1685,331 +1685,8 @@
 %7D%0A%09%0A
-%09@AfterViews%0A%09public void showViewPagerIfNeeded() %7B%0A%09%09if (mPager != null && mTabs != null) %7B%0A%09%09%09/*DetailsPagerAdapter adapter = new DetailsPagerAdapter(%0A%09%09%09%09%09getSupportFragmentManager(), new String%5B%5D %7B %22Reittitiedot%22, %22Vaihtokuvat%22, %22Kartta%22 %7D, -1);%0A%09%09%09mPager.setAdapter(adapter);%0A%09%09%09mTabs.setViewPager(mPager);*/%0A%09%09%7D%0A%09%7D%0A%09%0A
 %09pri

Remove unused code