Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 027dcfa4 authored by Jason Monk's avatar Jason Monk
Browse files

Layout updates to share sheet

The biggest change is that padding will only appear above/below
service section, and at the start of the non-service section. For
this a bunch of changes to how padding is needed.

Also some other dimen changes for specs.

Test: visual
Change-Id: I39747701597e620425bdcb4113d1a3585f6de137
Fixes: 37913738
parent 84e0f453
Loading
Loading
Loading
Loading
+35 −2
Original line number Diff line number Diff line
@@ -69,7 +69,10 @@ import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Space;

import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.ResolverActivity.TargetInfo;
@@ -1412,6 +1415,10 @@ public class ChooserActivity extends ResolverActivity {
                } else {
                    lp.height = v.getMeasuredHeight();
                }
                if (i != (mColumnCount - 1)) {
                    row.addView(new Space(ChooserActivity.this),
                            new LinearLayout.LayoutParams(0, 0, 1));
                }
            }

            // Pre-measure so we can scale later.
@@ -1439,13 +1446,34 @@ public class ChooserActivity extends ResolverActivity {
            if (startType == ChooserListAdapter.TARGET_SERVICE) {
                holder.row.setBackgroundColor(
                        getColor(R.color.chooser_service_row_background_color));
                int nextStartType = mChooserListAdapter.getPositionTargetType(
                        getFirstRowPosition(rowPosition + 1));
                int serviceSpacing = holder.row.getContext().getResources()
                        .getDimensionPixelSize(R.dimen.chooser_service_spacing);
                int top = rowPosition == 0 ? serviceSpacing : 0;
                if (nextStartType != ChooserListAdapter.TARGET_SERVICE) {
                    setVertPadding(holder, top, serviceSpacing);
                } else {
                    setVertPadding(holder, top, 0);
                }
            } else {
                holder.row.setBackgroundColor(Color.TRANSPARENT);
                int lastStartType = mChooserListAdapter.getPositionTargetType(
                        getFirstRowPosition(rowPosition - 1));
                if (lastStartType == ChooserListAdapter.TARGET_SERVICE || rowPosition == 0) {
                    int serviceSpacing = holder.row.getContext().getResources()
                            .getDimensionPixelSize(R.dimen.chooser_service_spacing);
                    setVertPadding(holder, serviceSpacing, 0);
                } else {
                    setVertPadding(holder, 0, 0);
                }
            }

            final int oldHeight = holder.row.getLayoutParams().height;
            int measuredRowHeight = holder.measuredRowHeight + holder.row.getPaddingTop()
                    + holder.row.getPaddingBottom();
            holder.row.getLayoutParams().height = Math.max(1,
                    (int) (holder.measuredRowHeight * getRowScale(rowPosition)));
                    (int) (measuredRowHeight * getRowScale(rowPosition)));
            if (holder.row.getLayoutParams().height != oldHeight) {
                holder.row.requestLayout();
            }
@@ -1457,11 +1485,16 @@ public class ChooserActivity extends ResolverActivity {
                    holder.itemIndices[i] = start + i;
                    mChooserListAdapter.bindView(holder.itemIndices[i], v);
                } else {
                    v.setVisibility(View.GONE);
                    v.setVisibility(View.INVISIBLE);
                }
            }
        }

        private void setVertPadding(RowViewHolder holder, int top, int bottom) {
            holder.row.setPadding(holder.row.getPaddingLeft(), top,
                    holder.row.getPaddingRight(), bottom);
        }

        int getFirstRowPosition(int row) {
            final int callerCount = mChooserListAdapter.getCallerTargetCount();
            final int callerRows = (int) Math.ceil((float) callerCount / mColumnCount);
+2 −4
Original line number Diff line number Diff line
@@ -18,11 +18,9 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="horizontal"
              android:layout_width="match_parent" android:layout_height="wrap_content"
              android:minHeight="80dp"
              android:layout_width="match_parent"
              android:layout_height="100dp"
              android:gravity="start|top"
              android:paddingTop="8dp"
              android:paddingBottom="8dp"
              android:paddingStart="@dimen/chooser_grid_padding"
              android:paddingEnd="@dimen/chooser_grid_padding"
              android:weightSum="4">
+3 −4
Original line number Diff line number Diff line
@@ -18,10 +18,9 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="0dp"
              android:layout_width="76dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:minWidth="80dp"
              android:minHeight="100dp"
              android:gravity="center"
              android:paddingTop="8dp"
              android:paddingBottom="8dp"
@@ -49,7 +48,7 @@
    <TextView android:id="@android:id/text1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginTop="8dp"
              android:layout_marginTop="4dp"
              android:layout_marginLeft="4dp"
              android:layout_marginRight="4dp"
              android:textAppearance="?attr/textAppearanceSmall"
+2 −0
Original line number Diff line number Diff line
@@ -533,6 +533,8 @@
    <dimen name="content_rect_bottom_clip_allowance">20dp</dimen>

    <dimen name="chooser_grid_padding">0dp</dimen>
    <!-- Spacing around the background change frome service to non-service -->
    <dimen name="chooser_service_spacing">8dp</dimen>

    <item type="dimen" name="aerr_padding_list_top">15dp</item>
    <item type="dimen" name="aerr_padding_list_bottom">8dp</item>
+1 −0
Original line number Diff line number Diff line
@@ -3059,4 +3059,5 @@
  <java-symbol type="array" name="config_batteryPackageTypeService" />
  <java-symbol type="bool" name="config_showAreaUpdateInfoSettings" />
  <java-symbol type="layout" name="shutdown_dialog" />
  <java-symbol type="dimen" name="chooser_service_spacing" />
</resources>