Verbessere Credits
parent
603fcd1797
commit
8096b4c4c1
@ -0,0 +1,53 @@
|
||||
package com.cyb3rko.techniklogger.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
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 AboutFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
|
||||
return AboutPage(context)
|
||||
.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 {
|
||||
findNavController().navigate(R.id.navigation_about_icons)
|
||||
})
|
||||
.create()
|
||||
}
|
||||
|
||||
private fun showLibraries() : View.OnClickListener {
|
||||
return View.OnClickListener {
|
||||
context?.let { trueContext ->
|
||||
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(trueContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.cyb3rko.techniklogger.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.cyb3rko.abouticons.AboutIcons
|
||||
import com.cyb3rko.techniklogger.R
|
||||
|
||||
class AboutIconsFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
|
||||
val aboutIcons = AboutIcons(requireContext(), R.drawable::class.java).setTitle("Benutzte Icons")
|
||||
return aboutIcons.get()
|
||||
}
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.cyb3rko.techniklogger.utils
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.cyb3rko.abouticons.AboutIcons
|
||||
import com.cyb3rko.techniklogger.R
|
||||
|
||||
class IconCredits : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContentView(AboutIcons(this, R.drawable::class.java).setTitle("Benutzte Icons").get())
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue