Skip to content

Commit

Permalink
fix: some UI changes (for better or worse)
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush2622 committed Mar 7, 2024
1 parent 7ac679f commit a2ca163
Show file tree
Hide file tree
Showing 26 changed files with 499 additions and 450 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
android:parentActivityName=".MainActivity" >
</activity>
<activity
android:name=".notifications.NotificationActivity"
android:name=".profile.activity.NotificationActivity"
android:label="Inbox Activity"
android:parentActivityName=".MainActivity" >
</activity>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/ani/dantotsu/home/AnimeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ class AnimeFragment : Fragment() {
binding.root.requestApplyInsets()
binding.root.requestLayout()
}

super.onResume()
}
}
2 changes: 2 additions & 0 deletions app/src/main/java/ani/dantotsu/home/AnimePageAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
SettingsDialogFragment.newInstance(SettingsDialogFragment.Companion.PageType.ANIME)
dialogFragment.show((it.context as AppCompatActivity).supportFragmentManager, "dialog")
}
binding.animeNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
binding.animeNotificationCount.text = Anilist.unreadNotificationCount.toString()

listOf(
binding.animePreviousSeason,
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/ani/dantotsu/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class HomeFragment : Fragment() {
if (!(PrefManager.getVal(PrefName.BannerAnimations) as Boolean)) binding.homeUserBg.pause()
binding.homeUserBg.loadImage(Anilist.bg)
binding.homeUserDataProgressBar.visibility = View.GONE

binding.homeNotificationDot.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
binding.homeNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()

binding.homeAnimeList.setOnClickListener {
ContextCompat.startActivity(
Expand Down Expand Up @@ -360,11 +360,12 @@ class HomeFragment : Fragment() {
}
}
}

override fun onResume() {
if (!model.loaded) Refresh.activity[1]!!.postValue(true)
if (_binding != null)
binding.homeNotificationDot.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
if (_binding != null) {
binding.homeNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
binding.homeNotificationCount.text = Anilist.unreadNotificationCount.toString()
}
super.onResume()
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/ani/dantotsu/home/MangaPageAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
}

updateAvatar()

binding.mangaNotificationCount.visibility = if (Anilist.unreadNotificationCount > 0) View.VISIBLE else View.GONE
binding.mangaNotificationCount.text = Anilist.unreadNotificationCount.toString()
binding.mangaSearchBar.hint = "MANGA"
binding.mangaSearchBarText.setOnClickListener {
ContextCompat.startActivity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class MangaChapterAdapter(
}
1L -> "1 day ago"
in 2..6 -> "$daysDifference days ago"
else -> SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH).format(targetDate)
else -> SimpleDateFormat("dd MMM yyyy", Locale.getDefault()).format(targetDate)
}
}

Expand Down
39 changes: 10 additions & 29 deletions app/src/main/java/ani/dantotsu/profile/ActivityActivity.kt
Original file line number Diff line number Diff line change
@@ -1,48 +1,29 @@
package ani.dantotsu.profile

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.updateLayoutParams
import ani.dantotsu.R
import ani.dantotsu.databinding.ActivityActivityBinding
import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager


class ActivityActivity : AppCompatActivity() {
private lateinit var binding: ActivityActivityBinding
private lateinit var binding: ActivityFollowBinding

@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
val immersiveMode = PrefManager.getVal<Boolean>(PrefName.ImmersiveMode)
if (immersiveMode) {
requestWindowFeature(Window.FEATURE_NO_TITLE)
}
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
binding = ActivityActivityBinding.inflate(layoutInflater)
if (!immersiveMode) {
this.window.statusBarColor =
ContextCompat.getColor(this, R.color.nav_bg_inv)
binding.root.fitsSystemWindows = true

} else {
binding.root.fitsSystemWindows = false
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
binding.listTitle.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
}
}
binding = ActivityFollowBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.listTitle.text = "Activity"
binding.listToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin = statusBarHeight }
binding.followerGrid.visibility = ViewGroup.GONE
binding.followerList.visibility = ViewGroup.GONE
}
}
28 changes: 1 addition & 27 deletions app/src/main/java/ani/dantotsu/profile/FollowActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@ package ani.dantotsu.profile

