Improvements (Read below)

- Removed red card color and added an chip if an module.prop isn't well formatted
- Added dialog for Low-quality module
- String fixes
This commit is contained in:
DerGoogler 2022-05-16 15:58:26 +02:00
parent ad2f59922f
commit 74e49369b7
5 changed files with 43 additions and 10 deletions

View File

@ -1,7 +1,9 @@
package com.fox2code.mmm.markdown;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
@ -276,9 +278,7 @@ public class MarkdownActivity extends CompatActivity {
.setTitle(title)
.setMessage(message)
.setCancelable(true)
.setPositiveButton(R.string.ok, (x, y) -> {
x.dismiss();
}).show();
.setPositiveButton(R.string.ok, (x, y) -> x.dismiss()).show();
});
}

View File

@ -27,6 +27,7 @@ import com.fox2code.mmm.manager.ModuleInfo;
import com.fox2code.mmm.manager.ModuleManager;
import com.fox2code.mmm.repo.RepoModule;
import com.google.android.material.chip.Chip;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.topjohnwu.superuser.internal.UiThreadHandler;
@ -67,6 +68,7 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
public static class ViewHolder extends RecyclerView.ViewHolder {
private final CardView cardView;
private final Chip invalidPropsChip;
private final ImageButton buttonAction;
private final SwitchMaterial switchMaterial;
private final TextView titleText;
@ -84,6 +86,7 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
super(itemView);
this.initState = true;
this.cardView = itemView.findViewById(R.id.card_view);
this.invalidPropsChip = itemView.findViewById(R.id.invalid_module_props);
this.buttonAction = itemView.findViewById(R.id.button_action);
this.switchMaterial = itemView.findViewById(R.id.switch_action);
this.titleText = itemView.findViewById(R.id.title_text);
@ -319,8 +322,21 @@ public final class ModuleViewAdapter extends RecyclerView.Adapter<ModuleViewAdap
backgroundAttr = moduleHolder.notificationType.backgroundAttr;
} else if (type == ModuleHolder.Type.INSTALLED &&
moduleHolder.hasFlag(ModuleInfo.FLAG_METADATA_INVALID)) {
foregroundAttr = R.attr.colorOnError;
backgroundAttr = R.attr.colorError;
invalidPropsChip.setOnClickListener(_view -> {
MaterialAlertDialogBuilder builder =
new MaterialAlertDialogBuilder(_view.getContext());
builder
.setTitle(R.string.low_quality_module)
.setMessage("Actual description for Low-quality module")
.setCancelable(true)
.setPositiveButton(R.string.ok, (x, y) -> x.dismiss()).show();
});
this.invalidPropsChip.setVisibility(View.VISIBLE);
// Backup restore
// foregroundAttr = R.attr.colorOnError;
// backgroundAttr = R.attr.colorError;
}
Resources.Theme theme = this.cardView.getContext().getTheme();
TypedValue value = new TypedValue();

View File

@ -28,7 +28,7 @@
android:layout_height="194dp"
android:visibility="gone"
android:scaleType="centerCrop"
/>
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
@ -43,6 +43,19 @@
android:orientation="horizontal"
android:gravity="center_vertical">
<com.google.android.material.chip.Chip
android:id="@+id/invalid_module_props"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="@string/low_quality_module"
android:textSize="12sp"
android:layout_marginEnd="4dp"
android:visibility="gone"
app:chipStartPadding="4dp"
app:chipEndPadding="2dp"
app:chipIconSize="15dp"
app:chipIcon="@drawable/ic_baseline_error_24" />
<TextView
android:id="@+id/title_text"
android:layout_width="0dp"
@ -116,7 +129,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UselessParent">
<com.google.android.material.chip.ChipGroup
android:layout_width="wrap_content"

View File

@ -36,7 +36,6 @@
<string name="master_delete_no">Dateien behalten</string>
<string name="master_delete_yes">Dateien löschen</string>
<string name="master_delete_fail">Fehler beim Löschen der Moduldateien</string>
<string name="module_id_prefix">" "</string>
<string name="install_from_storage">Module aus dem Speicher installieren</string>
<string name="invalid_format">Das ausgewählte Modul hat ein ungültiges Format</string>
<string name="local_install_title">Lokale Installation</string>

View File

@ -74,6 +74,7 @@
<string name="module_id_prefix">Module ID: </string>
<string name="install_from_storage">Install module from storage</string>
<string name="invalid_format">The selected module has an invalid format</string>
<string name="low_quality_module">Low-quality module</string>
<string name="local_install_title">Local install</string>
<string name="source_code">Source code</string>
<string name="magisk_builtin_module">Magisk built-in module</string>
@ -105,7 +106,10 @@
terminal extensions.\nUseful if a module misuses Fox\'s Mmm extensions.
</string>
<string name="wrap_text_pref">Text wrapping</string>
<string name="wrap_text_desc">" Show text on multiple lines instead of putting all text on the same line when installing a module. "</string>
<string name="wrap_text_desc">
Show text on multiple lines instead of putting
all text on the same line when installing a module.
</string>
<string name="enable_blur_pref">Blur</string>
<string name="disable_chips_in_description">Disable chips in description</string>
<string name="repo_enabled">Repo on</string>