Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
49c557c4d3
21 changed files with 108 additions and 94 deletions
|
@ -24,6 +24,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -235,8 +236,7 @@ public class MapTileDownloader {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
request.setError(false);
|
request.setError(false);
|
||||||
try {
|
try {
|
||||||
URL url = new URL(request.url);
|
URLConnection connection = NetworkUtils.getHttpURLConnection(request.url);
|
||||||
URLConnection connection = url.openConnection();
|
|
||||||
connection.setRequestProperty("User-Agent", USER_AGENT); //$NON-NLS-1$
|
connection.setRequestProperty("User-Agent", USER_AGENT); //$NON-NLS-1$
|
||||||
connection.setConnectTimeout(CONNECTION_TIMEOUT);
|
connection.setConnectTimeout(CONNECTION_TIMEOUT);
|
||||||
connection.setReadTimeout(CONNECTION_TIMEOUT);
|
connection.setReadTimeout(CONNECTION_TIMEOUT);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -401,7 +402,7 @@ public class TileSourceManager {
|
||||||
public static List<TileSourceTemplate> downloadTileSourceTemplates(String versionAsUrl) {
|
public static List<TileSourceTemplate> downloadTileSourceTemplates(String versionAsUrl) {
|
||||||
final List<TileSourceTemplate> templates = new ArrayList<TileSourceTemplate>();
|
final List<TileSourceTemplate> templates = new ArrayList<TileSourceTemplate>();
|
||||||
try {
|
try {
|
||||||
URLConnection connection = new URL("http://download.osmand.net//tile_sources.php?" + versionAsUrl).openConnection();
|
URLConnection connection = NetworkUtils.getHttpURLConnection("http://download.osmand.net//tile_sources.php?" + versionAsUrl);
|
||||||
XmlPullParser parser = PlatformUtil.newXMLPullParser();
|
XmlPullParser parser = PlatformUtil.newXMLPullParser();
|
||||||
parser.setInput(connection.getInputStream(), "UTF-8");
|
parser.setInput(connection.getInputStream(), "UTF-8");
|
||||||
int tok;
|
int tok;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@color/actionbar_light_color" android:state_pressed="true"/>
|
||||||
|
<item android:drawable="@color/actionbar_light_color" android:state_focused="true"/>
|
||||||
|
<item android:drawable="@color/list_item_background_dark"/>
|
||||||
|
</selector>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true" android:drawable="@color/actionbar_light_color" />
|
||||||
|
<item android:state_focused="true" android:drawable="@color/actionbar_light_color" />
|
||||||
|
<item android:drawable="@color/expandable_list_item_light" />
|
||||||
|
</selector>
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/favorite_icon_size"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="@dimen/favorite_icon_size"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||||
android:layout_marginRight="@dimen/dashFavIconMargin"/>
|
android:layout_marginRight="@dimen/dashFavIconMargin"/>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/main_scroll"
|
android:id="@+id/main_scroll"
|
||||||
android:background="@color/dashboard_background">
|
android:background="?attr/expandable_list_background">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
||||||
|
android:background="?attr/options_button_background"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="@dimen/list_header_height"
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="@dimen/list_header_height"
|
||||||
android:paddingLeft="@dimen/list_header_padding">
|
android:paddingLeft="@dimen/list_header_padding">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
android:id="@+id/category_name"
|
android:id="@+id/category_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="@dimen/list_header_bottom_margin"
|
|
||||||
android:layout_marginLeft="@dimen/list_header_text_left_margin"
|
android:layout_marginLeft="@dimen/list_header_text_left_margin"
|
||||||
android:layout_marginTop="@dimen/list_header_top_margin"
|
android:layout_marginTop="@dimen/list_header_top_margin"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -30,6 +30,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
android:layout_marginTop="@dimen/list_header_settings_top_margin"
|
||||||
|
android:layout_marginRight="@dimen/list_header_settings_top_margin"
|
||||||
|
android:background="?attr/options_button_background"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:src="?attr/list_settings_icon"/>
|
android:src="?attr/list_settings_icon"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -2034,4 +2034,7 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
|
||||||
<string name="share_note">Падзяліцца нататкаю</string>
|
<string name="share_note">Падзяліцца нататкаю</string>
|
||||||
<string name="rename_recording">Пераназваць запіс</string>
|
<string name="rename_recording">Пераназваць запіс</string>
|
||||||
<string name="export">Экспарт</string>
|
<string name="export">Экспарт</string>
|
||||||
|
<string name="audio">Аўдыё</string>
|
||||||
|
<string name="video">Відэа</string>
|
||||||
|
<string name="photo">Фота</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="audio">Audio</string>
|
||||||
|
<string name="video">Video</string>
|
||||||
|
<string name="photo">Photo</string>
|
||||||
<string name="share_note">Share note</string>
|
<string name="share_note">Share note</string>
|
||||||
<string name="rename_recording">Rename recording</string>
|
<string name="rename_recording">Rename recording</string>
|
||||||
<string name="watch">Watch</string>
|
<string name="watch">Watch</string>
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
|
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
|
||||||
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
|
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
|
||||||
<item name="plugin_description_header_text_color">#727272</item>
|
<item name="plugin_description_header_text_color">#727272</item>
|
||||||
<item name="expandable_list_item_background">@color/expandable_list_item_light</item>
|
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_light</item>
|
||||||
<item name="expandable_list_background">@color/color_white</item>
|
<item name="expandable_list_background">@color/color_white</item>
|
||||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
||||||
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
|
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
|
||||||
<item name="ic_world_globe">@drawable/ic_world_globe_dark</item>
|
<item name="ic_world_globe">@drawable/ic_world_globe_dark</item>
|
||||||
<item name="plugin_description_header_text_color">#70818c</item>
|
<item name="plugin_description_header_text_color">#70818c</item>
|
||||||
<item name="expandable_list_item_background">@color/list_item_background_dark</item>
|
<item name="expandable_list_item_background">@drawable/expandable_list_item_background_dark</item>
|
||||||
<item name="expandable_list_background">@color/list_background_dark</item>
|
<item name="expandable_list_background">@color/list_background_dark</item>
|
||||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
||||||
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||||
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -99,12 +100,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
return selectedItems;
|
return selectedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View vs = super.onCreateView(inflater, container, savedInstanceState);
|
|
||||||
return vs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -731,6 +726,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
viewName.setTextColor(defaultColor);
|
viewName.setTextColor(defaultColor);
|
||||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||||
}
|
}
|
||||||
|
TextView sizeText = (TextView) v.findViewById(R.id.local_index_size);
|
||||||
if (child.getSize() >= 0) {
|
if (child.getSize() >= 0) {
|
||||||
String size;
|
String size;
|
||||||
if (child.getSize() > 100) {
|
if (child.getSize() > 100) {
|
||||||
|
@ -738,16 +734,18 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
} else {
|
} else {
|
||||||
size = child.getSize() + " kB";
|
size = child.getSize() + " kB";
|
||||||
}
|
}
|
||||||
((TextView) v.findViewById(R.id.local_index_size)).setText(size);
|
sizeText.setText(size);
|
||||||
} else {
|
} else {
|
||||||
((TextView) v.findViewById(R.id.local_index_size)).setText("");
|
sizeText.setText("");
|
||||||
}
|
}
|
||||||
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
|
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
|
||||||
if (child.isExpanded()) {
|
if (child.isExpanded()) {
|
||||||
descr.setVisibility(View.VISIBLE);
|
descr.setVisibility(View.VISIBLE);
|
||||||
descr.setText(child.getHtmlDescription());
|
descr.setText(child.getHtmlDescription());
|
||||||
|
sizeText.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
descr.setVisibility(View.GONE);
|
descr.setVisibility(View.GONE);
|
||||||
|
sizeText.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
options.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -902,15 +900,19 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
item = optionsMenu.getMenu().add(R.string.export)
|
final OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
.setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark);
|
if (osmEditingPlugin != null && osmEditingPlugin.isActive()){
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item = optionsMenu.getMenu().add(R.string.export)
|
||||||
@Override
|
.setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark);
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
osmEditingPlugin.sendGPXFiles(getActivity(), AvailableGPXFragment.this, gpxInfo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
item = optionsMenu.getMenu().add(R.string.edit_filter_delete_menu_item)
|
item = optionsMenu.getMenu().add(R.string.edit_filter_delete_menu_item)
|
||||||
.setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
|
.setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
@ -138,7 +139,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
||||||
|
|
||||||
protected void executeThreadOperation(int operationId) throws Exception {
|
protected void executeThreadOperation(int operationId) throws Exception {
|
||||||
if(operationId == DOWNLOAD_BUILDS_LIST){
|
if(operationId == DOWNLOAD_BUILDS_LIST){
|
||||||
URLConnection connection = new URL(URL_TO_RETRIEVE_BUILDS).openConnection();
|
URLConnection connection = NetworkUtils.getHttpURLConnection(URL_TO_RETRIEVE_BUILDS);
|
||||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||||
parser.setInput(connection.getInputStream(), "UTF-8");
|
parser.setInput(connection.getInputStream(), "UTF-8");
|
||||||
int next;
|
int next;
|
||||||
|
@ -164,7 +165,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(operationId == INSTALL_BUILD){
|
} else if(operationId == INSTALL_BUILD){
|
||||||
URLConnection connection = new URL(URL_GET_BUILD + currentSelectedBuild.path).openConnection();
|
URLConnection connection = NetworkUtils.getHttpURLConnection(URL_GET_BUILD + currentSelectedBuild.path);
|
||||||
if(pathToDownload.exists()){
|
if(pathToDownload.exists()){
|
||||||
pathToDownload.delete();
|
pathToDownload.delete();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TabHost.TabSpec;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
|
@ -40,14 +39,13 @@ import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||||
*/
|
*/
|
||||||
public class FavoritesActivity extends TabActivity {
|
public class FavoritesActivity extends TabActivity {
|
||||||
|
|
||||||
private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
|
// private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
|
||||||
private static final String TRACKS = "TRACKS";
|
private static final String TRACKS = "TRACKS";
|
||||||
private static final String SELECTED_TRACK = "SELECTED_TRACK";
|
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
|
||||||
public static int FAVORITES_TAB = 0;
|
// public static int FAVORITES_TAB = 0;
|
||||||
public static int GPX_TAB = 1;
|
// public static int GPX_TAB = 1;
|
||||||
public static int SELECTED_GPX_TAB = 2;
|
// public static int SELECTED_GPX_TAB = 2;
|
||||||
public static String TAB_PARAM = "TAB_PARAM";
|
public static String TAB_PARAM = "TAB_PARAM";
|
||||||
private TabSpec selectedTrack;
|
|
||||||
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,12 +79,12 @@ public class FavoritesActivity extends TabActivity {
|
||||||
|
|
||||||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||||
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
mTabs.add(getTabIndicator(R.string.my_favorites, FavoritesTreeFragment.class));
|
||||||
mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class));
|
|
||||||
AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
AudioVideoNotesPlugin audioVideoNotesPlugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive()
|
if (audioVideoNotesPlugin != null && audioVideoNotesPlugin.isActive()
|
||||||
&& audioVideoNotesPlugin.getAllRecordings().size() > 0){
|
&& audioVideoNotesPlugin.getAllRecordings().size() > 0){
|
||||||
mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class));
|
mTabs.add(getTabIndicator(R.string.notes, NotesFragment.class));
|
||||||
}
|
}
|
||||||
|
mTabs.add(getTabIndicator(R.string.my_tracks, AvailableGPXFragment.class));
|
||||||
mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
|
mTabs.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
|
||||||
|
|
||||||
setViewPagerAdapter(mViewPager, mTabs);
|
setViewPagerAdapter(mViewPager, mTabs);
|
||||||
|
@ -205,7 +203,7 @@ public class FavoritesActivity extends TabActivity {
|
||||||
stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
searchEdit.setHint(stopHint);
|
searchEdit.setHint(stopHint);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
||||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
||||||
getActivity(), true, false);
|
getActivity(), true, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(),
|
|
||||||
// getActivity(), true, false);
|
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
MenuItem item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit)
|
MenuItem item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit)
|
||||||
.setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
|
.setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
|
||||||
|
|
|
@ -246,25 +246,6 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
menu.clear();
|
menu.clear();
|
||||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||||
// MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_light,
|
|
||||||
// R.drawable.ic_action_search_dark, MenuItem.SHOW_AS_ACTION_ALWAYS
|
|
||||||
// | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
|
||||||
// searchView = new com.actionbarsherlock.widget.SearchView(getDownloadActivity());
|
|
||||||
// mi.setActionView(searchView);
|
|
||||||
// searchView.setOnQueryTextListener(new OnQueryTextListener() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onQueryTextSubmit(String query) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public boolean onQueryTextChange(String newText) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// createMenuItem(menu, ACTION_ID, R.string.export_fav, R.drawable.ic_action_gsave_light,
|
|
||||||
// R.drawable.ic_action_gsave_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showProgressBar() {
|
public void showProgressBar() {
|
||||||
|
@ -534,8 +515,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
} else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) {
|
} else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) {
|
||||||
ch.setVisibility(View.VISIBLE);
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
||||||
app.getSettings().isLightContent() ? R.drawable.ic_action_settings_enabled_light
|
app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light
|
||||||
: R.drawable.ic_action_settings_enabled_dark));
|
: R.drawable.ic_overflow_menu_dark));
|
||||||
ch.setOnClickListener(new View.OnClickListener() {
|
ch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -547,8 +528,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
||||||
model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
model.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
||||||
ch.setVisibility(View.VISIBLE);
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
|
||||||
app.getSettings().isLightContent() ? R.drawable.ic_action_fav_light
|
app.getSettings().isLightContent() ? R.drawable.ic_overflow_menu_light
|
||||||
: R.drawable.ic_action_fav_dark));
|
: R.drawable.ic_overflow_menu_dark));
|
||||||
ch.setOnClickListener(new View.OnClickListener() {
|
ch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.view.MenuItem.OnMenuItemClickListener;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -174,8 +175,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
|
||||||
b.append("&q=").append(URLEncoder.encode(search, "UTF-8")); //$NON-NLS-1$
|
b.append("&q=").append(URLEncoder.encode(search, "UTF-8")); //$NON-NLS-1$
|
||||||
|
|
||||||
log.info("Searching address at : " + b); //$NON-NLS-1$
|
log.info("Searching address at : " + b); //$NON-NLS-1$
|
||||||
URL url = new URL(b.toString());
|
URLConnection conn = NetworkUtils.getHttpURLConnection(b.toString());
|
||||||
URLConnection conn = url.openConnection();
|
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
conn.setRequestProperty("User-Agent", Version.getFullVersion((OsmandApplication) getActivity().getApplication())); //$NON-NLS-1$
|
conn.setRequestProperty("User-Agent", Version.getFullVersion((OsmandApplication) getActivity().getApplication())); //$NON-NLS-1$
|
||||||
conn.connect();
|
conn.connect();
|
||||||
|
|
|
@ -277,13 +277,12 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription(Context ctx) {
|
public String getDescription(Context ctx) {
|
||||||
String nm = name == null ? "" : name;
|
|
||||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||||
if (isPhoto()) {
|
if (isPhoto()) {
|
||||||
return ctx.getString(R.string.recording_photo_description, nm, time).trim();
|
return ctx.getString(R.string.recording_photo_description, "", time).trim();
|
||||||
}
|
}
|
||||||
updateInternalDescription();
|
updateInternalDescription();
|
||||||
return ctx.getString(R.string.recording_description, nm, getDuration(ctx), time)
|
return ctx.getString(R.string.recording_description, "", getDuration(ctx), time)
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ExpandableListView;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -26,6 +27,7 @@ import net.osmand.plus.activities.FavoritesActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
|
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -42,8 +44,8 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
setHasOptionsMenu(true);
|
||||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||||
|
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
||||||
view.findViewById(R.id.select_all).setVisibility(View.GONE);
|
view.findViewById(R.id.select_all).setVisibility(View.GONE);
|
||||||
((TextView) view.findViewById(R.id.header)).setText(R.string.notes);
|
((TextView) view.findViewById(R.id.header)).setText(R.string.notes);
|
||||||
|
@ -60,6 +62,7 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
menu.clear();
|
||||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ public class NotesFragment extends ListFragment {
|
||||||
|
|
||||||
|
|
||||||
public OsmandApplication getMyApplication() {
|
public OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication)getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
class NotesAdapter extends ArrayAdapter<AudioVideoNotesPlugin.Recording> {
|
||||||
|
@ -82,24 +85,28 @@ public class NotesFragment extends ListFragment {
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
View row = convertView;
|
View row = convertView;
|
||||||
if (row == null){
|
if (row == null) {
|
||||||
row = inflater.inflate(R.layout.note, parent, false);
|
row = inflater.inflate(R.layout.note, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
final AudioVideoNotesPlugin.Recording recording = getItem(position);
|
||||||
if (recording.getName() != null){
|
String name = recording.getName();
|
||||||
((TextView) row.findViewById(R.id.name)).setText(recording.getName());
|
TextView nameText = ((TextView) row.findViewById(R.id.name));
|
||||||
((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
if (name != null) {
|
||||||
row.findViewById(R.id.descr).setVisibility(View.VISIBLE);
|
nameText.setText(name);
|
||||||
} else {
|
} else if (recording.isAudio()) {
|
||||||
((TextView) row.findViewById(R.id.name)).setText(recording.getDescription(getActivity()));
|
nameText.setText(R.string.audio);
|
||||||
row.findViewById(R.id.descr).setVisibility(View.GONE);
|
} else if (recording.isVideo()) {
|
||||||
|
nameText.setText(R.string.video);
|
||||||
|
} else if (recording.isPhoto()) {
|
||||||
|
nameText.setText(R.string.photo);
|
||||||
}
|
}
|
||||||
|
((TextView) row.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
||||||
|
|
||||||
ImageView icon = (ImageView) row.findViewById(R.id.icon);
|
ImageView icon = (ImageView) row.findViewById(R.id.icon);
|
||||||
if (recording.isAudio()){
|
if (recording.isAudio()) {
|
||||||
icon.setImageResource(R.drawable.ic_type_audio);
|
icon.setImageResource(R.drawable.ic_type_audio);
|
||||||
} else if (recording.isVideo()){
|
} else if (recording.isVideo()) {
|
||||||
icon.setImageResource(R.drawable.ic_type_video);
|
icon.setImageResource(R.drawable.ic_type_video);
|
||||||
} else {
|
} else {
|
||||||
icon.setImageResource(R.drawable.ic_type_img);
|
icon.setImageResource(R.drawable.ic_type_img);
|
||||||
|
@ -111,23 +118,35 @@ public class NotesFragment extends ListFragment {
|
||||||
openPopUpMenu(v, recording);
|
openPopUpMenu(v, recording);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
row.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showOnMap(recording);
|
||||||
|
}
|
||||||
|
});
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openPopUpMenu(View v,final AudioVideoNotesPlugin.Recording recording) {
|
private void showOnMap(Recording recording) {
|
||||||
|
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(),
|
||||||
|
recording); //$NON-NLS-1$
|
||||||
|
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openPopUpMenu(View v, final AudioVideoNotesPlugin.Recording recording) {
|
||||||
boolean light = getMyApplication().getSettings().isLightContent();
|
boolean light = getMyApplication().getSettings().isLightContent();
|
||||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
boolean isPhoto = recording.isPhoto();
|
boolean isPhoto = recording.isPhoto();
|
||||||
final int playIcon;
|
final int playIcon;
|
||||||
if(isPhoto){
|
if (isPhoto) {
|
||||||
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
|
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
|
||||||
} else {
|
} else {
|
||||||
playIcon = light ? R.drawable.ic_play_light : R.drawable.ic_play_dark;
|
playIcon = light ? R.drawable.ic_play_light : R.drawable.ic_play_dark;
|
||||||
}
|
}
|
||||||
item = optionsMenu.getMenu().add(isPhoto ? R.string.watch : R.string.recording_context_menu_play)
|
item = optionsMenu.getMenu().add(isPhoto ? R.string.watch : R.string.recording_context_menu_play)
|
||||||
.setIcon(playIcon);
|
.setIcon(playIcon);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,9 +161,7 @@ public class NotesFragment extends ListFragment {
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(),
|
showOnMap(recording);
|
||||||
recording); //$NON-NLS-1$
|
|
||||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -226,4 +243,5 @@ public class NotesFragment extends ListFragment {
|
||||||
editText.requestFocus();
|
editText.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -256,8 +257,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
b.append(",").append(topLatitude); //$NON-NLS-1$
|
b.append(",").append(topLatitude); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
log.info("Loading bugs " + b); //$NON-NLS-1$
|
log.info("Loading bugs " + b); //$NON-NLS-1$
|
||||||
URL url = new URL(b.toString());
|
URLConnection connection = NetworkUtils.getHttpURLConnection(b.toString());
|
||||||
URLConnection connection = url.openConnection();
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
XmlPullParser parser = Xml.newPullParser();
|
XmlPullParser parser = Xml.newPullParser();
|
||||||
parser.setInput(reader);
|
parser.setInput(reader);
|
||||||
|
|
|
@ -574,8 +574,7 @@ public class RouteProvider {
|
||||||
}
|
}
|
||||||
uri.append("&fast=").append(params.fast ? "1" : "0").append("&layer=mapnik"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
uri.append("&fast=").append(params.fast ? "1" : "0").append("&layer=mapnik"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
log.info("URL route " + uri);
|
log.info("URL route " + uri);
|
||||||
URL url = new URL(uri.toString());
|
URLConnection connection = NetworkUtils.getHttpURLConnection(uri.toString());
|
||||||
URLConnection connection = url.openConnection();
|
|
||||||
connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx));
|
connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx));
|
||||||
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream())));
|
Document doc = dom.parse(new InputSource(new InputStreamReader(connection.getInputStream())));
|
||||||
|
@ -949,9 +948,7 @@ public class RouteProvider {
|
||||||
// .append("&language=").append(Locale.getDefault().getLanguage());
|
// .append("&language=").append(Locale.getDefault().getLanguage());
|
||||||
|
|
||||||
log.info("URL route " + request);
|
log.info("URL route " + request);
|
||||||
URI uri = URI.create(request.toString());
|
URLConnection connection = NetworkUtils.getHttpURLConnection(request.toString());
|
||||||
URL url = uri.toURL();
|
|
||||||
URLConnection connection = url.openConnection();
|
|
||||||
connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx));
|
connection.setRequestProperty("User-Agent", Version.getFullVersion(params.ctx));
|
||||||
|
|
||||||
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
DocumentBuilder dom = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
|
Loading…
Reference in a new issue