mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +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;
|
||||||
|
|
@ -146,9 +145,9 @@ public class UploadMediaDetailAdapter extends
|
||||||
locale
|
locale
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
if (activity == null){
|
if (activity == null) {
|
||||||
fragment.startActivityForResult(intent, REQUEST_CODE_FOR_VOICE_INPUT);
|
fragment.startActivityForResult(intent, REQUEST_CODE_FOR_VOICE_INPUT);
|
||||||
}else {
|
} else {
|
||||||
activity.startActivityForResult(intent, REQUEST_CODE_FOR_VOICE_INPUT);
|
activity.startActivityForResult(intent, REQUEST_CODE_FOR_VOICE_INPUT);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -157,14 +156,18 @@ public class UploadMediaDetailAdapter extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSpeechResult(String spokenText) {
|
public void handleSpeechResult(String spokenText) {
|
||||||
if (currentPosition < uploadMediaDetails.size()) {
|
if (!spokenText.isEmpty()) {
|
||||||
UploadMediaDetail uploadMediaDetail = uploadMediaDetails.get(currentPosition);
|
String spokenTextCapitalized =
|
||||||
if (selectedVoiceIcon == SelectedVoiceIcon.CAPTION){
|
spokenText.substring(0, 1).toUpperCase() + spokenText.substring(1);
|
||||||
uploadMediaDetail.setCaptionText(spokenText);
|
if (currentPosition < uploadMediaDetails.size()) {
|
||||||
}else {
|
UploadMediaDetail uploadMediaDetail = uploadMediaDetails.get(currentPosition);
|
||||||
uploadMediaDetail.setDescriptionText(spokenText);
|
if (selectedVoiceIcon == SelectedVoiceIcon.CAPTION) {
|
||||||
|
uploadMediaDetail.setCaptionText(spokenTextCapitalized);
|
||||||
|
} else {
|
||||||
|
uploadMediaDetail.setDescriptionText(spokenTextCapitalized);
|
||||||
|
}
|
||||||
|
notifyItemChanged(currentPosition);
|
||||||
}
|
}
|
||||||
notifyItemChanged(currentPosition);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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