-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from PyPiSan/dev
New functionality added
- Loading branch information
Showing
29 changed files
with
705 additions
and
215 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
83 changes: 83 additions & 0 deletions
83
app/src/main/java/com/pypisan/kinani/adapter/SavedVideosAdapter.java
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,83 @@ | ||
package com.pypisan.kinani.adapter; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.cardview.widget.CardView; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import com.bumptech.glide.Glide; | ||
import com.pypisan.kinani.R; | ||
import com.pypisan.kinani.model.SavedVideosModel; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class SavedVideosAdapter extends RecyclerView.Adapter<SavedVideosAdapter.SavedVideosViewHolder> { | ||
|
||
private final ArrayList<SavedVideosModel> savedVideos; | ||
|
||
private final Context context; | ||
private final SelectListener listener; | ||
public SavedVideosAdapter(ArrayList<SavedVideosModel> savedVideos, Context context, SelectListener listener){ | ||
this.savedVideos = savedVideos; | ||
this.context = context; | ||
this.listener = listener; | ||
|
||
} | ||
@NonNull | ||
@Override | ||
public SavedVideosViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View view = LayoutInflater.from(parent.getContext()) | ||
.inflate(R.layout.saved_videos_adapter, parent, false); | ||
return new SavedVideosAdapter.SavedVideosViewHolder(view); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull SavedVideosViewHolder holder, int position) { | ||
ImageView picture = holder.picture; | ||
TextView videoName = holder.videoName; | ||
TextView episode = holder.episode; | ||
|
||
// String image = savedVideos.get(position).getImage(); | ||
String name = savedVideos.get(position).getTitle(); | ||
String episodeNum = savedVideos.get(position).getEpisode(); | ||
String showType = savedVideos.get(position).getShowType(); | ||
|
||
Glide.with(context) | ||
.load("https://gogocdn.net/cover/fairy-tail-100-years-quest.png") | ||
.into(picture); | ||
videoName.setText(name); | ||
episode.setText(String.format("Episode: "+episodeNum)); | ||
holder.cardView.setOnClickListener(view -> { | ||
listener.onItemClicked(name, episodeNum,showType); | ||
}); | ||
|
||
} | ||
|
||
@Override | ||
public int getItemCount() {return savedVideos.size();} | ||
|
||
public interface SelectListener { | ||
void onItemClicked(String title, String Episode, String showType); | ||
} | ||
|
||
public class SavedVideosViewHolder extends RecyclerView.ViewHolder{ | ||
|
||
ImageView picture; | ||
TextView videoName; | ||
TextView episode; | ||
CardView cardView; | ||
public SavedVideosViewHolder(@NonNull View itemView) { | ||
super(itemView); | ||
this.picture = itemView.findViewById(R.id.Picture); | ||
this.videoName = itemView.findViewById(R.id.video_name); | ||
this.episode = itemView.findViewById(R.id.video_episode); | ||
this.cardView = itemView.findViewById(R.id.videosCard); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/pypisan/kinani/model/SavedVideosModel.java
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,28 @@ | ||
package com.pypisan.kinani.model; | ||
|
||
|
||
public class SavedVideosModel { | ||
|
||
private String title, episode,showType; | ||
public SavedVideosModel(String title, String episode, String showType){ | ||
this.title = title; | ||
this.episode = episode; | ||
this.showType = showType; | ||
} | ||
|
||
public SavedVideosModel(){ | ||
|
||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getEpisode() { | ||
return episode; | ||
} | ||
|
||
public String getShowType() { | ||
return showType; | ||
} | ||
} |
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
Oops, something went wrong.