Search in sources :

Example 1 with ZimManageActivity

use of org.kiwix.kiwixmobile.zim_manager.ZimManageActivity in project kiwix-android by kiwix.

the class LibraryFragment method downloadFile.

@Override
public void downloadFile(Book book) {
    downloadingBooks.add(book);
    if (libraryAdapter != null && faActivity != null && faActivity.searchView != null) {
        libraryAdapter.getFilter().filter(faActivity.searchView.getQuery());
    }
    Toast.makeText(super.getActivity(), getString(R.string.download_started_library), Toast.LENGTH_LONG).show();
    Intent service = new Intent(super.getActivity(), DownloadService.class);
    service.putExtra(DownloadIntent.DOWNLOAD_URL_PARAMETER, book.getUrl());
    service.putExtra(DownloadIntent.DOWNLOAD_ZIM_TITLE, book.getTitle());
    service.putExtra(EXTRA_BOOK, book);
    super.getActivity().startService(service);
    mConnection = new DownloadServiceConnection();
    super.getActivity().bindService(service, mConnection.downloadServiceInterface, Context.BIND_AUTO_CREATE);
    ZimManageActivity manage = (ZimManageActivity) super.getActivity();
    manage.displayDownloadInterface();
}
Also used : ZimManageActivity(org.kiwix.kiwixmobile.zim_manager.ZimManageActivity) Intent(android.content.Intent) DownloadIntent(org.kiwix.kiwixmobile.downloader.DownloadIntent)

Aggregations

Intent (android.content.Intent)1 DownloadIntent (org.kiwix.kiwixmobile.downloader.DownloadIntent)1 ZimManageActivity (org.kiwix.kiwixmobile.zim_manager.ZimManageActivity)1