feat: tell user if not logged in
This commit is contained in:
parent
a24d1515b3
commit
de21365c90
3 changed files with 23 additions and 11 deletions
|
@ -32,6 +32,7 @@ import ani.dantotsu.media.MediaDetailsActivity
|
|||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.toast
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import com.xwray.groupie.Section
|
||||
import io.noties.markwon.editor.MarkwonEditor
|
||||
|
@ -102,6 +103,7 @@ class CommentsFragment : Fragment() {
|
|||
binding.commentsList.adapter = adapter
|
||||
binding.commentsList.layoutManager = LinearLayoutManager(activity)
|
||||
|
||||
if (CommentsAPI.authToken != null) {
|
||||
lifecycleScope.launch {
|
||||
val commentId = arguments?.getInt("commentId")
|
||||
if (commentId != null && commentId > 0) {
|
||||
|
@ -110,6 +112,10 @@ class CommentsFragment : Fragment() {
|
|||
loadAndDisplayComments()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
toast("Not logged in")
|
||||
activity.binding.commentMessageContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.commentSort.setOnClickListener { sortView ->
|
||||
fun sortComments(sortOrder: String) {
|
||||
|
@ -242,7 +248,10 @@ class CommentsFragment : Fragment() {
|
|||
|
||||
override fun afterTextChanged(s: android.text.Editable?) {
|
||||
if ((activity.binding.commentInput.text.length) > 300) {
|
||||
activity.binding.commentInput.text.delete(300, activity.binding.commentInput.text.length)
|
||||
activity.binding.commentInput.text.delete(
|
||||
300,
|
||||
activity.binding.commentInput.text.length
|
||||
)
|
||||
snackString("CommentNotificationWorker cannot be longer than 300 characters")
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +275,8 @@ class CommentsFragment : Fragment() {
|
|||
anim.doOnEnd {
|
||||
activity.binding.commentLabel.visibility = View.VISIBLE
|
||||
activity.binding.commentSend.visibility = View.VISIBLE
|
||||
activity.binding.commentLabel.animate().translationX(0f).setDuration(300).start()
|
||||
activity.binding.commentLabel.animate().translationX(0f).setDuration(300)
|
||||
.start()
|
||||
activity.binding.commentSend.animate().translationX(0f).setDuration(300).start()
|
||||
|
||||
}
|
||||
|
|
|
@ -377,6 +377,7 @@
|
|||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/commentMessageContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
|
|
|
@ -248,6 +248,7 @@
|
|||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/commentMessageContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue