// Path: src/com/dotcool/reader/activity/INovelListHelper.java
// public interface INovelListHelper {
// 	public void manualAdd();
// 	public void downloadAllNovelInfo();
// 	public void refreshList();
// 	
// }


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.dotcool.R;
import com.dotcool.reader.activity.INovelListHelper;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
    	View view = inflater.inflate(R.layout.fragment_display_novel_tab, container, false);
    	
        mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
        mTabHost.setup(getSherlockActivity(), getChildFragmentManager(), R.id.content);

        mTabHost.addTab(mTabHost.newTabSpec(MAIN_SPEC).setIndicator(MAIN_SPEC),
                DisplayLightNovelListFragment.class, null);
        mTabHost.addTab(mTabHost.newTabSpec(TEASER_SPEC).setIndicator(TEASER_SPEC),
                DisplayTeaserListFragment.class, null);
        mTabHost.addTab(mTabHost.newTabSpec(ORIGINAL_SPEC).setIndicator(ORIGINAL_SPEC),
                DisplayOriginalListFragment.class, null);

        return view;
	}

	@Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		// set menu for main/teaser/original
		inflater.inflate(R.menu.fragment_display_novel_tab, menu);
	}

	@Override
	public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
		Fragment currentTab = getChildFragmentManager().findFragmentById(R.id.content);
		Log.d(TAG, "Current fragment: " + currentTab.getClass().toString());
		switch(item.getItemId()) {
			case R.id.menu_manual_add:
// Path: src/com/dotcool/reader/activity/INovelListHelper.java
// public interface INovelListHelper {
// 	public void manualAdd();
// 	public void downloadAllNovelInfo();
// 	public void refreshList();
// 	
// }


// Path: src/com/dotcool/reader/fragment/DisplayNovelTabFragment.java
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.dotcool.R;
import com.dotcool.reader.activity.INovelListHelper;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
    	View view = inflater.inflate(R.layout.fragment_display_novel_tab, container, false);
    	
        mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
        mTabHost.setup(getSherlockActivity(), getChildFragmentManager(), R.id.content);

        mTabHost.addTab(mTabHost.newTabSpec(MAIN_SPEC).setIndicator(MAIN_SPEC),
                DisplayLightNovelListFragment.class, null);
        mTabHost.addTab(mTabHost.newTabSpec(TEASER_SPEC).setIndicator(TEASER_SPEC),
                DisplayTeaserListFragment.class, null);
        mTabHost.addTab(mTabHost.newTabSpec(ORIGINAL_SPEC).setIndicator(ORIGINAL_SPEC),
                DisplayOriginalListFragment.class, null);

        return view;
	}

	@Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		// set menu for main/teaser/original
		inflater.inflate(R.menu.fragment_display_novel_tab, menu);
	}

	@Override
	public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
		Fragment currentTab = getChildFragmentManager().findFragmentById(R.id.content);
		Log.d(TAG, "Current fragment: " + currentTab.getClass().toString());
		switch(item.getItemId()) {
			case R.id.menu_manual_add:
				if(currentTab instanceof INovelListHelper)