Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added collapse long trip warning messages #524

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -163,4 +164,5 @@ dependencies {
exclude group: 'com.google.code.findbugs'
}
kaptAndroidTestDebug "com.google.dagger:dagger-compiler:$daggerVersion"

}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
anjandev marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
15 changes: 8 additions & 7 deletions app/src/main/res/layout/list_item_departure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,18 @@
app:layout_constraintTop_toBottomOf="@+id/lineNameView"
tools:text="Zoologischer Garten (S+U)"/>

<TextView
<cn.carbs.android.expandabletextview.library.ExpandableTextView
android:id="@+id/messageView"
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"
app:layout_constraintTop_toBottomOf="@+id/destinationView"
tools:text="This is a message that would be displayed and might be potentially very long."/>
android:textColor="@color/holo_red_light"
anjandev marked this conversation as resolved.
Show resolved Hide resolved
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"/>


</android.support.constraint.ConstraintLayout>

Expand Down
24 changes: 24 additions & 0 deletions app/src/main/res/values/attr_expandable_text_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<declare-styleable name="ExpandableTextView">
<attr name="etv_MaxLinesOnShrink" format="reference|integer" />
<attr name="etv_EllipsisHint" format="reference|string" /><!--default is ..-->
<attr name="etv_ToExpandHint" format="reference|string" /><!--"to expand" hint string, default is "Expand"-->
<attr name="etv_ToShrinkHint" format="reference|string" /><!--"to shrink" hint string, default is "Shrink"-->
<attr name="etv_GapToExpandHint" format="reference|string" /><!--gap between "toExpandHint" and "trimmed text"-->
<attr name="etv_GapToShrinkHint" format="reference|string" /><!--gap between "toShrinkHint" and "trimmed text"-->
<attr name="etv_EnableToggle" format="reference|boolean" /><!--if toggle the state when click ExpandTextView-->
<attr name="etv_ToExpandHintShow" format="reference|boolean" /><!--if show "toExpandHint"-->
<attr name="etv_ToShrinkHintShow" format="reference|boolean" /><!--if show "toShrinkHint"-->
<attr name="etv_ToExpandHintColor" format="reference|color" /><!--text color of "toExpandHint"-->
<attr name="etv_ToShrinkHintColor" format="reference|color" /><!--text color of "toShrinkHint"-->
<attr name="etv_ToExpandHintColorBgPressed" format="reference|color" /><!--background color if "toExpandHint" pressed-->
<attr name="etv_ToShrinkHintColorBgPressed" format="reference|color" /><!--background color if "toShrinkHint" pressed-->
<attr name="etv_InitState" format="enum"><!--init state, default is shrink-->
<enum name="shrink" value="0"/>
<enum name="expand" value="1"/>
</attr>
</declare-styleable>

</resources>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add this? I don't really understand the chinese on the libraries' page.