Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-03-06 00:30:13 +01:00
commit 3f04a79754
24 changed files with 380 additions and 102 deletions

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/dashboard"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#70000000"
android:visibility="gone">
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_gravity="end"
android:layout_height="match_parent">
<include android:id="@+id/init_progress"
layout="@layout/application_loading"/>
<net.osmand.plus.dashboard.NotifyingScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="360dp"
android:layout_height="match_parent"
android:id="@+id/main_scroll"
android:fadeScrollbars="true">
<LinearLayout
android:id="@+id/content"
android:paddingTop="@dimen/dashboard_map_top_padding"
android:paddingBottom="@dimen/dashboard_map_bottom_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</net.osmand.plus.dashboard.NotifyingScrollView>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loading"
android:background="?attr/card_bg"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashMapHeight"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/ProgressMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:textColor="@color/icon_color_light"
android:text="@string/loading_data"
android:textSize="@dimen/dashProgressTextSize"/>
</LinearLayout>

View file

@ -6,26 +6,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashMapHeight"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/ProgressMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:textColor="@color/icon_color_light"
android:text="@string/loading_data"
android:textSize="@dimen/dashProgressTextSize"/>
</LinearLayout>
<include layout="@layout/application_loading"/>
<ImageView android:id="@+id/map_image"
android:scaleType="centerCrop"

View file

@ -8,13 +8,18 @@
android:background="#70000000"
android:visibility="gone">
<LinearLayout android:orientation="vertical"
<RelativeLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_gravity="end"
android:layout_height="match_parent">
<include android:layout_height="@dimen/dashMapHeight"
android:layout_width="@dimen/dashboard_map_width"
android:id="@+id/init_progress"
layout="@layout/application_loading"/>
<net.osmand.plus.dashboard.NotifyingScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="360dp"
android:layout_width="@dimen/dashboard_map_width"
android:layout_height="match_parent"
android:id="@+id/main_scroll"
android:fadeScrollbars="true">
@ -29,6 +34,6 @@
</net.osmand.plus.dashboard.NotifyingScrollView>
</LinearLayout>
</RelativeLayout>
</FrameLayout>

View file

@ -2047,8 +2047,8 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="proxy_host_descr">Einen Proxy\'s Hostname einrichten (Bsp. 127.0.0.1)</string>
<string name="proxy_port_title">Proxy-Port</string>
<string name="proxy_port_descr">Einen Proxy\'s Port einrichten (Bsp. 8118)</string>
<string name="enable_plugin">Deaktivieren</string>
<string name="disable_plugin">Aktivieren</string>
<string name="enable_plugin">Deaktiviert</string>
<string name="disable_plugin">Aktiviert</string>
<string name="enable_plugin2">Aktivieren</string>
<string name="disable_plugin2">Deaktivieren</string>
<string name="plugin_description_title">Beschreibung</string>

View file

@ -2,4 +2,5 @@
<resources>
<dimen name="dashboard_map_top_padding">0dp</dimen>
<dimen name="dashboard_map_bottom_padding">0dp</dimen>
<dimen name="dashMapHeight">125dp</dimen>
</resources>

View file

@ -44,7 +44,7 @@
<dimen name="gpx_small_text_margin">14dp</dimen>
<dimen name="gpx_text_top_margin">6dp</dimen>
<dimen name="dashboard_map_width">360dp</dimen>
<dimen name="dashboard_map_top_padding">200dp</dimen>
<dimen name="dashboard_map_top_padding">@dimen/dashMapHeight</dimen>
<dimen name="dashboard_map_bottom_padding">90dp</dimen>
<!-- TextSizes -->

View file

@ -9,6 +9,7 @@
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
-->
<string name="route_points">Route points</string>
<string name="track_segments">Track segments</string>
<string name="track_points">Track points</string>
<string name="online_map_settings">Online maps</string>

View file

