add nigntmode and xml changes
This commit is contained in:
parent
97f6fff8c2
commit
a3e1307452
2 changed files with 29 additions and 21 deletions
|
@ -19,19 +19,17 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="fill_horizontal"
|
android:layout_marginBottom="@dimen/list_content_padding"
|
||||||
android:layout_weight="1"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:paddingTop="22dp"
|
android:layout_marginLeft="@dimen/list_content_padding"
|
||||||
android:paddingLeft="@dimen/list_content_padding"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:paddingStart="@dimen/list_content_padding"
|
android:layout_marginStart="@dimen/list_content_padding"
|
||||||
android:paddingRight="@dimen/list_content_padding"
|
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
||||||
android:paddingEnd="@dimen/list_content_padding"
|
android:textSize="@dimen/empty_state_text_size"
|
||||||
android:text="@string/wikivoyage_download_pics"
|
android:textColor="?attr/wikivoyage_primary_text_color"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:text="@string/wikivoyage_download_pics" />
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="@dimen/dialog_header_text_size"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.WikivoyageShowImages;
|
import net.osmand.plus.OsmandSettings.WikivoyageShowImages;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
import net.osmand.plus.activities.TrackActivity;
|
||||||
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
|
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment;
|
import net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
|
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
|
||||||
|
@ -40,6 +41,8 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragment {
|
public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragment {
|
||||||
|
|
||||||
|
@ -321,22 +324,26 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
if (langs == null) {
|
if (langs == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PopupMenu popup = new PopupMenu(view.getContext(), view, Gravity.END);
|
final PopupMenu popup = new PopupMenu(view.getContext(), view, Gravity.END);
|
||||||
for (final String lang : langs) {
|
Map<String, String> names = new HashMap<>();
|
||||||
|
for (String n : langs) {
|
||||||
|
names.put(n, FileNameTranslationHelper.getVoiceName(getContext(), n));
|
||||||
|
}
|
||||||
|
for (final Map.Entry<String, String> e : names.entrySet()) {
|
||||||
|
final String lang = e.getValue();
|
||||||
|
final String langKey = e.getKey();
|
||||||
MenuItem item = popup.getMenu().add(lang);
|
MenuItem item = popup.getMenu().add(lang);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
if (!selectedLang.equals(lang)) {
|
if (!selectedLang.equals(langKey)) {
|
||||||
selectedLang = lang;
|
selectedLang = langKey;
|
||||||
populateArticle();
|
populateArticle();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +415,10 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
String url = TravelArticle.getImageUrl(imageTitle, false);
|
String url = TravelArticle.getImageUrl(imageTitle, false);
|
||||||
sb.append("<div class=\"title-image\" style=\"background-image: url(").append(url).append(")\"></div>");
|
sb.append("<div class=\"title-image\" style=\"background-image: url(").append(url).append(")\"></div>");
|
||||||
}
|
}
|
||||||
sb.append("<div class=\"main\">\n");
|
|
||||||
|
String nightModeClass = nightMode?"nightmode":"";
|
||||||
|
|
||||||
|
sb.append("<div class=\"main "+nightModeClass+"\">\n");
|
||||||
sb.append("<h1>").append(article.getTitle()).append("</h1>");
|
sb.append("<h1>").append(article.getTitle()).append("</h1>");
|
||||||
sb.append(article.getContent());
|
sb.append(article.getContent());
|
||||||
sb.append(FOOTER_INNER);
|
sb.append(FOOTER_INNER);
|
||||||
|
|
Loading…
Reference in a new issue