import android.content.Intent
import android.os.Bundle
import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
import android.view.Window
import android.view.WindowManager
import android.widget.ImageButton
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import ani.dantotsu.R
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.api.User
import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
Expand All @@ -36,31 +30,11 @@ class FollowActivity : AppCompatActivity(){
private lateinit var selected: ImageButton

override fun onCreate(savedInstanceState: Bundle?) {
val immersiveMode = PrefManager.getVal<Boolean>(PrefName.ImmersiveMode)
if (immersiveMode) {
requestWindowFeature(Window.FEATURE_NO_TITLE)
}
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
binding = ActivityFollowBinding.inflate(layoutInflater)

if (!immersiveMode) {
this.window.statusBarColor =
ContextCompat.getColor(this, R.color.nav_bg_inv)
binding.root.fitsSystemWindows = true

} else {
binding.root.fitsSystemWindows = false
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
binding.listTitle.updateLayoutParams<MarginLayoutParams> {
topMargin = statusBarHeight
}
}

binding.listToolbar.updateLayoutParams<MarginLayoutParams> { topMargin = statusBarHeight }
setContentView(binding.root)
val layoutType = PrefManager.getVal<Int>(PrefName.FollowerLayout)
selected = getSelected(layoutType)
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/ani/dantotsu/profile/FollowerItem.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package ani.dantotsu.profile

import android.app.Activity
import android.content.Context
import android.view.View
import ani.dantotsu.R
import ani.dantotsu.databinding.ItemFollowerBinding
import ani.dantotsu.loadImage
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.request.RequestOptions
import com.xwray.groupie.viewbinding.BindableItem
import jp.wasabeef.glide.transformations.BlurTransformation

class FollowerItem(
private val id: Int,
Expand All @@ -18,9 +25,16 @@ class FollowerItem(
override fun bind(viewBinding: ItemFollowerBinding, position: Int) {
binding = viewBinding
binding.profileUserName.text = name
val context = binding.profileBannerImage.context
avatar?.let { binding.profileUserAvatar.loadImage(it) }
if (banner != null) {
binding.profileBannerImage.loadImage(banner)
if (!(context as Activity).isDestroyed)
Glide.with(context as Context)
.load(GlideUrl(banner))
.diskCacheStrategy(DiskCacheStrategy.ALL).override(400)
.apply(RequestOptions.bitmapTransform(BlurTransformation(2, 6)))
.into(binding.profileBannerImage)
} else {
binding.profileBannerImage.setImageResource(R.drawable.linear_gradient_bg)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,43 @@
package ani.dantotsu.notifications
package ani.dantotsu.profile.activity

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
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.anilist.api.Notification
import ani.dantotsu.databinding.ActivityNotificationBinding
import ani.dantotsu.databinding.ActivityFollowBinding
import ani.dantotsu.initActivity
import ani.dantotsu.media.MediaDetailsActivity
import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.activity.NotificationItem
import ani.dantotsu.settings.saving.PrefManager
import ani.dantotsu.settings.saving.PrefName
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
import com.xwray.groupie.GroupieAdapter
import kotlinx.coroutines.launch

class NotificationActivity : AppCompatActivity() {
private lateinit var binding: ActivityNotificationBinding
private lateinit var binding: ActivityFollowBinding
private var adapter: GroupieAdapter = GroupieAdapter()
private var notificationList: List<Notification> = emptyList()

@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
val immersiveMode = PrefManager.getVal<Boolean>(PrefName.ImmersiveMode)
if (immersiveMode) {
requestWindowFeature(Window.FEATURE_NO_TITLE)
}
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
initActivity(this)
binding = ActivityNotificationBinding.inflate(layoutInflater)
if (!immersiveMode) {
this.window.statusBarColor =
ContextCompat.getColor(this, R.color.nav_bg_inv)
binding.root.fitsSystemWindows = true

} else {
binding.root.fitsSystemWindows = false
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
binding.listTitle.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
}
}
binding = ActivityFollowBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.notificationList.adapter = adapter
binding.notificationList.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)

binding.listTitle.text = "Notifications"
binding.listToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin = statusBarHeight }
binding.listRecyclerView.adapter = adapter
binding.listRecyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
binding.followerGrid.visibility = ViewGroup.GONE
binding.followerList.visibility = ViewGroup.GONE
binding.listBack.setOnClickListener {
onBackPressed()
}
Expand Down
Loading

0 comments on commit a2ca163

Please sign in to comment.