Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@emedinaa
Forked from tatd3v/onBindViewHolder
Last active May 24, 2020 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emedinaa/12d3d71cce65688ca949d784b90d8c7e to your computer and use it in GitHub Desktop.
Save emedinaa/12d3d71cce65688ca949d784b90d8c7e to your computer and use it in GitHub Desktop.
@Override
public void onBindViewHolder(@NonNull RecyclerAdapter.CharacterViewHolder holder, int position) {
Character character = characterList.get(position);
holder.tvName.setText(character.getName());
holder.tvHouse.setText(character.getHouse());
holder.tvPatronous.setText(character.getPatronus());
holder.tvSpecies.setText(character.getBloodStatus());
holder.tvSpecies.setText(character.getSpecies());
holder.tvBloodStatus.setText(character.getBloodStatus());
holder.tvRole.setText(character.getRole());
holder.tvSchool.setText(character.getSchool());
if(character.isDeathEater() == true){
holder.tvDeathEater.setText("true");
} else {
holder.tvDeathEater.setText("false");
}
if(character.isDumboldoresArmy() == true){
holder.tvDumbArmy.setText("true");
} else {
holder.tvDumbArmy.setText("false");
}
if(character.isOrderOfThePhoenix() == true){
holder.tvOrderFenix.setText("true");
} else {
holder.tvOrderFenix.setText("false");
}
if(character.isMinistryOfMagic() == true){
holder.tvMinMagic.setText("true");
} else {
holder.tvMinMagic.setText("false");
}
holder.tvAlias.setText(character.getAlias());
holder.tvWand.setText(character.getWand());
holder.tvBoggart.setText(character.getBoggart());
holder.tvAnimagus.setText(character.getAnimagus());
val name = character.getName()
/*if(name.isEmpty){
holder.tvName.visibility = View.GONE
}else{
holder.tvName.visibility = View.VISIBLE
holder.tvName.text = name
}*/
val visibility = if (name.isEmpty()) View.GONE else View.VISIBLE
holder.tvName.text = name
holder.tvName.visibility = visibility
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment