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-12-09 11:15:48 -04:00
|
|
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
2020-05-27 12:19:20 -03:00
|
|
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
|
|
|
|
2020-12-09 11:15:48 -04:00
|
|
|
public final class ClearAvatarPromptActivity extends Activity {
|
2017-08-16 12:01:26 -07:00
|
|
|
|
2020-04-28 13:27:09 -03:00
|
|
|
private static final String ARG_TITLE = "arg_title";
|
|
|
|
|
|
|
|
public static Intent createForUserProfilePhoto() {
|
2020-12-09 11:15:48 -04:00
|
|
|
Intent intent = new Intent(ApplicationDependencies.getApplication(), ClearAvatarPromptActivity.class);
|
|
|
|
intent.putExtra(ARG_TITLE, R.string.ClearProfileActivity_remove_profile_photo);
|
|
|
|
return intent;
|
2020-04-28 13:27:09 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Intent createForGroupProfilePhoto() {
|
2020-12-09 11:15:48 -04:00
|
|
|
Intent intent = new Intent(ApplicationDependencies.getApplication(), ClearAvatarPromptActivity.class);
|
2020-04-28 13:27:09 -03:00
|
|
|
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-12-09 11:15:48 -04:00
|
|
|
int message = getIntent().getIntExtra(ARG_TITLE, 0);
|
2020-04-28 13:27:09 -03:00
|
|
|
|
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-12-09 11:15:48 -04:00
|
|
|
.setMessage(message)
|
2020-05-27 12:19:20 -03:00
|
|
|
.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
|
|
|
}
|
|
|
|
|
|
|
|
}
|