Merge branch 'develop' into iadeelzafar/wifi-hotspot

This commit is contained in:
Adeel Zafar 2019-08-11 22:05:15 +05:00
commit b14b845995
6 changed files with 15 additions and 12 deletions

View File

@ -12,6 +12,7 @@ Kiwix is written in [Kotlin](https://kotlinlang.org/) (with a few old pieces in
[![Build Status](https://travis-ci.org/kiwix/kiwix-android.svg?branch=master)](https://travis-ci.org/kiwix/kiwix-android)
[![IRC Web](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](http://chat.kiwix.org)
[![codecov](https://codecov.io/gh/kiwix/kiwix-android/branch/master/graph/badge.svg)](https://codecov.io/gh/kiwix/kiwix-android)
[![CodeFactor](https://www.codefactor.io/repository/github/kiwix/kiwix-android/badge)](https://www.codefactor.io/repository/github/kiwix/kiwix-android)
---
## Build Instructions
@ -56,8 +57,8 @@ You can use IRC web interface on [http://chat.kiwix.org/](http://chat.kiwix.org/
Our other sources of communications include
- Email: kiwix-developer@lists.sourceforge.net or contact@kiwix.org
- Jabber: kelson@kiwix.org
- Email: contact@kiwix.org
- Mailing list: kiwix-developer@lists.sourceforge.net
For more information, please refer to [https://wiki.kiwix.org/wiki/Communication](https://wiki.kiwix.org/wiki/Communication).

View File

@ -342,7 +342,7 @@ public class ZimContentProvider extends ContentProvider {
// This is the code which retrieve the mimeType from the libzim
// "slow" and still bugyy
if (mimeType.isEmpty()) {
if (mimeType == null || mimeType.isEmpty()) {
String t = uri.toString();
int pos = uri.toString().indexOf(CONTENT_URI.toString());
if (pos != -1) {

View File

@ -41,7 +41,7 @@ class NewBookDao @Inject constructor(private val box: Box<BookOnDiskEntity>) {
inValues(BookOnDiskEntity_.bookId, booksOnDisk.map { it.book.id }.toTypedArray())
}
.remove()
box.put(booksOnDisk.map(::BookOnDiskEntity))
box.put(booksOnDisk.distinctBy { it.book.id }.map(::BookOnDiskEntity))
}
}

View File

@ -585,7 +585,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
++tempVisitCount;
visitCounterPref.setCount(tempVisitCount);
if (tempVisitCount >= 5
if (tempVisitCount >= 10
&& !visitCounterPref.getNoThanksState()
&& NetworkUtils.isNetworkAvailable(this) && !BuildConfig.DEBUG) {
showRateDialog();
@ -1119,6 +1119,9 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
}
private void externalLinkPopup(Intent intent) {
int warningResId = (sharedPreferenceUtil.nightMode())
? R.drawable.ic_warning_white : R.drawable.ic_warning_black;
new AlertDialog.Builder(this, dialogStyle())
.setTitle(R.string.external_link_popup_dialog_title)
.setMessage(R.string.external_link_popup_dialog_message)
@ -1132,7 +1135,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
startActivity(intent);
})
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> startActivity(intent))
.setIcon(android.R.drawable.ic_dialog_alert)
.setIcon(warningResId)
.show();
}
@ -1410,6 +1413,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
webViewList.get(currentWebViewIndex).findViewById(R.id.get_content_card).setEnabled(true);
}
updateBottomToolbarVisibility();
presenter.loadBooks();
Log.d(TAG_KIWIX, "action" + getIntent().getAction());
Intent intent = getIntent();
@ -2106,7 +2110,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
@Override
public void setHomePage(View view) {
RecyclerView homeRecyclerView = view.findViewById(R.id.recycler_view);
presenter.showHome();
presenter.loadBooks();
homeRecyclerView.setAdapter(booksAdapter);
downloadBookButton = view.findViewById(R.id.content_main_card_download_button);
downloadBookButton.setOnClickListener(v -> manageZimFiles(1));

View File

@ -19,7 +19,7 @@ class MainContract {
}
interface Presenter extends BaseContract.Presenter<View> {
void showHome();
void loadBooks();
void saveBooks(List<BooksOnDiskListItem.BookOnDisk> books);

View File

@ -9,10 +9,8 @@ import javax.inject.Inject;
import org.kiwix.kiwixmobile.base.BasePresenter;
import org.kiwix.kiwixmobile.bookmark.BookmarkItem;
import org.kiwix.kiwixmobile.data.DataSource;
import org.kiwix.kiwixmobile.data.local.entity.Bookmark;
import org.kiwix.kiwixmobile.di.PerActivity;
import org.kiwix.kiwixmobile.history.HistoryListItem;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem;
/**
@ -30,7 +28,7 @@ class MainPresenter extends BasePresenter<MainContract.View> implements MainCont
}
@Override
public void showHome() {
public void loadBooks() {
dataSource.getLanguageCategorizedBooks()
.subscribe(new SingleObserver<List<BooksOnDiskListItem>>() {
@Override
@ -61,7 +59,7 @@ class MainPresenter extends BasePresenter<MainContract.View> implements MainCont
@Override
public void onComplete() {
showHome();
loadBooks();
}
@Override