Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-05-02 19:35:39 +02:00
commit 1d394637ff
10 changed files with 583 additions and 301 deletions

View file

@ -1,3 +1,31 @@
:root {
/* Colors for main part of texts */
--main-text-color-day: #212121;
--main-text-color-night: #cccccc;
/* Colors for headline and description text */
--headline-text-color-day: #454545;
--headline-text-color-night: #999999;
--description-text-color: #727272;
/* Link colors */
--link-text-color-day: #237bff;
--link-text-color-night: #d28521;
/* Navbar, image bg and buttong bg colors */
--topbar-bg-color-day: #f2f2f2;
--topbar-bg-color-night: #222526;
/* Font size, line height */
--main-text-font-size: 1.1em;
--main-text-line-height: 1.6em;
--headers-font-size: 1.2em;
/* Background colors */
--background-color-day: #ffffff;
--background-color-night: #17191a;
}
body { body {
max-width: 100% !important; max-width: 100% !important;
margin-top: 0%; margin-top: 0%;
@ -7,73 +35,65 @@ body {
font-size: 1em; font-size: 1em;
} }
.nightmode > body {
color: #17191a;
}
.main { .main {
max-width: 100% !important; max-width: 100% !important;
/* overflow-x: hidden; hide scroll bar */
display: block; display: block;
padding-top: 7%; padding-top: 7%;
padding-bottom: 0; padding-bottom: 0;
padding-left: 7%; padding-left: 7%;
padding-right: 7%; padding-right: 7%;
background-color: white; background-color: var(--background-color-day);
font-family: sans-serif; font-family: sans-serif;
} }
.content {
display: none;
overflow: hidden;
/*
padding-left: 7%;
padding-right: 7%;
*/
}
.nightmode { .nightmode {
max-width: 100% !important; max-width: 100% !important;
display: block; display: block;
font-family: sans-serif; font-family: sans-serif;
background-color: #17191a; background-color: var(--background-color-night);
} }
.nav-bar { .nav-bar {
background-color: #f2f2f2; background-color: var(--topbar-bg-color-day);
font-size: 1.1em;
font-family: sans-serif;
color: #727272;
word-wrap: break-word;
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
padding-top: 8px; padding-top: 12px;
padding-bottom: 8px; padding-bottom: 12px;
font-size: var(--main-text-font-size);
font-weight: normal; font-weight: normal;
line-height: 1.6em; line-height: var(--main-text-line-height);
font-family: sans-serif;
color: var(--description-text-color);
word-wrap: break-word;
white-space: nowrap;
overflow-x: auto;
} }
.nav-bar-current { .nav-bar-current {
color: #2f7af5; color: var(--link-text-color-day);
} }
.nightmode > .nav-bar { .nav-bar.nightmode {
background-color: #222526; background-color: var(--topbar-bg-color-night);
font-size: 1.1em; font-size: var(--main-text-font-size);
font-family: sans-serif; font-family: sans-serif;
color: #222526; color: var(--main-text-color-night);
word-wrap: break-word; word-wrap: break-word;
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
padding-top: 8px; padding-top: 12px;
padding-bottom: 8px; padding-bottom: 12px;
font-weight: normal; font-weight: normal;
line-height: 1.6em; line-height: var(--main-text-line-height);
}
.nightmode > .nav-bar, .nightmode > div > .nav-bar, {
background-color: #222526;
font-size: 1.1em;
font-family: sans-serif;
color: #222526;
word-wrap: break-word;
padding-left: 16px;
padding-right: 16px;
padding-top: 8px;
padding-bottom: 8px;
font-weight: normal;
line-height: 1.6em;
} }
.title-image { .title-image {
@ -83,55 +103,77 @@ body {
background-size: 100%; background-size: 100%;
background-size:cover; background-size:cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f2f2f2; background-color: var(--topbar-bg-color-day);
}
.title-image.nightmode {
width: 100%;
height: 30%;
background: center;
background-size: 100%;
background-size:cover;
background-repeat: no-repeat;
background-color: var(--topbar-bg-color-night);
} }
h1 { h1 {
font-size: 2em; font-size: 2em;
color: #212121; color: var(--main-text-color-day);
font-family: RobotoSlab-Regular; font-family: RobotoSlab-Regular;
letter-spacing: 0.02em; letter-spacing: 0.02em;
word-wrap: break-word; word-wrap: break-word;
padding-top: 5%; /* padding-top: 5%;*/
font-weight: normal; font-weight: normal;
} }
.nightmode > h1, .nightmode > div > h1 { .nightmode h1 {
color: #a3a3a3; color: var(--main-text-color-night);
} }
h2 { h2 {
font-size: 1.5em; font-size: 1.5em;
color: #454545; color: var(--headline-text-color-day);
font-family: RobotoSlab-Regular; font-family: RobotoSlab-Regular;
font-weight:100; font-weight: 100;
word-wrap: break-word; word-wrap: break-word;
padding-top: 2%; line-height: var(--main-text-line-height);
padding-bottom: 4%;
line-height: 1.6em;
letter-spacing: 0.015em; letter-spacing: 0.015em;
border-bottom: 1px solid #eaecf0; border-bottom: 1px solid #eaecf0;
padding-top: 0%;
padding-bottom: 5%;
padding-left: content;
width: 100%; width: 100%;
} }
.nightmode > h2, .nightmode > div > h2 { .nightmode h2 {
color: #cccccc; color: var(--headline-text-color-night);
border-bottom: 1px solid #2d3133; border-bottom: 1px solid #2d3133;
font-weight:100; font-weight: 100;
}
h2.active {
border-bottom: 0px;
}
.nightmode h2.active {
padding-left: content;
color: var(--main-text-color-night);
border-bottom: 0px;
} }
h2.active:after { h2.active:after {
color: #222526;
transform: rotate(-135deg); transform: rotate(-135deg);
-webkit-transform: rotate(-135deg); -webkit-transform: rotate(-135deg);
position: absolute; position: absolute;
right: 1em; right: 7%;
} }
h2:after { h2:after {
/* Headline arrow */ /* Headline arrow */
vertical-align: middle; vertical-align: middle;
content: ""; content: "";
border: solid #727272; border: solid var(--description-text-color);
border-width: 0 2px 2px 0; border-width: 0 2px 2px 0;
margin-top: 13px; margin-top: 13px;
display: inline-block; display: inline-block;
@ -139,47 +181,65 @@ h2:after {
transform: rotate(45deg); transform: rotate(45deg);
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
position: absolute; position: absolute;
right: 1em; right: 7%;
} }
/*
.mw-headline {
}
*/
h3 { h3 {
color: #212121; color: var(--description-text-color);
font-size: 1.2em; font-size: var(--headers-font-size);
font-family: sans-serif; font-family: sans-serif;
word-wrap: break-word; word-wrap: break-word;
font-weight: bold; font-weight: bold;
margin-top: 5%; margin-top: 5%;
margin-bottom: 3%; margin-bottom: 3%;
line-height: 1.6em; line-height: var(--main-text-line-height);
} }
.nightmode > h3, .nightmode > div > h3 { .nightmode h3 {
color: #727272; color: var(--description-text-color);
}
h4, h5 {
color: var(--headline-text-color-day);
font-size: var(--headers-font-size);
font-family: sans-serif;
word-wrap: break-word;
font-weight: bold;
margin-top: 5%;
margin-bottom: 3%;
padding-left: content;
line-height: var(--main-text-line-height);
}
.nightmode h4, .nightmode h5 {
color: var(--headline-text-color-night);
}
.mw-headline {
padding-left: content;
padding-right: 7%;
} }
p { p {
color: var(--main-text-color-day);
font-family: sans-serif; font-family: sans-serif;
font-size: 1.1em; font-size: var(--main-text-font-size);
line-height: 1.6em; line-height: var(--main-text-line-height);
padding-left: content;
} }
.nightmode > div > p, .nightmode > p { .nightmode p {
color: #cccccc; color: var(--main-text-color-night);
} }
ul { ul, dl {
/* font-size: 1.1em; */ /* font-size: var(--main-text-font-size); */
color: var(--main-text-color-day);
font-size: var(--main-text-font-size);
list-style-type: disc; list-style-type: disc;
line-height: 1.6em; line-height: var(--main-text-line-height);
margin-left: 5%; margin-left: 5%;
padding: 0%; padding: 0%;
} }
li { li {
@ -188,12 +248,12 @@ li {
padding-bottom: 1%; padding-bottom: 1%;
} }
.nightmode > ul, .nightmode > div > ul { .nightmode ul, .nightmode dl {
color: #cccccc; color: #cccccc;
} }
.toc { .toc {
font-size: 1.1em; font-size: var(--main-text-font-size);
} }
@ -201,27 +261,24 @@ img {
width: 100%; width: 100%;
} }
a, a.external, a.free, a.text { a, a.external.free, a.text {
color: #237bff; color: var(--link-text-color-day);
text-decoration-color: #a3c8ff; text-decoration-color: #a3c8ff;
word-wrap: break-word; word-wrap: break-word;
background-color: #fafafa; /* background-color: #edf4ff; */
} }
.nightmode > a, .nightmode > div > a { .nightmode a, .nightmode a.external.free, .nightmode a.text {
color: #d28521; color: var(--link-text-color-night);
text-decoration-color: #854f08; text-decoration-color: #854f08;
word-wrap: break-word; word-wrap: break-word;
} /*background-color: #222526;*/
.nightmode > a.external, .nightmode > a.free, .nightmode > a.text {
color: #d28521;
text-decoration-color: #854f08;
word-wrap: break-word;
background-color: #222526;
} }
pre { pre {
font-size: var(--main-text-font-size);
line-height: var(--main-text-line-height);
font-family: sans-serif;
white-space: pre-wrap; white-space: pre-wrap;
white-space: -moz-pre-wrap; white-space: -moz-pre-wrap;
white-space: -pre-wrap; white-space: -pre-wrap;
@ -229,16 +286,16 @@ pre {
word-wrap: break-word; word-wrap: break-word;
} }
.nightmode > pre { .nightmode pre {
color: #727272; color: var(--main-text-color-night);
} }
.geo { a.geo {
background-color: #fafafa; background-color: #fafafa;
border: 1px solid #e6e6e6; border: 1px solid #e6e6e6;
border-radius: 4px; border-radius: 4px;
padding: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;
color: #237bff; color: var(--link-text-color-day);
font-size: 0.9em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
@ -246,13 +303,13 @@ pre {
display: inline-block; display: inline-block;
} }
.nightmode > .geo, .nightmode > div > .geo, .nightmode > div > ul > .geo, .nightmode > a > .geo { .nightmode a.geo {
color: #d28521; color: var(--link-text-color-night);
background-color: #222526; background-color: var(--topbar-bg-color-night);
border: 1px solid #2d3133; border: 1px solid #2d3133;
border-radius: 4px; border-radius: 4px;
padding: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;
color: #d28521; color: var(--link-text-color-night);
font-size: 0.9em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
@ -277,16 +334,8 @@ td {
.thumbnailcaption { .thumbnailcaption {
padding-top: 3%; padding-top: 3%;
width: 100%; width: 100%;
font-size: 1.1em; font-size: var(--main-text-font-size);
color: #727272; color: var(--description-text-color);
font-style: italic; font-style: italic;
text-align: center; text-align: center;
} }
.content {
display: none;
overflow: hidden;
}

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_map"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?attr/wikivoyage_primary_text_color"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Ukraine"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/wikivoyage_secondary_text"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="255 Mb • Standard map"/>
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:minHeight="0dp"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>
<ImageView
android:id="@+id/icon_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
tools:src="@drawable/ic_action_import"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:background="?attr/wikivoyage_card_divider_color"/>
</LinearLayout>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/text_margin_small"
android:layout_marginRight="@dimen/text_margin_small"
android:background="?attr/wikivoyage_travel_card_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/maps_you_need"
android:textColor="?attr/wikivoyage_primary_text_color"
android:textSize="@dimen/travel_card_primary_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
android:textColor="@color/wikivoyage_secondary_text"
android:textSize="@dimen/travel_card_primary_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/maps_you_need_descr"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/wikivoyage_card_divider_color"/>
<LinearLayout
android:id="@+id/items_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding"
android:orientation="vertical"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/bottom_sheet_content_margin_small"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small">
<FrameLayout
android:id="@+id/secondary_btn_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/wikivoyage_secondary_btn_bg">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/secondary_button"
android:layout_width="match_parent"
android:layout_height="@dimen/wikivoyage_card_button_height"
android:layout_gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:ellipsize="end"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/text_button_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:ignore="UnusedAttribute"
tools:text="Later"/>
</FrameLayout>
<View
android:id="@+id/buttons_divider"
android:layout_width="@dimen/bottom_sheet_content_margin_small"
android:layout_height="match_parent"/>
<FrameLayout
android:id="@+id/primary_btn_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/wikivoyage_primary_btn_bg">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/primary_button"
android:layout_width="match_parent"
android:layout_height="@dimen/wikivoyage_card_button_height"
android:layout_gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:ellipsize="end"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:textColor="?attr/wikivoyage_primary_btn_text_color"
android:textSize="@dimen/text_button_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:ignore="UnusedAttribute"
tools:text="Download all"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,106 +1,86 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout <LinearLayout
android:id="@+id/app_bar" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content"> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/wikivoyage_bg_color"
android:orientation="vertical">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
osmand:layout_scrollFlags="scroll|enterAlways" android:id="@+id/toolbar"
android:id="@+id/toolbar" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height"
android:layout_height="wrap_content" android:background="?attr/wikivoyage_app_bar_color"
osmand:contentInsetLeft="0dp" android:gravity="center_vertical"
osmand:contentInsetStart="0dp" android:minHeight="@dimen/toolbar_height"
osmand:contentInsetRight="0dp" osmand:contentInsetLeft="54dp"
osmand:contentInsetEnd="0dp"> osmand:contentInsetStart="54dp">
<LinearLayout <LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent">
android:layout_height="wrap_content">
<LinearLayout <net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent" android:id="@+id/title_text_view"
android:layout_height="@dimen/dashboard_map_toolbar" android:layout_width="0dp"
android:gravity="center_vertical"> android:layout_height="match_parent"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium" />
<ImageButton <net.osmand.plus.widgets.TextViewEx
android:id="@+id/back_button" android:id="@+id/select_language_text_view"
style="@style/Widget.AppCompat.ActionButton" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_marginBottom="@dimen/content_padding_small"
tools:src="@drawable/ic_arrow_back"/> android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
<View android:layout_marginTop="@dimen/content_padding_small"
android:layout_width="0dp" android:drawablePadding="@dimen/context_menu_padding_margin_small"
android:layout_weight="1" android:gravity="center_vertical"
android:layout_height="match_parent"/> android:letterSpacing="@dimen/text_button_letter_spacing"
android:padding="@dimen/context_menu_padding_margin_tiny"
<net.osmand.plus.widgets.TextViewEx android:textSize="@dimen/text_button_text_size"
android:id="@+id/select_language_text_view" osmand:typeface="@string/font_roboto_medium"
android:layout_width="wrap_content" tools:background="@drawable/wikipedia_select_lang_bg_dark_n"
android:layout_height="match_parent" tools:drawableLeft="@drawable/ic_action_map_language"
android:layout_marginBottom="@dimen/content_padding_small" tools:ignore="UnusedAttribute"
android:layout_marginTop="@dimen/content_padding_small" tools:text="En"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small" tools:textColor="?attr/wikivoyage_active_color" />
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
tools:background="?attr/ctx_menu_controller_bg"
android:gravity="center_vertical"
android:padding="@dimen/context_menu_padding_margin_tiny"
android:textAllCaps="true"
tools:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="RU"/>
</LinearLayout>
<TextView
android:id="@+id/title_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/list_header_padding"
android:paddingBottom="@dimen/list_header_padding"
android:textSize="@dimen/map_button_text_size"
tools:text="Title"/>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.Toolbar> </android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView <FrameLayout
osmand:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="0dp"
android:layout_weight="1">
<TextView <WebView
android:id="@+id/content" android:id="@+id/content_web_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/read_full_article"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/content_padding"/> android:layout_gravity="bottom|center_horizontal"
</android.support.v4.widget.NestedScrollView> android:layout_margin="@dimen/content_padding"
android:gravity="center_vertical"
android:text="@string/read_full_article"
android:textAllCaps="true"
osmand:typeface="@string/font_roboto_medium"
tools:background="@drawable/bt_round_long_night"
tools:textColor="?attr/ctx_menu_controller_text_color" />
<net.osmand.plus.widgets.TextViewEx </FrameLayout>
osmand:typeface="@string/font_roboto_medium"
android:layout_margin="@dimen/content_padding"
android:id="@+id/read_full_article"
android:layout_gravity="bottom|center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@drawable/bt_round_long_night"
android:text="@string/read_full_article"
android:gravity="center_vertical"
android:textAllCaps="true"
tools:textColor="?attr/ctx_menu_controller_text_color"/>
</android.support.design.widget.CoordinatorLayout> </LinearLayout>

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="maps_you_need_descr">You read articles: %1$s. Based on this, we suggest you download these maps:</string>
<string name="maps_you_need">Maps you need</string>
<string name="osmand_team">OsmAnd team</string> <string name="osmand_team">OsmAnd team</string>
<string name="popular_destinations">Popular destinations</string> <string name="popular_destinations">Popular destinations</string>
<string name="paid_app">Paid app</string> <string name="paid_app">Paid app</string>

View file

@ -426,7 +426,38 @@ public class DownloadResources extends DownloadResourceGroup {
return true; return true;
} }
/**
* @return smallest index item, if there are no downloaded index items; null otherwise.
*/
@Nullable
public static IndexItem findSmallestIndexItemAt(OsmandApplication app, LatLon latLon, DownloadActivityType type) throws IOException {
IndexItem res = null;
List<IndexItem> items = findIndexItemsAt(app, latLon, type, true);
for (IndexItem item : items) {
if (item.isDownloaded()) {
return null;
}
if (res == null) {
res = item;
} else {
res = getSmallestIndexItem(res, item);
}
}
return res;
}
private static IndexItem getSmallestIndexItem(@NonNull IndexItem item1, @NonNull IndexItem item2) {
if (item1.contentSize > item2.contentSize) {
return item2;
}
return item1;
}
public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type) throws IOException { public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type) throws IOException {
return findIndexItemsAt(app, latLon, type, false);
}
public static List<IndexItem> findIndexItemsAt(OsmandApplication app, LatLon latLon, DownloadActivityType type, boolean includeDownloaded) throws IOException {
List<IndexItem> res = new ArrayList<>(); List<IndexItem> res = new ArrayList<>();
OsmandRegions regions = app.getRegions(); OsmandRegions regions = app.getRegions();
@ -456,7 +487,7 @@ public class DownloadResources extends DownloadResourceGroup {
} }
WorldRegion downloadRegion = regions.getRegionData(regions.getFullName(o)); WorldRegion downloadRegion = regions.getRegionData(regions.getFullName(o));
if (downloadRegion != null && isRegion && regions.contain(o, point31x, point31y)) { if (downloadRegion != null && isRegion && regions.contain(o, point31x, point31y)) {
if (!isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) { if (includeDownloaded || !isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) {
addIndexItem(downloadThread, type, downloadRegion, res); addIndexItem(downloadThread, type, downloadRegion, res);
} }
} }

View file

@ -1,53 +1,65 @@
package net.osmand.plus.mapcontextmenu; package net.osmand.plus.mapcontextmenu;
import android.annotation.SuppressLint;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsIntent;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.PopupMenu; import android.support.v7.widget.PopupMenu;
import android.text.Html; import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.RelativeSizeSpan;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageButton; import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
public class WikipediaDialogFragment extends DialogFragment {
public class WikipediaDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = "WikipediaDialogFragment"; public static final String TAG = "WikipediaDialogFragment";
private View mainView; private static final String HEADER_INNER = "<html><head>\n" +
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" +
"<meta http-equiv=\"cleartype\" content=\"on\" />\n" +
"<link href=\"article_style.css\" type=\"text/css\" rel=\"stylesheet\"/>\n" +
"</head>";
private static final String FOOTER_INNER = "</body></html>";
private WebView contentWebView;
private TextView articleToolbarText;
private TextView readFullArticleButton;
private TextView selectLanguageTextView;
private boolean darkMode; private boolean darkMode;
private Amenity amenity; private Amenity amenity;
private String lang; private String lang;
@ -72,82 +84,73 @@ public class WikipediaDialogFragment extends DialogFragment {
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new Dialog(getContext(), getTheme()); int themeId = darkMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme_LightStatusBar;
if (!getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) { Dialog dialog = new Dialog(getContext(), themeId);
dialog.getWindow().getAttributes().windowAnimations = R.style.Animations_Alpha; Window window = dialog.getWindow();
if (window != null) {
if (!getSettings().DO_NOT_USE_ANIMATIONS.get()) {
window.getAttributes().windowAnimations = R.style.Animations_Alpha;
}
if (Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(getResolvedColor(getStatusBarColor()));
}
} }
return dialog; return dialog;
} }
@SuppressLint("SetJavaScriptEnabled")
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mainView = inflater.inflate(R.layout.wikipedia_dialog_fragment, container, false); View mainView = inflater.inflate(R.layout.wikipedia_dialog_fragment, container, false);
mainView.setBackgroundColor(ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_bottom_view_bg_dark : R.color.ctx_menu_bottom_view_bg_light)); setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
AppBarLayout appBarLayout = (AppBarLayout) mainView.findViewById(R.id.app_bar); articleToolbarText = (TextView) mainView.findViewById(R.id.title_text_view);
appBarLayout.setBackgroundColor(ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_buttons_bg_dark: R.color.ctx_menu_buttons_bg_light));
int toolbarTextColor = ContextCompat.getColor(getContext(), R.color.dashboard_subheader_text_light);
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.back_button);
backButton.setImageDrawable(getMyApplication().getIconsCache().getPaintedIcon(R.drawable.ic_arrow_back, toolbarTextColor));
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
TextView titleTextView = (TextView) mainView.findViewById(R.id.title_text_view);
titleTextView.setTextColor(toolbarTextColor);
ColorStateList buttonColorStateList = AndroidUtils.createPressedColorStateList(getContext(), darkMode, ColorStateList buttonColorStateList = AndroidUtils.createPressedColorStateList(getContext(), darkMode,
R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p, R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p); R.color.ctx_menu_controller_button_text_color_dark_n, R.color.ctx_menu_controller_button_text_color_dark_p);
final TextView readFullArticleButton = (TextView) mainView.findViewById(R.id.read_full_article); readFullArticleButton = (TextView) mainView.findViewById(R.id.read_full_article);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) readFullArticleButton.getLayoutParams();
params.setBehavior(new CoordinatorLayout.Behavior() {
@Override
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
return dependency instanceof AppBarLayout;
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
if (dependency instanceof AppBarLayout) {
int readFullArticleButtonHeight = child.getMeasuredHeight();
if (readFullArticleButtonHeight != 0) {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
int viewBottomMargin = lp.bottomMargin;
int distanceToScroll = child.getHeight() + viewBottomMargin;
float ratio = dependency.getY() / readFullArticleButtonHeight;
child.setTranslationY(-distanceToScroll * ratio);
}
}
return true;
}
});
readFullArticleButton.setLayoutParams(params);
readFullArticleButton.setBackgroundResource(darkMode ? R.drawable.bt_round_long_night : R.drawable.bt_round_long_day); readFullArticleButton.setBackgroundResource(darkMode ? R.drawable.bt_round_long_night : R.drawable.bt_round_long_day);
readFullArticleButton.setTextColor(buttonColorStateList); readFullArticleButton.setTextColor(buttonColorStateList);
int paddingLeft = (int) getResources().getDimension(R.dimen.wikipedia_button_left_padding);
int paddingRight = (int) getResources().getDimension(R.dimen.dialog_content_margin);
readFullArticleButton.setPadding(paddingLeft, 0, paddingRight, 0);
readFullArticleButton.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_world_globe_dark), null, null, null); readFullArticleButton.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_world_globe_dark), null, null, null);
readFullArticleButton.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.content_padding_small)); readFullArticleButton.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.content_padding_small));
final TextView selectLanguageTextView = mainView.findViewById(R.id.select_language_text_view); selectLanguageTextView = mainView.findViewById(R.id.select_language_text_view);
selectLanguageTextView.setTextColor(buttonColorStateList); selectLanguageTextView.setTextColor(buttonColorStateList);
selectLanguageTextView.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_map_language), null, null, null); selectLanguageTextView.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_map_language), null, null, null);
selectLanguageTextView.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.context_menu_padding_margin_small)); selectLanguageTextView.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.context_menu_padding_margin_small));
selectLanguageTextView.setBackgroundResource(darkMode ? R.drawable.wikipedia_select_lang_bg_dark : R.drawable.wikipedia_select_lang_bg_light); selectLanguageTextView.setBackgroundResource(darkMode ? R.drawable.wikipedia_select_lang_bg_dark : R.drawable.wikipedia_select_lang_bg_light);
contentWebView = (WebView) mainView.findViewById(R.id.content_web_view);
WebSettings webSettings = contentWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
return mainView; return mainView;
} }
@NonNull
private String getBaseUrl() {
File wikivoyageDir = getMyApplication().getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR);
if (new File(wikivoyageDir, "article_style.css").exists()) {
return "file://" + wikivoyageDir.getAbsolutePath() + "/";
}
return "file:///android_asset/";
}
@NonNull
private String createHtmlContent(@NonNull String article) {
StringBuilder sb = new StringBuilder(HEADER_INNER);
String nightModeClass = darkMode ? " nightmode" : "";
sb.append("<div class=\"main");
sb.append(nightModeClass);
sb.append("\">\n");
sb.append(article);
sb.append(FOOTER_INNER);
return sb.toString();
}
@Override @Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
populateWiki(); populateWiki();
@ -176,9 +179,8 @@ public class WikipediaDialogFragment extends DialogFragment {
final String langSelected = lng; final String langSelected = lng;
final String title = amenity.getName(langSelected); final String title = amenity.getName(langSelected);
((TextView) mainView.findViewById(R.id.title_text_view)).setText(title); articleToolbarText.setText(title);
readFullArticleButton.setOnClickListener(new View.OnClickListener() {
mainView.findViewById(R.id.read_full_article).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
String article = "https://" + langSelected.toLowerCase() + ".wikipedia.org/wiki/" + title.replace(' ', '_'); String article = "https://" + langSelected.toLowerCase() + ".wikipedia.org/wiki/" + title.replace(' ', '_');
@ -186,7 +188,6 @@ public class WikipediaDialogFragment extends DialogFragment {
} }
}); });
final TextView selectLanguageTextView = mainView.findViewById(R.id.select_language_text_view);
selectLanguageTextView.setText(langSelected); selectLanguageTextView.setText(langSelected);
selectLanguageTextView.setOnClickListener(new View.OnClickListener() { selectLanguageTextView.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -196,29 +197,15 @@ public class WikipediaDialogFragment extends DialogFragment {
}); });
String content = amenity.getDescription(langSelected); String content = amenity.getDescription(langSelected);
contentWebView.loadDataWithBaseURL(getBaseUrl(), createHtmlContent(content), "text/html", "UTF-8", null);
TextView articleTextView = (TextView) mainView.findViewById(R.id.content);
Spannable spannableContent = new SpannableString(Html.fromHtml(content));
int length = spannableContent.length();
spannableContent.setSpan(new RelativeSizeSpan(1.2f), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
int contentTextColor = ContextCompat.getColor(getContext(), darkMode ? R.color.ctx_menu_bottom_view_text_color_dark : R.color.ctx_menu_bottom_view_text_color_light);
articleTextView.setTextColor(contentTextColor);
articleTextView.setText(spannableContent);
articleTextView.setMovementMethod(LinkMovementMethod.getInstance());
} }
} }
public static void showFullArticle(Context context, Uri uri, boolean nightMode) { public static void showFullArticle(Context context, Uri uri, boolean nightMode) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) { CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() .setToolbarColor(ContextCompat.getColor(context, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
.setToolbarColor(ContextCompat.getColor(context, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color)) .build();
.build(); customTabsIntent.launchUrl(context, uri);
customTabsIntent.launchUrl(context, uri);
} else {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(uri);
context.startActivity(i);
}
} }
private void showPopupLangMenu(View view, final String langSelected) { private void showPopupLangMenu(View view, final String langSelected) {
@ -264,11 +251,7 @@ public class WikipediaDialogFragment extends DialogFragment {
private Drawable getIcon(int resId) { private Drawable getIcon(int resId) {
int colorId = darkMode ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n; int colorId = darkMode ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n;
return getMyApplication().getIconsCache().getIcon(resId, colorId); return getIcon(resId, colorId);
}
private OsmandApplication getMyApplication() {
return (OsmandApplication) getActivity().getApplication();
} }
public static boolean showInstance(AppCompatActivity activity, Amenity amenity, String lang) { public static boolean showInstance(AppCompatActivity activity, Amenity amenity, String lang) {
@ -293,4 +276,25 @@ public class WikipediaDialogFragment extends DialogFragment {
public static boolean showInstance(AppCompatActivity activity, Amenity amenity) { public static boolean showInstance(AppCompatActivity activity, Amenity amenity) {
return showInstance(activity, amenity, null); return showInstance(activity, amenity, null);
} }
protected void setupToolbar(Toolbar toolbar) {
toolbar.setNavigationIcon(getIcon(R.drawable.ic_arrow_back, R.color.icon_color));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
@ColorRes
protected int getStatusBarColor() {
return darkMode ? R.color.status_bar_wikivoyage_article_dark : R.color.status_bar_wikivoyage_article_light;
}
@ColorInt
protected int getResolvedColor(@ColorRes int colorId) {
return ContextCompat.getColor(getContext(), colorId);
}
} }

View file

@ -544,7 +544,8 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
int r = getDefaultRadiusPoi(tb); int r = getDefaultRadiusPoi(tb);
int ex = (int) point.x; int ex = (int) point.x;
int ey = (int) point.y; int ey = (int) point.y;
for (SelectedGpxFile g : selectedGpxHelper.getSelectedGPXFiles()) { List<SelectedGpxFile> selectedGpxFiles = new ArrayList<>(selectedGpxHelper.getSelectedGPXFiles());
for (SelectedGpxFile g : selectedGpxFiles) {
List<WptPt> pts = getListStarPoints(g); List<WptPt> pts = getListStarPoints(g);
// int fcolor = g.getColor() == 0 ? clr : g.getColor(); // int fcolor = g.getColor() == 0 ? clr : g.getColor();
for (WptPt n : pts) { for (WptPt n : pts) {

View file

@ -413,19 +413,16 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
if (aggregatedPartOfArrayOrig.length > 0) { if (aggregatedPartOfArrayOrig.length > 0) {
String current = aggregatedPartOfArrayOrig[0]; String current = aggregatedPartOfArrayOrig[0];
sb.append("<div class=\"nav-bar"+nightModeClass+"\" onClick=\"showNavigation()\">"); sb.append("<div class=\"nav-bar"+nightModeClass+"\" onClick=\"showNavigation()\">");
if (aggregatedPartOfArrayOrig.length > 1) { if (aggregatedPartOfArrayOrig.length > 0) {
String[] aggregatedPartOfArray = new String[aggregatedPartOfArrayOrig.length - 1]; for (int i = 0; i < aggregatedPartOfArrayOrig.length ; i++) {
for (int i = 0; i < aggregatedPartOfArrayOrig.length - 1; i++) { if (i > 0) {
aggregatedPartOfArray[i] = aggregatedPartOfArrayOrig[aggregatedPartOfArrayOrig.length - i - 1]; sb.append("&nbsp;&nbsp;•&nbsp;&nbsp;").append(aggregatedPartOfArrayOrig[i]);
} else {
if (!TextUtils.isEmpty(current)) {
sb.append("<span class=\"nav-bar-current\">").append(current).append("</span>");
}
}
} }
String navBarString = TextUtils.join("", aggregatedPartOfArray);
sb.append(navBarString);
}
if (!TextUtils.isEmpty(current)) {
if (aggregatedPartOfArrayOrig.length > 1) {
sb.append("");
}
sb.append("<span class=\"nav-bar-current\">").append(current).append("</span>");
} }
sb.append("</div>"); sb.append("</div>");
} }

View file

@ -103,6 +103,8 @@ public class TravelLocalDataHelper {
saved.aggregatedPartOf = article.aggregatedPartOf; saved.aggregatedPartOf = article.aggregatedPartOf;
saved.imageTitle = article.imageTitle; saved.imageTitle = article.imageTitle;
saved.content = article.getPartialContent(); saved.content = article.getPartialContent();
saved.lat = article.lat;
saved.lon = article.lon;
savedArticles.add(saved); savedArticles.add(saved);
dbHelper.addSavedArticle(saved); dbHelper.addSavedArticle(saved);
notifySavedUpdated(); notifySavedUpdated();
@ -153,7 +155,7 @@ public class TravelLocalDataHelper {
private static class WikivoyageLocalDataDbHelper { private static class WikivoyageLocalDataDbHelper {
private static final int DB_VERSION = 3; private static final int DB_VERSION = 4;
private static final String DB_NAME = "wikivoyage_local_data"; private static final String DB_NAME = "wikivoyage_local_data";
private static final String HISTORY_TABLE_NAME = "wikivoyage_search_history"; private static final String HISTORY_TABLE_NAME = "wikivoyage_search_history";
@ -189,6 +191,8 @@ public class TravelLocalDataHelper {
private static final String BOOKMARKS_COL_IMAGE_TITLE = "image_title"; private static final String BOOKMARKS_COL_IMAGE_TITLE = "image_title";
private static final String BOOKMARKS_COL_PARTIAL_CONTENT = "partial_content"; private static final String BOOKMARKS_COL_PARTIAL_CONTENT = "partial_content";
private static final String BOOKMARKS_COL_TRAVEL_BOOK = "travel_book"; private static final String BOOKMARKS_COL_TRAVEL_BOOK = "travel_book";
private static final String BOOKMARKS_COL_LAT = "lat";
private static final String BOOKMARKS_COL_LON = "lon";
private static final String BOOKMARKS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + private static final String BOOKMARKS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " +
BOOKMARKS_TABLE_NAME + " (" + BOOKMARKS_TABLE_NAME + " (" +
@ -198,7 +202,9 @@ public class TravelLocalDataHelper {
BOOKMARKS_COL_IS_PART_OF + " TEXT, " + BOOKMARKS_COL_IS_PART_OF + " TEXT, " +
BOOKMARKS_COL_IMAGE_TITLE + " TEXT, " + BOOKMARKS_COL_IMAGE_TITLE + " TEXT, " +
BOOKMARKS_COL_PARTIAL_CONTENT + " TEXT, " + BOOKMARKS_COL_PARTIAL_CONTENT + " TEXT, " +
BOOKMARKS_COL_TRAVEL_BOOK + " TEXT);"; BOOKMARKS_COL_TRAVEL_BOOK + " TEXT, " +
BOOKMARKS_COL_LAT + " double, " +
BOOKMARKS_COL_LON + " double);";
private static final String BOOKMARKS_TABLE_SELECT = "SELECT " + private static final String BOOKMARKS_TABLE_SELECT = "SELECT " +
BOOKMARKS_COL_CITY_ID + ", " + BOOKMARKS_COL_CITY_ID + ", " +
@ -206,7 +212,9 @@ public class TravelLocalDataHelper {
BOOKMARKS_COL_LANG + ", " + BOOKMARKS_COL_LANG + ", " +
BOOKMARKS_COL_IS_PART_OF + ", " + BOOKMARKS_COL_IS_PART_OF + ", " +
BOOKMARKS_COL_IMAGE_TITLE + ", " + BOOKMARKS_COL_IMAGE_TITLE + ", " +
BOOKMARKS_COL_PARTIAL_CONTENT + BOOKMARKS_COL_PARTIAL_CONTENT + ", " +
BOOKMARKS_COL_LAT + ", " +
BOOKMARKS_COL_LON +
" FROM " + BOOKMARKS_TABLE_NAME; " FROM " + BOOKMARKS_TABLE_NAME;
private final OsmandApplication context; private final OsmandApplication context;
@ -253,6 +261,10 @@ public class TravelLocalDataHelper {
conn.execSQL("UPDATE " + BOOKMARKS_TABLE_NAME + " SET " + BOOKMARKS_COL_TRAVEL_BOOK + " = ?", args); conn.execSQL("UPDATE " + BOOKMARKS_TABLE_NAME + " SET " + BOOKMARKS_COL_TRAVEL_BOOK + " = ?", args);
} }
} }
if (oldVersion < 4) {
conn.execSQL("ALTER TABLE " + BOOKMARKS_TABLE_NAME + " ADD " + BOOKMARKS_COL_LAT + " double");
conn.execSQL("ALTER TABLE " + BOOKMARKS_TABLE_NAME + " ADD " + BOOKMARKS_COL_LON + " double");
}
} }
@NonNull @NonNull
@ -388,9 +400,10 @@ public class TravelLocalDataHelper {
SQLiteConnection conn = openConnection(false); SQLiteConnection conn = openConnection(false);
if (conn != null) { if (conn != null) {
try { try {
conn.execSQL("INSERT INTO " + BOOKMARKS_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?)", conn.execSQL("INSERT INTO " + BOOKMARKS_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
new Object[]{article.cityId, article.title, article.lang, new Object[]{article.cityId, article.title, article.lang,
article.aggregatedPartOf, article.imageTitle, article.content, travelBook}); article.aggregatedPartOf, article.imageTitle, article.content,
travelBook, article.lat, article.lon});
} finally { } finally {
conn.close(); conn.close();
} }
@ -446,6 +459,8 @@ public class TravelLocalDataHelper {
res.aggregatedPartOf = cursor.getString(3); res.aggregatedPartOf = cursor.getString(3);
res.imageTitle = cursor.getString(4); res.imageTitle = cursor.getString(4);
res.content = cursor.getString(5); res.content = cursor.getString(5);
res.lat = cursor.getDouble(6);
res.lon = cursor.getDouble(7);
return res; return res;
} }