Cleanup about screen.

This commit is contained in:
Erik C. Thauvin 2020-07-28 03:18:42 -07:00
parent 0a02198f5f
commit 95967532aa
3 changed files with 39 additions and 10 deletions

View file

@ -9,7 +9,7 @@
[![TES Remote Programmer](https://github.com/ethauvin/TESRemoteProgrammer/raw/master/images/github_graphic.png)](httpd://mobile.thauvin.net/android/) [![TES Remote Programmer](https://github.com/ethauvin/TESRemoteProgrammer/raw/master/images/github_graphic.png)](httpd://mobile.thauvin.net/android/)
Program your Telephone Entry System remotely (off-site) using your phone. Easily program your Telephone Entry System remotely from anywhere using your phone.
Most Telephone Entry Systems can be programmed from the front keypad or remotely from an off-premise location using any touch-tone phone. TES Remote Programmer streamlines the often cumbersome remote programming process by providing data entry screens and automated dial-in options. Most Telephone Entry Systems can be programmed from the front keypad or remotely from an off-premise location using any touch-tone phone. TES Remote Programmer streamlines the often cumbersome remote programming process by providing data entry screens and automated dial-in options.

View file

@ -25,8 +25,13 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import mehdi.sakout.aboutpage.AboutPage import mehdi.sakout.aboutpage.AboutPage
import mehdi.sakout.aboutpage.Element import mehdi.sakout.aboutpage.Element
import net.thauvin.erik.android.tesremoteprogrammer.util.fromHtml import org.jetbrains.anko.design.snackbar
import java.util.Calendar import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.*
/** /**
* The <code>net.thauvin.erik.android.tesremoteprogrammer.AboutActivity</code> class. * The <code>net.thauvin.erik.android.tesremoteprogrammer.AboutActivity</code> class.
@ -36,6 +41,9 @@ import java.util.Calendar
* @since 1.0 * @since 1.0
*/ */
class AboutActivity : AppCompatActivity() { class AboutActivity : AppCompatActivity() {
private val dateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(BuildConfig.TIMESTAMP),
ZoneId.of("America/Los_Angeles"))
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
@ -47,15 +55,14 @@ class AboutActivity : AppCompatActivity() {
val aboutPage = AboutPage(this).apply { val aboutPage = AboutPage(this).apply {
isRTL(false) isRTL(false)
setImage(R.drawable.background_splash) setImage(R.drawable.background_splash)
val version = String.format(getString(R.string.about_version), BuildConfig.VERSION_NAME) setDescription(getString(R.string.about_description))
setDescription( addItem(getVersion())
"<strong>$version</strong><br><small>&copy; ${Calendar.getInstance().get(Calendar.YEAR)} Erik C. Thauvin</small>".fromHtml()
)
addEmail("erik@thauvin.net") addEmail("erik@thauvin.net")
addGitHub("ethauvin/TESRemoteProgrammer") addGitHub("ethauvin/TESRemoteProgrammer")
addWebsite("https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml") addWebsite("https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml")
addItem(getPrivacyPolicy()) addItem(getPrivacyPolicy())
addTwitter("ethauvin") addTwitter("ethauvin")
addItem(getCopyright())
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
addItem(getCrashTest()) addItem(getCrashTest())
@ -76,6 +83,16 @@ class AboutActivity : AppCompatActivity() {
} }
} }
private fun getCopyright(): Element {
return Element().apply {
title = "© ${Calendar.getInstance().get(Calendar.YEAR)} Erik C. Thauvin"
intent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://m.thauvin.net/android/")
)
}
}
private fun getPrivacyPolicy(): Element { private fun getPrivacyPolicy(): Element {
return Element().apply { return Element().apply {
title = getString(R.string.about_privacy) title = getString(R.string.about_privacy)
@ -88,4 +105,14 @@ class AboutActivity : AppCompatActivity() {
) )
} }
} }
private fun getVersion(): Element {
val dateTimeFormatter = DateTimeFormatter.ofPattern(getString(R.string.about_built_on))
return Element().apply {
title = String.format(getString(R.string.about_version), BuildConfig.VERSION_NAME)
onClickListener = View.OnClickListener {
it.snackbar(dateTime.format(dateTimeFormatter))
}
}
}
} }

View file

@ -7,7 +7,9 @@
<item quantity="one">property</item> <item quantity="one">property</item>
<item quantity="other">properties</item> <item quantity="other">properties</item>
</plurals> </plurals>
<string name="about_description">Easily program your Telephone Entry System remotely from anywhere using your phone.</string>
<string name="about_version">Version <xliff:g id="version">%1$s</xliff:g></string> <string name="about_version">Version <xliff:g id="version">%1$s</xliff:g></string>
<string name="about_built_on">\'Built on\' YYYY-MM-dd \'at\' HH:mm zzz</string>
<string name="about_contact_us">Contact me</string> <string name="about_contact_us">Contact me</string>
<string name="about_github">Documentation on GitHub</string> <string name="about_github">Documentation on GitHub</string>
<string name="about_twitter">Follow me on Twitter</string> <string name="about_twitter">Follow me on Twitter</string>