Utilize Wrapper instead of dynamic theme.

This commit is contained in:
Alex Hart 2020-05-29 12:36:00 -03:00 committed by Greyson Parrelli
parent 2ddd1437cf
commit c634c24afb

View File

@ -4,6 +4,7 @@ package org.thoughtcrime.securesms;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.ContextThemeWrapper;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -16,8 +17,6 @@ public class ClearProfileAvatarActivity extends Activity {
private static final String ARG_TITLE = "arg_title"; private static final String ARG_TITLE = "arg_title";
private final DynamicTheme theme = new DynamicNoActionBarTheme();
public static Intent createForUserProfilePhoto() { public static Intent createForUserProfilePhoto() {
return new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO"); return new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
} }
@ -28,22 +27,13 @@ public class ClearProfileAvatarActivity extends Activity {
return intent; return intent;
} }
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
theme.onCreate(this);
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
theme.onResume(this);
int titleId = getIntent().getIntExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo); int titleId = getIntent().getIntExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
new AlertDialog.Builder(this) new AlertDialog.Builder(new ContextThemeWrapper(this, DynamicTheme.isDarkTheme(this) ? R.style.TextSecure_DarkTheme : R.style.TextSecure_LightTheme))
.setMessage(titleId) .setMessage(titleId)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
.setPositiveButton(R.string.ClearProfileActivity_remove, (dialog, which) -> { .setPositiveButton(R.string.ClearProfileActivity_remove, (dialog, which) -> {