Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5ee107fc79
24 changed files with 379 additions and 167 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
<meta-data
|
||||
android:name="com.facebook.sdk.ApplicationId"
|
||||
android:resource="@string/facebook_app_id"/>
|
||||
android:value="fb2057524931189530"/>
|
||||
<activity
|
||||
android:name="net.osmand.plus.activities.MapActivity"
|
||||
android:theme="@style/FirstSplashScreenFree"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
tools:replace="android:icon">
|
||||
<meta-data
|
||||
android:name="com.facebook.sdk.ApplicationId"
|
||||
android:resource="@string/facebook_app_id"/>
|
||||
android:value="fb131313131043971"/>
|
||||
<activity
|
||||
android:name="net.osmand.plus.activities.MapActivity"
|
||||
android:theme="@style/FirstSplashScreenCustom"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
tools:replace="android:icon">
|
||||
<meta-data
|
||||
android:name="com.facebook.sdk.ApplicationId"
|
||||
android:resource="@string/facebook_app_id"/>
|
||||
android:value="fb792288460976727"/>
|
||||
<activity
|
||||
android:name="net.osmand.plus.activities.MapActivity"
|
||||
android:theme="@style/FirstSplashScreenFreeDev"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
body {
|
||||
max-width: 100% !important;
|
||||
/* overflow-x: hidden; hide scroll bar */
|
||||
display: block;
|
||||
margin-top: 7%;
|
||||
margin-bottom: 0;
|
||||
|
@ -10,9 +11,10 @@ body {
|
|||
|
||||
h2 {
|
||||
font-size: 2em;
|
||||
color: #727272;
|
||||
color: #454545;
|
||||
font-family: serif;
|
||||
font-weight: normal;
|
||||
font-weight: bold;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h3 {
|
||||
|
@ -20,6 +22,7 @@ h3 {
|
|||
font-size: 1.5em;
|
||||
font-family: sans-serif;
|
||||
padding-top: 5%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
p {
|
||||
|
@ -30,8 +33,13 @@ p {
|
|||
|
||||
li {
|
||||
font-family: sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 250%;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
ul {
|
||||
font-size: 1.1em;
|
||||
padding-top: 3%;
|
||||
padding-bottom: 3%;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,19 +50,29 @@ img {
|
|||
a {
|
||||
color: #237bff;
|
||||
text-decoration-color: #a3c8ff;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
a.external-free {
|
||||
external-free {
|
||||
word-wrap: break-word;
|
||||
background-color: #f2f2f2;
|
||||
background-color: #black;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
white-space: -moz-pre-wrap;
|
||||
white-space: -pre-wrap;
|
||||
white-space: -o-pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.thumb-tright, .thumbinner {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.thumbcaption {
|
||||
.thumbnailcaption {
|
||||
padding-top: 3%;
|
||||
width: 100%;
|
||||
font-size: 1.1em;
|
||||
|
|
|
@ -396,7 +396,7 @@ dependencies {
|
|||
compile 'com.google.firebase:firebase-messaging:12.0.1'
|
||||
compile 'com.google.firebase:firebase-iid:12.0.1'
|
||||
compile 'com.google.firebase:firebase-config:12.0.1'
|
||||
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
|
||||
compile 'com.facebook.android:facebook-android-sdk:4.31.0'
|
||||
}
|
||||
compile 'com.android.support:multidex:1.0.1'
|
||||
compile 'com.android.support:gridlayout-v7:27.1.0'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="NewApi" severity="warning" />
|
||||
<issue id="ResourceAsColor" severity="warning" />
|
||||
</lint>
|
|
@ -5,7 +5,6 @@
|
|||
<!-- string name="app_version_suffix"></string -->
|
||||
|
||||
<!-- Not translatable -->
|
||||
<string name="facebook_app_id">2057524931189530</string>
|
||||
<string name="full_version_price">€7,99</string>
|
||||
<string name="osm_live">OsmAnd Live</string>
|
||||
<string name="ga_api_key">UA-28342846-2</string>
|
||||
|
|
|
@ -164,7 +164,6 @@
|
|||
<!-- Longitude row: -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/longitude_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
29
OsmAnd/res/layout/wikivoyage_search_list_header.xml
Normal file
29
OsmAnd/res/layout/wikivoyage_search_list_header.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/wikivoyage_search_list_header_height"
|
||||
android:background="?attr/wikivoyage_card_bg_color"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/content_padding"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Search results"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,70 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/wikivoyage_card_bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="search_term: "/>
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:minHeight="@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/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
tools:src="@drawable/ic_action_placeholder_city"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="Amsterdam"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/left_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_content_margin_small"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||
tools:text="Amstellend North Holland"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/right_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||
tools:text="En, Ru, De, ..."/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_selected_item_title_height"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_selected_item_title_height"
|
||||
android:background="?attr/wikivoyage_card_divider_color"
|
||||
android:focusable="false"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_term"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="city_id: "/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/city_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="article_title: "/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/article_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="lang: "/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lang"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<include
|
||||
android:id="@+id/shadow"
|
||||
layout="@layout/card_bottom_divider"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -193,4 +193,6 @@
|
|||
<dimen name="coords_input_show_hide_keyboard_btn_padding">19dp</dimen>
|
||||
|
||||
<dimen name="toolbar_height">84dp</dimen>
|
||||
|
||||
<dimen name="wikivoyage_search_list_header_height">54dp</dimen>
|
||||
</resources>
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
<attr name="wikivoyage_bg_color" format="reference"/>
|
||||
<attr name="wikivoyage_card_bg_color" format="reference"/>
|
||||
<attr name="wikivoyage_card_divider_color" format="reference"/>
|
||||
<attr name="wikivoyage_app_bar_color" format="reference"/>
|
||||
<attr name="wikivoyage_app_bar_text_color" format="reference"/>
|
||||
<attr name="wikivoyage_active_color" format="reference"/>
|
||||
|
|
|
@ -267,4 +267,6 @@
|
|||
<dimen name="coords_input_keyboard_item_height">56dp</dimen>
|
||||
|
||||
<dimen name="toolbar_height">56dp</dimen>
|
||||
|
||||
<dimen name="wikivoyage_search_list_header_height">36dp</dimen>
|
||||
</resources>
|
|
@ -9,6 +9,7 @@
|
|||
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
|
||||
-->
|
||||
<string name="shared_string_result">Result</string>
|
||||
<string name="use_two_digits_longitude">Use two digits longitude</string>
|
||||
<string name="shared_string_travel">Travel</string>
|
||||
<string name="waypoints_removed_from_map_markers">Waypoints removed from map markers</string>
|
||||
|
|
|
@ -199,6 +199,7 @@
|
|||
|
||||
<item name="wikivoyage_bg_color">@color/wikivoyage_bg_light</item>
|
||||
<item name="wikivoyage_card_bg_color">@color/wikivoyage_card_bg_light</item>
|
||||
<item name="wikivoyage_card_divider_color">@color/wikivoyage_card_divider_light</item>
|
||||
<item name="wikivoyage_app_bar_color">@color/wikivoyage_app_bar_light</item>
|
||||
<item name="wikivoyage_app_bar_text_color">@color/wikivoyage_app_bar_text_light</item>
|
||||
<item name="wikivoyage_active_color">@color/wikivoyage_active_light</item>
|
||||
|
@ -389,6 +390,7 @@
|
|||
|
||||
<item name="wikivoyage_bg_color">@color/wikivoyage_bg_dark</item>
|
||||
<item name="wikivoyage_card_bg_color">@color/wikivoyage_card_bg_dark</item>
|
||||
<item name="wikivoyage_card_divider_color">@color/wikivoyage_card_divider_dark</item>
|
||||
<item name="wikivoyage_app_bar_color">@color/wikivoyage_app_bar_dark</item>
|
||||
<item name="wikivoyage_app_bar_text_color">@color/wikivoyage_app_bar_text_dark</item>
|
||||
<item name="wikivoyage_active_color">@color/wikivoyage_active_dark</item>
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Application;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -165,10 +166,8 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
// if(!osmandSettings.FOLLOW_THE_ROUTE.get()) {
|
||||
// targetPointsHelper.clearPointToNavigate(false);
|
||||
// }
|
||||
|
||||
InAppHelper.initialize(this);
|
||||
initRemoteConfig();
|
||||
printFirebasetoken();
|
||||
initExternalLibs();
|
||||
startApplication();
|
||||
System.out.println("Time to start application " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
|
||||
timeToStart = System.currentTimeMillis();
|
||||
|
@ -878,6 +877,31 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void initExternalLibs() {
|
||||
initRemoteConfig();
|
||||
printFirebasetoken();
|
||||
initFBEvents();
|
||||
}
|
||||
|
||||
public void initFBEvents() {
|
||||
try {
|
||||
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
|
||||
Class<?> cls = Class.forName("com.facebook.FacebookSdk");
|
||||
Method ms = cls.getMethod("sdkInitialize", Context.class);
|
||||
ms.invoke(null, getApplicationContext());
|
||||
Class<?> cl = Class.forName("com.facebook.appevents.AppEventsLogger");
|
||||
Method mm = cl.getMethod("activateApp", Application.class);
|
||||
mm.invoke(null, this);
|
||||
Method mu = cl.getMethod("getUserID");
|
||||
String uid = (String) mu.invoke(null);
|
||||
LOG.info("FB token: " + uid);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void initRemoteConfig() {
|
||||
try {
|
||||
|
@ -891,7 +915,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
log.invoke(inst, defaults);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -907,7 +931,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
LOG.info("Fbase token: " + firebaseToken);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.res.ColorStateList;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -67,7 +66,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
if (listener != null) {
|
||||
OsmandSettings.CommonPreference<Boolean> pref = settings.COORDS_INPUT_TWO_DIGITS_LONGTITUDE;
|
||||
pref.set(!pref.get());
|
||||
listener.onTwoDigitsLongtitudeChanged();
|
||||
listener.onInputSettingsChanged();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
@ -113,7 +112,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
int format = (int) v.getTag();
|
||||
settings.COORDS_INPUT_FORMAT.set(format);
|
||||
if (listener != null) {
|
||||
listener.onFormatChanged();
|
||||
listener.onInputSettingsChanged();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
@ -150,12 +149,10 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
|
||||
interface CoordinateInputFormatChangeListener {
|
||||
|
||||
void onTwoDigitsLongtitudeChanged();
|
||||
|
||||
void onKeyboardChanged();
|
||||
|
||||
void onHandChanged();
|
||||
|
||||
void onFormatChanged();
|
||||
void onInputSettingsChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.ClipData;
|
|||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -35,6 +36,7 @@ import android.view.MenuItem;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
@ -88,8 +90,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private boolean lightTheme;
|
||||
private boolean orientationPortrait;
|
||||
|
||||
private boolean isSoftKeyboardShown = true;
|
||||
private boolean useTwoDigitsLongtitude;
|
||||
private boolean isSoftKeyboardShown;
|
||||
private boolean north = true;
|
||||
private boolean east = true;
|
||||
|
||||
|
@ -107,7 +108,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
super.onCreate(savedInstanceState);
|
||||
lightTheme = getMyApplication().getSettings().isLightContent();
|
||||
setStyle(STYLE_NO_FRAME, lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||
useTwoDigitsLongtitude = getMyApplication().getSettings().COORDS_INPUT_TWO_DIGITS_LONGTITUDE.get();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -253,7 +253,11 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (isOsmandKeyboardCurrentlyVisible()) {
|
||||
changeOsmandKeyboardVisibility(false);
|
||||
}
|
||||
editTexts.get(6).requestFocus();
|
||||
for (EditText et : editTexts) {
|
||||
if (et.getId() == R.id.point_name_et) {
|
||||
et.requestFocus();
|
||||
}
|
||||
}
|
||||
final View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
|
@ -261,19 +265,12 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
public void run() {
|
||||
isSoftKeyboardShown = true;
|
||||
AndroidUtils.showSoftKeyboard(focusedView);
|
||||
showHideKeyboardIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_keyboard_hide));
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
});
|
||||
editTexts.get(6).setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus && isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), v);
|
||||
}
|
||||
}
|
||||
});
|
||||
adapter = new CoordinateInputAdapter(mapActivity, mapMarkers);
|
||||
RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||
|
@ -372,12 +369,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (isSoftKeyboardShown) {
|
||||
isSoftKeyboardShown = false;
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), focusedView);
|
||||
showHideKeyboardIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_keyboard_show));
|
||||
} else {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
isSoftKeyboardShown = true;
|
||||
AndroidUtils.showSoftKeyboard(focusedView);
|
||||
showHideKeyboardIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_keyboard_hide));
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
@ -386,6 +385,22 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Rect r = new Rect();
|
||||
mainView.getWindowVisibleDisplayFrame(r);
|
||||
int screenHeight = mainView.getRootView().getHeight();
|
||||
int keypadHeight = screenHeight - r.bottom;
|
||||
if (keypadHeight > screenHeight * 0.15) {
|
||||
isSoftKeyboardShown = true;
|
||||
showHideKeyboardIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_keyboard_hide));
|
||||
} else {
|
||||
isSoftKeyboardShown = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupKeyboardItems(View keyboardView, View.OnClickListener listener, @IdRes int... itemsIds) {
|
||||
|
@ -615,6 +630,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (focusedView != null && focusedView instanceof EditTextEx) {
|
||||
EditTextEx et = (EditTextEx) focusedView;
|
||||
int currentLength = et.getText().length();
|
||||
if (et.getId() == R.id.lon_first_input_et) {
|
||||
String lonFirstInput = et.getText().toString();
|
||||
if (currentLength == 2) {
|
||||
if (lonFirstInput.charAt(0) != '1' && lonFirstInput.charAt(0) != '0') {
|
||||
switchEditText(et.getId(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (et.getMaxSymbolsCount() > 0 && currentLength > strLength && currentLength >= et.getMaxSymbolsCount()) {
|
||||
switchEditText(et.getId(), true);
|
||||
}
|
||||
|
@ -718,7 +741,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
clearInputs();
|
||||
|
||||
int format = getMyApplication().getSettings().COORDS_INPUT_FORMAT.get();
|
||||
|
||||
boolean useTwoDigitsLongtitude = getMyApplication().getSettings().COORDS_INPUT_TWO_DIGITS_LONGTITUDE.get();
|
||||
setupEditTextEx(R.id.lat_first_input_et, CoordinateInputFormats.getFirstPartSymbolsCount(format, true, useTwoDigitsLongtitude), true);
|
||||
setupEditTextEx(R.id.lon_first_input_et, CoordinateInputFormats.getFirstPartSymbolsCount(format, false, useTwoDigitsLongtitude), false);
|
||||
|
||||
|
@ -752,8 +775,21 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
R.id.lon_first_input_et, R.id.lon_second_input_et, R.id.lon_third_input_et, R.id.point_name_et);
|
||||
|
||||
for (EditText et : editTexts) {
|
||||
if (et.getId() == R.id.lon_first_input_et) {
|
||||
((LinearLayout.LayoutParams) et.getLayoutParams()).weight = editTexts.get(0).getMaxSymbolsCount();
|
||||
et.requestLayout();
|
||||
}
|
||||
if (et.getId() != R.id.point_name_et) {
|
||||
et.addTextChangedListener(textWatcher);
|
||||
}else {
|
||||
et.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus && isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), v);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
et.setOnTouchListener(inputEditTextOnTouchListener);
|
||||
et.setOnLongClickListener(inputEditTextOnLongClickListener);
|
||||
|
@ -813,11 +849,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private CoordinateInputFormatChangeListener createCoordinateInputFormatChangeListener() {
|
||||
return new CoordinateInputFormatChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onTwoDigitsLongtitudeChanged() {
|
||||
changeTwoDigitsLongtitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyboardChanged() {
|
||||
changeKeyboard();
|
||||
|
@ -829,7 +860,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFormatChanged() {
|
||||
public void onInputSettingsChanged() {
|
||||
registerInputs();
|
||||
}
|
||||
};
|
||||
|
@ -841,13 +872,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
registerMainView();
|
||||
}
|
||||
|
||||
private void changeTwoDigitsLongtitude() {
|
||||
editTexts.get(3).setMaxSymbolsCount(getMyApplication().getSettings().COORDS_INPUT_TWO_DIGITS_LONGTITUDE.get() ? 2 : 3);
|
||||
((LinearLayout)mainView.findViewById(R.id.longitude_row)).removeView(editTexts.get(3));
|
||||
// editTexts.get(3).invalidate();
|
||||
registerMainView();
|
||||
}
|
||||
|
||||
private void changeEditTextSelections() {
|
||||
for (EditText et : editTexts) {
|
||||
et.setSelection(et.getText().length());
|
||||
|
|
|
@ -102,7 +102,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
}
|
||||
|
||||
final PopupMenu popup = new PopupMenu(view.getContext(), view, Gravity.END);
|
||||
for (final String lang : searchResult.getLang()) {
|
||||
for (final String lang : searchResult.getLangs()) {
|
||||
MenuItem item = popup.getMenu().add(lang);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -130,7 +130,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
return;
|
||||
}
|
||||
if (selectedLang == null) {
|
||||
selectedLang = searchResult.getLang().get(0);
|
||||
selectedLang = searchResult.getLangs().get(0);
|
||||
}
|
||||
|
||||
selectedLangTv.setText(selectedLang);
|
||||
|
|
|
@ -60,12 +60,20 @@ public class WikivoyageDbHelper {
|
|||
private static final String SEARCH_COL_ARTICLE_TITLE = "article_title";
|
||||
private static final String SEARCH_COL_LANG = "lang";
|
||||
|
||||
private static final String SEARCH_TABLE_SELECT = "SELECT " +
|
||||
private static final String SEARCH_QUERY = "SELECT " +
|
||||
SEARCH_COL_SEARCH_TERM + ", " +
|
||||
SEARCH_COL_CITY_ID + ", " +
|
||||
SEARCH_TABLE_NAME + "." + SEARCH_COL_CITY_ID + ", " +
|
||||
SEARCH_COL_ARTICLE_TITLE + ", " +
|
||||
SEARCH_COL_LANG +
|
||||
" FROM " + SEARCH_TABLE_NAME;
|
||||
SEARCH_TABLE_NAME + "." + SEARCH_COL_LANG + ", " +
|
||||
ARTICLES_COL_IS_PART_OF +
|
||||
" FROM " + SEARCH_TABLE_NAME +
|
||||
" JOIN " + ARTICLES_TABLE_NAME +
|
||||
" ON " + SEARCH_TABLE_NAME + "." + SEARCH_COL_ARTICLE_TITLE + " = " + ARTICLES_TABLE_NAME + "." + ARTICLES_COL_TITLE +
|
||||
" AND " + SEARCH_TABLE_NAME + "." + SEARCH_COL_LANG + " = " + ARTICLES_TABLE_NAME + "." + ARTICLES_COL_LANG +
|
||||
" WHERE " + SEARCH_TABLE_NAME + "." + SEARCH_COL_CITY_ID +
|
||||
" IN (SELECT " + SEARCH_TABLE_NAME + "." + SEARCH_COL_CITY_ID +
|
||||
" FROM " + SEARCH_TABLE_NAME +
|
||||
" WHERE " + SEARCH_COL_SEARCH_TERM + " LIKE ?)";
|
||||
|
||||
private final OsmandApplication application;
|
||||
|
||||
|
@ -82,10 +90,7 @@ public class WikivoyageDbHelper {
|
|||
SQLiteConnection conn = openConnection();
|
||||
if (conn != null) {
|
||||
try {
|
||||
String dbQuery = SEARCH_TABLE_SELECT + " WHERE " + SEARCH_COL_CITY_ID +
|
||||
" IN (SELECT " + SEARCH_COL_CITY_ID + " FROM " + SEARCH_TABLE_NAME +
|
||||
" WHERE " + SEARCH_COL_SEARCH_TERM + " LIKE ?)";
|
||||
SQLiteCursor cursor = conn.rawQuery(dbQuery, new String[]{searchQuery + "%"});
|
||||
SQLiteCursor cursor = conn.rawQuery(SEARCH_QUERY, new String[]{searchQuery + "%"});
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
res.add(readSearchResult(cursor));
|
||||
|
@ -100,12 +105,12 @@ public class WikivoyageDbHelper {
|
|||
Collections.sort(list, new Comparator<WikivoyageSearchResult>() {
|
||||
@Override
|
||||
public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) {
|
||||
boolean c1 = CollatorStringMatcher.cmatches(collator, searchQuery, o1.articleTitle.get(0),
|
||||
boolean c1 = CollatorStringMatcher.cmatches(collator, searchQuery, o1.articleTitles.get(0),
|
||||
StringMatcherMode.CHECK_ONLY_STARTS_WITH);
|
||||
boolean c2 = CollatorStringMatcher.cmatches(collator, searchQuery, o2.articleTitle.get(0),
|
||||
boolean c2 = CollatorStringMatcher.cmatches(collator, searchQuery, o2.articleTitles.get(0),
|
||||
StringMatcherMode.CHECK_ONLY_STARTS_WITH);
|
||||
if (c1 == c2) {
|
||||
return collator.compare(o1.articleTitle.get(0), o2.articleTitle.get(0));
|
||||
return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0));
|
||||
} else if (c1) {
|
||||
return -1;
|
||||
} else if (c2) {
|
||||
|
@ -125,18 +130,18 @@ public class WikivoyageDbHelper {
|
|||
WikivoyageSearchResult prev = wikivoyage.get(rs.cityId);
|
||||
if (prev != null) {
|
||||
int insInd = prev.langs.size();
|
||||
if (rs.getLang().get(0).equals(baseLng)) {
|
||||
if (rs.langs.get(0).equals(baseLng)) {
|
||||
insInd = 0;
|
||||
} else if (rs.getLang().get(0).equals("en")) {
|
||||
if (!prev.getLang().get(0).equals(baseLng)) {
|
||||
} else if (rs.langs.get(0).equals("en")) {
|
||||
if (!prev.langs.get(0).equals(baseLng)) {
|
||||
insInd = 0;
|
||||
} else {
|
||||
insInd = 1;
|
||||
}
|
||||
}
|
||||
prev.articleTitle.add(insInd, rs.articleTitle.get(0));
|
||||
prev.articleTitles.add(insInd, rs.articleTitles.get(0));
|
||||
prev.langs.add(insInd, rs.langs.get(0));
|
||||
prev.searchTerm.add(insInd, rs.searchTerm.get(0));
|
||||
prev.searchTerms.add(insInd, rs.searchTerms.get(0));
|
||||
} else {
|
||||
wikivoyage.put(rs.cityId, rs);
|
||||
}
|
||||
|
@ -175,10 +180,11 @@ public class WikivoyageDbHelper {
|
|||
private WikivoyageSearchResult readSearchResult(SQLiteCursor cursor) {
|
||||
WikivoyageSearchResult res = new WikivoyageSearchResult();
|
||||
|
||||
res.searchTerm.add(cursor.getString(0));
|
||||
res.searchTerms.add(cursor.getString(0));
|
||||
res.cityId = cursor.getLong(1);
|
||||
res.articleTitle.add(cursor.getString(2));
|
||||
res.articleTitles.add(cursor.getString(2));
|
||||
res.langs.add(cursor.getString(3));
|
||||
res.isPartOf = cursor.getString(4);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -3,43 +3,65 @@ package net.osmand.plus.wikivoyage.data;
|
|||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WikivoyageSearchResult implements Parcelable {
|
||||
|
||||
List<String> searchTerm = new ArrayList<>();
|
||||
private static final int SHOW_LANGS = 3;
|
||||
|
||||
List<String> searchTerms = new ArrayList<>();
|
||||
long cityId;
|
||||
List<String> articleTitle = new ArrayList<>();
|
||||
List<String> articleTitles = new ArrayList<>();
|
||||
List<String> langs = new ArrayList<>();
|
||||
String isPartOf;
|
||||
|
||||
WikivoyageSearchResult() {
|
||||
|
||||
}
|
||||
|
||||
private WikivoyageSearchResult(Parcel in) {
|
||||
searchTerm = in.createStringArrayList();
|
||||
searchTerms = in.createStringArrayList();
|
||||
cityId = in.readLong();
|
||||
articleTitle = in.createStringArrayList();
|
||||
articleTitles = in.createStringArrayList();
|
||||
langs = in.createStringArrayList();
|
||||
isPartOf = in.readString();
|
||||
}
|
||||
|
||||
public List<String> getSearchTerm() {
|
||||
return searchTerm;
|
||||
public List<String> getSearchTerms() {
|
||||
return searchTerms;
|
||||
}
|
||||
|
||||
public long getCityId() {
|
||||
return cityId;
|
||||
}
|
||||
|
||||
public List<String> getArticleTitle() {
|
||||
return articleTitle;
|
||||
public List<String> getArticleTitles() {
|
||||
return articleTitles;
|
||||
}
|
||||
|
||||
public List<String> getLang() {
|
||||
public List<String> getLangs() {
|
||||
return langs;
|
||||
}
|
||||
|
||||
public String getIsPartOf() {
|
||||
return isPartOf;
|
||||
}
|
||||
|
||||
public String getFirstLangsString() {
|
||||
StringBuilder res = new StringBuilder();
|
||||
int limit = Math.min(SHOW_LANGS, langs.size());
|
||||
for (int i = 0; i < limit; i++) {
|
||||
res.append(Algorithms.capitalizeFirstLetter(langs.get(i)));
|
||||
if (i != limit - 1) {
|
||||
res.append(", ");
|
||||
}
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
@ -47,10 +69,11 @@ public class WikivoyageSearchResult implements Parcelable {
|
|||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeStringList(searchTerm);
|
||||
dest.writeStringList(searchTerms);
|
||||
dest.writeLong(cityId);
|
||||
dest.writeStringList(articleTitle);
|
||||
dest.writeStringList(articleTitles);
|
||||
dest.writeStringList(langs);
|
||||
dest.writeString(isPartOf);
|
||||
}
|
||||
|
||||
public static final Creator<WikivoyageSearchResult> CREATOR = new Creator<WikivoyageSearchResult>() {
|
||||
|
|
|
@ -6,17 +6,26 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.wikivoyage.data.WikivoyageSearchResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecyclerViewAdapter.ViewHolder> {
|
||||
public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private List<WikivoyageSearchResult> items = new ArrayList<>();
|
||||
private static final int HEADER_TYPE = 0;
|
||||
private static final int ITEM_TYPE = 1;
|
||||
|
||||
private OsmandApplication app;
|
||||
private IconsCache iconsCache;
|
||||
|
||||
private List<Object> items = new ArrayList<>();
|
||||
|
||||
private View.OnClickListener onItemClickListener;
|
||||
|
||||
|
@ -24,23 +33,51 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
|
|||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
SearchRecyclerViewAdapter(OsmandApplication app) {
|
||||
this.app = app;
|
||||
this.iconsCache = app.getIconsCache();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
|
||||
View itemView = LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.wikivoyage_search_list_item, viewGroup, false);
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||
boolean header = viewType == HEADER_TYPE;
|
||||
int layoutId = header ? R.layout.wikivoyage_search_list_header : R.layout.wikivoyage_search_list_item;
|
||||
View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(layoutId, viewGroup, false);
|
||||
if (header) {
|
||||
return new HeaderVH(itemView);
|
||||
}
|
||||
itemView.setOnClickListener(onItemClickListener);
|
||||
return new ViewHolder(itemView);
|
||||
return new ItemVH(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
|
||||
WikivoyageSearchResult item = items.get(i);
|
||||
// FIXME
|
||||
viewHolder.searchTerm.setText(item.getSearchTerm().toString());
|
||||
viewHolder.cityId.setText(String.valueOf(item.getCityId()));
|
||||
viewHolder.articleTitle.setText(item.getArticleTitle().toString());
|
||||
viewHolder.lang.setText(item.getLang().toString());
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int pos) {
|
||||
if (viewHolder instanceof HeaderVH) {
|
||||
((HeaderVH) viewHolder).title.setText((String) getItem(pos));
|
||||
} else {
|
||||
ItemVH holder = (ItemVH) viewHolder;
|
||||
boolean lastItem = pos == getItemCount() - 1;
|
||||
|
||||
WikivoyageSearchResult item = (WikivoyageSearchResult) getItem(pos);
|
||||
holder.icon.setImageDrawable(
|
||||
iconsCache.getIcon(R.drawable.ic_action_placeholder_city, R.color.icon_color)
|
||||
);
|
||||
holder.title.setText(item.getArticleTitles().get(0));
|
||||
holder.leftDescr.setText(item.getIsPartOf());
|
||||
holder.rightDescr.setText(item.getFirstLangsString());
|
||||
holder.divider.setVisibility(lastItem ? View.GONE : View.VISIBLE);
|
||||
holder.shadow.setVisibility(lastItem ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
Object item = getItem(position);
|
||||
if (item instanceof String) {
|
||||
return HEADER_TYPE;
|
||||
}
|
||||
return ITEM_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,32 +85,46 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
|
|||
return items.size();
|
||||
}
|
||||
|
||||
public WikivoyageSearchResult getItem(int pos) {
|
||||
public Object getItem(int pos) {
|
||||
return items.get(pos);
|
||||
}
|
||||
|
||||
public void setItems(@Nullable List<WikivoyageSearchResult> items) {
|
||||
if (items == null) {
|
||||
this.items.clear();
|
||||
} else {
|
||||
this.items = items;
|
||||
this.items.clear();
|
||||
if (items != null && !items.isEmpty()) {
|
||||
this.items.add(app.getString(R.string.shared_string_result));
|
||||
this.items.addAll(items);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
static class HeaderVH extends RecyclerView.ViewHolder {
|
||||
|
||||
final TextView searchTerm;
|
||||
final TextView cityId;
|
||||
final TextView articleTitle;
|
||||
final TextView lang;
|
||||
final TextView title;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
public HeaderVH(View itemView) {
|
||||
super(itemView);
|
||||
searchTerm = (TextView) itemView.findViewById(R.id.search_term);
|
||||
cityId = (TextView) itemView.findViewById(R.id.city_id);
|
||||
articleTitle = (TextView) itemView.findViewById(R.id.article_title);
|
||||
lang = (TextView) itemView.findViewById(R.id.lang);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
}
|
||||
}
|
||||
|
||||
static class ItemVH extends RecyclerView.ViewHolder {
|
||||
|
||||
final ImageView icon;
|
||||
final TextView title;
|
||||
final TextView leftDescr;
|
||||
final TextView rightDescr;
|
||||
final View divider;
|
||||
final View shadow;
|
||||
|
||||
public ItemVH(View itemView) {
|
||||
super(itemView);
|
||||
icon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
leftDescr = (TextView) itemView.findViewById(R.id.left_description);
|
||||
rightDescr = (TextView) itemView.findViewById(R.id.right_description);
|
||||
divider = itemView.findViewById(R.id.divider);
|
||||
shadow = itemView.findViewById(R.id.shadow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class WikivoyageSearchDialogFragment extends WikivoyageBaseDialogFragment
|
|||
}
|
||||
});
|
||||
|
||||
adapter = new SearchRecyclerViewAdapter();
|
||||
adapter = new SearchRecyclerViewAdapter(getMyApplication());
|
||||
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
|
||||
rv.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
rv.setAdapter(adapter);
|
||||
|
@ -98,7 +98,11 @@ public class WikivoyageSearchDialogFragment extends WikivoyageBaseDialogFragment
|
|||
public void onClick(View v) {
|
||||
int pos = rv.getChildAdapterPosition(v);
|
||||
if (pos != RecyclerView.NO_POSITION) {
|
||||
WikivoyageArticleDialogFragment.showInstance(getFragmentManager(), adapter.getItem(pos));
|
||||
Object item = adapter.getItem(pos);
|
||||
if (item instanceof WikivoyageSearchResult) {
|
||||
WikivoyageArticleDialogFragment.showInstance(getFragmentManager(),
|
||||
(WikivoyageSearchResult) item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue