Show "remote profile" message. (#873)

* Show "remote profile" message. Closes #806

* Improve remote message look
main
Ivan Kupalov 6 years ago committed by Konrad Pozniak
parent d928fe7a1d
commit 449c7a3bad
  1. 7
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt
  2. 1
      app/src/main/java/com/keylesspalace/tusky/entity/Account.kt
  3. 6
      app/src/main/java/com/keylesspalace/tusky/util/ViewExtensions.kt
  4. 22
      app/src/main/res/layout/activity_account.xml
  5. 1
      app/src/main/res/values-ru/strings.xml
  6. 3
      app/src/main/res/values/strings.xml

@ -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)

@ -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

@ -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
}
} }

@ -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"

@ -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>

@ -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>

Loading…
Cancel
Save