[android] Fixed bottom ellipsize chart

This commit is contained in:
Dmitry Donskoy 2020-04-10 00:31:49 +03:00 committed by Vladimir Byko-Ianko
parent 5c8222ec9f
commit a186264434
2 changed files with 14 additions and 13 deletions

View file

@ -157,7 +157,7 @@
tools:text="10000 m" />
</LinearLayout>
</LinearLayout>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_base"
@ -204,16 +204,13 @@
android:enabled="false"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/medium_divider"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/margin_base"
android:minWidth="@dimen/margin_base"/>
<LinearLayout
android:layout_toEndOf="@id/difficulty_container"
android:layout_alignParentEnd="true"
android:id="@+id/time_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
@ -228,8 +225,9 @@
android:textAppearance="?android:textAppearanceMedium"
android:textStyle="bold"
android:singleLine="true"
android:text="30000000000000000003000000000000000000300000000000000000030000000000000000003000000000000000000 h. 25 min." />
android:ellipsize="end"
tools:text="3 h. 25 min." />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</merge>

View file

@ -2,6 +2,7 @@ package com.mapswithme.maps.widget.placepage;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -58,9 +59,6 @@ public class ElevationProfileViewRenderer implements PlacePageViewRenderer<Place
@SuppressWarnings("NullableProblems")
@NonNull
private View mTimeContainer;
@SuppressWarnings("NullableProblems")
@NonNull
private View mMediumDivider;
@Override
public void render(@NonNull PlacePageData data)
@ -103,7 +101,6 @@ public class ElevationProfileViewRenderer implements PlacePageViewRenderer<Place
mDifficultyLevels[0] = mDifficultyContainer.findViewById(R.id.difficulty_level_1);
mDifficultyLevels[1] = mDifficultyContainer.findViewById(R.id.difficulty_level_2);
mDifficultyLevels[2] = mDifficultyContainer.findViewById(R.id.difficulty_level_3);
mMediumDivider = view.findViewById(R.id.medium_divider);
}
@Override
@ -119,7 +116,13 @@ public class ElevationProfileViewRenderer implements PlacePageViewRenderer<Place
boolean invalidDifficulty = level > MAX_DIFFICULTY_LEVEL || level == UNKNOWN_DIFFICULTY;
UiUtils.hideIf(invalidDifficulty, mDifficultyContainer);
UiUtils.hideIf(invalidDifficulty, mMediumDivider);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mTimeContainer.getLayoutParams();
params.removeRule(RelativeLayout.ALIGN_PARENT_END);
params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.removeRule(RelativeLayout.ALIGN_PARENT_START);
params.removeRule(RelativeLayout.LEFT_OF);
params.addRule(invalidDifficulty ? RelativeLayout.ALIGN_PARENT_START : RelativeLayout.ALIGN_PARENT_END);
mTimeContainer.setLayoutParams(params);
if (invalidDifficulty)
return;