mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-02 15:17:32 +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 Context context = ((AlertDialog) dialog).getContext();
|
||||||
final SponsorSegment segment = sponsorSegmentsOfCurrentVideo[which];
|
final SponsorSegment segment = sponsorSegmentsOfCurrentVideo[which];
|
||||||
|
|
||||||
new AlertDialog.Builder(context) // negative and positive are switched for more intuitive order
|
final VoteOption[] voteOptions = VoteOption.values();
|
||||||
.setNegativeButton(str("vote_upvote"), new DialogInterface.OnClickListener() {
|
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
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
switch (voteOptions[which]) {
|
||||||
|
case UPVOTE:
|
||||||
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
||||||
voteForSegment(segment, true, null);
|
voteForSegment(segment, true, null);
|
||||||
}
|
break;
|
||||||
})
|
case DOWNVOTE:
|
||||||
.setPositiveButton(str("vote_downvote"), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, str("vote_started"), Toast.LENGTH_SHORT).show();
|
||||||
voteForSegment(segment, false, null);
|
voteForSegment(segment, false, null);
|
||||||
}
|
break;
|
||||||
})
|
case CATEGORY_CHANGE:
|
||||||
.setNeutralButton(str("vote_category"), new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
onNewCategorySelect(segment, context);
|
onNewCategorySelect(segment, context);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.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 {
|
private static class EditByHandSaveDialogListener implements DialogInterface.OnClickListener {
|
||||||
public boolean settingStart;
|
public boolean settingStart;
|
||||||
public WeakReference<EditText> editText;
|
public WeakReference<EditText> editText;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user