diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java index a798b49597..83e589ae9e 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java @@ -1,11 +1,9 @@ package net.osmand.plus.routepointsnavigation; -import android.annotation.TargetApi; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.text.format.DateFormat; import android.util.Log; @@ -14,8 +12,6 @@ import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; import android.widget.*; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.actionbarsherlock.view.*; import net.osmand.CallbackWithObject; import net.osmand.plus.*; import net.osmand.plus.activities.OsmandListActivity; @@ -27,6 +23,7 @@ import java.util.*; /** * Created by Bars on 13.06.2014. + * */ public class RoutePointsActivity extends OsmandListActivity { @@ -39,15 +36,11 @@ public class RoutePointsActivity extends OsmandListActivity { private List sortedPointsList; - private List pointsStatus; - //saves indexed of sorted list private List pointsIndex; private int selectedItemIndex; - private ActionMode actionMode; - @Override protected void onCreate(Bundle savedInstanceState) { super.setContentView(R.layout.route_steps_main); @@ -106,9 +99,10 @@ public class RoutePointsActivity extends OsmandListActivity { ArrayList pointItemsList = new ArrayList(); for (int i = 0; i < sortedPointsList.size(); i++) { String pointName = sortedPointsList.get(i).name; - if (pointsStatus.get(i) != 0) { + long time = plugin.getPointStatus(pointsIndex.get(i)); + if (time != 0) { String dateString; - Date date = new Date(pointsStatus.get(i)); + Date date = new Date(time); if (DateFormat.is24HourFormat(app)) { dateString = DateFormat.format("MM/dd k:mm", date).toString(); } else { @@ -136,12 +130,11 @@ public class RoutePointsActivity extends OsmandListActivity { listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { selectedItemIndex = i; view.setSelected(true); - actionMode = getActivity().startActionMode(mActionModeCallback); + getActivity().startActionMode(mActionModeCallback); } }); } @@ -163,26 +156,19 @@ public class RoutePointsActivity extends OsmandListActivity { } } - private List getAllPointsStatus() { - List pointsStatus = new ArrayList(); - for (int i = 0; i < sortedPointsList.size(); i++) { - pointsStatus.add(plugin.getPointStatus(pointsIndex.get(i))); - } - - return pointsStatus; - } - private void sortPoints() { sortedPointsList = plugin.getPoints(); List listToSort = new ArrayList(); List indexItemsAtTheEnd = new ArrayList(); pointsIndex = new ArrayList(); int curPointInd = plugin.getCurrentPointIndex(); - if (curPointInd != -1){ + //current item should be first if it's exists + if (curPointInd != -1) { pointsIndex.add(curPointInd); listToSort.add(plugin.getCurrentPoint()); } + //all not visited points should be at the top for (int i = 0; i < sortedPointsList.size(); i++) { if (i == curPointInd) { continue; @@ -197,11 +183,14 @@ public class RoutePointsActivity extends OsmandListActivity { } List timeOfVisits = new ArrayList(); - for(int i=0; i { - private RoutePointsActivity ctx; private ArrayList pointsList; public PointItemAdapter(Context context, int textViewResourceId, ArrayList pointsList) { super(context, textViewResourceId, pointsList); - ctx = (RoutePointsActivity) context; this.pointsList = new ArrayList(); this.pointsList.addAll(pointsList); }