Change alert dialogs

fix_reports
Thomas 2 years ago
parent 5ce553f8cf
commit e0b12ab0e2

@ -30,6 +30,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.jetbrains.annotations.NotNull;
@ -96,7 +97,7 @@ public class BasePeertubeActivity extends BaseBarActivity {
if (item.getItemId() == R.id.action_cast) {
if (PeertubeBaseMainActivity.chromeCasts != null && PeertubeBaseMainActivity.chromeCasts.size() > 0) {
String[] chromecast_choice = new String[PeertubeBaseMainActivity.chromeCasts.size()];
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.chromecast_choice);
int i = 0;
for (ChromeCast cc : PeertubeBaseMainActivity.chromeCasts) {

@ -23,7 +23,6 @@ import android.os.Handler;
import android.os.Looper;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.IOException;
@ -36,6 +35,7 @@ import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityMainPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseActivity;
import app.fedilab.android.peertube.client.data.VideoData;
import app.fedilab.android.peertube.helper.Helper;
import su.litvak.chromecast.api.v2.ChromeCast;
@ -43,7 +43,7 @@ import su.litvak.chromecast.api.v2.ChromeCasts;
import su.litvak.chromecast.api.v2.ChromeCastsListener;
import su.litvak.chromecast.api.v2.MediaStatus;
public abstract class PeertubeBaseMainActivity extends AppCompatActivity implements ChromeCastsListener {
public abstract class PeertubeBaseMainActivity extends BaseActivity implements ChromeCastsListener {
public static List<ChromeCast> chromeCasts;
public static ChromeCast chromeCast;

@ -47,6 +47,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
import java.util.HashMap;
@ -160,7 +161,7 @@ public class AllPlaylistsActivity extends BaseBarActivity implements PlaylistAda
public void manageAlert(Playlist playlistParam) {
playlistToEdit = playlistParam;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(AllPlaylistsActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(AllPlaylistsActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
bindingDialog = AddPlaylistPeertubeBinding.inflate(LayoutInflater.from(AllPlaylistsActivity.this), null, false);
dialogBuilder.setView(bindingDialog.getRoot());

@ -32,6 +32,8 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -106,7 +108,7 @@ public class InstancePickerActivity extends BaseBarActivity {
itemsKeyLanguage = new String[languages.size()];
binding.pickupLanguages.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(InstancePickerActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
int i = 0;
if (languages.size() > 0) {
@ -173,7 +175,7 @@ public class InstancePickerActivity extends BaseBarActivity {
binding.pickupCategories.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(InstancePickerActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(InstancePickerActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
int i = 0;
if (categories.size() > 0) {
Iterator<Map.Entry<Integer, String>> it = categories.entrySet().iterator();

@ -108,6 +108,7 @@ import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoSize;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import org.jetbrains.annotations.NotNull;
@ -674,7 +675,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
}
private void reportAlert(RetrofitPeertubeAPI.ActionType type, AlertDialog alertDialog) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(PeertubeActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
LayoutInflater inflater1 = getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.popup_report_peertube, new LinearLayout(PeertubeActivity.this), false);
dialogBuilder.setView(dialogView);
@ -874,7 +875,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
});
binding.videoInformation.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(PeertubeActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
LayoutInflater inflater = getLayoutInflater();
View dialogView = inflater.inflate(R.layout.popup_video_info_peertube, new LinearLayout(PeertubeActivity.this), false);
TextView info_privacy = dialogView.findViewById(R.id.info_privacy);
@ -1111,7 +1112,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
} else if (itemId == R.id.action_report) {
AlertDialog alertDialog;
AlertDialog.Builder dialogBuilder;
dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
dialogBuilder = new MaterialAlertDialogBuilder(PeertubeActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
LayoutInflater inflater1 = getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.popup_report_choice, new LinearLayout(PeertubeActivity.this), false);
dialogBuilder.setView(dialogView);
@ -1243,7 +1244,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
if (promptNSFW && peertube != null && peertube.isNsfw() && (nsfwAction.compareTo(Helper.BLUR) == 0 || nsfwAction.compareTo(Helper.DO_NOT_LIST) == 0)) {
AlertDialog alertDialog;
AlertDialog.Builder dialogBuilder;
dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
dialogBuilder = new MaterialAlertDialogBuilder(PeertubeActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
dialogBuilder.setTitle(R.string.nsfw_title_warning);
dialogBuilder.setCancelable(false);
dialogBuilder.setMessage(R.string.nsfw_message_warning);
@ -2035,7 +2036,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
return;
}
if (apiResponse.getPlaylists() != null && apiResponse.getPlaylists().size() > 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(PeertubeActivity.this);
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(PeertubeActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
builder.setTitle(R.string.modify_playlists);
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();

@ -43,6 +43,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -108,7 +109,7 @@ public class PeertubeEditUploadActivity extends BaseBarActivity {
binding.setUploadDelete.setOnClickListener(v -> {
AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(PeertubeEditUploadActivity.this);
builderInner = new MaterialAlertDialogBuilder(PeertubeEditUploadActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
builderInner.setMessage(getString(R.string.delete_video_confirmation));
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {

@ -60,6 +60,7 @@ import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.kobakei.ratethisapp.RateThisApp;
import org.jetbrains.annotations.NotNull;
@ -141,7 +142,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
@SuppressLint("ApplySharedPref")
public static void showRadioButtonDialogFullInstances(Activity activity, boolean storeInDb) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
AlertDialog.Builder alt_bld = new AlertDialog.Builder(activity);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.instance_choice);
String instance = HelperInstance.getLiveInstance(activity);
final EditText input = new EditText(activity);
@ -577,7 +578,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
instanceConfig = new RetrofitPeertubeAPI(PeertubeMainActivity.this).getConfigInstance();
} catch (Error error) {
runOnUiThread(() -> {
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.refresh_token_failed);
alt_bld.setMessage(R.string.refresh_token_failed_message);
alt_bld.setNegativeButton(R.string.action_logout, (dialog, id) -> {
@ -710,7 +711,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
@SuppressLint("ApplySharedPref")
private void showRadioButtonDialog() {
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
alt_bld.setTitle(R.string.instance_choice);
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(PeertubeMainActivity.this);
String acad = HelperInstance.getLiveInstance(PeertubeMainActivity.this);

@ -31,6 +31,8 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -184,7 +186,7 @@ public class PeertubeRegisterActivity extends BaseBarActivity {
return;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeRegisterActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(PeertubeRegisterActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
dialogBuilder.setCancelable(false);
dialogBuilder.setPositiveButton(R.string.validate, (dialog, which) -> {
dialog.dismiss();

@ -42,6 +42,7 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.tabs.TabLayout;
import org.jetbrains.annotations.NotNull;
@ -120,7 +121,7 @@ public class ShowAccountActivity extends BaseBarActivity {
PostActionsVM viewModel = new ViewModelProvider(ShowAccountActivity.this).get(PostActionsVM.class);
viewModel.post(MUTE, accountAcct == null ? account.getUsername() + "@" + account.getHost() : accountAcct, null).observe(ShowAccountActivity.this, apiResponse -> manageVIewPostActions(MUTE, apiResponse));
} else if (item.getItemId() == R.id.action_report) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ShowAccountActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(ShowAccountActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
LayoutInflater inflater1 = getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.popup_report_peertube, new LinearLayout(ShowAccountActivity.this), false);
dialogBuilder.setView(dialogView);

@ -50,6 +50,7 @@ import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.tabs.TabLayout;
import org.jetbrains.annotations.NotNull;
@ -133,7 +134,7 @@ public class ShowChannelActivity extends BaseBarActivity {
PostActionsVM viewModel = new ViewModelProvider(ShowChannelActivity.this).get(PostActionsVM.class);
viewModel.post(MUTE, channel.getOwnerAccount().getAcct(), null).observe(ShowChannelActivity.this, apiResponse -> manageVIewPostActions(MUTE, apiResponse));
} else if (item.getItemId() == R.id.action_report) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ShowChannelActivity.this);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(ShowChannelActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
LayoutInflater inflater1 = getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.popup_report_peertube, new LinearLayout(ShowChannelActivity.this), false);
dialogBuilder.setView(dialogView);
@ -264,7 +265,7 @@ public class ShowChannelActivity extends BaseBarActivity {
} else if (doAction == action.UNFOLLOW) {
boolean confirm_unfollow = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
if (confirm_unfollow) {
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(ShowChannelActivity.this);
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(ShowChannelActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
unfollowConfirm.setTitle(getString(R.string.unfollow_confirm));
unfollowConfirm.setMessage(channel.getAcct());
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());

@ -16,7 +16,6 @@ package app.fedilab.android.peertube.activities;
import static app.fedilab.android.peertube.viewmodel.TimelineVM.TimelineType.HISTORY;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@ -25,6 +24,8 @@ import android.view.View;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.jetbrains.annotations.NotNull;
import java.text.SimpleDateFormat;
@ -144,7 +145,7 @@ public class VideosTimelineActivity extends BaseBarActivity {
finish();
return true;
} else if (item.getItemId() == R.id.action_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(VideosTimelineActivity.this);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(VideosTimelineActivity.this, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
builder.setTitle(R.string.delete_history);
builder.setMessage(R.string.delete_history_confirm);
builder.setIcon(android.R.drawable.ic_dialog_alert)

@ -17,10 +17,10 @@ package app.fedilab.android.peertube.drawer;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
@ -40,6 +40,8 @@ import androidx.appcompat.widget.PopupMenu;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import app.fedilab.android.R;
@ -141,7 +143,7 @@ public class AboutInstanceAdapter extends RecyclerView.Adapter<RecyclerView.View
popup.setOnMenuItemClickListener(item -> {
int itemId = item.getItemId();
if (itemId == R.id.action_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(R.string.delete_instance);
builder.setMessage(R.string.delete_instance_confirm);
builder.setIcon(android.R.drawable.ic_dialog_alert)

@ -16,8 +16,8 @@ package app.fedilab.android.peertube.drawer;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -37,6 +37,8 @@ import androidx.appcompat.widget.PopupMenu;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import app.fedilab.android.R;
@ -93,7 +95,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
popup.setOnMenuItemClickListener(item -> {
int itemId = item.getItemId();
if (itemId == R.id.action_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(context.getString(R.string.delete_channel) + ": " + channel.getName());
builder.setMessage(context.getString(R.string.action_channel_confirm_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert)

@ -14,12 +14,12 @@ package app.fedilab.android.peertube.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.MUTE;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.REPLY;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@ -49,6 +49,8 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -159,8 +161,9 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
}
popup.setOnMenuItemClickListener(item -> {
int itemId = item.getItemId();
MaterialAlertDialogBuilder builder;
if (itemId == R.id.action_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(R.string.delete_comment);
builder.setMessage(R.string.delete_comment_confirm);
builder.setIcon(android.R.drawable.ic_dialog_alert)
@ -193,8 +196,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
allCommentRemoved.onAllCommentRemoved();
}
} else if (itemId == R.id.action_remove_comments) {
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(context);
builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(R.string.delete_account_comment);
builder.setMessage(R.string.delete_account_comment_confirm);
builder.setIcon(android.R.drawable.ic_dialog_alert)

@ -14,6 +14,7 @@ package app.fedilab.android.peertube.drawer;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.FOLLOW;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.ActionType.UNFOLLOW;
import static app.fedilab.android.peertube.viewmodel.TimelineVM.TimelineType.MY_VIDEOS;
@ -50,6 +51,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.ArrayList;
import java.util.List;
@ -227,7 +229,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
popup.getMenu().findItem(R.id.action_follow).setTitle(context.getString(R.string.action_follow));
boolean confirm_unfollow = sharedpreferences.getBoolean(Helper.SET_UNFOLLOW_VALIDATION, true);
if (confirm_unfollow) {
AlertDialog.Builder unfollowConfirm = new AlertDialog.Builder(context);
AlertDialog.Builder unfollowConfirm = new MaterialAlertDialogBuilder(context, dialogStyle());
unfollowConfirm.setTitle(context.getString(R.string.unfollow_confirm));
unfollowConfirm.setMessage(video.getChannel().getAcct());
unfollowConfirm.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
@ -257,7 +259,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
intent.putExtras(b);
context.startActivity(intent);
} else if (itemId == R.id.action_report) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(context, dialogStyle());
LayoutInflater inflater1 = ((Activity) context).getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.popup_report_peertube, new LinearLayout(context), false);
dialogBuilder.setView(dialogView);
@ -321,7 +323,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
return;
}
if (apiResponse.getPlaylists() != null && apiResponse.getPlaylists().size() > 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(R.string.modify_playlists);
List<PlaylistData.Playlist> ownerPlaylists = apiResponse.getPlaylists();

@ -15,8 +15,9 @@ package app.fedilab.android.peertube.drawer;
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@ -29,6 +30,8 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import app.fedilab.android.R;
@ -102,7 +105,7 @@ public class PlaylistAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
popup.setOnMenuItemClickListener(item -> {
int itemId = item.getItemId();
if (itemId == R.id.action_delete) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context, dialogStyle());
builder.setTitle(context.getString(R.string.action_lists_delete) + ": " + playlist.getDisplayName());
builder.setMessage(context.getString(R.string.action_lists_confirm_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert)

@ -14,6 +14,7 @@ package app.fedilab.android.peertube.fragment;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import static app.fedilab.android.peertube.activities.PeertubeUploadActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
import android.Manifest;
@ -46,6 +47,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
@ -234,7 +236,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
public void manageAlert(ChannelParams oldChannelValues) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(context, dialogStyle());
bindingDialog = AddChannelPeertubeBinding.inflate(LayoutInflater.from(context), null, false);
dialogBuilder.setView(bindingDialog.getRoot());

@ -14,6 +14,7 @@ package app.fedilab.android.peertube.fragment;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import static app.fedilab.android.peertube.client.RetrofitPeertubeAPI.DataType.MY_CHANNELS;
import static app.fedilab.android.peertube.helper.Helper.peertubeInformation;
@ -43,6 +44,7 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.jetbrains.annotations.NotNull;
@ -120,7 +122,7 @@ public class DisplayPlaylistsFragment extends Fragment {
if (add_new != null) {
add_new.setOnClickListener(view -> {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(context, dialogStyle());
LayoutInflater inflater1 = ((Activity) context).getLayoutInflater();
View dialogView = inflater1.inflate(R.layout.add_playlist_peertube, new LinearLayout(context), false);
dialogBuilder.setView(dialogView);

@ -18,6 +18,7 @@ import static android.content.Context.DOWNLOAD_SERVICE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.dialogStyle;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.typeOfConnection;
import android.annotation.SuppressLint;
@ -500,7 +501,7 @@ public class Helper {
* @param url String download url
*/
public static void manageDownloads(final Context context, final String url) {
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
final AlertDialog.Builder builder = new MaterialAlertDialogBuilder(context, dialogStyle());
final DownloadManager.Request request;
try {
request = new DownloadManager.Request(Uri.parse(url.trim()));
@ -535,7 +536,7 @@ public class Helper {
* @param currentAccount BaseAccount
*/
public static void logoutCurrentUser(Activity activity, BaseAccount currentAccount) {
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
AlertDialog.Builder alt_bld = new MaterialAlertDialogBuilder(activity, dialogStyle());
alt_bld.setTitle(R.string.action_logout);
if (currentAccount.mastodon_account != null && currentAccount.mastodon_account.username != null && currentAccount.instance != null) {
alt_bld.setMessage(activity.getString(R.string.logout_account_confirmation, currentAccount.mastodon_account.username, currentAccount.instance));

@ -26,6 +26,8 @@ import android.content.SharedPreferences;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.PreferenceManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.util.List;
import app.fedilab.android.R;
@ -47,7 +49,7 @@ public class SwitchAccountHelper {
e.printStackTrace();
}
AlertDialog.Builder builderSingle = new AlertDialog.Builder(activity);
AlertDialog.Builder builderSingle = new MaterialAlertDialogBuilder(activity, app.fedilab.android.mastodon.helper.Helper.dialogStyle());
builderSingle.setTitle(activity.getString(R.string.list_of_accounts));
if (accounts != null) {
final OwnAccountsAdapter accountsListAdapter = new OwnAccountsAdapter(activity, accounts);

Loading…
Cancel
Save