Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 8b84206

Browse files
authored
Merge pull request #87 from divacky/master
added dashboard consumption,possibility to turn off the display of dashboards
2 parents 2607c47 + 7b118e5 commit 8b84206

File tree

10 files changed

+961
-174
lines changed

10 files changed

+961
-174
lines changed

app/src/main/java/com/mqbcoding/stats/DashboardFragment.java

Lines changed: 233 additions & 78 deletions
Large diffs are not rendered by default.

app/src/main/java/com/mqbcoding/stats/GeocodeLocationService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ private void initializeTimerTask() {
103103
@Override
104104
public void run() {
105105
Location lastLocation = null;
106+
int lastAltitude = 0;
106107
try {
107108
lastLocation = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
109+
lastAltitude = (int) mLastDecodedLocation.getAltitude();
108110
Log.d(TAG,"Received location: " + lastLocation);
111+
Log.d(TAG,"Received Altitude: " + lastAltitude);
109112
} catch (SecurityException ex) {
110113
Log.e(TAG, "Security Exception while getting last known location?");
111114
}
@@ -115,6 +118,7 @@ public void run() {
115118
List<Address> addresses = geocoder.getFromLocation(
116119
lastLocation.getLatitude(), lastLocation.getLongitude(), 1);
117120
if (mListener != null && addresses != null && addresses.size() > 0) {
121+
addresses.set(0,addresses.get(0)).setUrl(String.valueOf(lastAltitude)+" m");
118122
mListener.onNewGeocodeResult(addresses.get(0));
119123
mLastDecodedLocation.set(lastLocation);
120124
Log.d(TAG, "Sended location to client: " + mLastDecodedLocation);
Loading

app/src/main/res/layout/fragment_dashboard.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
app:layout_constraintStart_toStartOf="parent"
1919
app:layout_constraintTop_toTopOf="parent" />
2020

21+
<include
22+
android:id="@+id/include_consumption"
23+
layout="@layout/layout_dashboard_consumption"
24+
android:layout_width="match_parent"
25+
android:layout_height="wrap_content"
26+
android:layout_marginTop="88dp"
27+
android:background="#00000000"
28+
app:layout_constraintEnd_toEndOf="parent"
29+
app:layout_constraintHorizontal_bias="0.0"
30+
app:layout_constraintStart_toStartOf="parent"
31+
app:layout_constraintTop_toTopOf="parent" />
32+
2133
<TextView
2234
android:id="@+id/textTitle"
2335
android:layout_width="580dp"

0 commit comments

Comments
 (0)