-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abe3f88
commit e49f0db
Showing
9 changed files
with
119 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/src/main/java/ani/dantotsu/media/MediaSocialAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package ani.dantotsu.media | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat | ||
import androidx.recyclerview.widget.RecyclerView | ||
import ani.dantotsu.databinding.ItemFollowerGridBinding | ||
import ani.dantotsu.loadImage | ||
import ani.dantotsu.profile.ProfileActivity | ||
import ani.dantotsu.profile.User | ||
import ani.dantotsu.setAnimation | ||
|
||
class MediaSocialAdapter(private val user: ArrayList<User>) : | ||
RecyclerView.Adapter<MediaSocialAdapter.DeveloperViewHolder>() { | ||
|
||
inner class DeveloperViewHolder(val binding: ItemFollowerGridBinding) : | ||
RecyclerView.ViewHolder(binding.root) | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DeveloperViewHolder { | ||
return DeveloperViewHolder( | ||
ItemFollowerGridBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
) | ||
) | ||
} | ||
|
||
override fun onBindViewHolder(holder: DeveloperViewHolder, position: Int) { | ||
val b = holder.binding | ||
setAnimation(b.root.context, b.root) | ||
val user = user[position] | ||
b.profileUserName.text = user.name | ||
b.profileUserAvatar.loadImage(user.pfp) | ||
b.profileInfo.text = user.info | ||
b.profileInfo.visibility = View.VISIBLE | ||
b.profileUserAvatar.setOnClickListener { | ||
val intent = Intent(b.root.context, ProfileActivity::class.java) | ||
intent.putExtra("userId", user.id) | ||
ContextCompat.startActivity(b.root.context, intent, null) | ||
} | ||
} | ||
|
||
override fun getItemCount(): Int = user.size | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ data class User( | |
val name: String, | ||
val pfp: String?, | ||
val banner: String?, | ||
val info: String? = null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters