Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding version and build number to About page. #547 #813

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions about/src/main/java/io/plaidapp/about/ui/model/AboutViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import io.plaidapp.about.ui.AboutStyler
import io.plaidapp.core.util.event.Event
import kotlin.LazyThreadSafetyMode.NONE

typealias AppBuildConfig = io.plaidapp.BuildConfig

/**
* [ViewModel] for the [io.plaidapp.about.ui.AboutActivity].
*/
Expand Down Expand Up @@ -66,7 +68,17 @@ internal class AboutViewModel(
R.string.about_plaid_2,
linksColor, highlightColor
)
spannableFrom(about0, "\n\n", about1, "\n\n", about2)

val about3 = getSpannableFromMarkdownWithString(
resources.getString(
R.string.about_plaid_3,
AppBuildConfig.VERSION_NAME,
AppBuildConfig.VERSION_CODE
),
linksColor, highlightColor
)

spannableFrom(about0, "\n\n", about1, "\n\n", about2, "\n\n", about3)
}
}

Expand Down Expand Up @@ -196,10 +208,24 @@ internal class AboutViewModel(
@StringRes stringId: Int,
linksColor: ColorStateList,
@ColorInt highlightColor: Int
): Spannable {
return getSpannableFromMarkdownWithString(
resources.getString(stringId),
linksColor,
highlightColor
)
}

private fun getSpannableFromMarkdownWithString(
string: String,
linksColor: ColorStateList,
@ColorInt highlightColor: Int
): Spannable {
return markdown.markdownToSpannable(
resources.getString(stringId), linksColor,
highlightColor, null
string,
linksColor,
highlightColor,
null
).toSpannable()
}

Expand Down
1 change: 1 addition & 0 deletions about/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<string name="about_plaid_0">Plaid is a source of design news &amp; inspiration that serves as a concrete example of [material design principles](https://www.google.com/design/spec/material-design/introduction.html#introduction-principles). Plaid pulls data from [Designer News](https://www.designernews.co/), [Dribbble](https://dribbble.com/) &amp; [Product Hunt](https://www.producthunt.com/); it is in no way an official client for these services nor endorsed by them. It is rather good&#160;though.</string>
<string name="about_plaid_1">Plaid is written by [Nick&#160;Butcher](http://twitter.com/crafty), [Florina&#160;Muntenescu](http://twitter.com/fmuntenescu), [Ben&#160;Weiss](http://twitter.com/keyboardsurfer), [Tiem&#160;Song](http://twitter.com/tiembo), [Manuel Vivo](https://twitter.com/manuelvicnt) and the Android community.</string>
<string name="about_plaid_2">The source code is available on [GitHub](http://github.com/nickbutcher/plaid).</string>
<string name="about_plaid_3">Version: %1$s Build: %2$d</string>
<string name="about_icon">"Plaid\'s icon is lovingly crafted by the inimitable [Roman&#160;Nurik"](http://twitter.com/romannurik)</string>
<string name="about_libs_intro">Plaid is built with the help of these awesome&#160;libraries</string>
<string name="about_lib_link">website</string>
Expand Down