mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-01 07:13:56 +01:00
Merge remote-tracking branch 'origin/issue2425' into issue2425
This commit is contained in:
commit
16df5e0eb4
1 changed files with 17 additions and 5 deletions
|
|
@ -160,18 +160,30 @@ public class UploadMediaDetailAdapter extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the result of the speech input by processing the spoken text.
|
||||||
|
* If the spoken text is not empty, it capitalizes the first letter of the spoken text
|
||||||
|
* and updates the appropriate field (caption or description) of the current
|
||||||
|
* UploadMediaDetail based on the selected voice icon.
|
||||||
|
* Finally, it notifies the adapter that the data set has changed.
|
||||||
|
*
|
||||||
|
* @param spokenText the text input received from speech recognition.
|
||||||
|
*/
|
||||||
public void handleSpeechResult(String spokenText) {
|
public void handleSpeechResult(String spokenText) {
|
||||||
if (!spokenText.isEmpty()) {
|
if (!spokenText.isEmpty()) {
|
||||||
String spokenTextCapitalized =
|
String spokenTextCapitalized =
|
||||||
spokenText.substring(0, 1).toUpperCase() + spokenText.substring(1);
|
spokenText.substring(0, 1).toUpperCase() + spokenText.substring(1);
|
||||||
if (currentPosition < uploadMediaDetails.size()) {
|
if (currentPosition < uploadMediaDetails.size()) {
|
||||||
UploadMediaDetail uploadMediaDetail = uploadMediaDetails.get(currentPosition);
|
UploadMediaDetail uploadMediaDetail = uploadMediaDetails.get(currentPosition);
|
||||||
if (selectedVoiceIcon == SelectedVoiceIcon.CAPTION) {
|
switch (selectedVoiceIcon) {
|
||||||
uploadMediaDetail.setCaptionText(spokenTextCapitalized);
|
case CAPTION:
|
||||||
} else {
|
uploadMediaDetail.setCaptionText(spokenTextCapitalized);
|
||||||
uploadMediaDetail.setDescriptionText(spokenTextCapitalized);
|
break;
|
||||||
|
case DESCRIPTION:
|
||||||
|
uploadMediaDetail.setDescriptionText(spokenTextCapitalized);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
notifyItemChanged(currentPosition);
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue