Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-03-23 14:11:33 +01:00
commit 392589291f
9 changed files with 41 additions and 36 deletions

View file

@ -14,6 +14,7 @@ import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.support.annotation.ColorRes; import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
@ -175,6 +176,12 @@ public class AndroidUtils {
return res; return res;
} }
public static void setSnackbarTextColor(Snackbar snackbar, @ColorRes int colorId) {
View view = snackbar.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(view.getContext(), colorId));
}
@SuppressLint("NewApi") @SuppressLint("NewApi")
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) { public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) {

View file

@ -19,9 +19,9 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.LockableViewPager; import net.osmand.plus.LockableViewPager;
@ -444,9 +444,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
} }
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
} }
@ -491,9 +489,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
startActivity(intent); startActivity(intent);
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
}; };

View file

@ -20,8 +20,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
@ -206,9 +206,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
updateAdapter(); updateAdapter();
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
} }

View file

@ -19,8 +19,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -169,9 +169,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
} }
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
} }

View file

@ -9,8 +9,8 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
@ -184,9 +184,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
}); });
@ -252,9 +250,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }

View file

@ -11,6 +11,7 @@ import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
@ -328,9 +329,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
updateDisplayedData(); updateDisplayedData();
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
} }
@ -417,9 +416,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
app.getMapMarkersHelper().syncWithMarkers(group); app.getMapMarkersHelper().syncWithMarkers(group);
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
} }

View file

@ -6,8 +6,8 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -157,9 +157,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
app.getMapMarkersHelper().moveMapMarkerToHistory(marker); app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(app, R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }
}); });

View file

@ -611,9 +611,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
super.onDismissed(transientBottomBar, event); super.onDismissed(transientBottomBar, event);
} }
}); });
View snackBarView = snackbar.getView(); AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
TextView tv = (TextView) snackBarView.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_dialog_buttons_dark));
snackbar.show(); snackbar.show();
} }

View file

@ -33,6 +33,7 @@ import net.osmand.search.core.ObjectType;
import net.osmand.search.core.SearchResult; import net.osmand.search.core.SearchResult;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -97,7 +98,22 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
showResult(sr); showResult(sr);
} else { } else {
dialogFragment.completeQueryWithObject(item.getSearchResult()); if ((sr.objectType == ObjectType.CITY || sr.objectType == ObjectType.VILLAGE)
&& sr.file != null && sr.object instanceof City) {
City c = (City) sr.object;
if (c.getStreets().isEmpty()) {
try {
sr.file.preloadStreets(c, null);
if (c.getStreets().isEmpty()) {
showResult(sr);
return;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
dialogFragment.completeQueryWithObject(sr);
} }
} }
} }
@ -198,6 +214,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
FavouritePoint fav = (FavouritePoint) object; FavouritePoint fav = (FavouritePoint) object;
pointDescription = fav.getPointDescription(); pointDescription = fav.getPointDescription();
break; break;
case VILLAGE:
case CITY: case CITY:
String cityName = searchResult.localeName; String cityName = searchResult.localeName;
String typeNameCity = QuickSearchListItem.getTypeName(app, searchResult); String typeNameCity = QuickSearchListItem.getTypeName(app, searchResult);