mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
parent
1ebbe63fc7
commit
b7323d0913
1 changed files with 16 additions and 10 deletions
|
|
@ -35,7 +35,6 @@ import fr.free.nrw.commons.utils.AbstractTextWatcher;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
@ -157,16 +156,20 @@ public class UploadMediaDetailAdapter extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSpeechResult(String spokenText) {
|
public void handleSpeechResult(String spokenText) {
|
||||||
|
if (!spokenText.isEmpty()) {
|
||||||
|
String spokenTextCapitalized =
|
||||||
|
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) {
|
if (selectedVoiceIcon == SelectedVoiceIcon.CAPTION) {
|
||||||
uploadMediaDetail.setCaptionText(spokenText);
|
uploadMediaDetail.setCaptionText(spokenTextCapitalized);
|
||||||
} else {
|
} else {
|
||||||
uploadMediaDetail.setDescriptionText(spokenText);
|
uploadMediaDetail.setDescriptionText(spokenTextCapitalized);
|
||||||
}
|
}
|
||||||
notifyItemChanged(currentPosition);
|
notifyItemChanged(currentPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove description based on position from the list and notifies the RecyclerView Adapter that
|
* Remove description based on position from the list and notifies the RecyclerView Adapter that
|
||||||
|
|
@ -555,12 +558,15 @@ public class UploadMediaDetailAdapter extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
|
|
||||||
void showAlert(int mediaDetailDescription, int descriptionInfo);
|
void showAlert(int mediaDetailDescription, int descriptionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface EventListener {
|
public interface EventListener {
|
||||||
|
|
||||||
void onPrimaryCaptionTextChange(boolean isNotEmpty);
|
void onPrimaryCaptionTextChange(boolean isNotEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SelectedVoiceIcon {
|
enum SelectedVoiceIcon {
|
||||||
CAPTION,
|
CAPTION,
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue