Warning, /network/kdeconnect-android/src/org/kde/kdeconnect/UserInterface/About/AboutKDEActivity.kt is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Maxim Leshchenko <cnmaks90@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 package org.kde.kdeconnect.UserInterface.About
0008 
0009 import android.os.Bundle
0010 import android.text.Html
0011 import android.text.Spanned
0012 import android.text.method.LinkMovementMethod
0013 import androidx.appcompat.app.AppCompatActivity
0014 import org.kde.kdeconnect_tp.R
0015 import org.kde.kdeconnect_tp.databinding.ActivityAboutKdeBinding
0016 
0017 class AboutKDEActivity : AppCompatActivity() {
0018     override fun onCreate(savedInstanceState: Bundle?) {
0019         super.onCreate(savedInstanceState)
0020 
0021         val binding = ActivityAboutKdeBinding.inflate(layoutInflater)
0022         setContentView(binding.root)
0023 
0024         setSupportActionBar(binding.toolbarLayout.toolbar)
0025         supportActionBar!!.setDisplayHomeAsUpEnabled(true)
0026         supportActionBar!!.setDisplayShowHomeEnabled(true)
0027 
0028         binding.aboutTextView.text = fromHtml(resources.getString(R.string.about_kde_about))
0029         binding.reportBugsOrWishesTextView.text = fromHtml(resources.getString(R.string.about_kde_report_bugs_or_wishes))
0030         binding.joinKdeTextView.text = fromHtml(resources.getString(R.string.about_kde_join_kde))
0031         binding.supportKdeTextView.text = fromHtml(resources.getString(R.string.about_kde_support_kde))
0032 
0033         binding.aboutTextView.movementMethod = LinkMovementMethod.getInstance()
0034         binding.reportBugsOrWishesTextView.movementMethod = LinkMovementMethod.getInstance()
0035         binding.joinKdeTextView.movementMethod = LinkMovementMethod.getInstance()
0036         binding.supportKdeTextView.movementMethod = LinkMovementMethod.getInstance()
0037     }
0038 
0039     private fun fromHtml(html: String): Spanned {
0040         return if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
0041             Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY)
0042         } else {
0043             @Suppress("DEPRECATION") Html.fromHtml(html)
0044         }
0045     }
0046 
0047     override fun onSupportNavigateUp(): Boolean {
0048         super.onBackPressed()
0049         return true
0050     }
0051 }