moved rtlLanguages to super class

This commit is contained in:
Chumva 2018-05-08 10:54:40 +03:00
parent f1ec563dbb
commit cbe7d9a73a
3 changed files with 6 additions and 11 deletions

View file

@ -20,6 +20,9 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public abstract class WikiArticleBaseDialogFragment extends WikiBaseDialogFragment {
@ -82,6 +85,7 @@ public abstract class WikiArticleBaseDialogFragment extends WikiBaseDialogFragme
" }" +
"}</script>"
+ "</body></html>";
protected static final Set<String> rtlLanguages = new HashSet<>(Arrays.asList("ar","dv","he","iw","fa","nqo","ps","sd","ug","ur","yi"));
protected WebView contentWebView;
protected TextView selectedLangTv;

View file

@ -38,9 +38,7 @@ import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.util.Algorithms;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@ -134,9 +132,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
@NonNull
protected String createHtmlContent() {
StringBuilder sb = new StringBuilder(HEADER_INNER);
String[] rtlLanguages = new String[]{"ar", "dv", "he", "iw", "fa", "nqo", "ps", "sd", "ug", "ur", "yi"};
Set<String> rtls = new HashSet<>(Arrays.asList(rtlLanguages));
String bodyTag = rtls.contains(langSelected) ? "<body dir=\"rtl\">\n" : "<body>\n";
String bodyTag = rtlLanguages.contains(langSelected) ? "<body dir=\"rtl\">\n" : "<body>\n";
sb.append(bodyTag);
String nightModeClass = nightMode ? " nightmode" : "";
sb.append("<div class=\"main");

View file

@ -42,11 +42,8 @@ import net.osmand.util.Algorithms;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static net.osmand.plus.OsmandSettings.WikiArticleShowImages.OFF;
@ -311,9 +308,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
@NonNull
protected String createHtmlContent() {
StringBuilder sb = new StringBuilder(HEADER_INNER);
String[] rtlLanguages = new String[]{"ar","dv","he","iw","fa","nqo","ps","sd","ug","ur","yi"};
Set<String> rtls = new HashSet<>(Arrays.asList(rtlLanguages));
String bodyTag = rtls.contains(article.getLang()) ? "<body dir=\"rtl\">\n" : "<body>\n";
String bodyTag = rtlLanguages.contains(article.getLang()) ? "<body dir=\"rtl\">\n" : "<body>\n";
sb.append(bodyTag);
String nightModeClass = nightMode ? " nightmode" : "";
String imageTitle = article.getImageTitle();