Implemented new about activity.
This commit is contained in:
parent
5733dcb67f
commit
899657c3ae
9 changed files with 97 additions and 52 deletions
|
@ -62,12 +62,8 @@ dependencies {
|
|||
implementation "com.github.hotchemi:permissionsdispatcher:$perms_dispatch_version"
|
||||
kapt "com.github.hotchemi:permissionsdispatcher-processor:$perms_dispatch_version"
|
||||
|
||||
// https://github.com/eggheadgames/android-about-box
|
||||
implementation 'com.github.eggheadgames:android-about-box:1.3.2'
|
||||
//implementation(name: 'library-debug', ext: 'aar')
|
||||
//implementation 'com.github.daniel-stoneuk:material-about-library:2.2.1'
|
||||
implementation "com.android.support:animated-vector-drawable:$support_version"
|
||||
implementation "com.android.support:cardview-v7:$support_version"
|
||||
// https://github.com/medyo/android-about-page
|
||||
implementation 'com.github.medyo:android-about-page:1.2.5'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
<activity
|
||||
android:name=".StepsActivity"
|
||||
android:screenOrientation="landscape" />
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
android:parentActivityName=".MainActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
</application>
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* AboutActivity.kt
|
||||
*
|
||||
* Copyright 2016-2019 Erik C. Thauvin (erik@thauvin.net)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.thauvin.erik.android.tesremoteprogrammer
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.app.AppCompatDelegate
|
||||
import mehdi.sakout.aboutpage.AboutPage
|
||||
import mehdi.sakout.aboutpage.Element
|
||||
import java.util.Calendar
|
||||
|
||||
/**
|
||||
* The <code>net.thauvin.erik.android.tesremoteprogrammer.AboutActivity</code> class.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2019-09-27
|
||||
* @since 1.0
|
||||
*/
|
||||
class AboutActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
AppCompatDelegate.MODE_NIGHT_NO
|
||||
)
|
||||
|
||||
val aboutPage = AboutPage(this).apply {
|
||||
isRTL(false)
|
||||
setImage(R.drawable.background_splash)
|
||||
val version = String.format(getString(R.string.about_version), BuildConfig.VERSION_NAME)
|
||||
setDescription(
|
||||
"${version}\n© ${Calendar.getInstance().get(Calendar.YEAR)} Erik C. Thauvin️"
|
||||
)
|
||||
addEmail("erik@thauvin.net")
|
||||
addGitHub("ethauvin/TESRemoteProgrammer")
|
||||
addWebsite("https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml")
|
||||
addItem(getPrivacyPolicy())
|
||||
addTwitter("ethauvin")
|
||||
|
||||
}.create()
|
||||
|
||||
setContentView(aboutPage)
|
||||
}
|
||||
|
||||
private fun getPrivacyPolicy(): Element {
|
||||
return Element().apply {
|
||||
title = getString(R.string.about_privacy)
|
||||
iconDrawable = R.drawable.icons8_policy_document
|
||||
iconTint = R.color.about_github_color
|
||||
value = "privacy"
|
||||
intent = Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse("https://m.thauvin.net/apps-privacy.shtml")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,8 +38,6 @@ import android.view.inputmethod.InputMethodManager
|
|||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.EditText
|
||||
import com.eggheadgames.aboutbox.AboutConfig
|
||||
import com.eggheadgames.aboutbox.activity.AboutActivity
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonSyntaxException
|
||||
import net.thauvin.erik.android.tesremoteprogrammer.models.Config
|
||||
|
@ -69,15 +67,13 @@ import java.io.FileNotFoundException
|
|||
import java.io.InputStreamReader
|
||||
import java.io.ObjectInputStream
|
||||
import java.io.ObjectOutputStream
|
||||
import java.text.DateFormat
|
||||
import java.util.ArrayList
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
@RuntimePermissions
|
||||
class MainActivity : AppCompatActivity(), AnkoLogger {
|
||||
private lateinit var config: Config
|
||||
private val aboutConfig: AboutConfig = AboutConfig.getInstance()
|
||||
// private val aboutConfig: AboutConfig = AboutConfig.getInstance()
|
||||
private val configurationsData = "configurations.dat"
|
||||
private val currentConfigData = "config.dat"
|
||||
private val defaultConfigurations = listOf(
|
||||
|
@ -127,39 +123,6 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
saveConfigurations(confs)
|
||||
saveConfig(false)
|
||||
}
|
||||
|
||||
// About dialog configuration
|
||||
with(aboutConfig) {
|
||||
appName = getString(R.string.app_name)
|
||||
appIcon = R.mipmap.ic_launcher
|
||||
|
||||
version = BuildConfig.VERSION_NAME
|
||||
|
||||
author = "Erik C. Thauvin"
|
||||
|
||||
extraTitle = "Last Update"
|
||||
extra = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault())
|
||||
.format(Date(BuildConfig.TIMESTAMP)).toString()
|
||||
|
||||
emailAddress = "erik@thauvin.net"
|
||||
emailSubject = "${getString(R.string.app_name)} ${BuildConfig.VERSION_NAME} Support"
|
||||
emailBody = ""
|
||||
|
||||
packageName = applicationContext.packageName
|
||||
buildType = AboutConfig.BuildType.GOOGLE
|
||||
shareMessage = "https://play.google.com/store/apps/details?id=$packageName"
|
||||
|
||||
appPublisher = "6626207141685878216"
|
||||
aboutLabelTitle = "About Erik C. Thauvin"
|
||||
companyHtmlPath = "https://m.thauvin.net/"
|
||||
|
||||
twitterUserName = "ethauvin"
|
||||
webHomePage = "https://thauv.in/TESRemote"
|
||||
|
||||
privacyHtmlPath = "https://m.thauvin.net/apps-privacy.shtml"
|
||||
acknowledgmentHtmlPath =
|
||||
"https://m.thauvin.net/android/TESRemoteProgrammer/licenses.shtml"
|
||||
}
|
||||
}
|
||||
|
||||
@NeedsPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
|
@ -343,7 +306,7 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
|
|||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
R.id.action_about -> {
|
||||
AboutActivity.launch(this)
|
||||
startActivity(Intent(this, AboutActivity::class.java))
|
||||
}
|
||||
R.id.action_confs -> {
|
||||
val confs = loadConfigurations().configs.toSortedMap()
|
||||
|
|
|
@ -396,7 +396,8 @@ class ProgrammingActivity : AppCompatActivity(), AnkoLogger {
|
|||
return isValid
|
||||
}
|
||||
|
||||
private fun validateSize(size: Int, min: Int, max: Int): Boolean = if (min > 0) {
|
||||
private fun validateSize(size: Int, min: Int, max: Int): Boolean =
|
||||
if (min > 0) {
|
||||
size in IntRange(min, max)
|
||||
} else {
|
||||
size == max
|
||||
|
|
BIN
app/src/main/res/drawable-mdpi/icons8_policy_document.png
Normal file
BIN
app/src/main/res/drawable-mdpi/icons8_policy_document.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 300 B |
BIN
app/src/main/res/drawable-xhdpi/icons8_policy_document.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/icons8_policy_document.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 487 B |
BIN
app/src/main/res/drawable-xxxhdpi/icons8_policy_document.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/icons8_policy_document.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 814 B |
|
@ -7,6 +7,12 @@
|
|||
<item quantity="one">property</item>
|
||||
<item quantity="other">properties</item>
|
||||
</plurals>
|
||||
<string name="about_version">Version <xliff:g id="version">%1$s</xliff:g></string>
|
||||
<string name="about_contact_us">Contact me</string>
|
||||
<string name="about_github">Documentation on GitHub</string>
|
||||
<string name="about_twitter">Follow me on Twitter</string>
|
||||
<string name="about_website">Open Source Licenses</string>
|
||||
<string name="about_privacy">Privacy Policy</string>
|
||||
<string name="action_about">About</string>
|
||||
<string name="action_config">Configurations</string>
|
||||
<string name="alert_config_error">Configuration Errors</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue