Merge branch 'master' of ssh://github.com/osmandapp/Osmand into TrackerLiveTrack
This commit is contained in:
commit
8e7c4d3043
4 changed files with 6 additions and 13 deletions
|
@ -461,14 +461,7 @@ public class Algorithms {
|
||||||
|
|
||||||
public static String gzipToString(byte[] gzip) throws IOException {
|
public static String gzipToString(byte[] gzip) throws IOException {
|
||||||
GZIPInputStream gzipIs = new GZIPInputStream(new ByteArrayInputStream(gzip));
|
GZIPInputStream gzipIs = new GZIPInputStream(new ByteArrayInputStream(gzip));
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(gzipIs, "UTF-8"));
|
return readFromInputStream(gzipIs).toString();
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
String s;
|
|
||||||
while ((s = br.readLine()) != null) {
|
|
||||||
sb.append(s);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean removeAllFiles(File f) {
|
public static boolean removeAllFiles(File f) {
|
||||||
|
|
|
@ -286,11 +286,11 @@ public class WikiArticleHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static String getPartialContent(String content) {
|
public static String getPartialContent(String source) {
|
||||||
if (content == null) {
|
if (source == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
String content = source.replaceAll("\\n", "");
|
||||||
int firstParagraphStart = content.indexOf(P_OPENED);
|
int firstParagraphStart = content.indexOf(P_OPENED);
|
||||||
int firstParagraphEnd = content.indexOf(P_CLOSED);
|
int firstParagraphEnd = content.indexOf(P_CLOSED);
|
||||||
firstParagraphEnd = firstParagraphEnd < firstParagraphStart ? content.indexOf(P_CLOSED, firstParagraphStart) : firstParagraphEnd;
|
firstParagraphEnd = firstParagraphEnd < firstParagraphStart ? content.indexOf(P_CLOSED, firstParagraphStart) : firstParagraphEnd;
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
||||||
for (int i = backStackEntryCount - 1; i >= 0; i--) {
|
for (int i = backStackEntryCount - 1; i >= 0; i--) {
|
||||||
BackStackEntry entry = fragmentManager.getBackStackEntryAt(i);
|
BackStackEntry entry = fragmentManager.getBackStackEntryAt(i);
|
||||||
if (!TAG.equals(entry.getName())) {
|
if (!TAG.equals(entry.getName())) {
|
||||||
pop = i;
|
pop = entry.getId();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,7 +600,7 @@ public class TravelDbHelper {
|
||||||
|
|
||||||
res.title = cursor.getString(0);
|
res.title = cursor.getString(0);
|
||||||
try {
|
try {
|
||||||
res.content = Algorithms.gzipToString(cursor.getBlob(1));
|
res.content = Algorithms.gzipToString(cursor.getBlob(1)).trim();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error(e.getMessage(), e);
|
LOG.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue