mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 02:08:40 +00:00
Directly reference activity for remove avatar confirmation prompt.
This commit is contained in:
@@ -7,18 +7,21 @@ import android.view.ContextThemeWrapper;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
public class ClearProfileAvatarActivity extends Activity {
|
||||
public final class ClearAvatarPromptActivity extends Activity {
|
||||
|
||||
private static final String ARG_TITLE = "arg_title";
|
||||
|
||||
public static Intent createForUserProfilePhoto() {
|
||||
return new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
||||
Intent intent = new Intent(ApplicationDependencies.getApplication(), ClearAvatarPromptActivity.class);
|
||||
intent.putExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static Intent createForGroupProfilePhoto() {
|
||||
Intent intent = new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
||||
Intent intent = new Intent(ApplicationDependencies.getApplication(), ClearAvatarPromptActivity.class);
|
||||
intent.putExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_group_photo);
|
||||
return intent;
|
||||
}
|
||||
@@ -27,10 +30,10 @@ public class ClearProfileAvatarActivity extends Activity {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
int titleId = getIntent().getIntExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
|
||||
int message = getIntent().getIntExtra(ARG_TITLE, 0);
|
||||
|
||||
new AlertDialog.Builder(new ContextThemeWrapper(this, DynamicTheme.isDarkTheme(this) ? R.style.TextSecure_DarkTheme : R.style.TextSecure_LightTheme))
|
||||
.setMessage(titleId)
|
||||
.setMessage(message)
|
||||
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
|
||||
.setPositiveButton(R.string.ClearProfileActivity_remove, (dialog, which) -> {
|
||||
Intent result = new Intent();
|
||||
@@ -22,7 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import org.thoughtcrime.securesms.ClearProfileAvatarActivity;
|
||||
import org.thoughtcrime.securesms.ClearAvatarPromptActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||
@@ -146,8 +146,8 @@ public class AvatarSelectionBottomSheetDialogFragment extends BottomSheetDialogF
|
||||
case GALLERY:
|
||||
return AvatarSelectionActivity.getIntentForGallery(context);
|
||||
case DELETE:
|
||||
return isGroup ? ClearProfileAvatarActivity.createForGroupProfilePhoto()
|
||||
: ClearProfileAvatarActivity.createForUserProfilePhoto();
|
||||
return isGroup ? ClearAvatarPromptActivity.createForGroupProfilePhoto()
|
||||
: ClearAvatarPromptActivity.createForUserProfilePhoto();
|
||||
default:
|
||||
throw new IllegalStateException("Unknown option: " + selectionOption);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user