2017-08-16 12:01:26 -07:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
2020-05-29 12:36:00 -03:00
|
|
|
import android.view.ContextThemeWrapper;
|
2020-05-27 12:19:20 -03:00
|
|
|
|
2019-06-05 15:47:14 -04:00
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2017-08-16 12:01:26 -07:00
|
|
|
|
2020-05-27 12:19:20 -03:00
|
|
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
|
|
|
|
2017-08-16 12:01:26 -07:00
|
|
|
public class ClearProfileAvatarActivity extends Activity {
|
|
|
|
|
2020-04-28 13:27:09 -03:00
|
|
|
private static final String ARG_TITLE = "arg_title";
|
|
|
|
|
|
|
|
public static Intent createForUserProfilePhoto() {
|
|
|
|
return new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Intent createForGroupProfilePhoto() {
|
|
|
|
Intent intent = new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO");
|
|
|
|
intent.putExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_group_photo);
|
|
|
|
return intent;
|
|
|
|
}
|
|
|
|
|
2017-08-16 12:01:26 -07:00
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
|
2020-04-28 13:27:09 -03:00
|
|
|
int titleId = getIntent().getIntExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
|
|
|
|
|
2020-05-29 12:36:00 -03:00
|
|
|
new AlertDialog.Builder(new ContextThemeWrapper(this, DynamicTheme.isDarkTheme(this) ? R.style.TextSecure_DarkTheme : R.style.TextSecure_LightTheme))
|
2020-05-27 12:19:20 -03:00
|
|
|
.setMessage(titleId)
|
|
|
|
.setNegativeButton(android.R.string.cancel, (dialog, which) -> finish())
|
|
|
|
.setPositiveButton(R.string.ClearProfileActivity_remove, (dialog, which) -> {
|
|
|
|
Intent result = new Intent();
|
|
|
|
result.putExtra("delete", true);
|
|
|
|
setResult(Activity.RESULT_OK, result);
|
|
|
|
finish();
|
|
|
|
})
|
|
|
|
.setOnCancelListener(dialog -> finish())
|
|
|
|
.show();
|
2017-08-16 12:01:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|