Update contributors in app

This commit is contained in:
topjohnwu 2022-06-02 06:08:47 -07:00
parent 5c6a7ffa6f
commit 2ed092c9db
9 changed files with 162 additions and 53 deletions

View File

@ -4,42 +4,63 @@ import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.databinding.RvItem import com.topjohnwu.magisk.databinding.RvItem
sealed class DeveloperItem { interface Dev {
abstract val items: List<IconLink>
abstract val name: Int
object Main : DeveloperItem() {
override val items =
listOf(
IconLink.Twitter.Main,
IconLink.Patreon,
IconLink.PayPal.Main,
IconLink.Github
)
override val name get() = R.string.topjohnwu
}
object App : DeveloperItem() {
override val items =
listOf<IconLink>(
IconLink.Twitter.App,
IconLink.PayPal.App
)
override val name get() = R.string.diareuse
}
}
private interface Dev {
val name: String val name: String
} }
private interface MainDev: Dev { private interface JohnImpl : Dev {
override val name get() = "topjohnwu" override val name get() = "topjohnwu"
} }
private interface AppDev: Dev { private interface VvbImpl : Dev {
override val name get() = "diareuse" override val name get() = "vvb2060"
}
private interface YUImpl : Dev {
override val name get() = "yujincheng08"
}
private interface RikkaImpl : Dev {
override val name get() = "RikkaW"
}
sealed class DeveloperItem : Dev {
abstract val items: List<IconLink>
val handle get() = "@${name}"
object John : DeveloperItem(), JohnImpl {
override val items =
listOf(
object : IconLink.Twitter(), JohnImpl {},
IconLink.Github.Project
)
}
object Vvb : DeveloperItem(), VvbImpl {
override val items =
listOf<IconLink>(
object : IconLink.Twitter(), VvbImpl {},
object : IconLink.Github.User(), VvbImpl {}
)
}
object YU : DeveloperItem(), YUImpl {
override val items =
listOf<IconLink>(
object : IconLink.Twitter() { override val name = "shanasaimoe" },
object : IconLink.Github.User(), YUImpl {},
object : IconLink.Sponsor(), YUImpl {}
)
}
object Rikka : DeveloperItem(), RikkaImpl {
override val items =
listOf<IconLink>(
object : IconLink.Twitter() { override val name = "rikkawww" },
object : IconLink.Github.User(), RikkaImpl {}
)
}
} }
sealed class IconLink : RvItem() { sealed class IconLink : RvItem() {
@ -50,14 +71,12 @@ sealed class IconLink : RvItem() {
override val layoutRes get() = R.layout.item_icon_link override val layoutRes get() = R.layout.item_icon_link
sealed class PayPal : IconLink(), Dev { abstract class PayPal : IconLink(), Dev {
override val icon get() = R.drawable.ic_paypal override val icon get() = R.drawable.ic_paypal
override val title get() = R.string.paypal override val title get() = R.string.paypal
override val link get() = "https://paypal.me/$name" override val link get() = "https://paypal.me/$name"
object App : PayPal(), AppDev object Project : PayPal() {
object Main : PayPal() {
override val name: String get() = "magiskdonate" override val name: String get() = "magiskdonate"
} }
} }
@ -68,19 +87,28 @@ sealed class IconLink : RvItem() {
override val link get() = Const.Url.PATREON_URL override val link get() = Const.Url.PATREON_URL
} }
sealed class Twitter : IconLink(), Dev { abstract class Twitter : IconLink(), Dev {
override val icon get() = R.drawable.ic_twitter override val icon get() = R.drawable.ic_twitter
override val title get() = R.string.twitter override val title get() = R.string.twitter
override val link get() = "https://twitter.com/$name" override val link get() = "https://twitter.com/$name"
object App : Twitter(), AppDev
object Main : Twitter(), MainDev
} }
object Github : IconLink() { abstract class Github : IconLink() {
override val icon get() = R.drawable.ic_github override val icon get() = R.drawable.ic_github
override val title get() = R.string.home_item_source override val title get() = R.string.github
override val link get() = Const.Url.SOURCE_CODE_URL
abstract class User : Github(), Dev {
override val link get() = "https://github.com/$name"
}
object Project : Github() {
override val link get() = Const.Url.SOURCE_CODE_URL
}
}
abstract class Sponsor : IconLink(), Dev {
override val icon get() = R.drawable.ic_favorite
override val title get() = R.string.github
override val link get() = "https://github.com/sponsors/$name"
} }
} }

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

View File

