Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2015-11-25 16:49:45 +01:00
commit 67b9299999
7 changed files with 126 additions and 158 deletions

View file

@ -9,14 +9,6 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:orientation="vertical"> android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -24,7 +16,7 @@
<EditText <EditText
android:id="@+id/Name" android:id="@+id/Name"
android:layout_width="180dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
@ -32,28 +24,20 @@
<requestFocus/> <requestFocus/>
</EditText> </EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/edit_tilesource_choose_existing"></TextView> android:ellipsize="end"
android:scrollHorizontally="true"
android:text="@string/edit_tilesource_choose_existing"/>
<Spinner <Spinner
android:id="@+id/TileSourceSpinner" android:id="@+id/TileSourceSpinner"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"></Spinner> android:layout_marginRight="5dp"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -62,16 +46,11 @@
<EditText <EditText
android:id="@+id/URLToLoad" android:id="@+id/URLToLoad"
android:layout_width="180dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:lines="5" android:lines="5"
android:minLines="2" android:minLines="2"
android:text=""></EditText> android:text=""/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -80,14 +59,9 @@
<EditText <EditText
android:id="@+id/MinZoom" android:id="@+id/MinZoom"
android:layout_width="180dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text=""></EditText> android:text=""/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -96,14 +70,9 @@
<EditText <EditText
android:id="@+id/MaxZoom" android:id="@+id/MaxZoom"
android:layout_width="180dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text=""></EditText> android:text=""/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -112,23 +81,17 @@
<EditText <EditText
android:id="@+id/ExpirationTime" android:id="@+id/ExpirationTime"
android:layout_width="180dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text=""></EditText> android:text=""/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<CheckBox <CheckBox
android:id="@+id/EllipticMercator" android:id="@+id/EllipticMercator"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_span="2" android:layout_span="2"
android:text="@string/edit_tilesource_elliptic_tile"/> android:text="@string/edit_tilesource_elliptic_tile"/>
</TableRow>
</TableLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -66,7 +66,7 @@
<string name="search_street_in_neighborhood_cities">Пошук вуліцы ў суседніх гарадах</string> <string name="search_street_in_neighborhood_cities">Пошук вуліцы ў суседніх гарадах</string>
<string name="intermediate_items_sort_return">Прамежкавыя пункты шляху адсартаваныя аптымальным чынам ад бягучага становішча да месца прызначэньня.</string> <string name="intermediate_items_sort_return">Прамежкавыя пункты шляху адсартаваныя аптымальным чынам ад бягучага становішча да месца прызначэньня.</string>
<string name="intermediate_items_sort_by_distance">Упарадкаваць па адлегласьці</string> <string name="intermediate_items_sort_by_distance">Упарадкаваць ад дзьвярэй да дзьвярэй</string>
<string name="local_osm_changes_backup_successful">Файл зьмен OSM пасьпяхова створаны ў %1$s</string> <string name="local_osm_changes_backup_successful">Файл зьмен OSM пасьпяхова створаны ў %1$s</string>
<string name="local_osm_changes_backup_failed">Збой рэзервовага капіяваньня файлу зьмен OSM</string> <string name="local_osm_changes_backup_failed">Збой рэзервовага капіяваньня файлу зьмен OSM</string>
<string name="local_osm_changes_backup">Рэзервовае капіяваньне файлу зьмен OSM</string> <string name="local_osm_changes_backup">Рэзервовае капіяваньне файлу зьмен OSM</string>
@ -2038,4 +2038,13 @@
<string name="rendering_attr_currentTrackColor_description">Колер сьледу GPX</string> <string name="rendering_attr_currentTrackColor_description">Колер сьледу GPX</string>
<string name="poi_dialog_reopen">Пераадкрыць</string> <string name="poi_dialog_reopen">Пераадкрыць</string>
<string name="use_drawer_btn">Выкарыстоўваць мэню</string> <string name="use_drawer_btn">Выкарыстоўваць мэню</string>
<string name="access_from_map_description">Кнопка Мэню паказвае панэль кіраваньня, а не мэню</string>
<string name="access_from_map">Доступ з мапы</string>
<string name="context_menu_item_delete_waypoint">Выдаліць шляхавую кропку GPX?</string>
<string name="context_menu_item_edit_waypoint">Правіць кропку шляху GPX</string>
<string name="routing_attr_avoid_stairs_name">Пазьбягаць лесьвіц</string>
<string name="routing_attr_avoid_stairs_description">Пазьбягаць лесьвіц</string>
<string name="routing_attr_avoid_borders_name">Пазьбягаць перасячэньня мяжы</string>
<string name="use_dashboard_btn">Выкарыстоўваць панэль кіраваньня</string>
<string name="dashboard_or_drawer_title">Панэль кіраваньня ці мэню</string>
</resources> </resources>

