From 39f4f0fb7c63342fffd934b42c240600cfa97d52 Mon Sep 17 00:00:00 2001 From: Anjan Momi Date: Sat, 15 Sep 2018 14:21:32 -0700 Subject: [PATCH 1/4] Added collapse long trip warning messages - test code --- app/build.gradle | 2 ++ .../departures/DepartureViewHolder.java | 19 ++++++++------- .../main/res/layout/list_item_departure.xml | 15 ++++++------ .../res/values/attr_expandable_text_view.xml | 24 +++++++++++++++++++ 4 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 app/src/main/res/values/attr_expandable_text_view.xml diff --git a/app/build.gradle b/app/build.gradle index 5e7d924d7..8d206c3df 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -127,6 +127,7 @@ dependencies { implementation 'com.mapzen.android:lost:3.0.4' // only added because of lint bug Timber 4.6.0 implementation 'com.jakewharton.timber:timber:4.7.0' + implementation 'cn.carbs.android:ExpandableTextView:1.0.3' implementation "com.google.dagger:dagger:$daggerVersion" kapt "com.google.dagger:dagger-compiler:$daggerVersion" @@ -163,4 +164,5 @@ dependencies { exclude group: 'com.google.code.findbugs' } kaptAndroidTestDebug "com.google.dagger:dagger-compiler:$daggerVersion" + } diff --git a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java index a0e31d05d..2898cc74b 100644 --- a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java +++ b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java @@ -107,10 +107,10 @@ void bind(Departure dep) { // show message if available if (Strings.isNullOrEmpty(dep.message)) { - message.setVisibility(GONE); + // message.setVisibility(GONE); } else { - message.setText(dep.message); - message.setVisibility(VISIBLE); + // message.setText(dep.message); + // message.setVisibility(VISIBLE); } // TODO show line from here on @@ -122,13 +122,16 @@ private void bindTimeAbs(Date date) { } private void bindDelay(long delayTime) { + delayTime = 99999; if (delayTime == 0) { - delay.setVisibility(GONE); + // delay.setVisibility(GONE); } else { - delay.setText(getDelayString(delayTime)); - delay.setVisibility(VISIBLE); - if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); - else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); + // String delayText = getDelayString(delayTime); + String delayText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sollicitudin lobortis magna, sit amet egestas nisi gravida vitae. Nam euismod sollicitudin eleifend. Donec lobortis nibh vel nulla molestie blandit. Nullam semper, massa id pellentesque pulvinar, quam tellus posuere eros, ac tristique nisl quam at justo. Proin sit amet magna sit amet libero dapibus malesuada nec non massa. Maecenas elementum leo et fringilla pellentesque. Phasellus vehicula ornare lorem nec aliquet. Duis semper laoreet nunc, at suscipit odio semper nec. Nam molestie efficitur enim, sit amet dapibus nibh lacinia scelerisque. Aliquam porttitor, leo vitae convallis cursus, sem magna gravida nunc, in accumsan dui lacus at enim.\n" + + "\n"; + message.setText(delayText); +// if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); +// else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); } } diff --git a/app/src/main/res/layout/list_item_departure.xml b/app/src/main/res/layout/list_item_departure.xml index 62067224b..daaabd72d 100644 --- a/app/src/main/res/layout/list_item_departure.xml +++ b/app/src/main/res/layout/list_item_departure.xml @@ -114,17 +114,18 @@ app:layout_constraintTop_toBottomOf="@+id/lineNameView" tools:text="Zoologischer Garten (S+U)"/> - + android:textColor="@color/holo_red_light" + android:textSize="12sp" + app:layout_constraintLeft_toLeftOf="@+id/guideline" + app:layout_constraintRight_toRightOf="parent" + android:text="This is a message that would be displayed and might be potentially very long." + app:layout_constraintTop_toBottomOf="@+id/destinationView"/> + diff --git a/app/src/main/res/values/attr_expandable_text_view.xml b/app/src/main/res/values/attr_expandable_text_view.xml new file mode 100644 index 000000000..2c41d6f6c --- /dev/null +++ b/app/src/main/res/values/attr_expandable_text_view.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 09f451a75f1c529a4eec0d730a40f7a6aa86f249 Mon Sep 17 00:00:00 2001 From: Anjan Momi Date: Sat, 15 Sep 2018 14:31:47 -0700 Subject: [PATCH 2/4] Added collapse long trip warning messages - removed test code --- .../departures/DepartureViewHolder.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java index 2898cc74b..7a78f4d1c 100644 --- a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java +++ b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java @@ -107,10 +107,10 @@ void bind(Departure dep) { // show message if available if (Strings.isNullOrEmpty(dep.message)) { - // message.setVisibility(GONE); + message.setVisibility(GONE); } else { - // message.setText(dep.message); - // message.setVisibility(VISIBLE); + message.setText(dep.message); + message.setVisibility(VISIBLE); } // TODO show line from here on @@ -122,16 +122,13 @@ private void bindTimeAbs(Date date) { } private void bindDelay(long delayTime) { - delayTime = 99999; if (delayTime == 0) { - // delay.setVisibility(GONE); + delay.setVisibility(GONE); } else { - // String delayText = getDelayString(delayTime); - String delayText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sollicitudin lobortis magna, sit amet egestas nisi gravida vitae. Nam euismod sollicitudin eleifend. Donec lobortis nibh vel nulla molestie blandit. Nullam semper, massa id pellentesque pulvinar, quam tellus posuere eros, ac tristique nisl quam at justo. Proin sit amet magna sit amet libero dapibus malesuada nec non massa. Maecenas elementum leo et fringilla pellentesque. Phasellus vehicula ornare lorem nec aliquet. Duis semper laoreet nunc, at suscipit odio semper nec. Nam molestie efficitur enim, sit amet dapibus nibh lacinia scelerisque. Aliquam porttitor, leo vitae convallis cursus, sem magna gravida nunc, in accumsan dui lacus at enim.\n" + - "\n"; - message.setText(delayText); -// if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); -// else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); + delay.setText(getDelayString(delayTime)); + delay.setVisibility(VISIBLE); + if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); + else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); } } From e5ea033d13dbc71a2587e3c17dab4112976a5035 Mon Sep 17 00:00:00 2001 From: Anjan Momi Date: Sat, 15 Sep 2018 15:04:00 -0700 Subject: [PATCH 3/4] change spaces to tabs --- .../grobox/transportr/departures/DepartureViewHolder.java | 6 +++--- app/src/main/res/layout/list_item_departure.xml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java index 7a78f4d1c..a0e31d05d 100644 --- a/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java +++ b/app/src/main/java/de/grobox/transportr/departures/DepartureViewHolder.java @@ -126,9 +126,9 @@ private void bindDelay(long delayTime) { delay.setVisibility(GONE); } else { delay.setText(getDelayString(delayTime)); - delay.setVisibility(VISIBLE); - if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); - else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); + delay.setVisibility(VISIBLE); + if (delayTime <= 0) delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_green_500)); + else delay.setTextColor(ContextCompat.getColor(delay.getContext(), R.color.md_red_500)); } } diff --git a/app/src/main/res/layout/list_item_departure.xml b/app/src/main/res/layout/list_item_departure.xml index daaabd72d..9695046d0 100644 --- a/app/src/main/res/layout/list_item_departure.xml +++ b/app/src/main/res/layout/list_item_departure.xml @@ -119,10 +119,10 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:textColor="@color/holo_red_light" - android:textSize="12sp" - app:layout_constraintLeft_toLeftOf="@+id/guideline" - app:layout_constraintRight_toRightOf="parent" + android:textColor="@color/holo_red_light" + android:textSize="12sp" + app:layout_constraintLeft_toLeftOf="@+id/guideline" + app:layout_constraintRight_toRightOf="parent" android:text="This is a message that would be displayed and might be potentially very long." app:layout_constraintTop_toBottomOf="@+id/destinationView"/> From 551a9699a67797c79c32af0b84cfbd2ecc1bb722 Mon Sep 17 00:00:00 2001 From: Anjan Momi Date: Sat, 13 Oct 2018 13:53:33 -0700 Subject: [PATCH 4/4] removed unneeded attr_expandable_text_view --- .../res/values/attr_expandable_text_view.xml | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 app/src/main/res/values/attr_expandable_text_view.xml diff --git a/app/src/main/res/values/attr_expandable_text_view.xml b/app/src/main/res/values/attr_expandable_text_view.xml deleted file mode 100644 index 2c41d6f6c..000000000 --- a/app/src/main/res/values/attr_expandable_text_view.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -