diff --git a/app/app.iml b/app/app.iml index e02613a..ea171ad 100644 --- a/app/app.iml +++ b/app/app.iml @@ -61,13 +61,6 @@ - - - - - - - @@ -75,6 +68,13 @@ + + + + + + + @@ -87,7 +87,7 @@ - + @@ -112,7 +112,6 @@ - @@ -121,6 +120,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index 0333580..392afb7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,7 +27,7 @@ compile 'com.survivingwithandroid:weatherlib:1.6.0' compile 'com.survivingwithandroid:weatherlib_okhttpclient:1.6.0' compile 'com.squareup.okhttp:okhttp:2.0.+' - compile 'com.jjoe64:graphview:4.0.1' + compile 'com.diogobernardino:williamchart:2.2' compile (name:'osmbonuspack_v5.7', ext:'aar') //compile 'org.slf4j:slf4j-log4j12:1.7.12' compile 'org.osmdroid:osmdroid-android:5.1@aar' diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java index 1fde51b..6e54b57 100644 --- a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java +++ b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java @@ -66,10 +66,9 @@ import android.widget.TextView; import android.widget.Toast; -import com.jjoe64.graphview.GraphView; -import com.jjoe64.graphview.GridLabelRenderer; -import com.jjoe64.graphview.series.DataPoint; -import com.jjoe64.graphview.series.LineGraphSeries; +import com.db.chart.model.LineSet; +import com.db.chart.view.AxisController; +import com.db.chart.view.LineChartView; import org.osmdroid.api.IMapController; import org.osmdroid.bonuspack.overlays.Marker; @@ -396,7 +395,8 @@ Hike hike = hikes.get(which); List dbPoints = points.get(which); List pathPoints = new ArrayList<>(); - DataPoint[] elevationDataPoints = new DataPoint[dbPoints.size()]; + float[] elevationDataPoints = new float[dbPoints.size()]; + String[] elevationDataPointsNames = new String[dbPoints.size()]; double min = Double.MAX_VALUE; for(DbGeoPoint dbGeoPoint : dbPoints) { pathPoints.add(new GeoPoint(dbGeoPoint.getLat(), dbGeoPoint.getLon(), dbGeoPoint.getAlt())); @@ -404,7 +404,8 @@ } for(int i=0; i< dbPoints.size(); i++) { DbGeoPoint dbGeoPoint = dbPoints.get(i); - elevationDataPoints[i] = new DataPoint(i, dbGeoPoint.getAlt() - min); + elevationDataPoints[i] = (int) (Math.random() * 100);//dbGeoPoint.getAlt() - min); + elevationDataPointsNames[i] = i+""; } LayoutInflater inflater = getLayoutInflater(); View rowView = inflater.inflate(R.layout.hike_list_detail, null, true); @@ -415,7 +416,7 @@ TextView difficultyView = (TextView) rowView.findViewById(R.id.hike_list_detail_difficulty); TextView upView = (TextView) rowView.findViewById(R.id.hike_list_detail_up); TextView downView = (TextView) rowView.findViewById(R.id.hike_list_detail_down); - GraphView elevationProfile = (GraphView) rowView.findViewById(R.id.hike_list_detail_elevation_profile); + LineChartView elevationProfileNew = (LineChartView) rowView.findViewById(R.id.hike_list_detail_elevation_profile); MapView hikeMap = (MapView) rowView.findViewById(R.id.hike_list_detail_map); titleView.setText(hike.getName()); authorView.setText(String.format(Locale.getDefault(), res.getString(R.string.hike_list_author), hike.getAuthor())); @@ -437,15 +438,21 @@ difficultyView.setCompoundDrawablesWithIntrinsicBounds(difficultyDrawable, null, null, null); upView.setText(String.format(Locale.getDefault(), "Up: %.02fm", hike.getHeightUp())); downView.setText(String.format(Locale.getDefault(), "Down: %.02fm", hike.getHeightDown())); - LineGraphSeries series = new LineGraphSeries<>(elevationDataPoints); - series.setThickness(1); - elevationProfile.addSeries(series); - GridLabelRenderer labelRenderer = elevationProfile.getGridLabelRenderer(); - labelRenderer.setHorizontalLabelsVisible(false); - labelRenderer.setVerticalLabelsVisible(false); - labelRenderer.setHighlightZeroLines(false); - labelRenderer.setNumHorizontalLabels(2); - labelRenderer.setNumVerticalLabels(2); + LineSet lineSet = new LineSet(elevationDataPointsNames, elevationDataPoints); + lineSet.setDotsColor(res.getColor(R.color.white)); + lineSet.setDotsStrokeColor(res.getColor(R.color.elevation_line)); + lineSet.setColor(res.getColor(R.color.elevation_line)); + lineSet.setFill(res.getColor(R.color.elevation_bg)); + lineSet.setDotsRadius(6); + lineSet.setDotsStrokeThickness(3); + lineSet.setThickness(4); + //elevationProfileNew.setXAxis(false); + elevationProfileNew.setXLabels(AxisController.LabelPosition.NONE); + //elevationProfileNew.setYLabels(AxisController.LabelPosition.NONE); + elevationProfileNew.setStep(20); + elevationProfileNew.setYAxis(false); + elevationProfileNew.addData(lineSet); + elevationProfileNew.show(); hikeMap.setTileSource(TileSourceFactory.MAPNIK); hikeMap.setBuiltInZoomControls(true); hikeMap.setMultiTouchControls(true); diff --git a/app/src/main/res/layout/hike_list_detail.xml b/app/src/main/res/layout/hike_list_detail.xml index 7a84945..963b7dd 100644 --- a/app/src/main/res/layout/hike_list_detail.xml +++ b/app/src/main/res/layout/hike_list_detail.xml @@ -111,11 +111,12 @@ android:layout_gravity="center_vertical" android:gravity="center_vertical"/> - + android:paddingBottom="16dp"/> #FF000000 #AFB9B9B9 #AA0E84F1 + #AA0E84F1 + #550E84F1 + #FFFFFFFF \ No newline at end of file