diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java index 4bb04c4d56..3e6caffafa 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java @@ -461,14 +461,7 @@ public class Algorithms { public static String gzipToString(byte[] gzip) throws IOException { GZIPInputStream gzipIs = new GZIPInputStream(new ByteArrayInputStream(gzip)); - BufferedReader br = new BufferedReader(new InputStreamReader(gzipIs, "UTF-8")); - StringBuilder sb = new StringBuilder(); - String s; - while ((s = br.readLine()) != null) { - sb.append(s); - } - br.close(); - return sb.toString(); + return readFromInputStream(gzipIs).toString(); } public static boolean removeAllFiles(File f) { diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/WikiArticleHelper.java b/OsmAnd/src/net/osmand/plus/wikipedia/WikiArticleHelper.java index 28bbdc8c06..d85decda64 100644 --- a/OsmAnd/src/net/osmand/plus/wikipedia/WikiArticleHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikipedia/WikiArticleHelper.java @@ -286,11 +286,11 @@ public class WikiArticleHelper { } @Nullable - public static String getPartialContent(String content) { - if (content == null) { + public static String getPartialContent(String source) { + if (source == null) { return null; } - + String content = source.replaceAll("\\n", ""); int firstParagraphStart = content.indexOf(P_OPENED); int firstParagraphEnd = content.indexOf(P_CLOSED); firstParagraphEnd = firstParagraphEnd < firstParagraphStart ? content.indexOf(P_CLOSED, firstParagraphStart) : firstParagraphEnd; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index 6ac32656dc..44ae21063c 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -425,7 +425,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme for (int i = backStackEntryCount - 1; i >= 0; i--) { BackStackEntry entry = fragmentManager.getBackStackEntryAt(i); if (!TAG.equals(entry.getName())) { - pop = i; + pop = entry.getId(); break; } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index e4becd523d..f001dd90d9 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -600,7 +600,7 @@ public class TravelDbHelper { res.title = cursor.getString(0); try { - res.content = Algorithms.gzipToString(cursor.getBlob(1)); + res.content = Algorithms.gzipToString(cursor.getBlob(1)).trim(); } catch (IOException e) { LOG.error(e.getMessage(), e); }