diff --git a/app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt b/app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt index 2d3342a64..1de24859a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt @@ -20,6 +20,7 @@ import com.topjohnwu.magisk.model.permissions.PermissionRequestBuilder import com.topjohnwu.magisk.utils.RxBus import com.topjohnwu.magisk.utils.SafetyNetHelper import com.topjohnwu.magisk.view.MagiskDialog +import com.topjohnwu.magisk.view.MarkDownWindow import com.topjohnwu.superuser.Shell import dalvik.system.DexFile import io.reactivex.Completable @@ -140,7 +141,12 @@ class ViewActionEvent(val action: Activity.() -> Unit) : ViewEvent(), ActivityEx class OpenFilePickerEvent : ViewEvent() -class OpenChangelogEvent(val item: Repo) : ViewEvent() +class OpenChangelogEvent(val item: Repo) : ViewEvent(), ContextExecutor { + override fun invoke(context: Context) { + MarkDownWindow.show(context, null, item.readme) + } +} + class InstallModuleEvent(val item: Repo) : ViewEvent() class PageChangedEvent : ViewEvent() diff --git a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt index b19f51c66..52d681208 100644 --- a/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/redesign/module/ModuleViewModel.kt @@ -20,6 +20,7 @@ import com.topjohnwu.magisk.model.entity.recycler.ModuleItem import com.topjohnwu.magisk.model.entity.recycler.RepoItem import com.topjohnwu.magisk.model.entity.recycler.SectionTitle import com.topjohnwu.magisk.model.events.InstallExternalModuleEvent +import com.topjohnwu.magisk.model.events.OpenChangelogEvent import com.topjohnwu.magisk.model.events.dialog.ModuleInstallDialog import com.topjohnwu.magisk.redesign.compat.CompatViewModel import com.topjohnwu.magisk.redesign.compat.Queryable @@ -252,6 +253,7 @@ class ModuleViewModel( } fun installPressed() = InstallExternalModuleEvent().publish() + fun infoPressed(item: RepoItem) = OpenChangelogEvent(item.item).publish() // --- diff --git a/app/src/main/res/drawable/ic_info.xml b/app/src/main/res/drawable/ic_info.xml new file mode 100644 index 000000000..ab24089b6 --- /dev/null +++ b/app/src/main/res/drawable/ic_info.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_repo_md2.xml b/app/src/main/res/layout/item_repo_md2.xml index 282031111..19093ef87 100644 --- a/app/src/main/res/layout/item_repo_md2.xml +++ b/app/src/main/res/layout/item_repo_md2.xml @@ -46,12 +46,10 @@ android:id="@+id/module_version_author" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/l1" - android:layout_marginEnd="@dimen/l1" android:text="@{@string/module_version_author(item.item.version ?? `?`, item.item.author ?? `?`)}" android:textAppearance="?appearanceTextCaptionVariant" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="@+id/module_title" + app:layout_constraintStart_toStartOf="@+id/module_title" app:layout_constraintTop_toBottomOf="@+id/module_title" tools:text="v1 by topjohnwu" /> @@ -81,20 +79,33 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="@dimen/l1" - android:layout_marginEnd="@dimen/l1" - android:text="@{@string/updated_on(item.item.lastUpdateString)}" + android:text="@{item.item.lastUpdateString}" android:textAppearance="?appearanceTextCaptionVariant" android:textSize="11sp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/module_download" + app:layout_constraintEnd_toStartOf="@+id/module_info" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/module_divider" tools:ignore="SmallSp" - tools:text="@string/updated_on" /> + tools:text="@tools:sample/date/ddmmyy" /> + +