You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.6 KiB
Kotlin

package com.cyb3rko.techniklogger.utils
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.cyb3rko.techniklogger.BuildConfig
import com.cyb3rko.techniklogger.R
import com.mikepenz.aboutlibraries.LibsBuilder
import mehdi.sakout.aboutpage.AboutPage
import mehdi.sakout.aboutpage.Element
class About : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
val aboutPage: View = AboutPage(this)
.setImage(R.mipmap.ic_launcher_foreground)
.setDescription("App zur Vereinfachung des Protokollierens aller Technik-Einsätze")
.addItem(Element().setTitle("Version ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
.setIconDrawable(R.drawable.about_icon_github))
.addGroup("Credits")
.addItem(Element().setTitle("Benutzte Libraries").setIconDrawable(R.drawable._icon_libraries).setOnClickListener(showLibraries()))
// .addItem(Element().setTitle("Benutzte Icons").setIconDrawable(R.drawable._icon_question).setOnClickListener {
// startActivity(Intent(applicationContext, IconCredits::class.java))
// })
.create()
setContentView(aboutPage)
}
private fun showLibraries() : View.OnClickListener {
return View.OnClickListener {
LibsBuilder()
.withShowLoadingProgress(true)
.withAboutVersionShownCode(false)
.withAboutVersionShownName(false)
.withFields(R.string::class.java.fields)
.withAutoDetect(true)
.withAboutIconShown(false)
.withAboutVersionShown(false)
.withVersionShown(true)
.withLicenseDialog(true)
.withLicenseShown(true)
.withCheckCachedDetection(true)
.withSortEnabled(true)
.start(application)
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
when (item.itemId) {
android.R.id.home -> finish()
}
return super.onOptionsItemSelected(item)
}
}