Show "remote profile" message. (#873)

* Show "remote profile" message. Closes #806

* Improve remote message look
This commit is contained in:
Ivan Kupalov 2018-10-03 21:53:31 +02:00 committed by Konrad Pozniak
parent a0988dc6c6
commit 6051ffe0b3
6 changed files with 30 additions and 10 deletions

View file

@ -361,6 +361,13 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
accountFragmentViewPager.hide()
}
if (account.isRemote()) {
accountRemoveView.show()
accountRemoveView.setOnClickListener {
LinkHelper.openLink(account.url, this)
}
}
val numberFormat = NumberFormat.getNumberInstance()
accountFollowersTextView.text = numberFormat.format(account.followersCount)
accountFollowingTextView.text = numberFormat.format(account.followingCount)

View file

@ -64,6 +64,7 @@ data class Account(
return account?.id == this.id
}
fun isRemote(): Boolean = this.username != this.localUsername
}
@Parcelize

View file

@ -11,9 +11,5 @@ fun View.hide() {
}
fun View.visible(visible: Boolean) {
this.visibility = if(visible) {
View.VISIBLE
} else {
View.GONE
}
this.visibility = if (visible) View.VISIBLE else View.GONE
}

View file

@ -39,8 +39,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="180dp"
android:paddingEnd="16dp"
android:paddingStart="16dp">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<Button
android:id="@+id/accountFollowButton"
@ -157,6 +157,18 @@
android:layout="@layout/view_account_moved"
app:layout_constraintTop_toBottomOf="@id/accountFieldList" />
<TextView
android:id="@+id/accountRemoveView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="@string/label_remote_account"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/accountMovedView"
tools:visibility="visible"
android:lineSpacingMultiplier="1.1"/>
<LinearLayout
android:id="@+id/accountFollowers"
android:layout_width="wrap_content"
@ -166,7 +178,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/accountFollowing"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/accountMovedView">
app:layout_constraintTop_toBottomOf="@id/accountRemoveView">
<TextView
android:id="@+id/accountFollowersTextView"
@ -197,7 +209,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/accountStatuses"
app:layout_constraintStart_toEndOf="@id/accountFollowers"
app:layout_constraintTop_toBottomOf="@id/accountMovedView">
app:layout_constraintTop_toBottomOf="@id/accountRemoveView">
<TextView
android:id="@+id/accountFollowingTextView"
@ -227,7 +239,7 @@
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/accountFollowing"
app:layout_constraintTop_toBottomOf="@id/accountMovedView">
app:layout_constraintTop_toBottomOf="@id/accountRemoveView">
<TextView
android:id="@+id/accountStatusesTextView"

View file

@ -332,4 +332,5 @@
<string name="profile_metadata_label_label">Заголовок</string>
<string name="profile_metadata_content_label">Значение</string>
<string name="label_remote_account">Информация может не полностью отражать профиль пользователя. Нажмите чтобы открыть профиль в браузере.</string>
</resources>

View file

@ -353,6 +353,9 @@
<string name="profile_metadata_content_label">Content</string>
<string name="pref_title_absolute_time">Use absolute time</string>
<string name="label_remote_account">Information below may reflect the user\'s profile incompletely. Press to open full profile in browser.</string>
<string name="unpin_action">Unpin</string>
<string name="pin_action">Pin</string>