Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
package org.iiab.controller.redesign;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

public class FlowLayout extends ViewGroup {

/** Default gap (dp) between pills when inflated from XML, matching the sibling Choose screen. */
private static final int DEFAULT_GAP_DP = 8;

private final int hGap;
private final int vGap;

Expand All @@ -26,6 +30,17 @@ public FlowLayout(Context c, int hGap, int vGap) {
this.vGap = vGap;
}

/**
* ADFA-4999. XML-inflatable constructor: uses an 8dp horizontal/vertical gap between children,
* so the Maps landing pill rows can wrap from XML instead of clipping on narrow screens.
*/
public FlowLayout(Context c, AttributeSet attrs) {
super(c, attrs);
int gap = Math.round(DEFAULT_GAP_DP * c.getResources().getDisplayMetrics().density);
this.hGap = gap;
this.vGap = gap;
}

@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Expand Down
23 changes: 10 additions & 13 deletions controller/app/src/main/res/layout/fragment_k2go_maps_landing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@
android:textAppearance="?attr/textAppearanceBodySmall"
android:textColor="@color/k2go_muted" />

<LinearLayout
android:layout_width="wrap_content"
<!-- ADFA-4999: pills wrap to the next line on narrow screens instead of clipping. -->
<org.iiab.controller.redesign.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="horizontal">
android:layout_marginTop="12dp">

<TextView
android:layout_width="wrap_content"
Expand All @@ -210,7 +210,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="5dp"
Expand All @@ -223,7 +222,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="5dp"
Expand All @@ -232,7 +230,7 @@
android:text="@string/k2go_maps_fqr_pill_online"
android:textAppearance="?attr/textAppearanceBodySmall"
android:textColor="@color/k2go_teal" />
</LinearLayout>
</org.iiab.controller.redesign.FlowLayout>
</LinearLayout>

<!-- Compact FQR row (shown when dismissed) -->
Expand Down Expand Up @@ -348,11 +346,11 @@
android:textAppearance="?attr/textAppearanceBodyMedium"
android:textColor="@color/k2go_amber" />

<LinearLayout
android:layout_width="wrap_content"
<!-- ADFA-4999: pills wrap to the next line on narrow screens instead of clipping. -->
<org.iiab.controller.redesign.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="horizontal">
android:layout_marginTop="12dp">

<TextView
android:layout_width="wrap_content"
Expand All @@ -369,7 +367,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="5dp"
Expand All @@ -378,7 +375,7 @@
android:text="@string/k2go_maps_rebuild_pill_offline"
android:textAppearance="?attr/textAppearanceBodySmall"
android:textColor="@color/k2go_amber" />
</LinearLayout>
</org.iiab.controller.redesign.FlowLayout>
</LinearLayout>

<TextView
Expand Down
Loading