@ -11,6 +11,8 @@
<import type="com.topjohnwu.magisk.ui.home.DeveloperItem" /> <import type="com.topjohnwu.magisk.ui.home.DeveloperItem" />
<import type="com.topjohnwu.magisk.ui.home.IconLink" />
<variable <variable
name="viewModel" name="viewModel"
type="com.topjohnwu.magisk.ui.home.HomeViewModel" /> type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
@ -131,14 +133,17 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_margin="@dimen/l1" android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:layout_marginTop="@dimen/l1"
android:focusable="false"> android:focusable="false">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="@dimen/l1"> android:paddingTop="@dimen/l1"
android:paddingBottom="@dimen/l1">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -157,8 +162,58 @@
android:text="@string/home_support_content" android:text="@string/home_support_content"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant" /> android:textAppearance="@style/AppearanceFoundation.Caption.Variant" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/l_50" >
<include
item="@{IconLink.Patreon.INSTANCE}"
layout="@layout/item_icon_link"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<include
item="@{IconLink.PayPal.Project.INSTANCE}"
layout="@layout/item_icon_link"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="@dimen/l1"
android:focusable="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/l1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:text="@string/home_follow_title"
android:textAppearance="@style/AppearanceFoundation.Title" />
<include <include
item="@{DeveloperItem.Main.INSTANCE}" item="@{DeveloperItem.John.INSTANCE}"
layout="@layout/item_developer" layout="@layout/item_developer"
viewModel="@{viewModel}" viewModel="@{viewModel}"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -166,7 +221,23 @@
android:layout_marginTop="@dimen/l_50" /> android:layout_marginTop="@dimen/l_50" />
<include <include
item="@{DeveloperItem.App.INSTANCE}" item="@{DeveloperItem.Vvb.INSTANCE}"
layout="@layout/item_developer"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50" />
<include
item="@{DeveloperItem.YU.INSTANCE}"
layout="@layout/item_developer"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50" />
<include
item="@{DeveloperItem.Rikka.INSTANCE}"
layout="@layout/item_developer" layout="@layout/item_developer"
viewModel="@{viewModel}" viewModel="@{viewModel}"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -18,13 +18,15 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:padding="@dimen/l1" > android:gravity="center_vertical"
android:paddingStart="@dimen/l1"
android:paddingEnd="@dimen/l1">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@{item.name}" android:text="@{item.handle}"
android:textAppearance="@style/AppearanceFoundation.Caption" android:textAppearance="@style/AppearanceFoundation.Caption"
android:textStyle="bold" android:textStyle="bold"
tools:text="\@topjohnwu" /> tools:text="\@topjohnwu" />
@ -39,7 +41,6 @@
android:clipToPadding="false" android:clipToPadding="false"
android:fadingEdgeLength="@dimen/l1" android:fadingEdgeLength="@dimen/l1"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/l_50"
android:requiresFadingEdge="horizontal" android:requiresFadingEdge="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="3" tools:itemCount="3"

View File

@ -18,10 +18,10 @@
<FrameLayout <FrameLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless" android:background="?selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:minWidth="60dp" android:minWidth="48dp"
android:onClick="@{() -> viewModel.onLinkPressed(item.link)}" android:onClick="@{() -> viewModel.onLinkPressed(item.link)}"
android:padding="@dimen/l_50" android:padding="@dimen/l_50"
tools:layout_gravity="center"> tools:layout_gravity="center">

View File

@ -22,6 +22,7 @@
<string name="home_notice_content">仅从官方 GitHub 页面下载 Magisk。未知来源的文件可能具有恶意行为</string> <string name="home_notice_content">仅从官方 GitHub 页面下载 Magisk。未知来源的文件可能具有恶意行为</string>
<string name="home_support_title">支持开发</string> <string name="home_support_title">支持开发</string>
<string name="home_follow_title">追踪我们</string>
<string name="home_item_source">源代码</string> <string name="home_item_source">源代码</string>
<string name="home_support_content">Magisk 将一直保持免费且开源,向开发者捐赠以表示支持。</string> <string name="home_support_content">Magisk 将一直保持免费且开源,向开发者捐赠以表示支持。</string>
<string name="home_installed_version">当前</string> <string name="home_installed_version">当前</string>

View File

@ -21,7 +21,8 @@
<string name="home_app_title">應用程式</string> <string name="home_app_title">應用程式</string>
<string name="home_notice_content">請從官方的 Github 網頁下載 Magisk。從未知來源下載的檔案可能懷有惡意</string> <string name="home_notice_content">請從官方的 Github 網頁下載 Magisk。從未知來源下載的檔案可能懷有惡意</string>
<string name="home_support_title">支援我們</string> <string name="home_support_title">支持開發</string>
<string name="home_follow_title">追蹤我們</string>
<string name="home_item_source">原始碼</string> <string name="home_item_source">原始碼</string>
<string name="home_support_content">Magisk 無論現在和未來永遠是免費且開源。但您可以透過發送小額的抖內來彰顯您對我們的支持。</string> <string name="home_support_content">Magisk 無論現在和未來永遠是免費且開源。但您可以透過發送小額的抖內來彰顯您對我們的支持。</string>
<string name="home_installed_version">已安裝</string> <string name="home_installed_version">已安裝</string>

View File

@ -11,6 +11,7 @@
<string name="paypal" translatable="false">PayPal</string> <string name="paypal" translatable="false">PayPal</string>
<string name="patreon" translatable="false">Patreon</string> <string name="patreon" translatable="false">Patreon</string>
<string name="twitter" translatable="false">Twitter</string> <string name="twitter" translatable="false">Twitter</string>
<string name="github" translatable="false">GitHub</string>
<drawable name="ic_launcher">@drawable/ic_logo</drawable> <drawable name="ic_launcher">@drawable/ic_logo</drawable>

View File

@ -22,6 +22,7 @@
<string name="home_notice_content">Download Magisk ONLY from the official GitHub page. Files from unknown sources can be malicious!</string> <string name="home_notice_content">Download Magisk ONLY from the official GitHub page. Files from unknown sources can be malicious!</string>
<string name="home_support_title">Support Us</string> <string name="home_support_title">Support Us</string>
<string name="home_follow_title">Follow Us</string>
<string name="home_item_source">Source</string> <string name="home_item_source">Source</string>
<string name="home_support_content">Magisk is, and always will be, free, and open source. You can however show us that you care by making a donation.</string> <string name="home_support_content">Magisk is, and always will be, free, and open source. You can however show us that you care by making a donation.</string>
<string name="home_installed_version">Installed</string> <string name="home_installed_version">Installed</string>