-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
AWS
committed
Mar 21, 2017
1 parent
2254582
commit be47f21
Showing
390 changed files
with
27,428 additions
and
4,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...id-sdk-cognito/src/main/resources/fabric/com.amazonaws.aws-android-sdk-cognito.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fabric-identifier=com.amazonaws.aws-android-sdk-cognito | ||
fabric-version=2.3.9 | ||
fabric-version=2.4.0 | ||
fabric-build-type=binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
aws-android-sdk-core/src/main/java/com/amazonaws/util/json/DateDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.amazonaws.util.json; | ||
|
||
import com.amazonaws.util.DateUtils; | ||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonParseException; | ||
import com.google.gson.JsonPrimitive; | ||
import com.google.gson.JsonSerializationContext; | ||
import com.google.gson.JsonSerializer; | ||
|
||
import java.lang.reflect.Type; | ||
import java.text.DateFormat; | ||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Arrays; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
public class DateDeserializer implements JsonDeserializer<Date>, JsonSerializer<Date> { | ||
|
||
private SimpleDateFormat mSimpleDateFormat; | ||
private final List<String> dateFormats; | ||
private final SimpleDateFormat mIso8601DateFormat; | ||
|
||
public DateDeserializer(String[] dateFormats) { | ||
this.dateFormats = Arrays.asList(dateFormats); | ||
this.mIso8601DateFormat = new SimpleDateFormat(DateUtils.ISO8601_DATE_PATTERN); | ||
} | ||
|
||
@Override | ||
public Date deserialize(JsonElement element, Type arg1, JsonDeserializationContext context) | ||
throws JsonParseException { | ||
final String dateString = element.getAsString(); | ||
Date date = null; | ||
for (final String df : dateFormats) { | ||
try { | ||
date = new Date(); | ||
mSimpleDateFormat = new SimpleDateFormat(df); | ||
date.setTime(mSimpleDateFormat.parse(dateString).getTime()); | ||
return date; | ||
} catch (final ParseException e) { | ||
// swallow , will try next type of date format | ||
} | ||
} | ||
// default to default implementation | ||
try { | ||
return DateFormat.getDateInstance(DateFormat.DEFAULT).parse(dateString); | ||
} catch (final ParseException e) { | ||
throw new JsonParseException(e.getMessage(), e); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public JsonElement serialize(Date src, Type typeOfSrc, | ||
JsonSerializationContext context) { | ||
synchronized (mIso8601DateFormat) { | ||
final String dateFormatAsString = mIso8601DateFormat.format(src); | ||
return new JsonPrimitive(dateFormatAsString); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
aws-android-sdk-core/src/main/resources/fabric/com.amazonaws.aws-android-sdk-core.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
fabric-identifier=com.amazonaws.aws-android-sdk-core | ||
fabric-version=2.3.9 | ||
fabric-version=2.4.0 | ||
fabric-build-type=binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.