Account activity redesign (#662)

* Refactor-all-the-things version of the fix for issue #573

* Migrate SpanUtils to kotlin because why not

* Minimal fix for issue #573

* Add tests for compose spanning

* Clean up code suggestions

* Make FakeSpannable.getSpans implementation less awkward

* Add secondary validation pass for urls

* Address code review feedback

* Fixup type filtering in FakeSpannable again

* Make all mentions in compose activity use the default link color

* new layout for AccountActivity

* fix the light theme

* convert AccountActivity to Kotlin

* introduce AccountViewModel

* Merge branch 'master' into account-activity-redesign

# Conflicts:
#	app/src/main/java/com/keylesspalace/tusky/AccountActivity.java

* add Bot badge to profile

* parse custom emojis in usernames

* add possibility to cancel follow request

* add third tab on profiles

* add account fields to profile

* add support for moved accounts

* set click listener on account moved view

* fix tests

* use 24dp as statusbar size

* add ability to hide reblogs from followed accounts

* add button to edit own account to AccountActivity

* set toolbar top margin programmatically

* fix crash

* add shadow behind statusbar

* introduce ViewExtensions to clean up code

* move code out of offsetChangedListener for perf reasons

* clean up stuff

* add error handling

* improve type safety

* fix ConstraintLayout warning

* remove unneeded ressources

* fix event dispatching

* fix crash in event handling

* set correct emoji on title

* improve some things

* wrap follower/foillowing/status views
This commit is contained in:
Konrad Pozniak 2018-06-18 13:26:18 +02:00 committed by GitHub
commit 63f9d99390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 1422 additions and 978 deletions

View file

@ -15,7 +15,6 @@
package com.keylesspalace.tusky.entity
import android.annotation.SuppressLint
import android.os.Parcel
import android.os.Parcelable
import android.text.Spanned
@ -26,7 +25,6 @@ import kotlinx.android.parcel.Parceler
import kotlinx.android.parcel.Parcelize
import kotlinx.android.parcel.WriteWith
@SuppressLint("ParcelCreator")
@Parcelize
data class Account(
val id: String,
@ -41,7 +39,11 @@ data class Account(
@SerializedName("followers_count") val followersCount: Int,
@SerializedName("following_count") val followingCount: Int,
@SerializedName("statuses_count") val statusesCount: Int,
val source: AccountSource?
val source: AccountSource?,
val bot: Boolean,
val emojis: List<Emoji> = emptyList(),
val fields: List<Field> = emptyList(),
val moved: Account? = null
) : Parcelable {
@ -62,20 +64,25 @@ data class Account(
return account?.id == this.id
}
object SpannedParceler : Parceler<Spanned> {
override fun create(parcel: Parcel) = HtmlUtils.fromHtml(parcel.readString())
override fun Spanned.write(parcel: Parcel, flags: Int) {
parcel.writeString(HtmlUtils.toHtml(this))
}
}
}
@Parcelize
@SuppressLint("ParcelCreator")
data class AccountSource(
val privacy: Status.Visibility,
val sensitive: Boolean,
val note: String
): Parcelable
): Parcelable
@Parcelize
data class Field (
val name:String,
val value: @WriteWith<SpannedParceler>() Spanned
): Parcelable
object SpannedParceler : Parceler<Spanned> {
override fun create(parcel: Parcel): Spanned = HtmlUtils.fromHtml(parcel.readString())
override fun Spanned.write(parcel: Parcel, flags: Int) {
parcel.writeString(HtmlUtils.toHtml(this))
}
}

View file

@ -23,5 +23,6 @@ data class Relationship (
@SerializedName("followed_by") val followedBy: Boolean,
val blocking: Boolean,
val muting: Boolean,
val requested: Boolean
val requested: Boolean,
@SerializedName("showing_reblogs") val showingReblogs: Boolean
)