use of omari.hamza.storyview.callback.StoryClickListeners in project Chat-app by TuTuanLe.
the class TopStatusAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull TopStatusViewHolder holder, int position) {
UserStatus userStatus = userStatuses.get(position);
Status lastStatus = userStatus.getStatuses().get(userStatus.getStatuses().size() - 1);
Glide.with(context).load(lastStatus.getImageUrl()).into(holder.binding.image);
Glide.with(context).load(lastStatus.getImageUrl()).into(holder.binding.imageUserStatus);
holder.binding.circularStatusView.setPortionsCount(userStatus.getStatuses().size());
holder.binding.circularStatusView.setOnClickListener(view -> {
ArrayList<MyStory> myStories = new ArrayList<>();
for (Status status : userStatus.getStatuses()) {
myStories.add(new MyStory(status.getImageUrl()));
}
new StoryView.Builder(((MainScreenActivity) context).getSupportFragmentManager()).setStoriesList(// Required
myStories).setStoryDuration(// Default is 2000 Millis (2 Seconds)
5000).setTitleText(// Default is Hidden
userStatus.getName()).setSubtitleText(// Default is Hidden
"").setTitleLogoUrl(// Default is Hidden
userStatus.getProfileImage()).setStoryClickListeners(new StoryClickListeners() {
@Override
public void onDescriptionClickListener(int position1) {
// your action
}
@Override
public void onTitleIconClickListener(int position1) {
// your action
}
}).build().show();
});
}
use of omari.hamza.storyview.callback.StoryClickListeners in project Chat-app by TuTuanLe.
the class StoryAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull StoryViewHolder holder, @SuppressLint("RecyclerView") int position) {
UserStatus userStatus = userStatuses.get(position);
Status lastStatus = userStatus.getStatuses().get(userStatus.getStatuses().size() - 1);
Glide.with(context).load(lastStatus.getImageUrl()).into(holder.binding.image);
Glide.with(context).load(lastStatus.getImageUrl()).into(holder.binding.imageUserStatus);
holder.binding.circularStatusView.setPortionsCount(userStatus.getStatuses().size());
if (selectedItem == position) {
holder.binding.frameLayout.setBackgroundResource(R.drawable.button_bg);
} else {
holder.binding.frameLayout.setBackgroundColor(0);
}
holder.binding.frameLayout.setOnClickListener(v -> {
int previousItem = selectedItem;
selectedItem = position;
notifyItemChanged(previousItem);
notifyItemChanged(position);
});
holder.binding.circularStatusView.setOnClickListener(view -> {
ArrayList<MyStory> myStories = new ArrayList<>();
for (Status status : userStatus.getStatuses()) {
myStories.add(new MyStory(status.getImageUrl()));
}
new StoryView.Builder(((MainScreenActivity) context).getSupportFragmentManager()).setStoriesList(// Required
myStories).setStoryDuration(// Default is 2000 Millis (2 Seconds)
5000).setTitleText(// Default is Hidden
userStatus.getName()).setSubtitleText(// Default is Hidden
"").setTitleLogoUrl(// Default is Hidden
userStatus.getProfileImage()).setStoryClickListeners(new StoryClickListeners() {
@Override
public void onDescriptionClickListener(int position1) {
// your action
}
@Override
public void onTitleIconClickListener(int position1) {
// your action
}
}).build().show();
});
}
Aggregations