mirror of
https://github.com/Michatec/michas-droid.git
synced 2026-05-30 18:02:43 +02:00
Add Open Collective
This commit is contained in:
@@ -19,6 +19,7 @@ data class Product(val repositoryId: Long, val packageName: String, val name: St
|
||||
data class Litecoin(val address: String): Donate()
|
||||
data class Flattr(val id: String): Donate()
|
||||
data class Liberapay(val id: String): Donate()
|
||||
data class OpenCollective(val id: String): Donate()
|
||||
}
|
||||
|
||||
class Screenshot(val locale: String, val type: Type, val path: String) {
|
||||
@@ -104,6 +105,10 @@ data class Product(val repositoryId: Long, val packageName: String, val name: St
|
||||
writeStringField("type", "liberapay")
|
||||
writeStringField("id", it.id)
|
||||
}
|
||||
is Donate.OpenCollective -> {
|
||||
writeStringField("type", "openCollective")
|
||||
writeStringField("id", it.id)
|
||||
}
|
||||
}::class
|
||||
}
|
||||
}
|
||||
@@ -189,6 +194,7 @@ data class Product(val repositoryId: Long, val packageName: String, val name: St
|
||||
"litecoin" -> Donate.Litecoin(address)
|
||||
"flattr" -> Donate.Flattr(id)
|
||||
"liberapay" -> Donate.Liberapay(id)
|
||||
"openCollective" -> Donate.OpenCollective(id)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ class IndexHandler(private val repositoryId: Long, private val callback: Callbac
|
||||
|
||||
internal object DonateComparator: Comparator<Product.Donate> {
|
||||
private val classes = listOf(Product.Donate.Regular::class, Product.Donate.Bitcoin::class,
|
||||
Product.Donate.Litecoin::class, Product.Donate.Flattr::class, Product.Donate.Liberapay::class)
|
||||
Product.Donate.Litecoin::class, Product.Donate.Flattr::class, Product.Donate.Liberapay::class,
|
||||
Product.Donate.OpenCollective::class)
|
||||
|
||||
override fun compare(donate1: Product.Donate, donate2: Product.Donate): Int {
|
||||
val index1 = classes.indexOf(donate1::class)
|
||||
@@ -247,6 +248,7 @@ class IndexHandler(private val repositoryId: Long, private val callback: Callbac
|
||||
"litecoin" -> productBuilder.donates += Product.Donate.Litecoin(content)
|
||||
"flattr" -> productBuilder.donates += Product.Donate.Flattr(content)
|
||||
"liberapay" -> productBuilder.donates += Product.Donate.Liberapay(content)
|
||||
"openCollective" -> productBuilder.donates += Product.Donate.OpenCollective(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ object IndexV1Parser {
|
||||
it.string("bitcoin") -> donates += Product.Donate.Bitcoin(valueAsString)
|
||||
it.string("flattrID") -> donates += Product.Donate.Flattr(valueAsString)
|
||||
it.string("liberapayID") -> donates += Product.Donate.Liberapay(valueAsString)
|
||||
it.string("openCollective") -> donates += Product.Donate.OpenCollective(valueAsString)
|
||||
it.dictionary("localized") -> forEachKey {
|
||||
if (it.token == JsonToken.START_OBJECT) {
|
||||
val locale = it.key
|
||||
|
||||
@@ -210,6 +210,7 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
is Product.Donate.Litecoin -> R.drawable.ic_donate_litecoin
|
||||
is Product.Donate.Flattr -> R.drawable.ic_donate_flattr
|
||||
is Product.Donate.Liberapay -> R.drawable.ic_donate_liberapay
|
||||
is Product.Donate.OpenCollective -> R.drawable.ic_donate_opencollective
|
||||
}
|
||||
|
||||
override fun getTitle(context: Context): String = when (donate) {
|
||||
@@ -218,14 +219,16 @@ class ProductAdapter(private val callbacks: Callbacks, private val columns: Int)
|
||||
is Product.Donate.Litecoin -> "Litecoin"
|
||||
is Product.Donate.Flattr -> "Flattr"
|
||||
is Product.Donate.Liberapay -> "Liberapay"
|
||||
is Product.Donate.OpenCollective -> "Open Collective"
|
||||
}
|
||||
|
||||
override val uri: Uri? = when (donate) {
|
||||
is Product.Donate.Regular -> Uri.parse(donate.url)
|
||||
is Product.Donate.Bitcoin -> Uri.parse("bitcoin:${donate.address}")
|
||||
is Product.Donate.Litecoin -> Uri.parse("liberapay:${donate.address}")
|
||||
is Product.Donate.Litecoin -> Uri.parse("litecoin:${donate.address}")
|
||||
is Product.Donate.Flattr -> Uri.parse("https://flattr.com/thing/${donate.id}")
|
||||
is Product.Donate.Liberapay -> Uri.parse("https://liberapay.com/~${donate.id}")
|
||||
is Product.Donate.OpenCollective -> Uri.parse("https://opencollective.com/${donate.id}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#ffffffff"
|
||||
android:pathData="M12 2A10 10 0 0 0 2 12A10 10 0 0 0 12 22A10 10 0 0 0 18.043 19.951L15.469 17.377A6.4 6.4 0 0 1 12
|
||||
18.4A6.4 6.4 0 0 1 5.6 12A6.4 6.4 0 0 1 12 5.6A6.4 6.4 0 0 1 15.465 6.627L18.047 4.045A10 10 0 0 0 12 2zM19.951
|
||||
5.957L17.377 8.531A6.4 6.4 0 0 1 18.4 12A6.4 6.4 0 0 1 17.373 15.465L19.955 18.047A10 10 0 0 0 22 12A10 10 0 0 0
|
||||
19.951 5.957z" />
|
||||
|
||||
</vector>
|
||||
Reference in New Issue
Block a user