From eba774618e05abf172d4c7dc1decc88bcf38bee4 Mon Sep 17 00:00:00 2001 From: Yutatsu <126276749+Yutatsu1@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:09:21 +0600 Subject: [PATCH 1/4] added default load control (#202) --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 7f7a4459..e86c560c 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -61,6 +61,7 @@ import androidx.media3.exoplayer.util.EventLogger import androidx.media3.session.MediaSession import androidx.media3.ui.* import androidx.media3.ui.CaptionStyleCompat.* +import androidx.media3.exoplayer.DefaultLoadControl import androidx.mediarouter.app.MediaRouteButton import ani.dantotsu.* import ani.dantotsu.R @@ -1448,10 +1449,26 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL private fun buildExoplayer() { //Player + val DEFAULT_MIN_BUFFER_MS = 600000 + val DEFAULT_MAX_BUFFER_MS = 600000 + val BUFFER_FOR_PLAYBACK_MS = 2500 + val BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = 5000 + + val loadControl = DefaultLoadControl.Builder() + .setBackBuffer(1000 * 60 * 2, true) + .setBufferDurationsMs( + DEFAULT_MIN_BUFFER_MS, + DEFAULT_MAX_BUFFER_MS, + BUFFER_FOR_PLAYBACK_MS, + BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS + ) + .build() + hideSystemBars() exoPlayer = ExoPlayer.Builder(this) .setMediaSourceFactory(DefaultMediaSourceFactory(cacheFactory)) .setTrackSelector(trackSelector) + .setLoadControl(loadControl) .build().apply { playWhenReady = true this.playbackParameters = this@ExoplayerView.playbackParameters @@ -2032,4 +2049,4 @@ class CustomCastButton : MediaRouteButton { true } } -} \ No newline at end of file +} From 4f61f4cf2cbebe139809a95be48b0255e33e2d60 Mon Sep 17 00:00:00 2001 From: aayush262 <99584765+aayush2622@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:53:57 +0530 Subject: [PATCH 2/4] fix: Github Actions --- .github/workflows/beta.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index f9b67516..a492d6a4 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -21,7 +21,7 @@ jobs: - name: Download last SHA artifact - uses: actions/download-artifact@v4.1.2 + uses: dawidd6/action-download-artifact@v3 with: workflow: beta.yml name: last-sha @@ -92,7 +92,7 @@ jobs: shell: bash run: | #Discord - commit_messages=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g') + commit_messages=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g; s/^/\n/') # Truncate commit messages if they are too long max_length=1900 # Adjust this value as needed if [ ${#commit_messages} -gt $max_length ]; then @@ -104,7 +104,7 @@ jobs: #Telegram curl -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \ -F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \ - -F "caption=Alpha-Build: ${VERSION}: ${commit_messages}" \ + -F "caption=Alpha-Build: ${VERSION}: ${commit_messages}" \ https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument env: From 84ae520f939e23fc91afa0cd5a5f7e467d9cc6aa Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 20 Feb 2024 13:59:50 +0530 Subject: [PATCH 3/4] feat(comments): click on username to open in anilist --- .../main/java/ani/dantotsu/media/comments/CommentItem.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt index 3b4c467a..43619d35 100644 --- a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt +++ b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt @@ -6,9 +6,12 @@ import androidx.recyclerview.widget.LinearLayoutManager import ani.dantotsu.R import ani.dantotsu.connections.comments.Comment import ani.dantotsu.connections.comments.CommentsAPI +import ani.dantotsu.copyToClipboard import ani.dantotsu.currActivity import ani.dantotsu.databinding.ItemCommentsBinding import ani.dantotsu.loadImage +import ani.dantotsu.openLinkInBrowser +import ani.dantotsu.others.ImageViewDialog import ani.dantotsu.snackString import com.xwray.groupie.GroupieAdapter import com.xwray.groupie.Section @@ -61,6 +64,9 @@ class CommentItem(val comment: Comment, viewBinding.commentTotalReplies.visibility = View.GONE viewReplyCallback(this) } + viewBinding.commentUserName.setOnClickListener { + openLinkInBrowser("https://anilist.co/user/${comment.username}") + } var isEditing = false var isReplying = false viewBinding.commentEdit.setOnClickListener { From b2f01a24b2eddb23669c3b95a1a6aaa8097ea05b Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 20 Feb 2024 14:11:38 +0530 Subject: [PATCH 4/4] feat(comments): re-added Divider for reply --- .../dantotsu/media/comments/CommentItem.kt | 7 ++++ app/src/main/res/layout/item_comments.xml | 34 +++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt index 43619d35..b6a1bc2e 100644 --- a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt +++ b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt @@ -55,18 +55,25 @@ class CommentItem(val comment: Comment, viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE if ((comment.replyCount ?: 0) > 0) { viewBinding.commentTotalReplies.visibility = View.VISIBLE + viewBinding.commentRepliesDivider.visibility = View.VISIBLE viewBinding.commentTotalReplies.text = "View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}" } else { viewBinding.commentTotalReplies.visibility = View.GONE + viewBinding.commentRepliesDivider.visibility = View.GONE } viewBinding.commentReply.visibility = View.VISIBLE viewBinding.commentTotalReplies.setOnClickListener { viewBinding.commentTotalReplies.visibility = View.GONE + viewBinding.commentRepliesDivider.visibility = View.GONE viewReplyCallback(this) } viewBinding.commentUserName.setOnClickListener { openLinkInBrowser("https://anilist.co/user/${comment.username}") } + viewBinding.commentText.setOnLongClickListener { + copyToClipboard(comment.content) + true + } var isEditing = false var isReplying = false viewBinding.commentEdit.setOnClickListener { diff --git a/app/src/main/res/layout/item_comments.xml b/app/src/main/res/layout/item_comments.xml index c263a8ce..c734c3dd 100644 --- a/app/src/main/res/layout/item_comments.xml +++ b/app/src/main/res/layout/item_comments.xml @@ -186,17 +186,31 @@ tools:ignore="ContentDescription" /> - - + android:layout_gravity="center_vertical" + android:orientation="horizontal"> + + + + +