@ -26,7 +26,9 @@ public class PointDescription {
public static final String POINT_TYPE_ADDRESS = "address";
public static final String POINT_TYPE_OSM_NOTE= "osm_note";
public static final String POINT_TYPE_MARKER = "marker";
public static final String POINT_TYPE_NOTE = "avnote";
public static final String POINT_TYPE_AUDIO_NOTE = "audionote";
public static final String POINT_TYPE_VIDEO_NOTE = "videonote";
public static final String POINT_TYPE_PHOTO_NOTE = "photonote";
public static final String POINT_TYPE_LOCATION = "location";
public static final String POINT_TYPE_ALARM = "alarm";
public static final String POINT_TYPE_TARGET = "destination";
@ -51,6 +53,14 @@ public class PointDescription {
}
}
public void setTypeName(String typeName){
this.typeName = typeName;
}
public void setName(String name){
this.name = name;
}
public String getTypeName() {
return typeName;
}
@ -111,10 +121,19 @@ public class PointDescription {
return POINT_TYPE_FAVORITE.equals(type);
}
public boolean isAvNote() {
return POINT_TYPE_NOTE.equals(type);
public boolean isAudioNote() {
return POINT_TYPE_AUDIO_NOTE.equals(type);
}
public boolean isVideoNote() {
return POINT_TYPE_VIDEO_NOTE.equals(type);
}
public boolean isPhotoNote() {
return POINT_TYPE_PHOTO_NOTE.equals(type);
}
@Override
public int hashCode() {
final int prime = 31;

View file

@ -26,6 +26,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.Location;
@ -156,7 +157,18 @@ public class MapActivity extends AccessibleActivity {
startProgressDialog = new ProgressDialog(this);
startProgressDialog.setCancelable(true);
app.checkApplicationIsBeingInitialized(this, startProgressDialog);
if (getMyApplication().isApplicationInitializing()) {
getMyApplication().checkApplicationIsBeingInitialized(this, (TextView) findViewById(R.id.ProgressMessage),
(ProgressBar) findViewById(R.id.ProgressBar), new Runnable() {
@Override
public void run() {
applicationInitialized();
}
});
} else {
applicationInitialized();
}
//app.checkApplicationIsBeingInitialized(this, null);
parseLaunchIntentLocation();
@ -242,6 +254,10 @@ public class MapActivity extends AccessibleActivity {
wakeLockHelper = new WakeLockHelper(getMyApplication());
}
private void applicationInitialized() {
findViewById(R.id.init_progress).setVisibility(View.GONE);
}
public void addLockView(FrameLayout lockView) {
this.lockView = lockView;
}

View file

@ -10,10 +10,12 @@ import java.util.List;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.myplaces.SelectedGPXFragment;
import net.osmand.plus.myplaces.TrackPointFragment;
import net.osmand.plus.myplaces.TrackRoutePointFragment;
import net.osmand.plus.myplaces.TrackSegmentFragment;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import android.content.Intent;
@ -23,6 +25,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -36,6 +39,7 @@ public class TrackActivity extends TabActivity {
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
private File file = null;
private GPXFile result;
ViewPager mViewPager;
@Override
public void onCreate(Bundle icicle) {
@ -56,7 +60,7 @@ public class TrackActivity extends TabActivity {
PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs);
final ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager = (ViewPager) findViewById(R.id.pager);
setViewPagerAdapter(mViewPager, new ArrayList<TabActivity.TabItem>());
mSlidingTabLayout.setViewPager(mViewPager);
@ -73,14 +77,19 @@ public class TrackActivity extends TabActivity {
}
protected void onPostExecute(GPXFile result) {
setSupportProgressBarIndeterminateVisibility(false);
// List<TabItem> items = new ArrayList<TabActivity.TabItem>();
// items.add(getTabIndicator(R.string.selected_track, SelectedGPXFragment.class));
setResult(result);
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
getTabIndicator(R.string.track_segments, TrackSegmentFragment.class));
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
getTabIndicator(R.string.track_points, TrackPointFragment.class));
// setViewPagerAdapter(mViewPager, items );
if (isHavingTrackPoints()){
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
getTabIndicator(R.string.track_points, TrackPointFragment.class));
}
if (isHavingRoutePoints()){
((OsmandFragmentPagerAdapter) mViewPager.getAdapter()).addTab(
getTabIndicator(R.string.route_points, TrackRoutePointFragment.class));
}
};
}.execute((Void)null);
@ -122,10 +131,6 @@ public class TrackActivity extends TabActivity {
return tb;
}
public void setToolbarVisibility(boolean visible){
findViewById(R.id.bottomControls).setVisibility(visible? View.VISIBLE : View.GONE);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
@ -138,5 +143,38 @@ public class TrackActivity extends TabActivity {
return false;
}
public List<GpxSelectionHelper.GpxDisplayGroup> getContent() {
GpxSelectionHelper selectedGpxHelper = getMyApplication().getSelectedGpxHelper();
List<GpxSelectionHelper.GpxDisplayGroup> displayGrous = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>();
selectedGpxHelper.collectDisplayGroups(displayGrous, getResult());
return displayGrous;
}
boolean isHavingTrackPoints(){
List<GpxSelectionHelper.GpxDisplayGroup> groups = getContent();
for (GpxSelectionHelper.GpxDisplayGroup group : groups){
GpxSelectionHelper.GpxDisplayItemType type = group.getType();
if (type == GpxSelectionHelper.GpxDisplayItemType.TRACK_POINTS &&
!group.getModifiableList().isEmpty()){
return true;
}
}
return false;
}
boolean isHavingRoutePoints(){
List<GpxSelectionHelper.GpxDisplayGroup> groups = getContent();
for (GpxSelectionHelper.GpxDisplayGroup group : groups){
GpxSelectionHelper.GpxDisplayItemType type = group.getType();
if (type == GpxSelectionHelper.GpxDisplayItemType.TRACK_ROUTE_POINTS &&
!group.getModifiableList().isEmpty()){
return true;
}
}
return false;
}
}

View file

@ -82,7 +82,6 @@ public class SearchAddressFragment extends Fragment {
@Override
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
boolean light = getApplication().getSettings().isLightActionBar();
Menu menu = onCreate;
int orientation = ScreenOrientationHelper.getScreenOrientation(getActivity());
boolean portrait = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
@ -93,7 +92,6 @@ public class SearchAddressFragment extends Fragment {
} else {
((SearchActivity) getActivity()).getClearToolbar(false);
}
light = false;
}
if(getActivity() instanceof SearchAddressActivity) {
MenuItem menuItem = menu.add(0, SELECT_POINT, 0, "");
@ -353,21 +351,31 @@ public class SearchAddressFragment extends Fragment {
return;
}
AddressInformation ai = new AddressInformation();
PointDescription pointDescription = ai.getHistoryName();
if (!Algorithms.isEmpty(street2) && !Algorithms.isEmpty(street)) {
ai = AddressInformation.build2StreetIntersection(getActivity(), osmandSettings);
pointDescription.setName(street2);
pointDescription.setTypeName(region + ", " + city);
} else if (!Algorithms.isEmpty(building)) {
ai = AddressInformation.buildBuilding(getActivity(), osmandSettings);
pointDescription.setName(street + ", " + building);
pointDescription.setTypeName(region + ", " + city);
} else if (!Algorithms.isEmpty(street)) {
ai = AddressInformation.buildStreet(getActivity(), osmandSettings);
pointDescription.setName(street);
pointDescription.setTypeName(region + ", " + city);
} else if(!Algorithms.isEmpty(city)) {
ai = AddressInformation.buildCity(getActivity(), osmandSettings);
pointDescription.setName(city);
pointDescription.setTypeName(region);
}
if(mode == ADD_TO_FAVORITE) {
Bundle b = new Bundle();
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
dlg.show();
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(),
ai.getHistoryName());
pointDescription);
} else if(mode == SELECT_POINT ){
Intent intent = getActivity().getIntent();
intent.putExtra(SELECT_ADDRESS_POINT_INTENT_KEY, ai.objectName);
@ -377,11 +385,11 @@ public class SearchAddressFragment extends Fragment {
getActivity().finish();
} else {
if (mode == NAVIGATE_TO) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
} else if (mode == ADD_WAYPOINT) {
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), pointDescription);
} else if (mode == SHOW_ON_MAP) {
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, ai.getHistoryName());
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, pointDescription);
MapActivity.launchMapActivityMoveToTop(getActivity());
}
}

View file

@ -48,7 +48,9 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
private Drawable locationIcon;
private Drawable poiIcon;
private Drawable wptIcon;
private Drawable noteIcon;
private Drawable audioNoteIcon;
private Drawable videoNoteIcon;
private Drawable photoNoteIcon;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -72,8 +74,10 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
favoriteIcon = getResources().getDrawable(R.drawable.ic_type_favorites);
locationIcon = getResources().getDrawable(R.drawable.ic_type_coordinates);
poiIcon = getResources().getDrawable(R.drawable.ic_type_info);
wptIcon = getResources().getDrawable(R.drawable.ic_action_flage_dark);
noteIcon = getResources().getDrawable(R.drawable.ic_action_note_dark);
wptIcon = getResources().getDrawable(R.drawable.ic_type_waypoint);
audioNoteIcon = getResources().getDrawable(R.drawable.ic_type_audio);
videoNoteIcon = getResources().getDrawable(R.drawable.ic_type_video);
photoNoteIcon = getResources().getDrawable(R.drawable.ic_type_img);
if (getMyApplication().getSettings().isLightContent()) {
addressIcon = addressIcon.mutate();
addressIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
@ -85,8 +89,12 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
poiIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
wptIcon = wptIcon.mutate();
wptIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
noteIcon = noteIcon.mutate();
noteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
audioNoteIcon = audioNoteIcon.mutate();
audioNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
videoNoteIcon = videoNoteIcon.mutate();
videoNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
photoNoteIcon = photoNoteIcon.mutate();
photoNoteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
}
}
@ -224,9 +232,13 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
icon.setImageDrawable(poiIcon);
} else if (historyEntry.getName().isWpt()) {
icon.setImageDrawable(wptIcon);
} else if (historyEntry.getName().isAvNote()) {
icon.setImageDrawable(noteIcon);
} else {
} else if (historyEntry.getName().isAudioNote()) {
icon.setImageDrawable(audioNoteIcon);
} else if (historyEntry.getName().isVideoNote()) {
icon.setImageDrawable(videoNoteIcon);
}else if (historyEntry.getName().isPhotoNote()) {
icon.setImageDrawable(photoNoteIcon);
} else {
icon.setImageDrawable(addressIcon);
}

