chore: Remove obsolete LicenseCard code (#399)

Unnecessary since the use of `aboutlibraries`
This commit is contained in:
Nik Clayton 2024-01-30 16:39:19 +01:00 committed by GitHub
parent 74ca756323
commit 358af13dfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 140 deletions

View File

@ -3688,39 +3688,6 @@
column="10"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1=" &lt;TextView"
errorLine2=" ~~~~~~~~">
<location
file="src/main/res/layout/card_license.xml"
line="15"
column="10"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1=" &lt;TextView"
errorLine2=" ~~~~~~~~">
<location
file="src/main/res/layout/card_license.xml"
line="22"
column="10"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1=" &lt;TextView"
errorLine2=" ~~~~~~~~">
<location
file="src/main/res/layout/card_license.xml"
line="28"
column="10"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"

View File

@ -1,65 +0,0 @@
/* Copyright 2018 Conny Duck
*
* This file is a part of Pachli.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Pachli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Pachli; if not,
* see <http://www.gnu.org/licenses>.
*/
package app.pachli.view
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.core.content.res.use
import app.pachli.core.activity.openLink
import app.pachli.core.common.extensions.hide
import app.pachli.core.designsystem.R as DR
import app.pachli.databinding.CardLicenseBinding
import com.google.android.material.card.MaterialCardView
import com.google.android.material.color.MaterialColors
class LicenseCard
@JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
) : MaterialCardView(context, attrs, defStyleAttr) {
init {
val binding = CardLicenseBinding.inflate(LayoutInflater.from(context), this)
setCardBackgroundColor(MaterialColors.getColor(context, com.google.android.material.R.attr.colorSurface, Color.BLACK))
val (name, license, link) = context.theme.obtainStyledAttributes(
attrs,
DR.styleable.LicenseCard,
0,
0,
).use { a ->
Triple(
a.getString(DR.styleable.LicenseCard_name),
a.getString(DR.styleable.LicenseCard_license),
a.getString(DR.styleable.LicenseCard_link),
)
}
binding.licenseCardName.text = name
binding.licenseCardLicense.text = license
if (link.isNullOrBlank()) {
binding.licenseCardLink.hide()
} else {
binding.licenseCardLink.text = link
setOnClickListener { context.openLink(link) }
}
}
}

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:layout_height="wrap_content"
tools:layout_width="match_parent"
tools:parentTag="com.google.android.material.card.MaterialCardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/licenseCardName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:textColor="?android:attr/textColorSecondary" />
<TextView
android:id="@+id/licenseCardLicense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorTertiary" />
<TextView
android:id="@+id/licenseCardLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?colorAccent" />
</LinearLayout>
</merge>

View File

@ -6,13 +6,6 @@
<attr name="android:text"/>
</declare-styleable>
<declare-styleable name="LicenseCard">
<attr name="name" format="string|reference" />
<attr name="license" format="string|reference" />
<attr name="link" format="string|reference" />
<attr name="description" format="string|reference" />
</declare-styleable>
<declare-styleable name="SliderPreference">
<attr name="android:value" format="string|reference" />
<attr name="android:valueFrom" format="string|reference" />