View file

@ -398,9 +398,9 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents {
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType); dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
} else { } else {
if (ErrorBottomSheetDialog.shouldShow(settings, this)) { if (ErrorBottomSheetDialog.shouldShow(settings, this)) {
new ErrorBottomSheetDialog().show(getFragmentManager(), "dialog"); new ErrorBottomSheetDialog().show(getSupportFragmentManager(), "dialog");
} else if (RateUsBottomSheetDialog.shouldShow(settings)) { } else if (RateUsBottomSheetDialog.shouldShow(settings)) {
new RateUsBottomSheetDialog().show(getFragmentManager(), "dialog"); new RateUsBottomSheetDialog().show(getSupportFragmentManager(), "dialog");
} }
} }
} }

View file

@ -1,34 +1,6 @@
package net.osmand.plus.activities.search; package net.osmand.plus.activities.search;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.osmand.Collator;
import net.osmand.CollatorStringMatcher;
import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.OsmAndCollator;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.MapObject;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmAndConstants;
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.activities.OsmandListActivity;
import net.osmand.plus.activities.search.SearchAddressFragment.AddressInformation;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.FavoriteDialogs;
import org.apache.commons.logging.Log;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
@ -62,10 +34,39 @@ import android.widget.TextView;
import android.widget.TextView.BufferType; import android.widget.TextView.BufferType;
import android.widget.TextView.OnEditorActionListener; import android.widget.TextView.OnEditorActionListener;
import net.osmand.Collator;
import net.osmand.CollatorStringMatcher;
import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.OsmAndCollator;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.MapObject;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmAndConstants;
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.activities.OsmandListActivity;
import net.osmand.plus.activities.search.SearchAddressFragment.AddressInformation;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.FavoriteDialogs;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressLint("NewApi") @SuppressLint("NewApi")
public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity { public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity {
private static final String ENDING_TEXT = "ending_text";
private EditText searchText; private EditText searchText;
private AsyncTask<Object, ?, ?> initializeTask; private AsyncTask<Object, ?, ?> initializeTask;
@ -76,7 +77,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
protected ProgressBar progress; protected ProgressBar progress;
protected LatLon locationToSearch; protected LatLon locationToSearch;
protected OsmandSettings settings; protected OsmandSettings settings;
protected List<T> initialListToFilter = new ArrayList<T>(); protected List<T> initialListToFilter = new ArrayList<>();
protected Handler uiHandler; protected Handler uiHandler;
protected Collator collator; protected Collator collator;
protected NamesFilter namesFilter; protected NamesFilter namesFilter;
@ -84,7 +85,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
private boolean initFilter = false; private boolean initFilter = false;
private String endingText = ""; private String endingText = "";
private T endingObject; private T endingObject;
private StyleSpan previousSpan; private StyleSpan previousSpan = new StyleSpan(Typeface.BOLD_ITALIC);
private static final Log log = PlatformUtil.getLog(SearchByNameAbstractActivity.class); private static final Log log = PlatformUtil.getLog(SearchByNameAbstractActivity.class);
private static final int NAVIGATE_TO = 3; private static final int NAVIGATE_TO = 3;
@ -233,17 +234,15 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putString("ENDING_TEXT", endingText); outState.putString(ENDING_TEXT, endingText);
outState.putParcelable("PREVIOUS_SPAN", this.previousSpan);
} }
@Override @Override
protected void onRestoreInstanceState(Bundle prevState) { protected void onRestoreInstanceState(Bundle prevState) {
endingText = prevState.getString("ENDING_TEXT"); endingText = prevState.getString(ENDING_TEXT);
if(endingText == null) { if(endingText == null) {
endingText = ""; endingText = "";
} }
previousSpan = prevState.getParcelable("PREVIOUS_SPAN");
super.onRestoreInstanceState(prevState); super.onRestoreInstanceState(prevState);
} }
@ -268,12 +267,9 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
if(updateText) { if(updateText) {
searchText.getText().replace(currentFilter.length(), currentFilter.length() + prevEndtext.length(), locEndingText); searchText.getText().replace(currentFilter.length(), currentFilter.length() + prevEndtext.length(), locEndingText);
} }
if (previousSpan != null) {
searchText.getText().removeSpan(previousSpan); searchText.getText().removeSpan(previousSpan);
previousSpan = null;
}
if (locEndingText.length() > 0) { if (locEndingText.length() > 0) {
previousSpan = new StyleSpan(Typeface.BOLD_ITALIC);
searchText.getText().setSpan(previousSpan, currentFilter.length(), currentFilter.length() + locEndingText.length(), searchText.getText().setSpan(previousSpan, currentFilter.length(), currentFilter.length() + locEndingText.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (searchText.getSelectionEnd() > currentFilter.length()) { if (searchText.getSelectionEnd() > currentFilter.length()) {
@ -384,7 +380,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
class UIUpdateHandler extends Handler { class UIUpdateHandler extends Handler {
private Map<String, Integer> endingMap = new HashMap<String, Integer>(); private Map<String, Integer> endingMap = new HashMap<>();
private int minimalIndex = Integer.MAX_VALUE; private int minimalIndex = Integer.MAX_VALUE;
private String minimalText = null; private String minimalText = null;

View file

@ -1,12 +1,12 @@
package net.osmand.plus.base; package net.osmand.plus.base;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.ColorRes; import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;

View file

@ -42,7 +42,6 @@ public class DashDashboardOrDrawerFragment extends DashBaseFragment {
settings.SHOW_DASHBOARD_ON_START.set(false); settings.SHOW_DASHBOARD_ON_START.set(false);
settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(false); settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(false);
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false); settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
dashboard.hideFragmentByTag(TAG);
dashboard.hideDashboard(); dashboard.hideDashboard();
} }
}); });

View file

@ -13,6 +13,7 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.Space;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -23,7 +24,6 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.support.v4.widget.Space;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -577,7 +577,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
GoToMapFragment fragment = new GoToMapFragment(); GoToMapFragment fragment = new GoToMapFragment();
fragment.regionCenter = region.getRegionCenter(); fragment.regionCenter = region.getRegionCenter();
fragment.regionName = region.getLocaleName(); fragment.regionName = region.getLocaleName();
fragment.show(getFragmentManager(), GoToMapFragment.TAG); fragment.show(getSupportFragmentManager(), GoToMapFragment.TAG);
} }
private void showDownloadWorldMapIfNeeded() { private void showDownloadWorldMapIfNeeded() {
@ -590,7 +590,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
SUGGESTED_TO_DOWNLOAD_BASEMAP = true; SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
AskMapDownloadFragment fragment = new AskMapDownloadFragment(); AskMapDownloadFragment fragment = new AskMapDownloadFragment();
fragment.indexItem = worldMap; fragment.indexItem = worldMap;
fragment.show(getFragmentManager(), AskMapDownloadFragment.TAG); fragment.show(getSupportFragmentManager(), AskMapDownloadFragment.TAG);
} }
} }
@ -599,7 +599,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
final boolean externalExists = final boolean externalExists =
getMyApplication().getSettings().getSecondaryStorage() != null; getMyApplication().getSettings().getSecondaryStorage() != null;
if (firstTime && externalExists && DataStoragePlaceDialogFragment.isInterestedInFirstTime) { if (firstTime && externalExists && DataStoragePlaceDialogFragment.isInterestedInFirstTime) {
new DataStoragePlaceDialogFragment().show(getFragmentManager(), null); new DataStoragePlaceDialogFragment().show(getSupportFragmentManager(), null);
} }
} }
@ -762,7 +762,8 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
regionName = savedInstanceState.getString(KEY_GOTO_MAP_REGION_NAME, ""); regionName = savedInstanceState.getString(KEY_GOTO_MAP_REGION_NAME);
regionName = regionName == null ? "" : regionName;
Object rCenterObj = savedInstanceState.getSerializable(KEY_GOTO_MAP_REGION_CENTER); Object rCenterObj = savedInstanceState.getSerializable(KEY_GOTO_MAP_REGION_CENTER);
if (rCenterObj != null) { if (rCenterObj != null) {
regionCenter = (LatLon) rCenterObj; regionCenter = (LatLon) rCenterObj;