Skip to content
Merged

V2.2.6 #1000

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ apply from: 'witness.gradle'
android {

defaultConfig {
versionCode 129
versionName "2.2.5"
versionCode 130
versionName "2.2.6"

applicationId "de.grobox.liberario"
minSdkVersion 24
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/de/grobox/transportr/AlertService.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void stopGpsLocListener() {
public void onLocationChanged(@NonNull Location location) {
lastLocationUpdate = System.currentTimeMillis();
long timeToDestination = (arrivalTimeLong - System.currentTimeMillis()) / 1000;
String timeString = (timeToDestination > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
String timeString = (Math.abs(timeToDestination) > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
long distanceToDestination = (long) destination.distanceTo(location);
if (distanceToDestination > ARRIVAL_THRESHOLD_METERS){
updateNotification(getString(R.string.meter, distanceToDestination) + " / " + timeString , false);
Expand All @@ -175,7 +175,7 @@ public void onLocationChanged(@NonNull Location location) {

private void onLocationUpdateTimeout() {
long timeToDestination = (arrivalTimeLong - System.currentTimeMillis()) / 1000;
String timeString = (timeToDestination > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
String timeString = (Math.abs(timeToDestination) > 60) ? getString(R.string.in_x_minutes, Math.round(timeToDestination / 60.0)) : getString(R.string.seconds, timeToDestination);
if (timeToDestination > ARRIVAL_THRESHOLD_SEC){
updateNotification( timeString , false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ internal class DepartureViewHolder(v: View) : RecyclerView.ViewHolder(v) {
visibility = it.visibility
}
}
timeAbs.text = formatTime(timeAbs.context, plannedTime)

timeAbs.text = formatTime(timeAbs.context, predictedTime?.let { Date(it.time) } ?: plannedTime)

predictedTime?.let {
val delayTime = it.time - plannedTime.time
formatDelay(timeRel.context, delayTime).let {
delay.apply {
text = it.delay
setTextColor(it.color)
text = "("+ it.delay + ")"
visibility = VISIBLE
}
timeAbs.setTextColor(it.color)
}
} ?: run { delay.visibility = GONE }

Expand Down
11 changes: 5 additions & 6 deletions app/src/main/java/de/grobox/transportr/trips/BaseViewHolder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.recyclerview.widget.RecyclerView
import de.grobox.transportr.R
import de.grobox.transportr.utils.DateUtils.formatDelay
import de.grobox.transportr.utils.DateUtils.formatTime
import de.grobox.transportr.utils.TransportrUtils.getColorFromAttr
import de.schildbach.pte.dto.Position
import de.schildbach.pte.dto.Stop
import java.util.*
Expand All @@ -49,13 +50,12 @@ internal abstract class BaseViewHolder(v: View) : RecyclerView.ViewHolder(v) {

if (stop.isArrivalTimePredicted && stop.arrivalDelay != null) {
val delay = stop.arrivalDelay
time.time = time.time - delay
formatDelay(delayView.context, delay).let {
delayView.apply {
text = it.delay
setTextColor(it.color)
text = "("+it.delay+")"
visibility = VISIBLE
}
if (timeView!=null) timeView.setTextColor(it.color)
}
} else {
delayView.visibility = GONE
Expand All @@ -70,13 +70,12 @@ internal abstract class BaseViewHolder(v: View) : RecyclerView.ViewHolder(v) {

if (stop.isDepartureTimePredicted && stop.departureDelay != null) {
val delay = stop.departureDelay
time.time = time.time - delay
formatDelay(delayView.context, delay).let {
delayView.apply {
text = it.delay
setTextColor(it.color)
text = "("+it.delay+")"
visibility = VISIBLE
}
if (timeView!=null) timeView.setTextColor(it.color)
}
} else {
delayView.visibility = GONE
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/list_item_departure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
android:id="@+id/delay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_red_500"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="@+id/departureTimeAbs"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/list_item_leg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
android:id="@+id/fromDelay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_red_500"
app:layout_constraintRight_toRightOf="@+id/fromTime"
app:layout_constraintTop_toBottomOf="@+id/fromTime"
tools:text="+12"
Expand Down Expand Up @@ -213,7 +212,6 @@
android:id="@+id/toDelay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_red_500"
app:layout_constraintEnd_toEndOf="@+id/toTime"
app:layout_constraintTop_toBottomOf="@+id/toTime"
tools:text="+3"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/list_item_stop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
android:id="@+id/fromDelay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_red_500"
app:layout_constraintRight_toRightOf="@+id/fromTime"
app:layout_constraintTop_toBottomOf="@+id/fromTime"
app:layout_constraintEnd_toEndOf="@+id/fromTime"
Expand All @@ -40,7 +39,6 @@
android:id="@+id/toDelay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/md_red_500"
app:layout_constraintEnd_toEndOf="@+id/toTime"
app:layout_constraintTop_toBottomOf="@+id/toTime"
tools:text="+3"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/list_item_trip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:gravity="end"
android:textColor="@color/md_red_500"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="@+id/fromTime"
app:layout_constraintTop_toBottomOf="@+id/fromTime"
Expand Down Expand Up @@ -133,7 +132,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="end"
android:textColor="@color/md_red_500"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="@+id/toTime"
app:layout_constraintTop_toBottomOf="@+id/toTime"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/changelog_master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
<changelog xmlns:tools="http://schemas.android.com/tools"
tools:ignore="UnusedResources">

<release
version="2.2.6"
versioncode="130">
<change>IMPORTANT CHANGE</change>
<change>Predicted time is displayed instead of scheduled time</change>
<change>Display of delay is informative only</change>
</release>

<release
version="2.2.5"
versioncode="129">
Expand Down
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/130.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* IMPORTANT CHANGE
* Predicted time is displayed instead of scheduled time
* Display of delay is informative only
Loading