Ergänze weitere Animationen
parent
c8523a9e9a
commit
9b9993f2ad
File diff suppressed because one or more lines are too long
@ -0,0 +1,48 @@
|
||||
package com.cyb3rko.techniklogger.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.text.style.ClickableSpan
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.ScrollView
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
|
||||
class AboutAnimationsFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
val myContext = requireContext()
|
||||
val information = listOf(
|
||||
Triple("Technical Assistance", "Jesús Suárez", "https://lottiefiles.com/29410-technical-assistance"),
|
||||
Triple("No connection animation", "Lenny Miranda Jr.", "https://lottiefiles.com/9010-no-connection-animation")
|
||||
)
|
||||
val view = ScrollView(myContext)
|
||||
val linearLayout = LinearLayout(myContext)
|
||||
linearLayout.orientation = LinearLayout.VERTICAL
|
||||
information.forEach {
|
||||
val textView = TextView(myContext)
|
||||
textView.textSize = 18f
|
||||
textView.setPaddingRelative(40, 50, 40, 0)
|
||||
val text = "${it.first}-Animation von ${it.second}"
|
||||
val spannableString = SpannableString(text)
|
||||
val clickableSpan = object: ClickableSpan() {
|
||||
override fun onClick(widget: View) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.third)))
|
||||
}
|
||||
}
|
||||
spannableString.setSpan(clickableSpan, 0, it.first.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
|
||||
textView.text = spannableString
|
||||
textView.movementMethod = LinkMovementMethod.getInstance()
|
||||
linearLayout.addView(textView)
|
||||
}
|
||||
view.addView(linearLayout)
|
||||
return view
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue