mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-23 02:07:33 +01:00
change vote buttons to items
This commit is contained in:
parent
03f6e496b9
commit
f4808a9778
@ -201,25 +201,30 @@ public abstract class SponsorBlockUtils {
|
||||
final Context context = ((AlertDialog) dialog).getContext();
|
||||
final SponsorSegment segment = sponsorSegmentsOfCurrentVideo[which];
|
||||
|
||||
new AlertDialog.Builder(context) // negative and positive are switched for more intuitive order
|
||||
.setNegativeButton(str("vote_upvote"), new DialogInterface.OnClickListener() {
|
||||
final VoteOption[] voteOptions = VoteOption.values();
|
||||
String[] items = new String[voteOptions.length];
|
||||
|
||||
for (int i = 0; i < voteOptions.length; i++) {
|
||||
items[i] = voteOptions[i].title;
|
||||
}
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (voteOptions[which]) {
|
||||
case UPVOTE:
|
||||
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
||||
voteForSegment(segment, true, null);
|
||||
}
|
||||
})
|
||||
.setPositiveButton(str("vote_downvote"), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
break;
|
||||
case DOWNVOTE:
|
||||
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
||||
voteForSegment(segment, false, null);
|
||||
}
|
||||
})
|
||||
.setNeutralButton(str("vote_category"), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
break;
|
||||
case CATEGORY_CHANGE:
|
||||
onNewCategorySelect(segment, context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
.show();
|
||||
@ -563,6 +568,18 @@ public abstract class SponsorBlockUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private enum VoteOption {
|
||||
UPVOTE(str("vote_upvote")),
|
||||
DOWNVOTE(str("vote_downvote")),
|
||||
CATEGORY_CHANGE(str("vote_category"));
|
||||
|
||||
public final String title;
|
||||
|
||||
VoteOption(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
private static class EditByHandSaveDialogListener implements DialogInterface.OnClickListener {
|
||||
public boolean settingStart;
|
||||
public WeakReference<EditText> editText;
|
||||
|
Loading…
x
Reference in New Issue
Block a user