Skip to content

Commit

Permalink
Merge pull request #1388 from kiwix/abdulwd/issue1261
Browse files Browse the repository at this point in the history
2.5.3 fixes
  • Loading branch information
macgills authored Aug 19, 2019
2 parents a86b11f + bebb23b commit 9709dfa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2.5.3
BUGFIX: Fix IndexOutOfBounds in KiwixMobileActivity `onResume`

2.5.2
BUGFIX: Some zim files were not displaying

2.5.1
NEW: Downloads are now using the DownloadManager
NEW: Downloads/Device/Library completely rewritten

2.5
NEW: Downloads are now using the DownloadManager
NEW: Downloads/Device/Library completely rewritten
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER') ?: "dev"
ext {
versionMajor = 2
versionMinor = 5
versionPatch = 2
versionPatch = 3
}

private String generateVersionName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,9 @@ public void onResume() {
}
}

if (!mWebViews.isEmpty() && mWebViews.get(currentWebViewIndex).getUrl() != null &&
if (!mWebViews.isEmpty() &&
currentWebViewIndex < mWebViews.size() &&
mWebViews.get(currentWebViewIndex).getUrl() != null &&
mWebViews.get(currentWebViewIndex).getUrl().equals("file:///android_asset/help.html") &&
mWebViews.get(currentWebViewIndex).findViewById(R.id.get_content_card) != null) {
mWebViews.get(currentWebViewIndex).findViewById(R.id.get_content_card).setEnabled(true);
Expand Down
23 changes: 8 additions & 15 deletions app/src/main/java/org/kiwix/kiwixmobile/utils/files/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,18 @@
import android.os.Environment;
import android.provider.DocumentsContract;
import android.util.Log;

import org.kiwix.kiwixmobile.BuildConfig;
import org.kiwix.kiwixmobile.downloader.ChunkUtils;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.kiwix.kiwixmobile.BuildConfig;

import static org.kiwix.kiwixmobile.downloader.ChunkUtils.deleteAllParts;
import static org.kiwix.kiwixmobile.utils.Constants.TAG_KIWIX;

public class FileUtils {
private static final String TAG = "KiwixFileUtils";

public static File getFileCacheDir(Context context) {
boolean external = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
Expand Down Expand Up @@ -150,17 +146,14 @@ static public String getLocalFilePathByUri(final Context ctx, final Uri uri) {
}

static private String contentQuery(Context context, Uri uri) {
Cursor cursor = null;
try (Cursor cursor = context.getContentResolver()
.query(uri, new String[] { "_data" }, null, null, null)) {

try {
cursor = context.getContentResolver().query(uri, new String[]{"_data"}, null, null, null);

if (cursor != null && cursor.moveToFirst())
if (cursor != null && cursor.moveToFirst()) {
return cursor.getString(cursor.getColumnIndexOrThrow("_data"));

} finally {
if (cursor != null)
cursor.close();
}
} catch (IllegalArgumentException e) {
Log.e(TAG, "Uri: " + uri.toString(), e);
}

return null;
Expand Down

0 comments on commit 9709dfa

Please sign in to comment.