View file

@ -170,10 +170,11 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
@Override
public PointDescription getObjectName(Object o) {
if(o instanceof Recording){
if(((Recording)o).getName(activity).isEmpty()) {
return new PointDescription(PointDescription.POINT_TYPE_NOTE, view.getResources().getString(R.string.recording_default_name));
Recording rec = (Recording) o;
if(rec.getName(activity).isEmpty()) {
return new PointDescription(rec.getSearchHistoryType(), view.getResources().getString(R.string.recording_default_name));
}
return new PointDescription(PointDescription.POINT_TYPE_NOTE, ((Recording)o).getName(activity));
return new PointDescription(rec.getSearchHistoryType(), ((Recording)o).getName(activity));
}
return null;
}

View file

@ -21,6 +21,7 @@ import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.access.AccessibleToast;
import net.osmand.data.DataTileManager;
import net.osmand.data.PointDescription;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
@ -213,6 +214,16 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
return "";
}
public String getSearchHistoryType(){
if (isPhoto()){
return PointDescription.POINT_TYPE_PHOTO_NOTE;
} else if (isVideo()) {
return PointDescription.POINT_TYPE_VIDEO_NOTE;
} else {
return PointDescription.POINT_TYPE_PHOTO_NOTE;
}
}
public boolean isPhoto() {
return file.getName().endsWith(IMG_EXTENSION);
}

View file

@ -15,7 +15,9 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
@ -101,7 +103,8 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.note, null, false);
getNoteView(recording, view, getActivity());
Drawable icon =getNoteView(recording, view, getActivity());
icon.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
view.setBackgroundColor(Color.TRANSPARENT);
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
@Override
@ -115,7 +118,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
@Override
public void onClick(View v) {
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15,
new PointDescription(PointDescription.POINT_TYPE_NOTE,
new PointDescription(recording.getSearchHistoryType(),
recording.getName(getActivity())), true,
recording); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity());
@ -125,7 +128,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
}
}
public static void getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
public static Drawable getNoteView(final AudioVideoNotesPlugin.Recording recording, View view,
final Context ctx) {
String name = recording.getName(ctx);
TextView nameText = ((TextView) view.findViewById(R.id.name));
@ -133,14 +136,16 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(ctx));
ImageView icon = (ImageView) view.findViewById(R.id.icon);
Drawable iconDrawable;
if (recording.isAudio()) {
icon.setImageResource(R.drawable.ic_type_audio);
iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
} else if (recording.isVideo()) {
icon.setImageResource(R.drawable.ic_type_video);
iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
} else {
icon.setImageResource(R.drawable.ic_type_img);
iconDrawable = ctx.getResources().getDrawable(R.drawable.ic_type_audio);
}
icon.setImageDrawable(iconDrawable);
return iconDrawable;
}
}

View file

