fix: some UI changes pt:2
This commit is contained in:
parent
2742f58af5
commit
e0cd43c63c
14 changed files with 96 additions and 62 deletions
|
@ -115,7 +115,7 @@
|
|||
android:windowSoftInputMode="adjustResize|stateHidden"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".profile.ActivityActivity"
|
||||
android:name=".profile.activity.ActivityActivity"
|
||||
android:label="Inbox Activity"
|
||||
android:parentActivityName=".MainActivity" >
|
||||
</activity>
|
||||
|
|
|
@ -2,6 +2,7 @@ package ani.dantotsu.profile
|
|||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import android.widget.ImageButton
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -47,7 +48,7 @@ class FollowActivity : AppCompatActivity(){
|
|||
false
|
||||
)
|
||||
binding.listRecyclerView.adapter = adapter
|
||||
|
||||
binding.listProgressBar.visibility = View.VISIBLE
|
||||
binding.listBack.setOnClickListener { finish() }
|
||||
|
||||
val title = intent.getStringExtra("title")
|
||||
|
@ -63,6 +64,7 @@ class FollowActivity : AppCompatActivity(){
|
|||
users = respond
|
||||
withContext(Dispatchers.Main) {
|
||||
fillList()
|
||||
binding.listProgressBar.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
binding.followerList.setOnClickListener {
|
||||
|
@ -86,7 +88,7 @@ class FollowActivity : AppCompatActivity(){
|
|||
}
|
||||
users?.forEach { user ->
|
||||
if (getLayoutType(selected) == 0) {
|
||||
adapter.add(FollowerItem(user.id, user.name ?: "Unknown", user.avatar?.medium, user.bannerImage) { onUserClick(it) })
|
||||
adapter.add(FollowerItem(user.id, user.name ?: "Unknown", user.avatar?.medium, user.bannerImage ?: user.avatar?.medium ) { onUserClick(it) })
|
||||
} else {
|
||||
adapter.add(GridFollowerItem(user.id, user.name ?: "Unknown", user.avatar?.medium) { onUserClick(it) })
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class FollowerItem(
|
|||
Glide.with(context as Context)
|
||||
.load(GlideUrl(banner))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 6)))
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 2)))
|
||||
.into(binding.profileBannerImage)
|
||||
} else {
|
||||
binding.profileBannerImage.setImageResource(R.drawable.linear_gradient_bg)
|
||||
|
|
|
@ -22,6 +22,7 @@ import ani.dantotsu.initActivity
|
|||
import ani.dantotsu.loadImage
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.others.ImageViewDialog
|
||||
import ani.dantotsu.profile.activity.ActivityActivity
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.snackString
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ani.dantotsu.profile
|
||||
package ani.dantotsu.profile.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
|
@ -11,11 +11,12 @@ import ani.dantotsu.connections.anilist.Anilist
|
|||
import ani.dantotsu.connections.anilist.api.Activity
|
||||
import ani.dantotsu.databinding.ActivityFollowBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.profile.activity.ActivityItem
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class ActivityActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityFollowBinding
|
||||
|
@ -39,17 +40,21 @@ class ActivityActivity : AppCompatActivity() {
|
|||
binding.listBack.setOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
|
||||
binding.listProgressBar.visibility = ViewGroup.VISIBLE
|
||||
var userId: Int? = intent.getIntExtra("userId", -1)
|
||||
if (userId == -1) userId = null
|
||||
val global = intent.getBooleanExtra("global", false)
|
||||
|
||||
lifecycleScope.launch {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val res = Anilist.query.getFeed(userId, global)
|
||||
|
||||
withContext(Dispatchers.Main){
|
||||
res?.data?.page?.activities?.let { activities ->
|
||||
activityList = activities
|
||||
adapter.update(activityList.map { ActivityItem(it){} })
|
||||
}
|
||||
binding.listProgressBar.visibility = ViewGroup.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package ani.dantotsu.profile.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -19,6 +20,7 @@ class ActivityItem(
|
|||
val clickCallback: (Int) -> Unit
|
||||
): BindableItem<ItemActivityBinding>() {
|
||||
private lateinit var binding: ItemActivityBinding
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun bind(viewBinding: ItemActivityBinding, position: Int) {
|
||||
binding = viewBinding
|
||||
when (activity.typename) {
|
||||
|
@ -31,19 +33,20 @@ class ActivityItem(
|
|||
else
|
||||
ContextCompat.getColor(binding.root.context, R.color.bg_opp)
|
||||
binding.activityFavorite.setColorFilter(color)
|
||||
|
||||
binding.activityFavoriteCount.text = activity.likeCount.toString()
|
||||
binding.activityMediaName.text = activity.media?.title?.userPreferred
|
||||
binding.activityText.text = "${activity.user!!.name} ${activity.status} ${activity.media!!.title!!.userPreferred}"
|
||||
binding.activityCover.loadImage(activity.media.coverImage?.medium)
|
||||
binding.activityText.text = "${activity.user!!.name} ${activity.status} ${activity.progress ?: ""}"
|
||||
binding.activityCover.loadImage(activity.media?.coverImage?.large)
|
||||
val context = binding.root.context
|
||||
val banner = activity.media.bannerImage
|
||||
val banner = activity.media?.bannerImage ?: activity.media?.coverImage?.large
|
||||
if (banner != null) {
|
||||
if (!(context as android.app.Activity).isDestroyed)
|
||||
if (!(context as android.app.Activity).isDestroyed) {
|
||||
Glide.with(context as Context)
|
||||
.load(GlideUrl(banner))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 2)))
|
||||
.into(binding.activityBannerImage)
|
||||
}
|
||||
} else {
|
||||
binding.activityBannerImage.setImageResource(R.drawable.linear_gradient_bg)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,9 @@ import ani.dantotsu.profile.ProfileActivity
|
|||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class NotificationActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityFollowBinding
|
||||
|
@ -41,13 +43,16 @@ class NotificationActivity : AppCompatActivity() {
|
|||
binding.listBack.setOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
|
||||
binding.listProgressBar.visibility = ViewGroup.VISIBLE
|
||||
lifecycleScope.launch {
|
||||
val res = Anilist.query.getNotifications(Anilist.userid?:0)
|
||||
res?.data?.page?.notifications?.let { notifications ->
|
||||
notificationList = notifications
|
||||
adapter.update(notificationList.map { NotificationItem(it, ::onNotificationClick) })
|
||||
}
|
||||
withContext(Dispatchers.Main){
|
||||
binding.listProgressBar.visibility = ViewGroup.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class NotificationItem(
|
|||
|
||||
private fun image(user: Boolean = false) {
|
||||
val context = binding.notificationBannerImage.context
|
||||
val cover = if (user) notification.user?.bannerImage else notification.media?.bannerImage
|
||||
val cover = if (user) notification.user?.bannerImage ?: notification.user?.avatar?.medium else notification.media?.bannerImage ?: notification.media?.coverImage?.large
|
||||
if (cover != null) {
|
||||
if (!(context as Activity).isDestroyed)
|
||||
Glide.with(context as Context)
|
||||
|
@ -50,7 +50,7 @@ class NotificationItem(
|
|||
binding.notificationBannerImage.setImageResource(R.drawable.linear_gradient_bg)
|
||||
}
|
||||
val defaultHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 170f, context.resources.displayMetrics).toInt()
|
||||
val userHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80f, context.resources.displayMetrics).toInt()
|
||||
val userHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 90f, context.resources.displayMetrics).toInt()
|
||||
|
||||
if (user) {
|
||||
binding.notificationCover.visibility = View.GONE
|
||||
|
@ -58,14 +58,12 @@ class NotificationItem(
|
|||
binding.notificationCoverUserContainer.visibility = View.VISIBLE
|
||||
binding.notificationCoverUser.loadImage(notification.user?.avatar?.large)
|
||||
binding.notificationBannerImage.layoutParams.height = userHeight
|
||||
binding.notificationBannerGradient.layoutParams.height = userHeight
|
||||
} else{
|
||||
binding.notificationCover.visibility = View.VISIBLE
|
||||
binding.notificationCoverUser.visibility = View.VISIBLE
|
||||
binding.notificationCoverUserContainer.visibility = View.GONE
|
||||
binding.notificationCover.loadImage(notification.media?.coverImage?.large)
|
||||
binding.notificationBannerImage.layoutParams.height = defaultHeight
|
||||
binding.notificationBannerGradient.layoutParams.height = defaultHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ class SettingsDialogFragment : BottomSheetDialogFragment() {
|
|||
R.drawable.ic_round_notifications_none_24
|
||||
}
|
||||
binding.settingsNotification.setImageResource(notificationIcon)
|
||||
binding.settingsNotification.visibility = View.VISIBLE
|
||||
|
||||
if (Anilist.token != null) {
|
||||
binding.settingsLogin.setText(R.string.logout)
|
||||
|
|
|
@ -6,13 +6,18 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ProgressBar
|
||||
<LinearLayout
|
||||
android:id="@+id/listProgressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
tools:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone" />
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/listToolbar"
|
||||
|
|
|
@ -78,13 +78,14 @@
|
|||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
|
||||
android:backgroundTint="@color/nav_bg_inv"
|
||||
app:cardCornerRadius="26dp">
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
android:layout_height="64dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:backgroundTint="@color/bg_white"
|
||||
app:cardCornerRadius="64dp">
|
||||
android:backgroundTint="@color/transparent"
|
||||
app:cardCornerRadius="64dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/activityUserAvatar"
|
||||
|
@ -60,21 +61,35 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activityFavorite"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activityFavorite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_round_favorite_24"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activityFavoriteCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/poppins_semi_bold"
|
||||
android:textSize="15sp"
|
||||
tools:text="12" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_marginTop="8dp">
|
||||
android:layout_height="180dp">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -86,15 +101,15 @@
|
|||
<ImageView
|
||||
android:id="@+id/activityBannerImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="153dp"
|
||||
android:layout_height="169dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:ignore="ContentDescription" />
|
||||
tools:ignore="ContentDescription"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="153dp"
|
||||
android:layout_height="170dp"
|
||||
app:srcCompat="@drawable/linear_gradient_nav"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
|
@ -113,6 +128,7 @@
|
|||
android:layout_width="102dp"
|
||||
android:layout_height="154dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_round_add_circle_24"
|
||||
tools:ignore="ContentDescription,ImageContrastCheck"
|
||||
tools:tint="@color/transparent" />
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:backgroundTint="@color/bg_white"
|
||||
app:cardCornerRadius="24dp">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/notificationContainer"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/notificationContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
|
@ -20,13 +20,12 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic"
|
||||
tools:ignore="ContentDescription" />
|
||||
tools:ignore="ContentDescription"
|
||||
tools:srcCompat="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/notificationBannerGradient"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:layout_height="match_parent"
|
||||
app:srcCompat="@drawable/linear_gradient_nav"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
|
@ -37,30 +36,30 @@
|
|||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:backgroundTint="@color/transparent"
|
||||
app:strokeColor="@color/transparent"
|
||||
app:cardCornerRadius="16dp">
|
||||
app:cardCornerRadius="16dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/notificationCover"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="144dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/ic_round_add_circle_24"
|
||||
tools:ignore="ContentDescription,ImageContrastCheck"
|
||||
tools:tint="@color/transparent" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/notificationCoverUserContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginStart="23dp"
|
||||
android:backgroundTint="@color/transparent"
|
||||
app:strokeColor="@color/transparent"
|
||||
app:cardCornerRadius="64dp">
|
||||
android:visibility="gone"
|
||||
app:cardCornerRadius="64dp"
|
||||
app:strokeColor="@color/transparent">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/notificationCoverUser"
|
||||
|
@ -77,8 +76,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="125dp">
|
||||
android:layout_marginStart="125dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notificationText"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue