-
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.
- Loading branch information
Showing
6 changed files
with
230 additions
and
95 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
app/src/main/java/salle/android/projects/registertest/controller/adapters/GenresAdapter.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,51 @@ | ||
package salle.android.projects.registertest.controller.adapters; | ||
|
||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import java.util.ArrayList; | ||
|
||
import salle.android.projects.registertest.R; | ||
|
||
public class GenresAdapter extends RecyclerView.Adapter<GenresAdapter.ViewHolder> { | ||
|
||
public static final String TAG = GenresAdapter.class.getName(); | ||
|
||
private ArrayList<String> mGenres; | ||
|
||
public GenresAdapter(ArrayList<String> genres) { | ||
mGenres = genres; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | ||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_genre, parent, false); | ||
return new GenresAdapter.ViewHolder(v); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { | ||
holder.tvName.setText(mGenres.get(position)); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return (mGenres != null ? mGenres.size() : 0); | ||
} | ||
|
||
public class ViewHolder extends RecyclerView.ViewHolder { | ||
|
||
Button tvName; | ||
|
||
public ViewHolder(@NonNull View itemView) { | ||
super(itemView); | ||
tvName = (Button) itemView.findViewById(R.id.item_genre_btn); | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="horizontal" | ||
android:layout_width="wrap_content" | ||
android:gravity="center" | ||
android:layout_height="wrap_content"> | ||
|
||
<Button | ||
android:id="@+id/item_genre_btn" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="10dp" | ||
style="@style/genre_item_text" | ||
android:text="@string/create_song_genre"/> | ||
|
||
|
||
</LinearLayout> |
Oops, something went wrong.