From 7ce8b69be15e69b5d92947a11b6f6ad7c1be270f Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 26 Apr 2018 19:04:10 +0300 Subject: [PATCH 1/4] change sqlQuery for random articles --- .../net/osmand/plus/wikivoyage/data/TravelDbHelper.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index 7260ca0e99..e3fc28e6a7 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -208,11 +208,10 @@ public class TravelDbHelper { SQLiteConnection conn = openConnection(); if (conn != null) { TravelArticle travelArticle; - SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " - + ARTICLES_TABLE_NAME - + " WHERE article_id IN (SELECT article_id FROM " - + ARTICLES_TABLE_NAME - + " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null); + String lang = application.getLanguage(); + SQLiteCursor cursor = conn.rawQuery("SELECT * FROM wikivoyage_articles" + + " WHERE title IN (SELECT title FROM popular_articles WHERE lang = ?" + + " ORDER BY RANDOM()) ORDER BY RANDOM() LIMIT 100", new String[]{lang}); if (cursor.moveToFirst()) { do { travelArticle = readArticle(cursor); From 7db4366355b51d6836708e74faabea0ff13ea9cb Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 27 Apr 2018 13:33:30 +0300 Subject: [PATCH 2/4] add check for file and line lineSpacingMultiplier --- OsmAnd/res/layout/wikivoyage_open_beta_card.xml | 1 + OsmAnd/res/layout/wikivoyage_start_editing_card.xml | 3 ++- OsmAnd/res/values-large/sizes.xml | 2 +- OsmAnd/res/values/sizes.xml | 3 ++- .../plus/wikivoyage/explore/ExploreTabFragment.java | 10 ++++++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/layout/wikivoyage_open_beta_card.xml b/OsmAnd/res/layout/wikivoyage_open_beta_card.xml index 58e971d386..945f3cbc14 100644 --- a/OsmAnd/res/layout/wikivoyage_open_beta_card.xml +++ b/OsmAnd/res/layout/wikivoyage_open_beta_card.xml @@ -44,6 +44,7 @@ android:id="@+id/description" android:layout_width="match_parent" android:layout_height="wrap_content" + android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" android:layout_marginBottom="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginLeft="@dimen/list_content_padding" diff --git a/OsmAnd/res/layout/wikivoyage_start_editing_card.xml b/OsmAnd/res/layout/wikivoyage_start_editing_card.xml index 0ecfab8230..ae54789119 100644 --- a/OsmAnd/res/layout/wikivoyage_start_editing_card.xml +++ b/OsmAnd/res/layout/wikivoyage_start_editing_card.xml @@ -31,7 +31,7 @@ android:layout_marginLeft="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding" android:layout_marginStart="@dimen/list_content_padding" - android:layout_marginTop="42dp" + android:layout_marginTop="40dp" android:layout_weight="1" android:textColor="@color/primary_text_dark" android:textSize="@dimen/default_list_text_size" @@ -50,6 +50,7 @@ android:id="@+id/description" android:layout_width="match_parent" android:layout_height="wrap_content" + android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" android:layout_marginBottom="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginLeft="@dimen/list_content_padding" diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml index 53875d577c..fb01ffb209 100644 --- a/OsmAnd/res/values-large/sizes.xml +++ b/OsmAnd/res/values-large/sizes.xml @@ -208,6 +208,6 @@ 33dp 82dp 216dp - 22dp + 24dp \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 7875a4e4d9..805b4d71bd 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -291,9 +291,10 @@ 14dp 22dp 64dp - 15dp + 16dp 144dp 0.01 + 1.2 \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 1ca6f0a3d8..aaa44aeee3 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -166,8 +166,11 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn startEditingTravelCard = new StartEditingTravelCard(app, nightMode); addOpenBetaTravelCard(items, nightMode); items.add(startEditingTravelCard); - items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations))); - addPopularDestinations(app); + + if (app.getTravelDbHelper().getSelectedTravelBook() != null) { + items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations))); + addPopularDestinations(app); + } return items; } @@ -200,8 +203,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn private void addOpenBetaTravelCard(List items, final boolean nightMode) { final OsmandApplication app = getMyApplication(); - if ((Version.isFreeVersion(app) && !app.getSettings().LIVE_UPDATES_PURCHASED.get() - && !app.getSettings().FULL_VERSION_PURCHASED.get())) { + if (!Version.isPaidVersion(app)) { items.add(new OpenBetaTravelCard(app, nightMode, getFragmentManager())); } } From da32bf59060b95582fb6fe7241e4a0a6485ffd25 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 27 Apr 2018 13:35:37 +0300 Subject: [PATCH 3/4] removed sql changes --- .../net/osmand/plus/wikivoyage/data/TravelDbHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index e3fc28e6a7..7260ca0e99 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -208,10 +208,11 @@ public class TravelDbHelper { SQLiteConnection conn = openConnection(); if (conn != null) { TravelArticle travelArticle; - String lang = application.getLanguage(); - SQLiteCursor cursor = conn.rawQuery("SELECT * FROM wikivoyage_articles" - + " WHERE title IN (SELECT title FROM popular_articles WHERE lang = ?" - + " ORDER BY RANDOM()) ORDER BY RANDOM() LIMIT 100", new String[]{lang}); + SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " + + ARTICLES_TABLE_NAME + + " WHERE article_id IN (SELECT article_id FROM " + + ARTICLES_TABLE_NAME + + " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null); if (cursor.moveToFirst()) { do { travelArticle = readArticle(cursor); From 0533a35671ce62fe531b0c98670e279f699fdfc7 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 27 Apr 2018 13:37:14 +0300 Subject: [PATCH 4/4] change xml --- OsmAnd/res/layout/wikivoyage_welcome_screen.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/layout/wikivoyage_welcome_screen.xml b/OsmAnd/res/layout/wikivoyage_welcome_screen.xml index 80f0951586..6ced2ce20c 100644 --- a/OsmAnd/res/layout/wikivoyage_welcome_screen.xml +++ b/OsmAnd/res/layout/wikivoyage_welcome_screen.xml @@ -56,7 +56,7 @@ android:layout_height="0dp" android:layout_weight="1" android:ellipsize="end" - android:lineSpacingMultiplier="1.2" + android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" android:text="@string/travel_guide_description" android:textColor="@color/wikivoyage_secondary_text" android:textSize="@dimen/default_list_text_size"/>