Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions COPYING.icons
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ The token thumbnails token_image_*.xml in token-images library are from andOTP
Copyright (C) 2017-2020 Jakob Nixdorf <andotp@shadowice.org>
Copyright (C) 2015 Bruno Bierbaumer

The token thumbnail token_image_forgejo.xml in token-images library is adapted
from the Forgejo logo by Caesar Schinas, licensed under Creative Commons
Attribution-ShareAlike 4.0 International.

* https://commons.wikimedia.org/wiki/File:Forgejo_logo.svg
* https://creativecommons.org/licenses/by-sa/4.0/

The token thumbnail token_image_group_office.xml in token-images library is
adapted from the GroupOffice logo published by Intermesh on the official
GroupOffice website.

* https://www.group-office.com/assets/ico/group-office.svg

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to
Expand All @@ -29,5 +42,3 @@ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.


Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum class TokenImage(val resource: Int,
Firefox(R.drawable.token_image_firefox),
Flight(R.drawable.token_image_flight_takeoff),
Floatplane(R.drawable.token_image_floatplane),
Forgejo(R.drawable.token_image_forgejo),
Friendica(R.drawable.token_image_friendica),
Fritz(R.drawable.token_image_fritz),
Gamepad(R.drawable.token_image_gamepad),
Expand All @@ -102,6 +103,7 @@ enum class TokenImage(val resource: Int,
GoDaddy(R.drawable.token_image_godaddy),
Gogs(R.drawable.token_image_gogs),
Google(R.drawable.token_image_google),
GroupOffice(R.drawable.token_image_group_office, "Group Office"),
GovUK(R.drawable.token_image_govuk),
Grav(R.drawable.token_image_grav),
Greenhost(R.drawable.token_image_greenhost),
Expand Down Expand Up @@ -267,14 +269,18 @@ enum class TokenImage(val resource: Int,
}

fun TokenImage.matchToken(issuer: String?, label: String?): Boolean {
val issuerToMatch = this.issuer ?: this.name
val issuersToMatch = listOfNotNull(this.issuer, this.name).distinct()

val issuerMatched = issuer?.lowercase(Locale.getDefault())
?.contains(issuerToMatch.lowercase(Locale.getDefault())) ?: false
val issuerMatched = issuersToMatch.any { issuerToMatch ->
issuer?.lowercase(Locale.getDefault())
?.contains(issuerToMatch.lowercase(Locale.getDefault())) ?: false
}

return if (!issuerMatched && this.alsoMatchLabel) {
label?.lowercase(Locale.getDefault())
?.contains(issuerToMatch.lowercase(Locale.getDefault())) ?: false
issuersToMatch.any { issuerToMatch ->
label?.lowercase(Locale.getDefault())
?.contains(issuerToMatch.lowercase(Locale.getDefault())) ?: false
}
} else {
issuerMatched
}
Expand Down
31 changes: 31 additions & 0 deletions token-images/src/main/res/drawable/token_image_forgejo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="212"
android:viewportHeight="212">
<path
android:fillColor="@android:color/transparent"
android:pathData="M64,174 L64,76 A50,50 0,0,1 114,26 L134,26"
android:strokeColor="#ff6600"
android:strokeWidth="25" />
<path
android:fillColor="@android:color/transparent"
android:pathData="M64,174 L64,144 A50,50 0,0,1 114,94 L134,94"
android:strokeColor="#d40000"
android:strokeWidth="25" />
<path
android:fillColor="@android:color/transparent"
android:pathData="M166,26 A18,18 0,1,0 130,26 A18,18 0,1,0 166,26"
android:strokeColor="#ff6600"
android:strokeWidth="15" />
<path
android:fillColor="@android:color/transparent"
android:pathData="M166,94 A18,18 0,1,0 130,94 A18,18 0,1,0 166,94"
android:strokeColor="#d40000"
android:strokeWidth="15" />
<path
android:fillColor="@android:color/transparent"
android:pathData="M82,186 A18,18 0,1,0 46,186 A18,18 0,1,0 82,186"
android:strokeColor="#d40000"
android:strokeWidth="15" />
</vector>
53 changes: 53 additions & 0 deletions token-images/src/main/res/drawable/token_image_group_office.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="60"
android:viewportHeight="60">
<path
android:fillColor="@android:color/transparent"
android:pathData="M12,1.75 H48 A10.25,10.25 0,0,1 58.25,12 V48 A10.25,10.25 0,0,1 48,58.25 H12 A10.25,10.25 0,0,1 1.75,48 V12 A10.25,10.25 0,0,1 12,1.75 Z"
android:strokeColor="#1a4b8e"
android:strokeWidth="3.5" />
<group
android:translateX="-530.164"
android:translateY="-762.477">
<path
android:fillColor="#1652a1"
android:pathData="M577.155,782.093a4.756,4.756 0,1 1,-4.756 -4.756,4.756 4.756,0 0,1 4.756,4.756h0" />
</group>
<group
android:translateX="-530.044"
android:translateY="-760.294">
<path
android:fillColor="#1652a1"
android:pathData="M575.865,802.71a3.193,3.193 0,0 1,-3.028 3.338h-1.431a3.2,3.2 0,0 1,-3.015 -3.338V790.946a3.21,3.21 0,0 1,3.015 -3.352H572.8a3.21,3.21 0,0 1,3.019 3.357v11.765Z" />
</group>
<group
android:translateX="-531.81"
android:translateY="-762.477">
<path
android:fillColor="#1652a1"
android:pathData="M566.884,782.093a4.756,4.756 0,1 1,-4.756 -4.756,4.756 4.756,0 0,1 4.756,4.756h0" />
</group>
<group
android:translateX="-531.697"
android:translateY="-760.294">
<path
android:fillColor="#1652a1"
android:pathData="M565.548,802.71a3.185,3.185 0,0 1,-3.007 3.338H561.1a3.181,3.181 0,0 1,-3.02 -3.323V790.946a3.2,3.2 0,0 1,3.02 -3.352h1.447a3.2,3.2 0,0 1,3.007 3.352Z" />
</group>
<group
android:translateX="-533.464"
android:translateY="-762.477">
<path
android:fillColor="#1652a1"
android:pathData="M556.564,782.093a4.756,4.756 0,1 1,-4.756 -4.756h0a4.756,4.756 0,0 1,4.756 4.756" />
</group>
<group
android:translateX="-533.346"
android:translateY="-760.294">
<path
android:fillColor="#1652a1"
android:pathData="M555.226,802.71a3.185,3.185 0,0 1,-3.007 3.338h-1.409a3.181,3.181 0,0 1,-3.02 -3.323V790.946a3.2,3.2 0,0 1,3.02 -3.352h1.434a3.2,3.2 0,0 1,3.02 3.352h0V802.71Z" />
</group>
</vector>