Skip to content

Commit a308a1c

Browse files
Fix Methods Usage Incompatible with Android API Level 21 (commons-app#5525)
1 parent 8df7f66 commit a308a1c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/src/main/java/fr/free/nrw/commons/upload/UploadMediaDetailAdapter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ private void startSpeechInput(String locale) {
146146
RecognizerIntent.EXTRA_LANGUAGE,
147147
locale
148148
);
149+
149150
try {
150151
if (activity == null) {
151152
fragment.startActivityForResult(intent, REQUEST_CODE_FOR_VOICE_INPUT);
@@ -182,9 +183,14 @@ public void handleSpeechResult(String spokenText) {
182183
*/
183184
public void removeDescription(final UploadMediaDetail uploadMediaDetail, final int position) {
184185
selectedLanguages.remove(position);
185-
final int ListPosition =
186-
(int) selectedLanguages.keySet().stream().filter(e -> e < position).count();
187-
this.uploadMediaDetails.remove(uploadMediaDetails.get(ListPosition));
186+
int listPosition = 0;
187+
List<Integer> keysList = new ArrayList<>(selectedLanguages.keySet());
188+
for (Integer key : keysList) {
189+
if (key < position) {
190+
listPosition++;
191+
}
192+
}
193+
this.uploadMediaDetails.remove(uploadMediaDetails.get(listPosition));
188194
int i = position + 1;
189195
while (selectedLanguages.containsKey(i)) {
190196
selectedLanguages.remove(i);

app/src/main/java/fr/free/nrw/commons/utils/CommonsDateUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static SimpleDateFormat getMediaSimpleDateFormat() {
3636
* @return timestamp
3737
*/
3838
public static SimpleDateFormat getIso8601DateFormatTimestamp() {
39-
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX",
39+
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'",
4040
Locale.ROOT);
4141
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
4242
return simpleDateFormat;

0 commit comments

Comments
 (0)