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() accountFragmentViewPager.hide()
} }
if (account.isRemote()) {
accountRemoveView.show()
accountRemoveView.setOnClickListener {
LinkHelper.openLink(account.url, this)
}
}
val numberFormat = NumberFormat.getNumberInstance() val numberFormat = NumberFormat.getNumberInstance()
accountFollowersTextView.text = numberFormat.format(account.followersCount) accountFollowersTextView.text = numberFormat.format(account.followersCount)
accountFollowingTextView.text = numberFormat.format(account.followingCount) accountFollowingTextView.text = numberFormat.format(account.followingCount)

View File

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

View File

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

View File

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

View File

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

View File

@ -353,6 +353,9 @@
<string name="profile_metadata_content_label">Content</string> <string name="profile_metadata_content_label">Content</string>
<string name="pref_title_absolute_time">Use absolute time</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="unpin_action">Unpin</string>
<string name="pin_action">Pin</string> <string name="pin_action">Pin</string>