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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
@ -9,126 +9,89 @@
android:layout_marginLeft="5dp"
android:orientation="vertical">
<TableLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_name"/>
<EditText
android:id="@+id/Name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="">
android:stretchColumns="1">
<requestFocus/>
</EditText>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:scrollHorizontally="true"
android:text="@string/edit_tilesource_choose_existing"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_name" />
<Spinner
android:id="@+id/TileSourceSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"/>
<EditText
android:id="@+id/Name"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_url_to_load"/>
<requestFocus />
</EditText>
</TableRow>
<EditText
android:id="@+id/URLToLoad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="5"
android:minLines="2"
android:text=""/>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_minzoom"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_choose_existing"></TextView>
<EditText
android:id="@+id/MinZoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""/>
<Spinner
android:id="@+id/TileSourceSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"></Spinner>
</TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_maxzoom"/>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/MaxZoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_url_to_load" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/edit_tilesource_expiration_time"/>
<EditText
android:id="@+id/URLToLoad"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:lines="5"
android:minLines="2"
android:text=""></EditText>
</TableRow>
<EditText
android:id="@+id/ExpirationTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""/>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_minzoom" />
<EditText
android:id="@+id/MinZoom"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text=""></EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_tilesource_maxzoom" />
<EditText
android:id="@+id/MaxZoom"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text=""></EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/edit_tilesource_expiration_time" />
<EditText
android:id="@+id/ExpirationTime"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text=""></EditText>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/EllipticMercator"
android:layout_width="wrap_content"
android:layout_marginRight="5dp"
android:layout_span="2"
android:text="@string/edit_tilesource_elliptic_tile" />
</TableRow>
</TableLayout>
<CheckBox
android:id="@+id/EllipticMercator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_span="2"
android:text="@string/edit_tilesource_elliptic_tile"/>
</LinearLayout>
</ScrollView>

View file

@ -66,7 +66,7 @@
<string name="search_street_in_neighborhood_cities">Пошук вуліцы ў суседніх гарадах</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_failed">Збой рэзервовага капіяваньня файлу зьмен OSM</string>
<string name="local_osm_changes_backup">Рэзервовае капіяваньне файлу зьмен OSM</string>
@ -2038,4 +2038,13 @@
<string name="rendering_attr_currentTrackColor_description">Колер сьледу GPX</string>
<string name="poi_dialog_reopen">Пераадкрыць</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>

View file

@ -398,9 +398,9 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents {
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
} else {
if (ErrorBottomSheetDialog.shouldShow(settings, this)) {
new ErrorBottomSheetDialog().show(getFragmentManager(), "dialog");
new ErrorBottomSheetDialog().show(getSupportFragmentManager(), "dialog");
} 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;
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.app.Activity;
import android.app.Dialog;
@ -62,10 +34,39 @@ import android.widget.TextView;
import android.widget.TextView.BufferType;
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")
public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity {
private static final String ENDING_TEXT = "ending_text";
private EditText searchText;
private AsyncTask<Object, ?, ?> initializeTask;
@ -76,7 +77,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
protected ProgressBar progress;
protected LatLon locationToSearch;
protected OsmandSettings settings;
protected List<T> initialListToFilter = new ArrayList<T>();
protected List<T> initialListToFilter = new ArrayList<>();
protected Handler uiHandler;
protected Collator collator;
protected NamesFilter namesFilter;
@ -84,7 +85,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
private boolean initFilter = false;
private String endingText = "";
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 int NAVIGATE_TO = 3;
@ -233,17 +234,15 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("ENDING_TEXT", endingText);
outState.putParcelable("PREVIOUS_SPAN", this.previousSpan);
outState.putString(ENDING_TEXT, endingText);
}
@Override
protected void onRestoreInstanceState(Bundle prevState) {
endingText = prevState.getString("ENDING_TEXT");
endingText = prevState.getString(ENDING_TEXT);
if(endingText == null) {
endingText = "";
}
previousSpan = prevState.getParcelable("PREVIOUS_SPAN");
super.onRestoreInstanceState(prevState);
}
@ -268,12 +267,9 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
if(updateText) {
searchText.getText().replace(currentFilter.length(), currentFilter.length() + prevEndtext.length(), locEndingText);
}
if (previousSpan != null) {
searchText.getText().removeSpan(previousSpan);
previousSpan = null;
}
searchText.getText().removeSpan(previousSpan);
if (locEndingText.length() > 0) {
previousSpan = new StyleSpan(Typeface.BOLD_ITALIC);
searchText.getText().setSpan(previousSpan, currentFilter.length(), currentFilter.length() + locEndingText.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (searchText.getSelectionEnd() > currentFilter.length()) {
@ -384,7 +380,7 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
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 String minimalText = null;

View file

@ -1,12 +1,12 @@
package net.osmand.plus.base;
import android.app.Dialog;
import android.app.DialogFragment;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.Gravity;
import android.view.LayoutInflater;
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_MAP_SCREEN.set(false);
settings.SHOW_CARD_TO_CHOOSE_DRAWER.set(false);
dashboard.hideFragmentByTag(TAG);
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.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.Space;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
@ -23,7 +24,6 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.support.v4.widget.Space;
import android.widget.TextView;
import android.widget.Toast;
@ -577,7 +577,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
GoToMapFragment fragment = new GoToMapFragment();
fragment.regionCenter = region.getRegionCenter();
fragment.regionName = region.getLocaleName();
fragment.show(getFragmentManager(), GoToMapFragment.TAG);
fragment.show(getSupportFragmentManager(), GoToMapFragment.TAG);
}
private void showDownloadWorldMapIfNeeded() {
@ -590,7 +590,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
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 =
getMyApplication().getSettings().getSecondaryStorage() != null;
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
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
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);
if (rCenterObj != null) {
regionCenter = (LatLon) rCenterObj;