Skip to content

Commit

Permalink
#58 Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gscdev committed Sep 9, 2021
1 parent da6e3e2 commit f70bb56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ChapterFragment extends Fragment implements AudioListener {

private StoryBookChapterGson storyBookChapter;

protected String[] chapterText = {};
protected String[] chapterParagraph = {};

private RecyclerView chapterRecyclerView;

Expand Down Expand Up @@ -160,7 +160,7 @@ public void onItemClick(WordGson wordWithAudio, View view, int position) {
chapterRecyclerView.setAdapter(wordViewAdapter);
}

chapterText = new String[storyBookParagraphGsons.size()];
chapterParagraph = new String[storyBookParagraphGsons.size()];
for (int paragraphIndex = 0; paragraphIndex < storyBookParagraphGsons.size(); paragraphIndex++) {
Log.i(getClass().getName(), "storyBookParagraphGson.getOriginalText(): \"" + storyBookParagraphGsons.get(paragraphIndex).getOriginalText() + "\"");

Expand All @@ -169,7 +169,7 @@ public void onItemClick(WordGson wordWithAudio, View view, int position) {
Log.i(getClass().getName(), "wordsInOriginalText.length: " + wordsInOriginalText.length);
Log.i(getClass().getName(), "Arrays.toString(wordsInOriginalText): " + Arrays.toString(wordsInOriginalText));

chapterText[paragraphIndex] = originalText;
chapterParagraph[paragraphIndex] = originalText;

List<WordGson> wordAudios = storyBookParagraphGsons.get(paragraphIndex).getWords();
Log.i(getClass().getName(), "words: " + wordAudios);
Expand All @@ -188,13 +188,13 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
super.onViewCreated(view, savedInstanceState);

// Add button for initializing Text-to-Speech (TTS)
final String[] finalChapterText = chapterText;
final String[] chapterText = chapterParagraph;
FloatingActionButton fab = view.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i(getClass().getName(), "onClick");
playAudio(finalChapterText, ChapterFragment.this);
playAudio(chapterText, ChapterFragment.this);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
int[] titleFontSize = getResources().getIntArray(R.array.cover_title_font_size);
int[] descriptionFontSize = getResources().getIntArray(R.array.chapter_text_font_size);

for (int i=0; i<chapterText.length; i++) {
chapterText[i] = setWordSpacing(chapterText[i]);
for (int i=0; i<chapterParagraph.length; i++) {
chapterParagraph[i] = setWordSpacing(chapterParagraph[i]);
}

titleTextView = root.findViewById(R.id.storybook_title);
titleTextView.setText(chapterText[0]);
titleTextView.setText(chapterParagraph[0]);

setTextSizeByLevel(titleTextView, titleFontSize);

// Initialize audio parameters with the storybook title
audioTextView = titleTextView;

audioText = TextUtils.join("", chapterText);
audioText = TextUtils.join("", chapterParagraph);
description[0] = setWordSpacing((String) getArguments().get(ARG_DESCRIPTION));
descriptionTextView = root.findViewById(R.id.storybook_description);
descriptionTextView.setText(description[0]);
Expand Down Expand Up @@ -150,10 +150,10 @@ public void onError(String utteranceId) {
public void onStop(String utteranceId, boolean interrupted) {
super.onStop(utteranceId, interrupted);
requireActivity().runOnUiThread(() -> {
titleTextView.setText(TextUtils.join("", chapterText));
titleTextView.setText(TextUtils.join("", chapterParagraph));
descriptionTextView.setText(description[0]);
});
audioText = TextUtils.join("", chapterText);
audioText = TextUtils.join("", chapterParagraph);
audioTextView = titleTextView;
}
};
Expand Down

0 comments on commit f70bb56

Please sign in to comment.