feat: comments sorter popup
This commit is contained in:
parent
aaf9bdd00c
commit
1694a1cb24
6 changed files with 64 additions and 12 deletions
|
@ -87,7 +87,7 @@ class CalendarActivity : AppCompatActivity() {
|
|||
|
||||
binding.listTitle.setText(R.string.release_calendar)
|
||||
binding.listSort.visibility = View.GONE
|
||||
|
||||
binding.random.visibility = View.GONE
|
||||
binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
this@CalendarActivity.selectedTabIdx = tab?.position ?: 1
|
||||
|
|
|
@ -4,11 +4,14 @@ import android.graphics.drawable.Drawable
|
|||
import android.os.Bundle
|
||||
import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.comments.Comment
|
||||
import ani.dantotsu.connections.comments.CommentsAPI
|
||||
|
@ -16,6 +19,8 @@ import ani.dantotsu.databinding.FragmentCommentsBinding
|
|||
import ani.dantotsu.databinding.ItemCommentsBinding
|
||||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
|
@ -120,6 +125,14 @@ class CommentsFragment : AppCompatActivity(){
|
|||
}
|
||||
adapter.add(section)
|
||||
}
|
||||
binding.commentSort.setOnClickListener {
|
||||
val popup = PopupMenu(this, it)
|
||||
popup.setOnMenuItemClickListener { item ->
|
||||
true
|
||||
}
|
||||
popup.inflate(R.menu.comments_sort_menu)
|
||||
popup.show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildMarkwon(): Markwon {
|
||||
|
|
|
@ -10,18 +10,36 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/commentTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity=""
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:gravity="center|start"
|
||||
android:text="@string/comments"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/commentTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:gravity="center"
|
||||
android:text="@string/comments"
|
||||
android:textColor="?attr/colorPrimary"
|
||||
android:textSize="16sp" />
|
||||
<ImageView
|
||||
android:id="@+id/commentSort"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/sort_by"
|
||||
app:srcCompat="@drawable/ic_round_sort_24"
|
||||
app:tint="?attr/colorOnBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/commentsList"
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
android:id="@+id/commentTotalReplies"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:alpha="0.6"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:text="View x more replies"
|
||||
|
|
15
app/src/main/res/menu/comments_sort_menu.xml
Normal file
15
app/src/main/res/menu/comments_sort_menu.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/comment_sort_ascending"
|
||||
android:title="@string/comments_sort_ascending" />
|
||||
<item
|
||||
android:id="@+id/comment_sort_descending"
|
||||
android:title="@string/comments_sort_descending" />
|
||||
<item
|
||||
android:id="@+id/comment_sort_upvote"
|
||||
android:title="@string/comments_sort_upvote" />
|
||||
<item
|
||||
android:id="@+id/comment_sort_downvote"
|
||||
android:title="@string/comments_sort_downvote" />
|
||||
</menu>
|
|
@ -657,5 +657,10 @@
|
|||
<string name="import_export_settings">Import/Export Settings</string>
|
||||
<string name="import_settings">Import Settings</string>
|
||||
<string name="try_internal_cast_experimental">Try Internal Cast (Experimental)</string>
|
||||
|
||||
<string name="comments">Comments</string>
|
||||
<string name="comments_sort_ascending">Ascending</string>
|
||||
<string name="comments_sort_descending">Descending</string>
|
||||
<string name="comments_sort_upvote">Most UpVoted</string>
|
||||
<string name="comments_sort_downvote">Most DownVoted</string>
|
||||
</resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue