Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c78e484b2a
36 changed files with 259 additions and 151 deletions
|
@ -45,7 +45,7 @@
|
|||
android:gravity="center_vertical"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:padding="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:background="@drawable/wikipedia_select_lang_bg_dark_n"
|
||||
tools:drawableLeft="@drawable/ic_action_map_language"
|
||||
|
@ -105,7 +105,7 @@
|
|||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:text="@string/shared_string_contents"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableLeft="@drawable/ic_action_list_header"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
@ -130,7 +130,7 @@
|
|||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:text="@string/points"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableLeft="@drawable/ic_action_track_16"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
@ -153,7 +153,7 @@
|
|||
android:paddingRight="@dimen/bottom_sheet_content_margin"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableRight="@drawable/ic_action_read_later_fill"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_options"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
android:id="@+id/point_edit_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/point_edit_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -31,7 +32,8 @@
|
|||
<ScrollView
|
||||
android:id="@+id/editor_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -43,7 +45,6 @@
|
|||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -171,7 +172,6 @@
|
|||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="48dp"
|
||||
android:foreground="@drawable/bg_contextmenu_shadow"
|
||||
android:foregroundGravity="top|fill_horizontal">
|
||||
|
||||
|
@ -231,14 +231,11 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom">
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/buttons_top_border"
|
||||
|
@ -302,5 +299,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -32,14 +32,16 @@
|
|||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/context_menu_padding_margin_medium"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/empty_state_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="London"/>
|
||||
|
||||
<TextView
|
||||
|
@ -74,7 +76,7 @@
|
|||
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginTop="1dp"
|
||||
android:alpha=".5"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
|
@ -102,7 +104,7 @@
|
|||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableLeft="@drawable/ic_action_read_article"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
@ -131,7 +133,7 @@
|
|||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableRight="@drawable/ic_action_read_later_fill"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableLeft="@drawable/ic_action_read_article"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
@ -131,7 +131,7 @@
|
|||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableRight="@drawable/ic_action_read_later_fill"
|
||||
tools:drawableTint="?attr/wikivoyage_active_color"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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"
|
||||
|
@ -20,13 +21,17 @@
|
|||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<TextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="Saved articles"/>
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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"
|
||||
|
@ -19,13 +20,17 @@
|
|||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<TextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/content_padding"
|
||||
android:ellipsize="end"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="Search results"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<dimen name="default_sub_text_size">14sp</dimen>
|
||||
<dimen name="default_sub_text_size_small">12sp</dimen>
|
||||
<dimen name="welcome_header_text_size">27sp</dimen>
|
||||
<dimen name="text_button_text_size">22sp</dimen>
|
||||
|
||||
<dimen name="dialog_header_text_size">24sp</dimen>
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@
|
|||
<dimen name="default_sub_text_size">12sp</dimen>
|
||||
<dimen name="default_sub_text_size_small">10sp</dimen>
|
||||
<dimen name="welcome_header_text_size">23sp</dimen>
|
||||
<dimen name="text_button_text_size">15sp</dimen>
|
||||
|
||||
<dimen name="default_split_segments_overview">13sp</dimen>
|
||||
<dimen name="default_split_segments_data">13sp</dimen>
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
|
@ -139,7 +140,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.favorites_tree, container, false);
|
||||
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||
favouritesAdapter.synchronizeGroups();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
|
@ -10,6 +11,7 @@ import android.support.annotation.IdRes;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
@ -40,6 +42,24 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
|
|||
}
|
||||
}
|
||||
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
||||
obs.removeOnGlobalLayoutListener(this);
|
||||
view.requestLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
((MapActivity) activity).exitFromFullScreen();
|
||||
}
|
||||
}
|
||||
|
@ -115,15 +135,15 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
|
|||
return iconsCache;
|
||||
}
|
||||
|
||||
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color){
|
||||
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color) {
|
||||
return getIconsCache().getPaintedIcon(id, color);
|
||||
}
|
||||
|
||||
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId){
|
||||
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
|
||||
return getIconsCache().getIcon(id, colorId);
|
||||
}
|
||||
|
||||
protected Drawable getContentIcon(@DrawableRes int id){
|
||||
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||
return getIconsCache().getThemedIcon(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.graphics.Shader.TileMode;
|
|||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -24,7 +25,7 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
|||
protected ExpandableListAdapter adapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = createView(inflater, container);
|
||||
listView = (ExpandableListView) v.findViewById(android.R.id.list);
|
||||
listView.setOnChildClickListener(this);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Typeface;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
|
@ -88,7 +89,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
private ActionMode actionMode;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.local_index, container, false);
|
||||
|
||||
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.os.StatFs;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -118,7 +119,7 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.first_usage_wizard_fragment, container, false);
|
||||
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
|
||||
listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.AttrRes;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -88,7 +89,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
private int textColorSecondary;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_reports, container, false);
|
||||
monthReportsSpinner = (Spinner) view.findViewById(R.id.monthReportsSpinner);
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.content.res.Resources;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -93,6 +94,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
|
||||
private MapContextMenu menu;
|
||||
private OnLayoutChangeListener containerLayoutListener;
|
||||
private boolean forceUpdateLayout;
|
||||
|
||||
private int menuTopViewHeight;
|
||||
private int menuTopShadowAllHeight;
|
||||
|
@ -133,7 +135,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
private boolean created;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
processScreenHeight(container);
|
||||
|
@ -628,7 +630,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
@Override
|
||||
public void onLayoutChange(View view, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (bottom != oldBottom) {
|
||||
if (forceUpdateLayout || bottom != oldBottom) {
|
||||
forceUpdateLayout = false;
|
||||
processScreenHeight(view.getParent());
|
||||
runLayoutListener();
|
||||
}
|
||||
|
@ -1748,6 +1751,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
public void setFragmentVisibility(boolean visible) {
|
||||
if (view != null) {
|
||||
if (visible) {
|
||||
forceUpdateLayout = true;
|
||||
view.setVisibility(View.VISIBLE);
|
||||
if (mapCenter != null) {
|
||||
map.setLatLon(mapCenter.getLatitude(), mapCenter.getLongitude());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.mapcontextmenu.builders.cards.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -39,7 +40,7 @@ public class ContextMenuCardDialogFragment extends BaseOsmAndFragment {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.context_menu_card_dialog, container, false);
|
||||
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
|
||||
if (dialog.getType() == ContextMenuCardDialog.CardDialogType.MAPILLARY) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
|||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -52,7 +53,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null && editor.isNew()) {
|
||||
Button replaceButton = (Button) view.findViewById(R.id.replace_button);
|
||||
|
|
|
@ -3,11 +3,11 @@ package net.osmand.plus.mapcontextmenu.editors;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.TypedValue;
|
||||
|
@ -15,12 +15,10 @@ import android.view.LayoutInflater;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -28,7 +26,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -40,11 +37,10 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
||||
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
|
||||
|
||||
getEditor().updateLandscapePortrait();
|
||||
getEditor().updateNightMode();
|
||||
|
@ -135,36 +131,6 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
descriptionEdit.setText(getDescriptionInitValue());
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (descriptionEdit.isFocused()) {
|
||||
ScrollView scrollView = (ScrollView) view.findViewById(R.id.editor_scroll_view);
|
||||
scrollView.scrollTo(0, bottom);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 21 && AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
Rect rect = new Rect();
|
||||
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
|
||||
int heightDiff = getResources().getDisplayMetrics().heightPixels - rect.bottom;
|
||||
view.findViewById(R.id.buttons_container).setPadding(0, 0, 0, heightDiff);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (descriptionEdit.isFocused()) {
|
||||
ScrollView scrollView = (ScrollView) view.findViewById(R.id.editor_scroll_view);
|
||||
scrollView.scrollTo(0, view.getBottom());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ImageView nameImage = (ImageView) view.findViewById(R.id.name_image);
|
||||
nameImage.setImageDrawable(getNameIcon());
|
||||
ImageView categoryImage = (ImageView) view.findViewById(R.id.category_image);
|
||||
|
@ -228,6 +194,11 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
return R.color.status_bar_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFullScreenAllowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void hideKeyboard() {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
if (inputMethodManager != null) {
|
||||
|
@ -250,7 +221,9 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
protected abstract boolean wasSaved();
|
||||
|
||||
protected abstract void save(boolean needDismiss);
|
||||
|
||||
protected abstract void delete(boolean needDismiss);
|
||||
|
||||
static int getResIdFromAttribute(final Context ctx, final int attr) {
|
||||
|
@ -262,6 +235,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
public abstract PointEditor getEditor();
|
||||
|
||||
public abstract String getToolbarTitle();
|
||||
|
||||
public void setCategory(String name) {
|
||||
|
@ -279,7 +253,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
protected MapActivity getMapActivity() {
|
||||
return (MapActivity)getActivity();
|
||||
return (MapActivity) getActivity();
|
||||
}
|
||||
|
||||
protected OsmandApplication getMyApplication() {
|
||||
|
@ -307,15 +281,19 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
public String getNameCaption() {
|
||||
return getMapActivity().getResources().getString(R.string.shared_string_name);
|
||||
}
|
||||
|
||||
public String getCategoryCaption() {
|
||||
return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_category);
|
||||
}
|
||||
|
||||
public abstract String getNameInitValue();
|
||||
|
||||
public abstract String getCategoryInitValue();
|
||||
|
||||
public abstract String getDescriptionInitValue();
|
||||
|
||||
public abstract Drawable getNameIcon();
|
||||
|
||||
public abstract Drawable getCategoryIcon();
|
||||
|
||||
public String getNameTextValue() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.mapcontextmenu.other;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -27,7 +28,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.mapcontextmenu.other;
|
|||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -29,7 +30,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.app.DatePickerDialog;
|
|||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.support.v7.widget.AppCompatTextView;
|
||||
|
@ -48,7 +49,7 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = (MapActivity) getActivity();
|
||||
final OsmandSettings settings = getSettings();
|
||||
final MapillaryPlugin plugin = OsmandPlugin.getPlugin(MapillaryPlugin.class);
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -94,7 +95,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
|
||||
planRouteContext = markersHelper.getPlanRouteContext();
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
|
@ -122,7 +123,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final MapActivity mapActivity = (MapActivity) getActivity();
|
||||
final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
|
@ -300,7 +301,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.available_gpx, container, false);
|
||||
listView = (ExpandableListView) v.findViewById(android.R.id.list);
|
||||
setHasOptionsMenu(true);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
|||
};
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
mainView = inflater.inflate(R.layout.track_points_tree, container, false);
|
||||
ExpandableListView listView = (ExpandableListView) mainView.findViewById(android.R.id.list);
|
||||
setHasOptionsMenu(true);
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.osmedit;
|
|||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -53,7 +54,7 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
|
||||
|
||||
deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.osmedit;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -45,7 +46,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.res.Resources;
|
|||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -52,7 +53,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.quick_action_list, container, false);
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import android.support.annotation.DrawableRes;
|
|||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
@ -48,6 +50,14 @@ public class WikivoyageBaseDialogFragment extends BaseOsmAndDialogFragment {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
FragmentTransaction ft = manager.beginTransaction();
|
||||
ft.add(this, tag);
|
||||
ft.addToBackStack(tag);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Drawable getContentIcon(int id) {
|
||||
return getIcon(id, R.color.icon_color);
|
||||
|
|
|
@ -8,15 +8,26 @@ import android.net.Uri;
|
|||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.data.TravelArticle;
|
||||
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.List;
|
||||
|
||||
import static android.support.v4.app.FragmentManager.POP_BACK_STACK_INCLUSIVE;
|
||||
|
||||
/**
|
||||
* Custom WebView client to handle the internal links.
|
||||
|
@ -24,11 +35,16 @@ import java.net.URLDecoder;
|
|||
|
||||
public class WikivoyageWebViewClient extends WebViewClient {
|
||||
|
||||
private static final String TAG = WikivoyageWebViewClient.class.getSimpleName();
|
||||
|
||||
private OsmandApplication app;
|
||||
private FragmentManager fragmentManager;
|
||||
private Context context;
|
||||
private TravelArticle article;
|
||||
|
||||
private static final String PAGE_PREFIX = "https://";
|
||||
private static final String PREFIX_GEO = "geo:";
|
||||
private static final String PAGE_PREFIX_HTTP = "http://";
|
||||
private static final String PAGE_PREFIX_HTTPS = "https://";
|
||||
private static final String WEB_DOMAIN = ".wikivoyage.com/wiki/";
|
||||
|
||||
public WikivoyageWebViewClient(FragmentActivity context, FragmentManager fm) {
|
||||
|
@ -40,13 +56,13 @@ public class WikivoyageWebViewClient extends WebViewClient {
|
|||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.contains(WEB_DOMAIN)) {
|
||||
String lang = url.substring(url.startsWith(PAGE_PREFIX) ? PAGE_PREFIX.length() : 0, url.indexOf("."));
|
||||
String articleName = url.replace(PAGE_PREFIX + lang + WEB_DOMAIN, "")
|
||||
String lang = url.substring(url.startsWith(PAGE_PREFIX_HTTPS) ? PAGE_PREFIX_HTTPS.length() : 0, url.indexOf("."));
|
||||
String articleName = url.replace(PAGE_PREFIX_HTTPS + lang + WEB_DOMAIN, "")
|
||||
.replaceAll("_", " ");
|
||||
try {
|
||||
articleName = URLDecoder.decode(articleName, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
Log.w(TAG, e.getMessage(), e);
|
||||
}
|
||||
long articleId = app.getTravelDbHelper().getArticleId(articleName, lang);
|
||||
if (articleId != 0) {
|
||||
|
@ -55,8 +71,49 @@ public class WikivoyageWebViewClient extends WebViewClient {
|
|||
warnAboutExternalLoad(url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (url.startsWith(PAGE_PREFIX_HTTP) || url.startsWith(PAGE_PREFIX_HTTPS)) {
|
||||
warnAboutExternalLoad(url);
|
||||
} else if (url.startsWith(PREFIX_GEO)) {
|
||||
if (article != null) {
|
||||
List<GPXUtilities.WptPt> points = article.getGpxFile().getPoints();
|
||||
GPXUtilities.WptPt gpxPoint = null;
|
||||
String coordinates = url.replace(PREFIX_GEO, "");
|
||||
double lat;
|
||||
double lon;
|
||||
try {
|
||||
lat = Double.valueOf(coordinates.substring(0, coordinates.indexOf(",")));
|
||||
lon = Double.valueOf(coordinates.substring(coordinates.indexOf(",") + 1,
|
||||
coordinates.length()));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.w(TAG, e.getMessage(), e);
|
||||
return true;
|
||||
}
|
||||
for (GPXUtilities.WptPt point : points) {
|
||||
if (point.getLatitude() == lat && point.getLongitude() == lon) {
|
||||
gpxPoint = point;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gpxPoint != null) {
|
||||
final OsmandSettings settings = app.getSettings();
|
||||
settings.setMapLocationToShow(lat, lon, settings.getLastKnownMapZoom(),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, gpxPoint.name),
|
||||
false,
|
||||
gpxPoint);
|
||||
fragmentManager.popBackStackImmediate(WikivoyageExploreDialogFragment.TAG,
|
||||
POP_BACK_STACK_INCLUSIVE);
|
||||
|
||||
File path = app.getTravelDbHelper().createGpxFile(article);
|
||||
GPXUtilities.GPXFile gpxFile = article.getGpxFile();
|
||||
gpxFile.path = path.getAbsolutePath();
|
||||
app.getSelectedGpxHelper().setGpxFileToDisplay(gpxFile);
|
||||
MapActivity.launchMapActivityMoveToTop(context);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
context.startActivity(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -74,4 +131,8 @@ public class WikivoyageWebViewClient extends WebViewClient {
|
|||
.setNegativeButton(R.string.shared_string_cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
public void setArticle(TravelArticle article) {
|
||||
this.article = article;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
private WebView contentWebView;
|
||||
|
||||
private TextView articleToolbarText;
|
||||
private WikivoyageWebViewClient webViewClient;
|
||||
|
||||
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
|
||||
@Nullable
|
||||
|
@ -196,7 +197,8 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
webSettings.setJavaScriptEnabled(true);
|
||||
updateWebSettings();
|
||||
contentWebView.addJavascriptInterface(new WikivoyageArticleWebAppInterface(), "Android");
|
||||
contentWebView.setWebViewClient(new WikivoyageWebViewClient(getActivity(), getFragmentManager()));
|
||||
webViewClient = new WikivoyageWebViewClient(getActivity(), getFragmentManager());
|
||||
contentWebView.setWebViewClient(webViewClient);
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
@ -340,6 +342,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
articleToolbarText.setText(article.getTitle());
|
||||
if (article.getGpxFile() != null) {
|
||||
trackButton.setText(getString(R.string.points) + " (" + article.getGpxFile().getPointsSize() + ")");
|
||||
webViewClient.setArticle(article);
|
||||
}
|
||||
|
||||
TravelLocalDataHelper ldh = getMyApplication().getTravelDbHelper().getLocalDataHelper();
|
||||
|
|
|
@ -184,7 +184,7 @@ public class TravelDbHelper {
|
|||
rs.cityId = cursor.getLong(0);
|
||||
rs.articleTitles.add(cursor.getString(1));
|
||||
rs.langs.add(cursor.getString(2));
|
||||
rs.isPartOf = cursor.getString(3);
|
||||
rs.isPartOf.add(cursor.getString(3));
|
||||
rs.imageTitle = cursor.getString(4);
|
||||
res.add(rs);
|
||||
} while (cursor.moveToNext());
|
||||
|
@ -237,6 +237,7 @@ public class TravelDbHelper {
|
|||
}
|
||||
prev.articleTitles.add(insInd, rs.articleTitles.get(0));
|
||||
prev.langs.add(insInd, rs.langs.get(0));
|
||||
prev.isPartOf.add(insInd, rs.isPartOf.get(0));
|
||||
} else {
|
||||
wikivoyage.put(rs.cityId, rs);
|
||||
}
|
||||
|
@ -287,11 +288,11 @@ public class TravelDbHelper {
|
|||
rs.cityId = cursor.getLong(0);
|
||||
rs.articleTitles.add(cursor.getString(1));
|
||||
rs.langs.add(cursor.getString(2));
|
||||
rs.isPartOf = cursor.getString(3);
|
||||
List<WikivoyageSearchResult> l = navMap.get(rs.isPartOf);
|
||||
rs.isPartOf.add(cursor.getString(3));
|
||||
List<WikivoyageSearchResult> l = navMap.get(rs.isPartOf.get(0));
|
||||
if (l == null) {
|
||||
l = new ArrayList<>();
|
||||
navMap.put(rs.isPartOf, l);
|
||||
navMap.put(rs.isPartOf.get(0), l);
|
||||
}
|
||||
l.add(rs);
|
||||
} while (cursor.moveToNext());
|
||||
|
@ -423,7 +424,9 @@ public class TravelDbHelper {
|
|||
public File createGpxFile(TravelArticle article) {
|
||||
final GPXFile gpx = article.getGpxFile();
|
||||
File file = application.getAppPath(IndexConstants.GPX_TRAVEL_DIR + getGPXName(article));
|
||||
if (!file.exists()) {
|
||||
GPXUtilities.writeGpxFile(file, gpx, application);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class WikivoyageSearchResult {
|
|||
long cityId;
|
||||
List<String> articleTitles = new ArrayList<>();
|
||||
List<String> langs = new ArrayList<>();
|
||||
String isPartOf;
|
||||
List<String> isPartOf = new ArrayList<>();
|
||||
String imageTitle;
|
||||
|
||||
public long getCityId() {
|
||||
|
@ -27,7 +27,7 @@ public class WikivoyageSearchResult {
|
|||
return langs;
|
||||
}
|
||||
|
||||
public String getIsPartOf() {
|
||||
public List<String> getIsPartOf() {
|
||||
return isPartOf;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
.placeholder(placeholder)
|
||||
.into(holder.icon);
|
||||
holder.title.setText(searchRes.getArticleTitles().get(0));
|
||||
holder.leftDescr.setText(searchRes.getIsPartOf());
|
||||
holder.leftDescr.setText(searchRes.getIsPartOf().get(0));
|
||||
holder.rightDescr.setText(searchRes.getFirstLangsString());
|
||||
} else {
|
||||
WikivoyageSearchHistoryItem historyItem = (WikivoyageSearchHistoryItem) item;
|
||||
|
|
Loading…
Reference in a new issue