mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-13 19:53:37 +00:00
Added info dialog for repos
This commit is contained in:
parent
f972f02fff
commit
a7f4496db7
@ -20,6 +20,7 @@ import com.topjohnwu.magisk.model.permissions.PermissionRequestBuilder
|
|||||||
import com.topjohnwu.magisk.utils.RxBus
|
import com.topjohnwu.magisk.utils.RxBus
|
||||||
import com.topjohnwu.magisk.utils.SafetyNetHelper
|
import com.topjohnwu.magisk.utils.SafetyNetHelper
|
||||||
import com.topjohnwu.magisk.view.MagiskDialog
|
import com.topjohnwu.magisk.view.MagiskDialog
|
||||||
|
import com.topjohnwu.magisk.view.MarkDownWindow
|
||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
import dalvik.system.DexFile
|
import dalvik.system.DexFile
|
||||||
import io.reactivex.Completable
|
import io.reactivex.Completable
|
||||||
@ -140,7 +141,12 @@ class ViewActionEvent(val action: Activity.() -> Unit) : ViewEvent(), ActivityEx
|
|||||||
|
|
||||||
class OpenFilePickerEvent : ViewEvent()
|
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 InstallModuleEvent(val item: Repo) : ViewEvent()
|
||||||
|
|
||||||
class PageChangedEvent : ViewEvent()
|
class PageChangedEvent : ViewEvent()
|
||||||
|
@ -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.RepoItem
|
||||||
import com.topjohnwu.magisk.model.entity.recycler.SectionTitle
|
import com.topjohnwu.magisk.model.entity.recycler.SectionTitle
|
||||||
import com.topjohnwu.magisk.model.events.InstallExternalModuleEvent
|
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.model.events.dialog.ModuleInstallDialog
|
||||||
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
import com.topjohnwu.magisk.redesign.compat.CompatViewModel
|
||||||
import com.topjohnwu.magisk.redesign.compat.Queryable
|
import com.topjohnwu.magisk.redesign.compat.Queryable
|
||||||
@ -252,6 +253,7 @@ class ModuleViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun installPressed() = InstallExternalModuleEvent().publish()
|
fun installPressed() = InstallExternalModuleEvent().publish()
|
||||||
|
fun infoPressed(item: RepoItem) = OpenChangelogEvent(item.item).publish()
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
10
app/src/main/res/drawable/ic_info.xml
Normal file
10
app/src/main/res/drawable/ic_info.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="?colorOnSurface"
|
||||||
|
android:pathData="M21 11.1V8C21 6.9 20.1 6 19 6H11L9 4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H10.2C11.4 21.8 13.6 23 16 23C19.9 23 23 19.9 23 16C23 14.1 22.2 12.4 21 11.1M9.3 18H3V8H19V9.7C18.1 9.2 17.1 9 16 9C12.1 9 9 12.1 9 16C9 16.7 9.1 17.4 9.3 18M16 21C13.2 21 11 18.8 11 16S13.2 11 16 11 21 13.2 21 16 18.8 21 16 21M17 14H15V12H17V14M17 20H15V15H17V20Z" />
|
||||||
|
</vector>
|
@ -46,12 +46,10 @@
|
|||||||
android:id="@+id/module_version_author"
|
android:id="@+id/module_version_author"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
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:text="@{@string/module_version_author(item.item.version ?? `?`, item.item.author ?? `?`)}"
|
||||||
android:textAppearance="?appearanceTextCaptionVariant"
|
android:textAppearance="?appearanceTextCaptionVariant"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="@+id/module_title"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="@+id/module_title"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/module_title"
|
app:layout_constraintTop_toBottomOf="@+id/module_title"
|
||||||
tools:text="v1 by topjohnwu" />
|
tools:text="v1 by topjohnwu" />
|
||||||
|
|
||||||
@ -81,20 +79,33 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/l1"
|
android:layout_marginStart="@dimen/l1"
|
||||||
android:layout_marginEnd="@dimen/l1"
|
android:text="@{item.item.lastUpdateString}"
|
||||||
android:text="@{@string/updated_on(item.item.lastUpdateString)}"
|
|
||||||
android:textAppearance="?appearanceTextCaptionVariant"
|
android:textAppearance="?appearanceTextCaptionVariant"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
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_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/module_divider"
|
app:layout_constraintTop_toBottomOf="@+id/module_divider"
|
||||||
tools:ignore="SmallSp"
|
tools:ignore="SmallSp"
|
||||||
tools:text="@string/updated_on" />
|
tools:text="@tools:sample/date/ddmmyy" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/module_info"
|
||||||
|
style="?styleIconNormal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:alpha=".5"
|
||||||
|
android:onClick="@{() -> viewModel.infoPressed(item)}"
|
||||||
|
android:paddingEnd="@dimen/l_50"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/module_download"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/module_download"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/module_download"
|
||||||
|
app:srcCompat="@drawable/ic_info" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/module_download"
|
android:id="@+id/module_download"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
style="?styleIconPrimary"
|
style="?styleIconPrimary"
|
||||||
|
android:paddingStart="@dimen/l_50"
|
||||||
isEnabled="@{!(item.progress == -100 || (item.progress > 0 && item.progress < 100))}"
|
isEnabled="@{!(item.progress == -100 || (item.progress > 0 && item.progress < 100))}"
|
||||||
android:contentDescription="@string/download"
|
android:contentDescription="@string/download"
|
||||||
android:onClick="@{() -> viewModel.download(item)}"
|
android:onClick="@{() -> viewModel.download(item)}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user