예제 #1
0
 @Override
 public void onStart() {
   super.onStart();
   mActivity
       .getApplicationContext()
       .bindService(calibreServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
   isBoundToService = true;
   if (getIntent().hasExtra(EXTRA_TAB)) {
     mBarTabManager.switchTabByTag(getIntent().getStringExtra(EXTRA_TAB));
   }
 }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Instantiate Main  UI Components
    setContentView(R.layout.tabs_main);
    mBarTabManager = getBarTabManager();

    // Diaglog Fragment Manager and their dialogs
    mFragmentManager = getSupportFragmentManager();

    mSettings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

    tab_connection = mBarTabManager.newTab(ConnectionFragment.TAB_TAG);
    tab_connection
        .setText(R.string.tab_connection)
        .setIcon(R.drawable.ic_tab_connection)
        .setFragmentClass(ConnectionFragment.class);
    mBarTabManager.addTab(tab_connection);

    tab_collection = mBarTabManager.newTab(CollectionFragment.TAB_TAG);
    tab_collection
        .setText(R.string.tab_collection)
        .setIcon(R.drawable.ic_tab_collection)
        .setFragmentClass(CollectionFragment.class);
    mBarTabManager.addTab(tab_collection);

    tab_opds = mBarTabManager.newTab(OPDSBrowserFragment.TAB_TAG);
    tab_opds
        .setText(R.string.tab_library)
        .setIcon(R.drawable.ic_tab_csync)
        .setFragmentClass(OPDSBrowserFragment.class);
    mBarTabManager.addTab(tab_opds);

    // Kickstart Calibre Service
    calibreServiceIntent = new Intent(this, CalibreService.class);
    startService(calibreServiceIntent);

    mDB = new MetadataDatabaseHelper(getApplicationContext());
  }
예제 #3
0
 public void onBookListChanged() {
   mBarTabManager.switchTab(tab_collection);
   CollectionFragment frag = (CollectionFragment) tab_collection.getFragment();
   if (frag != null) frag.refreshBookList();
 }