You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.
Currently, the project structure is too coupled to make modifications, for example, you have the following code inside your ViewHolder
public void onClick(View v) {
int position = getAdapterPosition();
mCursor.moveToPosition(position);
int topicNameIndex = mCursor.getColumnIndex(DatabaseContract.FlashCardsEntry.FLASH_CARD_TOPIC_NAME);
int questionIndex = mCursor.getColumnIndex(DatabaseContract.FlashCardsEntry.FLASH_CARD_QUESTION);
int answerIndex = mCursor.getColumnIndex(DatabaseContract.FlashCardsEntry.FLASH_CARD_ANSWER);
String topicName = mCursor.getString(topicNameIndex);
String question = mCursor.getString(questionIndex);
String answer = mCursor.getString(answerIndex);
flashCardsRecyclerViewCursorAdapterOnClickListener.onFlashCardClicked(new FlashCard(topicName,question,answer));
}
A ViewHolder shouldn't know that we're using Cursors for storing data, Instead it should only deals with a DTO and do the conversion to cursor inside a helper class for loading/saving.
The text was updated successfully, but these errors were encountered:
@vincent-paing Yeah i do agree with your suggestions. This coupling may be present in more than one place but we should take one at a time starting from this one. You can definitely go ahead and fix it. 😄
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently, the project structure is too coupled to make modifications, for example, you have the following code inside your ViewHolder
A ViewHolder shouldn't know that we're using Cursors for storing data, Instead it should only deals with a DTO and do the conversion to cursor inside a helper class for loading/saving.
The text was updated successfully, but these errors were encountered: