diff --git a/app/src/main/java/org/thoughtcrime/securesms/wallpaper/crop/WallpaperCropActivity.java b/app/src/main/java/org/thoughtcrime/securesms/wallpaper/crop/WallpaperCropActivity.java index 79292e6887..16801ffebc 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/wallpaper/crop/WallpaperCropActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/wallpaper/crop/WallpaperCropActivity.java @@ -15,7 +15,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StyleRes; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.Toolbar; @@ -29,6 +28,7 @@ import org.signal.imageeditor.core.model.EditorModel; import org.signal.imageeditor.core.renderers.FaceBlurRenderer; import org.thoughtcrime.securesms.BaseActivity; import org.thoughtcrime.securesms.R; +import org.thoughtcrime.securesms.components.ProgressCard; import org.thoughtcrime.securesms.conversation.colors.ColorizerView; import org.thoughtcrime.securesms.recipients.RecipientId; import org.thoughtcrime.securesms.scribbles.UriGlideRenderer; @@ -36,7 +36,6 @@ import org.thoughtcrime.securesms.util.AsynchronousCallback; import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.Projection; import org.thoughtcrime.securesms.util.ViewUtil; -import org.thoughtcrime.securesms.util.views.SimpleProgressDialog; import org.thoughtcrime.securesms.wallpaper.ChatWallpaper; import org.thoughtcrime.securesms.wallpaper.ChatWallpaperPreviewActivity; @@ -55,6 +54,7 @@ public final class WallpaperCropActivity extends BaseActivity { private ImageEditorView imageEditor; private WallpaperCropViewModel viewModel; + private ProgressCard progressCard; public static Intent newIntent(@NonNull Context context, @Nullable RecipientId recipientId, @@ -86,7 +86,9 @@ public final class WallpaperCropActivity extends BaseActivity { WallpaperCropViewModel.Factory factory = new WallpaperCropViewModel.Factory(recipientId); viewModel = new ViewModelProvider(this, factory).get(WallpaperCropViewModel.class); - imageEditor = findViewById(R.id.image_editor); + imageEditor = findViewById(R.id.image_editor); + progressCard = findViewById(R.id.wallpaper_crop_progress_card); + View sentBubble = findViewById(R.id.preview_bubble_2); TextView bubble2Text = findViewById(R.id.chat_wallpaper_bubble2_text); View setWallPaper = findViewById(R.id.preview_set_wallpaper); @@ -156,17 +158,24 @@ public final class WallpaperCropActivity extends BaseActivity { Point size = new Point(imageEditor.getWidth(), imageEditor.getHeight()); - AlertDialog dialog = SimpleProgressDialog.show(this); + if (progressCard != null) { + progressCard.setVisibility(View.VISIBLE); + } + viewModel.render(this, model, size, new AsynchronousCallback.MainThread() { @Override public void onComplete(@Nullable ChatWallpaper result) { - dialog.dismiss(); + if (progressCard != null) { + progressCard.setVisibility(View.GONE); + } setResult(RESULT_OK, new Intent().putExtra(ChatWallpaperPreviewActivity.EXTRA_CHAT_WALLPAPER, result)); finish(); } @Override public void onError(@Nullable WallpaperCropViewModel.Error error) { - dialog.dismiss(); + if (progressCard != null) { + progressCard.setVisibility(View.GONE); + } Toast.makeText(WallpaperCropActivity.this, R.string.WallpaperCropActivity__error_setting_wallpaper, Toast.LENGTH_SHORT).show(); } }.toWorkerCallback()); diff --git a/app/src/main/res/layout/chat_wallpaper_crop_activity.xml b/app/src/main/res/layout/chat_wallpaper_crop_activity.xml index af8e32a0c1..3c70ab7b2b 100644 --- a/app/src/main/res/layout/chat_wallpaper_crop_activity.xml +++ b/app/src/main/res/layout/chat_wallpaper_crop_activity.xml @@ -179,4 +179,16 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/navigation_bar_guideline" /> + + \ No newline at end of file