diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java index e0470d471..f2e57d82c 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java @@ -81,11 +81,12 @@ public class ZimHostActivity extends BaseActivity implements private Intent serviceIntent; private Task task; - private BooksOnDiskAdapter booksAdapter; + BooksOnDiskAdapter booksAdapter; HotspotService hotspotService; String ip; boolean bound; ServiceConnection serviceConnection; + ArrayList selectedBooksPath = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -147,6 +148,8 @@ public class ZimHostActivity extends BaseActivity implements //Get File Path of All The ZIMs using booksAdapter + getSelectedBooksPath(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { toggleHotspot(); } else { @@ -165,6 +168,19 @@ public class ZimHostActivity extends BaseActivity implements }); } + void getSelectedBooksPath() { + BooksOnDiskListItem.BookOnDisk bookOnDisk; + + for (BooksOnDiskListItem item : booksAdapter.getItems()) { + if (item.isSelected()) { + bookOnDisk = (BooksOnDiskListItem.BookOnDisk) item; + File file = bookOnDisk.getFile(); + selectedBooksPath.add(file.getAbsolutePath()); + Log.v(TAG, "ZIM PATH : " + file.getAbsolutePath()); + } + } + } + public void open(BooksOnDiskListItem.BookOnDisk bookOnDisk) { File file = bookOnDisk.getFile(); Intent zimFile = new Intent(this, MainActivity.class);