pull/107/head
Der_Googler 2 years ago
parent 7066e2d205
commit 237305fd16

@ -25,7 +25,7 @@ import io.noties.markwon.Markwon;
public enum ActionButtonType {
INFO(R.drawable.ic_baseline_info_24) {
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
String notesUrl = moduleHolder.repoModule.notesUrl;
if (notesUrl.startsWith("https://api.androidacy.com/magisk/readme/?module=") ||
notesUrl.startsWith("https://www.androidacy.com/")) {
@ -49,7 +49,7 @@ public enum ActionButtonType {
},
UPDATE_INSTALL() {
@Override
public void update(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void update(ImageButton button, ModuleHolder moduleHolder) {
int icon = moduleHolder.hasUpdate() ?
R.drawable.ic_baseline_update_24 :
R.drawable.ic_baseline_system_update_24;
@ -57,7 +57,7 @@ public enum ActionButtonType {
}
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
if (moduleInfo == null) return;
String updateZipUrl = moduleHolder.getUpdateZipUrl();
@ -115,7 +115,7 @@ public enum ActionButtonType {
},
UNINSTALL() {
@Override
public void update(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void update(ImageButton button, ModuleHolder moduleHolder) {
int icon = moduleHolder.hasFlag(ModuleInfo.FLAG_MODULE_UNINSTALLING) ?
R.drawable.ic_baseline_delete_outline_24 : (
!moduleHolder.hasFlag(ModuleInfo.FLAG_MODULE_UPDATING) ||
@ -126,7 +126,7 @@ public enum ActionButtonType {
}
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
if (!moduleHolder.hasFlag(ModuleInfo.FLAGS_MODULE_ACTIVE |
ModuleInfo.FLAG_MODULE_UNINSTALLING) &&
moduleHolder.hasFlag(ModuleInfo.FLAG_MODULE_UPDATING)) {
@ -137,7 +137,7 @@ public enum ActionButtonType {
!moduleHolder.hasFlag(ModuleInfo.FLAG_MODULE_UNINSTALLING))) {
Log.e("ActionButtonType", "Failed to switch uninstalled state!");
}
update(button, cardView, moduleHolder);
update(button, moduleHolder);
}
@Override
@ -159,7 +159,7 @@ public enum ActionButtonType {
},
CONFIG(R.drawable.ic_baseline_app_settings_alt_24) {
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
String config = moduleHolder.getMainModuleConfig();
if (config == null) return;
if (AndroidacyUtil.isAndroidacyLink(config)) {
@ -171,19 +171,19 @@ public enum ActionButtonType {
},
SUPPORT() {
@Override
public void update(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void update(ImageButton button, ModuleHolder moduleHolder) {
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
button.setImageResource(supportIconForUrl(moduleInfo.support));
}
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
IntentHelper.openUrl(button.getContext(), moduleHolder.getMainModuleInfo().support);
}
},
DONATE() {
@Override
public void update(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void update(ImageButton button, ModuleHolder moduleHolder) {
ModuleInfo moduleInfo = moduleHolder.getMainModuleInfo();
int icon = R.drawable.ic_baseline_monetization_on_24;
if (moduleInfo.donate.startsWith("https://www.paypal.me/")) {
@ -195,7 +195,7 @@ public enum ActionButtonType {
}
@Override
public void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void doAction(ImageButton button, ModuleHolder moduleHolder) {
IntentHelper.openUrl(button.getContext(), moduleHolder.getMainModuleInfo().donate);
}
};
@ -227,11 +227,11 @@ public enum ActionButtonType {
this.iconId = iconId;
}
public void update(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder) {
public void update(ImageButton button, ModuleHolder moduleHolder) {
button.setImageResource(this.iconId);
}
public abstract void doAction(ImageButton button, MaterialCardView cardView, ModuleHolder moduleHolder);
public abstract void doAction(ImageButton button, ModuleHolder moduleHolder);
public boolean doActionLong(ImageButton button, ModuleHolder moduleHolder) {
return false;

@ -126,7 +126,7 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
ModuleHolder moduleHolder = this.moduleHolder;
if (index < this.actionButtonsTypes.size() && moduleHolder != null) {
this.actionButtonsTypes.get(index)
.doAction((ImageButton) v, (MaterialCardView) cardView, moduleHolder);
.doAction((ImageButton) v, moduleHolder);
if (moduleHolder.shouldRemove()) {
this.cardView.setVisibility(View.GONE);
}
@ -234,7 +234,7 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
imageButton.setImportantForAccessibility(
View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
ActionButtonType button = this.actionButtonsTypes.get(i);
button.update(imageButton, (MaterialCardView) cardView, moduleHolder);
button.update(imageButton, moduleHolder);
imageButton.setContentDescription(button.name());
} else {
imageButton.setVisibility(View.GONE);

Loading…
Cancel
Save