Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/rebelonion/Dantotsu into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Mar 6, 2024
2 parents 3632055 + bd64454 commit 251f1e8
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 58 deletions.
28 changes: 25 additions & 3 deletions app/src/main/java/ani/dantotsu/profile/FollowActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ 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
Expand All @@ -17,6 +21,7 @@ import ani.dantotsu.initActivity
import ani.dantotsu.navBarHeight
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.Dispatchers
Expand All @@ -37,12 +42,27 @@ class FollowActivity : AppCompatActivity(){
binding = ActivityFollowBinding.inflate(layoutInflater)
setContentView(binding.root)

if (!PrefManager.getVal<Boolean>(PrefName.ImmersiveMode)) {
this.window.statusBarColor =
ContextCompat.getColor(this, R.color.nav_bg_inv)
binding.root.fitsSystemWindows = true

} else {
binding.root.fitsSystemWindows = false
requestWindowFeature(Window.FEATURE_NO_TITLE)
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
binding.listTitle.updateLayoutParams<MarginLayoutParams> {
topMargin = statusBarHeight
}
}
val layoutType = PrefManager.getVal<Int>(PrefName.FollowerLayout)
selected = getSelected(layoutType)
binding.followerGrid.alpha = 0.33f
binding.followerList.alpha = 0.33f
selected(selected)
binding.root.updateLayoutParams<MarginLayoutParams> { topMargin += navBarHeight }
binding.listRecyclerView.layoutManager = LinearLayoutManager(
this,
LinearLayoutManager.VERTICAL,
Expand All @@ -53,11 +73,13 @@ class FollowActivity : AppCompatActivity(){
binding.listBack.setOnClickListener { finish() }

val title = intent.getStringExtra("title")
val userID= intent.getIntExtra("userId", 0)
binding.listTitle.text = title

lifecycleScope.launch(Dispatchers.IO) {
val respond = when (title) {
"Following" -> Anilist.query.userFollowing(intent.getIntExtra("userId", 0))?.data?.page?.following
"Followers" -> Anilist.query.userFollowers(intent.getIntExtra("userId", 0))?.data?.page?.followers
"Following" -> Anilist.query.userFollowing(userID)?.data?.page?.following
"Followers" -> Anilist.query.userFollowers(userID)?.data?.page?.followers
else -> null
}
users = respond
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/layout/activity_follow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
android:visibility="gone" />

<FrameLayout
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:orientation="horizontal">

<ImageView
Expand All @@ -33,16 +32,17 @@
<TextView
android:id="@+id/listTitle"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_height="48dp"
android:layout_marginStart="44dp"
android:layout_gravity="center_vertical"
android:gravity="center|start"
android:ellipsize="end"
android:fontFamily="@font/poppins_bold"
android:gravity="center|start"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
android:textColor="?attr/colorOnBackground"
android:textSize="18sp"
tools:text="xyz" />
tools:text="Follow" />

<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
Expand All @@ -55,8 +55,8 @@

<ImageButton
android:id="@+id/followerList"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
android:scaleX="-1"
Expand All @@ -76,8 +76,8 @@

<ImageButton
android:id="@+id/followerGrid"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:alpha="0.33"
android:background="?android:attr/selectableItemBackground"
app:srcCompat="@drawable/ic_round_grid_view_24"
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/fragment_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:text="Stats"
android:textSize="18sp"
Expand Down Expand Up @@ -344,6 +345,7 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:text="Bio"
android:textSize="18sp"
Expand All @@ -367,7 +369,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
android:visibility="gone"
tools:visibility="visible">


<TextView
Expand Down Expand Up @@ -521,6 +524,7 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:text="Favorite Characters"
android:textSize="18sp" />
Expand Down Expand Up @@ -552,6 +556,7 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:padding="8dp"
android:fontFamily="@font/poppins_bold"
android:text="Favorite Staff"
android:textSize="18sp" />
Expand Down
84 changes: 45 additions & 39 deletions app/src/main/res/layout/item_follower.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,59 @@
android:layout_height="120dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:orientation="horizontal">

<ImageView
android:id="@+id/profileBannerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/linear_gradient_bg"
tools:ignore="ContentDescription" />

<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_black_50"
tools:ignore="ContentDescription" />

<com.google.android.material.card.MaterialCardView
android:id="@+id/profileUserAvatarContainer"
android:layout_width="82dp"
android:layout_height="82dp"
android:id="@+id/profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:backgroundTint="@color/bg_white"
app:cardCornerRadius="64dp">
app:cardCornerRadius="32dp">
<ImageView
android:id="@+id/profileBannerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/linear_gradient_bg"
tools:ignore="ContentDescription" />

<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_black_50"
tools:ignore="ContentDescription" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profileUserAvatar"
<com.google.android.material.card.MaterialCardView
android:id="@+id/profileUserAvatarContainer"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_gravity="center"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:tint="@color/transparent"
tools:ignore="ContentDescription,ImageContrastCheck" />
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:backgroundTint="@color/bg_white"
app:cardCornerRadius="64dp">

</com.google.android.material.card.MaterialCardView>
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/profileUserAvatar"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_gravity="center"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:tint="@color/transparent"
tools:ignore="ContentDescription,ImageContrastCheck" />

<TextView
android:id="@+id/profileUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="120dp"
android:text="Username"
android:textColor="@color/bg_white"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</com.google.android.material.card.MaterialCardView>

<TextView
android:id="@+id/profileUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="120dp"
android:text="Username"
android:textColor="@color/bg_white"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
20 changes: 14 additions & 6 deletions app/src/main/res/layout/item_follower_grid.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
android:layout_height="150dp"
android:layout_height="wrap_content"
android:padding="8dp"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">

<com.google.android.material.card.MaterialCardView
android:id="@+id/profileUserAvatarContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:backgroundTint="@color/bg_white"
app:cardCornerRadius="124dp">
<ImageView
android:id="@+id/profileUserAvatar"
android:layout_width="112dp"
android:layout_height="112dp"
android:layout_gravity="center"
android:layout_width="100dp"
android:layout_height="100dp"
tools:tint="@color/transparent"
tools:ignore="ContentDescription,ImageContrastCheck" />
</com.google.android.material.card.MaterialCardView>

<TextView
android:id="@+id/profileUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:fontFamily="@font/poppins_semi_bold"
android:text="Username"
android:textColor="?attr/colorOnBackground"
android:textSize="12sp"
Expand Down

0 comments on commit 251f1e8

Please sign in to comment.