Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 74e4936

Browse files
committed
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
1 parent ad2f599 commit 74e4936

File tree

5 files changed

+43
-10
lines changed

5 files changed

+43
-10
lines changed

app/src/main/java/com/fox2code/mmm/markdown/MarkdownActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.fox2code.mmm.markdown;
22

3+
import android.annotation.SuppressLint;
34
import android.content.Intent;
45
import android.content.pm.PackageManager;
6+
import android.content.res.ColorStateList;
57
import android.content.res.Configuration;
68
import android.content.res.Resources;
79
import android.graphics.Color;
@@ -276,9 +278,7 @@ private void makeChip(String title, String message) {
276278
.setTitle(title)
277279
.setMessage(message)
278280
.setCancelable(true)
279-
.setPositiveButton(R.string.ok, (x, y) -> {
280-
x.dismiss();
281-
}).show();
281+
.setPositiveButton(R.string.ok, (x, y) -> x.dismiss()).show();
282282

283283
});
284284
}

app/src/main/java/com/fox2code/mmm/module/ModuleViewAdapter.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.fox2code.mmm.manager.ModuleManager;
2828
import com.fox2code.mmm.repo.RepoModule;
2929
import com.google.android.material.chip.Chip;
30+
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
3031
import com.google.android.material.switchmaterial.SwitchMaterial;
3132
import com.topjohnwu.superuser.internal.UiThreadHandler;
3233

@@ -67,6 +68,7 @@ public int getItemCount() {
6768

6869
public static class ViewHolder extends RecyclerView.ViewHolder {
6970
private final CardView cardView;
71+
private final Chip invalidPropsChip;
7072
private final ImageButton buttonAction;
7173
private final SwitchMaterial switchMaterial;
7274
private final TextView titleText;
@@ -84,6 +86,7 @@ public ViewHolder(@NonNull View itemView) {
8486
super(itemView);
8587
this.initState = true;
8688
this.cardView = itemView.findViewById(R.id.card_view);
89+
this.invalidPropsChip = itemView.findViewById(R.id.invalid_module_props);
8790
this.buttonAction = itemView.findViewById(R.id.button_action);
8891
this.switchMaterial = itemView.findViewById(R.id.switch_action);
8992
this.titleText = itemView.findViewById(R.id.title_text);
@@ -115,7 +118,7 @@ public ViewHolder(@NonNull View itemView) {
115118
this.buttonAction.setClickable(false);
116119
this.switchMaterial.setEnabled(false);
117120
this.switchMaterial.setOnCheckedChangeListener((v, checked) -> {
118-
if (this.initState) return; // Skip if non user
121+
if (this.initState) return; // Skip if non user
119122
ModuleHolder moduleHolder = this.moduleHolder;
120123
if (moduleHolder != null && moduleHolder.moduleInfo != null) {
121124
ModuleInfo moduleInfo = moduleHolder.moduleInfo;
@@ -319,8 +322,21 @@ public boolean update(ModuleHolder moduleHolder) {
319322
backgroundAttr = moduleHolder.notificationType.backgroundAttr;
320323
} else if (type == ModuleHolder.Type.INSTALLED &&
321324
moduleHolder.hasFlag(ModuleInfo.FLAG_METADATA_INVALID)) {
322-
foregroundAttr = R.attr.colorOnError;
323-
backgroundAttr = R.attr.colorError;
325+
invalidPropsChip.setOnClickListener(_view -> {
326+
MaterialAlertDialogBuilder builder =
327+
new MaterialAlertDialogBuilder(_view.getContext());
328+
329+
builder
330+
.setTitle(R.string.low_quality_module)
331+
.setMessage("Actual description for Low-quality module")
332+
.setCancelable(true)
333+
.setPositiveButton(R.string.ok, (x, y) -> x.dismiss()).show();
334+
335+
});
336+
this.invalidPropsChip.setVisibility(View.VISIBLE);
337+
// Backup restore
338+
// foregroundAttr = R.attr.colorOnError;
339+
// backgroundAttr = R.attr.colorError;
324340
}
325341
Resources.Theme theme = this.cardView.getContext().getTheme();
326342
TypedValue value = new TypedValue();

app/src/main/res/layout/module_entry.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
android:layout_height="194dp"
2929
android:visibility="gone"
3030
android:scaleType="centerCrop"
31-
/>
31+
tools:ignore="ContentDescription" />
3232

3333
<LinearLayout
3434
android:layout_width="match_parent"
@@ -43,6 +43,19 @@
4343
android:orientation="horizontal"
4444
android:gravity="center_vertical">
4545

46+
<com.google.android.material.chip.Chip
47+
android:id="@+id/invalid_module_props"
48+
android:layout_width="wrap_content"
49+
android:layout_height="40dp"
50+
android:text="@string/low_quality_module"
51+
android:textSize="12sp"
52+
android:layout_marginEnd="4dp"
53+
android:visibility="gone"
54+
app:chipStartPadding="4dp"
55+
app:chipEndPadding="2dp"
56+
app:chipIconSize="15dp"
57+
app:chipIcon="@drawable/ic_baseline_error_24" />
58+
4659
<TextView
4760
android:id="@+id/title_text"
4861
android:layout_width="0dp"
@@ -116,7 +129,8 @@
116129
android:layout_width="match_parent"
117130
android:layout_height="wrap_content"
118131
app:layout_constraintStart_toStartOf="parent"
119-
app:layout_constraintTop_toTopOf="parent">
132+
app:layout_constraintTop_toTopOf="parent"
133+
tools:ignore="UselessParent">
120134

121135
<com.google.android.material.chip.ChipGroup
122136
android:layout_width="wrap_content"

app/src/main/res/values-de/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<string name="master_delete_no">Dateien behalten</string>
3737
<string name="master_delete_yes">Dateien löschen</string>
3838
<string name="master_delete_fail">Fehler beim Löschen der Moduldateien</string>
39-
<string name="module_id_prefix">" "</string>
4039
<string name="install_from_storage">Module aus dem Speicher installieren</string>
4140
<string name="invalid_format">Das ausgewählte Modul hat ein ungültiges Format</string>
4241
<string name="local_install_title">Lokale Installation</string>

app/src/main/res/values/strings.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<string name="module_id_prefix">Module ID: </string>
7575
<string name="install_from_storage">Install module from storage</string>
7676
<string name="invalid_format">The selected module has an invalid format</string>
77+
<string name="low_quality_module">Low-quality module</string>
7778
<string name="local_install_title">Local install</string>
7879
<string name="source_code">Source code</string>
7980
<string name="magisk_builtin_module">Magisk built-in module</string>
@@ -105,7 +106,10 @@
105106
terminal extensions.\nUseful if a module misuses Fox\'s Mmm extensions.
106107
</string>
107108
<string name="wrap_text_pref">Text wrapping</string>
108-
<string name="wrap_text_desc">" Show text on multiple lines instead of putting all text on the same line when installing a module. "</string>
109+
<string name="wrap_text_desc">
110+
Show text on multiple lines instead of putting
111+
all text on the same line when installing a module.
112+
</string>
109113
<string name="enable_blur_pref">Blur</string>
110114
<string name="disable_chips_in_description">Disable chips in description</string>
111115
<string name="repo_enabled">Repo on</string>

0 commit comments

Comments
 (0)