Skip to content

Commit

Permalink
bug/#6-reset-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
Neomer committed Apr 13, 2019
1 parent fb6ee43 commit d33d6e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {

txtQuestion = getView().findViewById(R.id.txtQuestion);
txtQuestion.setMovementMethod(new ScrollingMovementMethod());
txtQuestion.scrollTo(0, 0);

progressBar = getView().findViewById(R.id.updateProgressBar);

Expand Down Expand Up @@ -90,6 +89,7 @@ private CharSequence getText(int id, Object... args) {
}

public void update(Question question) {
txtQuestion.scrollTo(0, 0);
if (progressBar != null) {
progressBar.setVisibility(View.INVISIBLE);
}
Expand All @@ -102,6 +102,7 @@ public void update(Question question) {
}

private void updateAnswer(Answer answer) {
txtQuestion.scrollTo(0, 0);
if (answer.getComment() != null && !answer.getComment().isEmpty()) {
txtQuestion.setText(Html.fromHtml(
getResources().getString(R.string.answer_and_comment_label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void dislike() {
}
}

void checkAnswer(String guess) {
void checkAnswer(final String guess) {
provider.getAnswer(question.getValue(), guess, new Callback<Answer>() {
@Override
public void onReady(Answer data) {
Expand All @@ -51,7 +51,7 @@ public void onReady(Answer data) {

@Override
public void onFailure(Throwable t) {
Log.e(TAG, t.getLocalizedMessage());
provider.getAnswer(getQuestion().getValue(), guess, this);
}
});
}
Expand Down

0 comments on commit d33d6e2

Please sign in to comment.