Skip to content

Commit 9f3613b

Browse files
authored
V2.2.6 (#1000)
* Better display for delays (like in Öffi) #957 * Release V2.26 Fastlane, Changelog Minor fix in AlertService
1 parent 58e8411 commit 9f3613b

File tree

10 files changed

+25
-20
lines changed

10 files changed

+25
-20
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ apply from: 'witness.gradle'
88
android {
99

1010
defaultConfig {
11-
versionCode 129
12-
versionName "2.2.5"
11+
versionCode 130
12+
versionName "2.2.6"
1313

1414
applicationId "de.grobox.liberario"
1515
minSdkVersion 24

app/src/main/java/de/grobox/transportr/AlertService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void stopGpsLocListener() {
161161
public void onLocationChanged(@NonNull Location location) {
162162
lastLocationUpdate = System.currentTimeMillis();
163163
long timeToDestination = (arrivalTimeLong - System.currentTimeMillis()) / 1000;
164-
String timeString = (timeToDestination > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
164+
String timeString = (Math.abs(timeToDestination) > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
165165
long distanceToDestination = (long) destination.distanceTo(location);
166166
if (distanceToDestination > ARRIVAL_THRESHOLD_METERS){
167167
updateNotification(getString(R.string.meter, distanceToDestination) + " / " + timeString , false);
@@ -175,7 +175,7 @@ public void onLocationChanged(@NonNull Location location) {
175175

176176
private void onLocationUpdateTimeout() {
177177
long timeToDestination = (arrivalTimeLong - System.currentTimeMillis()) / 1000;
178-
String timeString = (timeToDestination > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
178+
String timeString = (Math.abs(timeToDestination) > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
179179
if (timeToDestination > ARRIVAL_THRESHOLD_SEC){
180180
updateNotification( timeString , false);
181181
} else {

app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,17 @@ internal class DepartureViewHolder(v: View) : RecyclerView.ViewHolder(v) {
6666
visibility = it.visibility
6767
}
6868
}
69-
timeAbs.text = formatTime(timeAbs.context, plannedTime)
69+
70+
timeAbs.text = formatTime(timeAbs.context, predictedTime?.let { Date(it.time) } ?: plannedTime)
71+
7072
predictedTime?.let {
7173
val delayTime = it.time - plannedTime.time
7274
formatDelay(timeRel.context, delayTime).let {
7375
delay.apply {
74-
text = it.delay
75-
setTextColor(it.color)
76+
text = "("+ it.delay + ")"
7677
visibility = VISIBLE
7778
}
79+
timeAbs.setTextColor(it.color)
7880
}
7981
} ?: run { delay.visibility = GONE }
8082

app/src/main/java/de/grobox/transportr/trips/BaseViewHolder.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.recyclerview.widget.RecyclerView
3030
import de.grobox.transportr.R
3131
import de.grobox.transportr.utils.DateUtils.formatDelay
3232
import de.grobox.transportr.utils.DateUtils.formatTime
33+
import de.grobox.transportr.utils.TransportrUtils.getColorFromAttr
3334
import de.schildbach.pte.dto.Position
3435
import de.schildbach.pte.dto.Stop
3536
import java.util.*
@@ -49,13 +50,12 @@ internal abstract class BaseViewHolder(v: View) : RecyclerView.ViewHolder(v) {
4950

5051
if (stop.isArrivalTimePredicted && stop.arrivalDelay != null) {
5152
val delay = stop.arrivalDelay
52-
time.time = time.time - delay
5353
formatDelay(delayView.context, delay).let {
5454
delayView.apply {
55-
text = it.delay
56-
setTextColor(it.color)
55+
text = "("+it.delay+")"
5756
visibility = VISIBLE
5857
}
58+
if (timeView!=null) timeView.setTextColor(it.color)
5959
}
6060
} else {
6161
delayView.visibility = GONE
@@ -70,13 +70,12 @@ internal abstract class BaseViewHolder(v: View) : RecyclerView.ViewHolder(v) {
7070

7171
if (stop.isDepartureTimePredicted && stop.departureDelay != null) {
7272
val delay = stop.departureDelay
73-
time.time = time.time - delay
7473
formatDelay(delayView.context, delay).let {
7574
delayView.apply {
76-
text = it.delay
77-
setTextColor(it.color)
75+
text = "("+it.delay+")"
7876
visibility = VISIBLE
7977
}
78+
if (timeView!=null) timeView.setTextColor(it.color)
8079
}
8180
} else {
8281
delayView.visibility = GONE

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
android:id="@+id/delay"
4747
android:layout_width="wrap_content"
4848
android:layout_height="wrap_content"
49-
android:textColor="@color/md_red_500"
5049
app:layout_constraintHorizontal_bias="1.0"
5150
app:layout_constraintLeft_toLeftOf="parent"
5251
app:layout_constraintRight_toRightOf="@+id/departureTimeAbs"

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
android:id="@+id/fromDelay"
2424
android:layout_width="wrap_content"
2525
android:layout_height="wrap_content"
26-
android:textColor="@color/md_red_500"
2726
app:layout_constraintRight_toRightOf="@+id/fromTime"
2827
app:layout_constraintTop_toBottomOf="@+id/fromTime"
2928
tools:text="+12"
@@ -213,7 +212,6 @@
213212
android:id="@+id/toDelay"
214213
android:layout_width="wrap_content"
215214
android:layout_height="wrap_content"
216-
android:textColor="@color/md_red_500"
217215
app:layout_constraintEnd_toEndOf="@+id/toTime"
218216
app:layout_constraintTop_toBottomOf="@+id/toTime"
219217
tools:text="+3"

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
android:id="@+id/fromDelay"
2121
android:layout_width="wrap_content"
2222
android:layout_height="wrap_content"
23-
android:textColor="@color/md_red_500"
2423
app:layout_constraintRight_toRightOf="@+id/fromTime"
2524
app:layout_constraintTop_toBottomOf="@+id/fromTime"
2625
app:layout_constraintEnd_toEndOf="@+id/fromTime"
@@ -40,7 +39,6 @@
4039
android:id="@+id/toDelay"
4140
android:layout_width="wrap_content"
4241
android:layout_height="wrap_content"
43-
android:textColor="@color/md_red_500"
4442
app:layout_constraintEnd_toEndOf="@+id/toTime"
4543
app:layout_constraintTop_toBottomOf="@+id/toTime"
4644
tools:text="+3"

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
android:layout_height="wrap_content"
4646
android:layout_marginTop="0dp"
4747
android:gravity="end"
48-
android:textColor="@color/md_red_500"
4948
app:layout_constraintLeft_toLeftOf="parent"
5049
app:layout_constraintRight_toRightOf="@+id/fromTime"
5150
app:layout_constraintTop_toBottomOf="@+id/fromTime"
@@ -133,7 +132,6 @@
133132
android:layout_width="0dp"
134133
android:layout_height="wrap_content"
135134
android:gravity="end"
136-
android:textColor="@color/md_red_500"
137135
app:layout_constraintLeft_toLeftOf="parent"
138136
app:layout_constraintRight_toRightOf="@+id/toTime"
139137
app:layout_constraintTop_toBottomOf="@+id/toTime"

app/src/main/res/xml/changelog_master.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
<changelog xmlns:tools="http://schemas.android.com/tools"
33
tools:ignore="UnusedResources">
44

5+
<release
6+
version="2.2.6"
7+
versioncode="130">
8+
<change>IMPORTANT CHANGE</change>
9+
<change>Predicted time is displayed instead of scheduled time</change>
10+
<change>Display of delay is informative only</change>
11+
</release>
12+
513
<release
614
version="2.2.5"
715
versioncode="129">
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* IMPORTANT CHANGE
2+
* Predicted time is displayed instead of scheduled time
3+
* Display of delay is informative only

0 commit comments

Comments
 (0)