Remove text from screenshot edit and share icons

Make the screenshot UI more streamlined; also updates the chip
padding for both icon-only and text-and-icon chips.

https://screenshot.googleplex.com/NakbJaCGm6a8iMp

Bug: 184744730
Test: manual; visual verification
Change-Id: Ie07be0c79bf3345fd4433dbaa4779de77f80fedd
This commit is contained in:
Miranda Kephart
2021-05-21 14:04:31 +00:00
parent 67fd70cdf3
commit 855d2b30df
4 changed files with 39 additions and 10 deletions

View File

@@ -34,14 +34,11 @@
android:id="@+id/screenshot_action_chip_icon"
android:tint="?android:attr/textColorPrimary"
android:layout_width="@dimen/screenshot_action_chip_icon_size"
android:layout_height="@dimen/screenshot_action_chip_icon_size"
android:layout_marginStart="@dimen/screenshot_action_chip_padding_start"
android:layout_marginEnd="@dimen/screenshot_action_chip_padding_middle"/>
android:layout_height="@dimen/screenshot_action_chip_icon_size"/>
<TextView
android:id="@+id/screenshot_action_chip_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/screenshot_action_chip_padding_end"
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
android:textSize="@dimen/screenshot_action_chip_text_size"
android:textColor="?android:attr/textColorPrimary"/>

View File

@@ -342,14 +342,18 @@
<dimen name="screenshot_action_container_padding_right">8dp</dimen>
<!-- Radius of the chip background on global screenshot actions -->
<dimen name="screenshot_button_corner_radius">8dp</dimen>
<!-- Margin between successive chips -->
<dimen name="screenshot_action_chip_margin_start">8dp</dimen>
<!-- Padding to make tappable chip height 48dp (18+11+11+4+4) -->
<dimen name="screenshot_action_chip_margin_vertical">4dp</dimen>
<dimen name="screenshot_action_chip_padding_vertical">11dp</dimen>
<dimen name="screenshot_action_chip_icon_size">18dp</dimen>
<dimen name="screenshot_action_chip_padding_start">8dp</dimen>
<!-- Padding between icon and text -->
<dimen name="screenshot_action_chip_padding_middle">8dp</dimen>
<dimen name="screenshot_action_chip_padding_end">16dp</dimen>
<!-- Padding on each side of the icon for icon-only chips -->
<dimen name="screenshot_action_chip_icon_only_padding_horizontal">14dp</dimen>
<!-- Padding at the edges of the chip for icon-and-text chips -->
<dimen name="screenshot_action_chip_padding_horizontal">12dp</dimen>
<!-- Spacing between chip icon and chip text -->
<dimen name="screenshot_action_chip_spacing">8dp</dimen>
<dimen name="screenshot_action_chip_text_size">14sp</dimen>
<dimen name="screenshot_dismissal_height_delta">80dp</dimen>
<dimen name="screenshot_crop_handle_thickness">3dp</dimen>

View File

@@ -21,8 +21,10 @@ import android.content.Context;
import android.graphics.drawable.Icon;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.systemui.R;
@@ -59,6 +61,7 @@ public class ScreenshotActionChip extends FrameLayout {
protected void onFinishInflate() {
mIconView = findViewById(R.id.screenshot_action_chip_icon);
mTextView = findViewById(R.id.screenshot_action_chip_text);
updatePadding(mTextView.getText().length() > 0);
}
@Override
@@ -76,6 +79,7 @@ public class ScreenshotActionChip extends FrameLayout {
void setText(CharSequence text) {
mTextView.setText(text);
updatePadding(text.length() > 0);
}
void setPendingIntent(PendingIntent intent, Runnable finisher) {
@@ -93,4 +97,28 @@ public class ScreenshotActionChip extends FrameLayout {
mIsPending = isPending;
setPressed(mIsPending);
}
private void updatePadding(boolean hasText) {
LinearLayout.LayoutParams iconParams =
(LinearLayout.LayoutParams) mIconView.getLayoutParams();
LinearLayout.LayoutParams textParams =
(LinearLayout.LayoutParams) mTextView.getLayoutParams();
if (hasText) {
int paddingHorizontal = mContext.getResources().getDimensionPixelSize(
R.dimen.screenshot_action_chip_padding_horizontal);
int spacing = mContext.getResources().getDimensionPixelSize(
R.dimen.screenshot_action_chip_spacing);
iconParams.setMarginStart(paddingHorizontal);
iconParams.setMarginEnd(spacing);
textParams.setMarginEnd(paddingHorizontal);
} else {
int paddingHorizontal = mContext.getResources().getDimensionPixelSize(
R.dimen.screenshot_action_chip_icon_only_padding_horizontal);
iconParams.setMarginStart(paddingHorizontal);
iconParams.setMarginEnd(paddingHorizontal);
}
mTextView.setVisibility(hasText ? View.VISIBLE : View.GONE);
mIconView.setLayoutParams(iconParams);
mTextView.setLayoutParams(textParams);
}
}

View File

@@ -519,7 +519,7 @@ public class ScreenshotView extends FrameLayout implements
ArrayList<ScreenshotActionChip> chips = new ArrayList<>();
mShareChip.setText(mContext.getString(com.android.internal.R.string.share));
mShareChip.setContentDescription(mContext.getString(com.android.internal.R.string.share));
mShareChip.setIcon(Icon.createWithResource(mContext, R.drawable.ic_screenshot_share), true);
mShareChip.setOnClickListener(v -> {
mShareChip.setIsPending(true);
@@ -531,7 +531,7 @@ public class ScreenshotView extends FrameLayout implements
});
chips.add(mShareChip);
mEditChip.setText(mContext.getString(R.string.screenshot_edit_label));
mEditChip.setContentDescription(mContext.getString(R.string.screenshot_edit_label));
mEditChip.setIcon(Icon.createWithResource(mContext, R.drawable.ic_screenshot_edit), true);
mEditChip.setOnClickListener(v -> {
mEditChip.setIsPending(true);