fix last divider in the statistic information block;

fix title width in the statistic information item;
fix disappearing of the block statistic information after view was hidden under tabs;
This commit is contained in:
Skalii 2021-01-26 15:42:56 +02:00
parent 2f20e7e5c1
commit 3d8f0cde14
3 changed files with 7 additions and 11 deletions

View file

@ -9,7 +9,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_overview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/list_header_height"
android:layout_marginBottom="@dimen/content_padding_small_half"
android:clipToPadding="false"
android:orientation="horizontal"

View file

@ -34,7 +34,7 @@
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:textColor="?android:attr/textColorSecondary"

View file

@ -18,7 +18,6 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ItemDecoration;
@ -125,12 +124,9 @@ public class OverviewCard extends BaseCard {
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ITEM_TIME);
final StatBlockAdapter sbAdapter = new StatBlockAdapter(items);
LinearLayoutManager llManager = new LinearLayoutManager(app);
llManager.setOrientation(LinearLayoutManager.HORIZONTAL);
rvOverview.setLayoutManager(llManager);
rvOverview.setItemAnimator(new DefaultItemAnimator());
rvOverview.setAdapter(sbAdapter);
rvOverview.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false));
rvOverview.addItemDecoration(new HorizontalDividerDecoration(app));
rvOverview.setAdapter(sbAdapter);
}
}
@ -305,7 +301,7 @@ public class OverviewCard extends BaseCard {
}
public void drawHorizontal(Canvas c, RecyclerView parent) {
for (int i = 0; i < parent.getChildCount(); i++) {
for (int i = 0; i < parent.getChildCount() - 1; i++) {
final View child = parent.getChildAt(i);
final int left = child.getRight() - divider.getIntrinsicWidth() + marginH;
final int right = left + divider.getIntrinsicHeight();
@ -317,8 +313,8 @@ public class OverviewCard extends BaseCard {
}
@Override
public void getItemOffsets(Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(marginH - divider.getIntrinsicWidth(), marginV, marginH + divider.getIntrinsicWidth(), marginV);
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.set(marginH - divider.getIntrinsicWidth(), 0, marginH + divider.getIntrinsicWidth(), 0);
}
}