Skip to content

Commit

Permalink
fix: reply text background color
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush2622 committed May 13, 2024
1 parent b0b51c4 commit a3b1d3d
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class OfflineAnimeAdapter(
if (style == 0) {
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
val episodes = view.findViewById<TextView>(R.id.itemTotal)
episodes.text = context.getString(R.string.episodes)
val text = " ${context.getString(R.string.episodes)}"
episodes.text = text
bannerView.setImageURI(item.banner ?: item.image)
totalEpisodes.text = item.totalEpisodeList
} else if (style == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class OfflineMangaAdapter(
if (style == 0) {
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
val chapters = view.findViewById<TextView>(R.id.itemTotal)
chapters.text = context.getString(R.string.chapters)
val text = " ${context.getString(R.string.chapters)}"
chapters.text = text
bannerView.setImageURI(item.banner ?: item.image)
totalChapter.text = item.totalChapter
} else if (style == 1) {
Expand Down
25 changes: 22 additions & 3 deletions app/src/main/java/ani/dantotsu/home/status/RepliesBottomDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ani.dantotsu.BottomSheetDialogFragment
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.api.ActivityReply
import ani.dantotsu.databinding.BottomSheetRecyclerBinding
import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.activity.ActivityReplyItem
import ani.dantotsu.snackString
import ani.dantotsu.util.MarkdownCreatorActivity
Expand Down Expand Up @@ -40,12 +41,12 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding.repliesRecyclerView.adapter = adapter
binding.repliesRecyclerView.layoutManager = LinearLayoutManager(
requireContext(),
context,
LinearLayoutManager.VERTICAL,
false
)
val context = requireContext()
binding.replyButton.setOnClickListener {
val context = requireContext()
ContextCompat.startActivity(
context,
Intent(context, MarkdownCreatorActivity::class.java)
Expand All @@ -63,7 +64,17 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {
if (response != null) {
replies.clear()
replies.addAll(response.data.page.activityReplies)
adapter.update(replies.map { ActivityReplyItem(it, requireActivity()) { _, _ -> } })
adapter.update(
replies.map {
ActivityReplyItem(
it,
requireActivity(),
clickCallback = { int, _ ->
onClick(int)
}
)
}
)
} else {
snackString("Failed to load replies")
}
Expand All @@ -72,6 +83,14 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {

}

private fun onClick(int: Int) {
ContextCompat.startActivity(
requireContext(),
Intent(requireContext(), ProfileActivity::class.java).putExtra("userId", int),
null
)
}

private fun loading(load: Boolean) {
binding.repliesRefresh.isVisible = load
binding.repliesRecyclerView.isVisible = !load
Expand Down
18 changes: 7 additions & 11 deletions app/src/main/java/ani/dantotsu/home/status/Stories.kt
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,13 @@ class Stories @JvmOverloads constructor(
it.toString()
}
}
} ${story.progress ?: story.media?.title?.userPreferred} " + if (story.status?.contains(
"completed"
) == false && !story.status.contains("plans") && !story.status.contains(
"repeating"
} ${story.progress ?: story.media?.title?.userPreferred} " +
if (
story.status?.contains("completed") == false &&
!story.status.contains("plans") &&
!story.status.contains("repeating")
)
) {
{
"of ${story.media?.title?.userPreferred}"
} else {
""
Expand Down Expand Up @@ -446,12 +447,7 @@ class Stories @JvmOverloads constructor(
binding.activityRepliesContainer.setOnClickListener {
RepliesBottomDialog.newInstance(story.id).show(activity.supportFragmentManager, "replies")
}
if (story.replyCount > 0) {
binding.replyCount.text = story.replyCount.toString()
binding.replyCount.visibility = View.VISIBLE
} else {
binding.replyCount.visibility = View.GONE
}
binding.replyCount.text = story.replyCount.toString()
binding.activityLikeCount.text = story.likeCount.toString()
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
binding.activityLikeContainer.setOnClickListener {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ani/dantotsu/media/MediaListViewActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class MediaListViewActivity: AppCompatActivity() {
binding.mediaGrid.setOnClickListener {
changeView(0, binding.mediaGrid)
}

binding.listTitle.text = intent.getStringExtra("title")
val text = "${intent.getStringExtra("title")} (${mediaList.count()})"
binding.listTitle.text = text
binding.mediaRecyclerView.adapter = MediaAdaptor(view, mediaList, this)
binding.mediaRecyclerView.layoutManager = GridLayoutManager(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.ImageButton
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -73,6 +74,8 @@ class NotificationActivity : AppCompatActivity() {
val dialogView = LayoutInflater.from(currContext()).inflate(R.layout.custom_dialog_layout, null)
val checkboxContainer = dialogView.findViewById<LinearLayout>(R.id.checkboxContainer)
val tickAllButton = dialogView.findViewById<ImageButton>(R.id.toggleButton)
val title = dialogView.findViewById<TextView>(R.id.scantitle)
title.visibility = ViewGroup.GONE
fun getToggleImageResource(container: ViewGroup): Int {
var allChecked = true
var allUnchecked = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SettingsActivity : AppCompatActivity() {
settingsVersion.apply {
text = getString(R.string.version_current, BuildConfig.VERSION_NAME)

settingsVersion.setOnLongClickListener {
setOnLongClickListener {
copyToClipboard(getDeviceInfo(), false)
toast(getString(R.string.copied_device_info))
return@setOnLongClickListener true
Expand Down
79 changes: 43 additions & 36 deletions app/src/main/res/layout/bottom_sheet_recycler.xml
Original file line number Diff line number Diff line change
@@ -1,55 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:orientation="vertical">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:paddingHorizontal="32dp"
android:text="@string/replies"
android:textColor="?attr/colorPrimary"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.cardview.widget.CardView
android:layout_width="32dp"
android:layout_height="4dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="14dp"
app:cardBackgroundColor="?attr/colorPrimary"
app:cardCornerRadius="2dp"
app:cardElevation="0dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="48dp"
android:fontFamily="@font/poppins"
android:gravity="bottom|center_horizontal"
android:text="@string/replies"
android:textSize="20sp"
android:textStyle="bold" />

<ImageView
android:id="@+id/replyButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/reply"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:src="@drawable/ic_add"
app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/title"
app:tint="?attr/colorPrimary" />
<ImageView
android:id="@+id/replyButton"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginStart="-48dp"
android:contentDescription="@string/reply"
android:fontFamily="@font/poppins_bold"
android:src="@drawable/ic_add"
app:tint="?attr/colorPrimary" />
</LinearLayout>

<ProgressBar
android:id="@+id/repliesRefresh"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
android:visibility="gone" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/repliesRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="16dp"
app:layout_constraintTop_toBottomOf="@+id/replyButton" />
tools:listitem="@layout/item_activity_reply" />

</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/layout/custom_dialog_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:padding="16dp">

<TextView
android:id="@+id/scantitle"
android:layout_width="265dp"
android:layout_height="48dp"
android:ellipsize="end"
Expand Down
75 changes: 35 additions & 40 deletions app/src/main/res/layout/fragment_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,39 +176,6 @@
tools:srcCompat="@tools:sample/backgrounds/scenic" />
</androidx.cardview.widget.CardView>

<FrameLayout
android:id="@+id/activityRepliesContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="-8dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="@+id/linearLayout">

<ImageView
android:id="@+id/activityReplies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:src="@drawable/ic_round_comment_24"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/replyCount"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end|bottom"
android:background="@drawable/notification_circle"
android:fontFamily="@font/poppins_semi_bold"
android:gravity="center"
android:textColor="#F3F3F3"
android:textSize="12sp"
android:visibility="gone"
tools:ignore="SmallSp"
tools:text="1"
tools:visibility="visible" />

</FrameLayout>

<LinearLayout
android:id="@+id/linearLayout"
Expand Down Expand Up @@ -238,31 +205,59 @@
tools:ignore="SpUsage"
tools:text="@string/slogan" />


<LinearLayout
android:id="@+id/activityLikeContainer"
android:id="@+id/activityRepliesContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:orientation="horizontal"

android:orientation="vertical"
tools:ignore="UseCompoundDrawables">

<ImageView
android:id="@+id/activityReplies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_round_comment_24"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/activityLikeCount"
android:id="@+id/replyCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:fontFamily="@font/poppins_semi_bold"
android:textSize="15sp"
tools:text="12" />


</LinearLayout>

<LinearLayout
android:id="@+id/activityLikeContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">

<ImageView
android:id="@+id/activityLike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_marginStart="12dp"
android:src="@drawable/ic_round_favorite_24"
tools:ignore="ContentDescription" />

<TextView
android:id="@+id/activityLikeCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:fontFamily="@font/poppins_semi_bold"
android:textSize="15sp"
tools:text="12" />
</LinearLayout>
</LinearLayout>

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/layout/item_activity_reply.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:background="?attr/colorSurface"
android:orientation="vertical">

<LinearLayout
Expand Down Expand Up @@ -105,7 +104,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:background="?android:colorBackground"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/lorem_ipsum"
android:textSize="12sp" />
Expand Down

0 comments on commit a3b1d3d

Please sign in to comment.