@ -4,6 +4,7 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@ -92,7 +93,8 @@ public class NotesFragment extends ListFragment {
}
final AudioVideoNotesPlugin.Recording recording = getItem(position);
DashAudioVideoNotesFragment.getNoteView(recording, row, getActivity());
Drawable icon = DashAudioVideoNotesFragment.getNoteView(recording, row, getActivity());
icon.setColorFilter(getResources().getColor(R.color.color_distance), Mode.MULTIPLY);
row.findViewById(R.id.play).setVisibility(View.GONE);
ImageButton options = (ImageButton) row.findViewById(R.id.options);
options.setOnClickListener(new View.OnClickListener() {
@ -113,7 +115,7 @@ public class NotesFragment extends ListFragment {
private void showOnMap(Recording recording) {
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15,
new PointDescription(PointDescription.POINT_TYPE_NOTE, recording.getName(getActivity())), true,
new PointDescription(recording.getSearchHistoryType(), recording.getName(getActivity())), true,
recording); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity());
}

View file

@ -11,7 +11,6 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.SearchHistoryHelper;
@ -20,7 +19,6 @@ import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
@ -90,7 +88,7 @@ public class DashRecentsFragment extends DashLocationFragment {
} else {
loc = new LatLon(0f, 0f);
}
setupFavorites();
setupRecents();
}
@Override
@ -98,7 +96,7 @@ public class DashRecentsFragment extends DashLocationFragment {
super.onPause();
}
public void setupFavorites(){
public void setupRecents(){
View mainView = getView();
SearchHistoryHelper helper = SearchHistoryHelper.getInstance((OsmandApplication) getActivity().getApplicationContext());
points = helper.getHistoryEntries();

View file

@ -136,6 +136,9 @@ public class DashboardOnMap {
private void addDashboardFragments(){
FragmentManager manager =ma. getSupportFragmentManager();
FragmentTransaction fragmentTransaction = manager.beginTransaction();
// if (manager.findFragmentByTag(DashMapFragment.TAG) == null) {
// fragmentTransaction.add(R.id.content, new DashMapFragment(), DashMapFragment.TAG);
// }
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashSearchFragment(), DashSearchFragment.TAG);
}

View file

@ -464,7 +464,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false);
runSelection(false);
allGpxAdapter.notifyDataSetChanged();
}

View file

@ -46,11 +46,10 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Spinner;
@ -94,14 +93,7 @@ public class SelectedGPXFragment extends ListFragment {
setContent();
}
private List<GpxDisplayGroup> getContent() {
GpxSelectionHelper selectedGpxHelper = app.getSelectedGpxHelper();
List<GpxDisplayGroup> displayGrous = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>();
if(getActivity() instanceof TrackActivity) {
selectedGpxHelper.collectDisplayGroups(displayGrous, getGpx());
}
return displayGrous;
}
private GPXFile getGpx() {
return ((TrackActivity) getActivity()).getResult();
@ -109,7 +101,7 @@ public class SelectedGPXFragment extends ListFragment {
protected List<GpxDisplayGroup> filterGroups() {
List<GpxDisplayGroup> groups = getContent();
List<GpxDisplayGroup> groups = ((TrackActivity) getActivity()).getContent();
if (isArgumentTrue(ARG_TO_FILTER_SHORT_TRACKS)) {
groups = new ArrayList<GpxSelectionHelper.GpxDisplayGroup>(groups);
Iterator<GpxDisplayGroup> it = groups.iterator();
@ -150,17 +142,6 @@ public class SelectedGPXFragment extends ListFragment {
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
view.findViewById(R.id.header_layout).setVisibility(View.GONE);
ListView listView = (ListView) view.findViewById(android.R.id.list);
listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
long packedPos = ((ExpandableListContextMenuInfo) menuInfo).packedPosition;
int group = ExpandableListView.getPackedPositionGroup(packedPos);
int child = ExpandableListView.getPackedPositionChild(packedPos);
if (child >= 0 && group >= 0) {
showContextMenu(adapter.getItem(child));
}
}
});
TextView tv = new TextView(getActivity());
tv.setText(R.string.none_selected_gpx);
tv.setTextSize(24);
@ -170,7 +151,7 @@ public class SelectedGPXFragment extends ListFragment {
return view;
}
private void showContextMenu(final GpxDisplayItem gpxDisplayItem) {
protected void showContextMenu(final GpxDisplayItem gpxDisplayItem) {
Builder builder = new AlertDialog.Builder(getMyActivity());
final ContextMenuAdapter adapter = new ContextMenuAdapter(getMyActivity());
basicFileOperation(gpxDisplayItem, adapter);
@ -255,7 +236,7 @@ public class SelectedGPXFragment extends ListFragment {
}
private void selectSplitDistance(final GpxDisplayGroup model) {
protected void selectSplitDistance(final GpxDisplayGroup model) {
Builder bld = new AlertDialog.Builder(getMyActivity());
int[] checkedItem = new int[] {!model.isSplitDistance() && !model.isSplitTime()? 0 : -1};
List<String> options = new ArrayList<String>();

View file

@ -1,6 +1,13 @@
package net.osmand.plus.myplaces;
import android.support.v4.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.R;
import net.osmand.plus.activities.TrackActivity;
import java.util.ArrayList;
import java.util.List;
@ -10,6 +17,7 @@ import java.util.List;
* on 04.03.2015.
*/
public class TrackPointFragment extends SelectedGPXFragment {
GpxSelectionHelper.GpxDisplayGroup group;
@Override
public void setContent() {
List<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups();
@ -21,11 +29,31 @@ public class TrackPointFragment extends SelectedGPXFragment {
if (group.getType() != GpxSelectionHelper.GpxDisplayItemType.TRACK_POINTS){
continue;
}
this.group = group;
for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) {
items.add(item);
}
}
adapter = new SelectedGPXAdapter(items);
setListAdapter(adapter);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
((TrackActivity) getActivity()).getClearToolbar(false);
if (isArgumentTrue(ARG_TO_HIDE_CONFIG_BTN)){
return;
}
MenuItem item = menu.add(R.string.add_to_favourite).setIcon(R.drawable.ic_action_fav_dark).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
saveAsFavorites(group);
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
}

View file

@ -0,0 +1,59 @@
package net.osmand.plus.myplaces;
import android.support.v4.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.R;
import net.osmand.plus.activities.TrackActivity;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Denis
* on 05.03.2015.
*/
public class TrackRoutePointFragment extends SelectedGPXFragment {
GpxSelectionHelper.GpxDisplayGroup group;
@Override
public void setContent() {
List<GpxSelectionHelper.GpxDisplayGroup> groups = filterGroups();
lightContent = app.getSettings().isLightContent();
List<GpxSelectionHelper.GpxDisplayItem> items = new ArrayList<>();
for (GpxSelectionHelper.GpxDisplayGroup group : groups) {
if (group.getType() != GpxSelectionHelper.GpxDisplayItemType.TRACK_ROUTE_POINTS){
continue;
}
this.group = group;
for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) {
items.add(item);
}
}
adapter = new SelectedGPXAdapter(items);
setListAdapter(adapter);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
((TrackActivity) getActivity()).getClearToolbar(false);
if (isArgumentTrue(ARG_TO_HIDE_CONFIG_BTN)){
return;
}
MenuItem item = menu.add(R.string.add_to_favourite).setIcon(R.drawable.ic_action_fav_dark).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
saveAsFavorites(group);
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
}

View file

@ -1,6 +1,20 @@
package net.osmand.plus.myplaces;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.R;
import net.osmand.plus.activities.TrackActivity;
import java.util.ArrayList;
import java.util.List;
@ -10,6 +24,21 @@ import java.util.List;
* on 04.03.2015.
*/
public class TrackSegmentFragment extends SelectedGPXFragment {
GpxSelectionHelper.GpxDisplayGroup group;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
ListView listView = (ListView) view.findViewById(android.R.id.list);
listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
long packedPos = ((AdapterView.AdapterContextMenuInfo) menuInfo).position;
showContextMenu(adapter.getItem((int)packedPos));
}
});
return view;
}
@Override
public void setContent() {
@ -22,6 +51,7 @@ public class TrackSegmentFragment extends SelectedGPXFragment {
if (group.getType() != GpxSelectionHelper.GpxDisplayItemType.TRACK_SEGMENT){
continue;
}
this.group = group;
for (GpxSelectionHelper.GpxDisplayItem item : group.getModifiableList()) {
items.add(item);
}
@ -29,4 +59,22 @@ public class TrackSegmentFragment extends SelectedGPXFragment {
adapter = new SelectedGPXAdapter(items);
setListAdapter(adapter);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
((TrackActivity) getActivity()).getClearToolbar(false);
if (isArgumentTrue(ARG_TO_HIDE_CONFIG_BTN)){
return;
}
MenuItem item = menu.add(R.string.showed_on_map).setIcon(R.drawable.ic_show_on_map).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
selectSplitDistance(group);
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
}