Layout and style updates for LongScreenshotActivity

- Give save button accent color.
- Remove cancel button (may come back in another form later)
- Share button becomes and icon on the right.
- Edit button moves to the bottom, gets icon + text

Bug: 180967468
Test: Visual eval with light and dark themes
Change-Id: I19ccea06e7dbec47b26ffd0684ebb7e31bdfe8b4
This commit is contained in:
Matt Casey
2021-03-19 11:08:11 -04:00
parent 177d8e36f5
commit b8090a0c40
4 changed files with 40 additions and 46 deletions

View File

@@ -336,7 +336,7 @@
</receiver>
<activity android:name=".screenshot.LongScreenshotActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:theme="@style/LongScreenshotActivity"
android:process=":screenshot"
android:exported="false"
android:finishOnTaskLaunch="true" />

View File

@@ -24,51 +24,27 @@
<Button
android:id="@+id/save"
style="@android:style/Widget.DeviceDefault.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
app:layout_constraintEnd_toStartOf="@id/cancel"
app:layout_constraintHorizontal_chainStyle="packed"
android:layout_marginLeft="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guideline" />
app:layout_constraintBottom_toTopOf="@id/preview" />
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cancel"
app:layout_constraintEnd_toStartOf="@id/edit"
app:layout_constraintStart_toEndOf="@id/save"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guideline" />
<Button
android:id="@+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/screenshot_edit_label"
app:layout_constraintEnd_toStartOf="@id/share"
app:layout_constraintStart_toEndOf="@id/cancel"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guideline" />
<Button
<ImageButton
android:id="@+id/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@*android:string/share"
style="@android:style/Widget.Material.Button.Borderless"
android:tint="?android:textColorPrimary"
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="6dp"
android:src="@drawable/ic_screenshot_share"
android:layout_marginRight="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/edit"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guideline" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1" />
app:layout_constraintBottom_toTopOf="@id/preview" />
<ImageView
android:id="@+id/preview"
@@ -78,7 +54,7 @@
android:layout_marginHorizontal="48dp"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="true"
app:layout_constraintTop_toBottomOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@id/save"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -93,7 +69,7 @@
android:layout_marginBottom="42dp"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="true"
app:layout_constraintTop_toBottomOf="@id/guideline"
app:layout_constraintTop_toTopOf="@id/preview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -110,7 +86,7 @@
android:layout_width="200dp"
android:layout_height="200dp"
android:elevation="2dp"
app:layout_constraintTop_toBottomOf="@id/guideline"
app:layout_constraintTop_toTopOf="@id/preview"
app:layout_constraintLeft_toLeftOf="parent"
app:handleThickness="@dimen/screenshot_crop_handle_thickness"
app:handleColor="@*android:color/accent_device_default"
@@ -119,5 +95,24 @@
app:borderColor="#fff"
/>
<Button
android:id="@+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
style="@android:style/Widget.DeviceDefault.Button.Colored"
android:backgroundTint="?android:colorBackground"
android:drawableStart="@drawable/ic_screenshot_edit"
android:drawableTint="?android:textColorPrimary"
android:paddingStart="16dp"
android:paddingEnd="8dp"
android:paddingVertical="8dp"
android:textColor="?android:textColorPrimary"
android:text="@string/screenshot_edit_label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -610,6 +610,11 @@
<item name="android:windowCloseOnTouchOutside">true</item>
</style>
<!-- Screenshots -->
<style name="LongScreenshotActivity" parent="@android:style/Theme.DeviceDefault.DayNight">
<item name="android:windowNoTitle">true</item>
</style>
<!-- Privacy dialog -->
<style name="PrivacyDialog" parent="ScreenRecord">
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>

View File

@@ -76,7 +76,6 @@ public class LongScreenshotActivity extends Activity {
private ImageView mPreview;
private View mSave;
private View mCancel;
private View mEdit;
private View mShare;
private CropView mCropView;
@@ -117,7 +116,6 @@ public class LongScreenshotActivity extends Activity {
mPreview = requireViewById(R.id.preview);
mSave = requireViewById(R.id.save);
mCancel = requireViewById(R.id.cancel);
mEdit = requireViewById(R.id.edit);
mShare = requireViewById(R.id.share);
mCropView = requireViewById(R.id.crop_view);
@@ -125,7 +123,6 @@ public class LongScreenshotActivity extends Activity {
mCropView.setCropInteractionListener(mMagnifierView);
mSave.setOnClickListener(this::onClicked);
mCancel.setOnClickListener(this::onClicked);
mEdit.setOnClickListener(this::onClicked);
mShare.setOnClickListener(this::onClicked);
@@ -313,7 +310,6 @@ public class LongScreenshotActivity extends Activity {
private void setButtonsEnabled(boolean enabled) {
mSave.setEnabled(enabled);
mCancel.setEnabled(enabled);
mEdit.setEnabled(enabled);
mShare.setEnabled(enabled);
}
@@ -350,8 +346,6 @@ public class LongScreenshotActivity extends Activity {
setButtonsEnabled(false);
if (id == R.id.save) {
startExport(PendingAction.SAVE);
} else if (id == R.id.cancel) {
finishAndRemoveTask();
} else if (id == R.id.edit) {
mUiEventLogger.log(ScreenshotEvent.SCREENSHOT_LONG_SCREENSHOT_EDIT);
startExport(PendingAction.EDIT);