Ejemplo n.º 1
0
 @Override
 public void onBackPressed() {
   OPDSBrowserFragment frag = (OPDSBrowserFragment) tab_opds.getFragment();
   if (frag == null || !frag.isVisible() || !frag.loadPreviousPage()) {
     super.onBackPressed();
   }
 }
Ejemplo n.º 2
0
  @Override
  public void onConnectClick(ConnectionInfo ci) {
    OPDSBrowserFragment frag = ((OPDSBrowserFragment) tab_opds.getFragment());

    if (mCalibreService != null) {
      mCalibreService.connectToServer(ci);
    }
    if (frag != null) {
      frag.loadURL(ci.getContentServerURL(), false);
    }
  }
Ejemplo n.º 3
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());
  }
Ejemplo n.º 4
0
 public void onDiscoveryStateChanged(CalibreService.DiscoveryState discoveryState) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) {
     frag.setDiscoveryState(discoveryState);
     switch (discoveryState) {
       case NO_SERVER:
         if (frag.isResumed() && mFragmentManager.findFragmentByTag("dlg-connect") == null) {
           NoServerDialogFragment instNSDF = new NoServerDialogFragment();
           instNSDF.show(mFragmentManager, "dlg-no-server");
         }
         break;
     }
   }
 }
Ejemplo n.º 5
0
 public void onBookListChanged() {
   mBarTabManager.switchTab(tab_collection);
   CollectionFragment frag = (CollectionFragment) tab_collection.getFragment();
   if (frag != null) frag.refreshBookList();
 }
Ejemplo n.º 6
0
 @Override
 public void onErrorReported(CalibreService.ErrorType e) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) frag.setErrorMessage(e);
 }
Ejemplo n.º 7
0
 public void onConnectionStateChanged(CalibreService.ConnectionState connectionState) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) frag.setConnectionState(connectionState);
 }
Ejemplo n.º 8
0
 @Override
 public void confirmDelete(int id) {
   CollectionFragment frag = (CollectionFragment) tab_collection.getFragment();
   if (frag != null) frag.deleteBook(id);
 }