Remove trailing whitespace
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 12 Jun 2013 16:29:10 +0000 (19:29 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 12 Jun 2013 16:29:10 +0000 (19:29 +0300)
31 files changed:
gson/com/google/gson/Gson.java
gson/com/google/gson/JsonIOException.java
gson/com/google/gson/JsonNull.java
gson/com/google/gson/JsonParser.java
gson/com/google/gson/JsonStreamParser.java
gson/com/google/gson/LongSerializationPolicy.java
gson/com/google/gson/annotations/Expose.java
gson/com/google/gson/annotations/Until.java
gson/com/google/gson/annotations/package-info.java
gson/com/google/gson/internal/$Gson$Preconditions.java
gson/com/google/gson/internal/bind/TypeAdapterRuntimeTypeWrapper.java
gson/com/google/gson/internal/bind/TypeAdapters.java
gson/com/google/gson/reflect/package-info.java
res/drawable-hdpi/ic_launcher.png
res/drawable-mdpi/ic_launcher.png
res/drawable-xhdpi/ic_launcher.png
res/drawable-xxhdpi/ic_launcher.png
res/layout/event_row_layout.xml
res/menu/add_event.xml
res/menu/event.xml
res/menu/main.xml
res/values/strings.xml
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/AddEventTabListener.java
src/ro/ieval/unical/Calendar.java
src/ro/ieval/unical/DisplayEventActivity.java
src/ro/ieval/unical/Event.java
src/ro/ieval/unical/EventAdapter.java
src/ro/ieval/unical/EventListActivity.java
src/ro/ieval/unical/LoginActivity.java
src/ro/ieval/unical/MainActivity.java

index a54188a678952e60ff5577b78e420cc362cf7f0f..7a52ac60bd178cf220950120a762cca0c42124ea 100644 (file)
@@ -408,7 +408,7 @@ public final class Gson {
    *  }</pre>
    *  Note that since you can not override type adapter factories for String and Java primitive
    *  types, our stats factory will not count the number of String or primitives that will be
-   *  read or written. 
+   *  read or written.
    * @param skipPast The type adapter factory that needs to be skipped while searching for
    *   a matching type adapter. In most cases, you should just pass <i>this</i> (the type adapter
    *   factory from where {@link #getDelegateAdapter} method is being invoked).
index dfeccd8ede6ce8563bfa4e6c642ae16cb1a54e40..310e506f51c530b05574ba96c4913c3e39f0b8e7 100644 (file)
@@ -18,7 +18,7 @@ package com.google.gson;
 /**
  * This exception is raised when Gson was unable to read an input stream
  * or write to one.
- * 
+ *
  * @author Inderjeet Singh
  * @author Joel Leitch
  */
index 56883369e9be65917aee2cefca5e951f01e84ad4..c82cedb69b1cdfda68515f82124141a656dde593 100644 (file)
@@ -1,63 +1,63 @@
-/*\r
- * Copyright (C) 2008 Google Inc.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package com.google.gson;\r
-\r
-/**\r
- * A class representing a Json {@code null} value.\r
- *\r
- * @author Inderjeet Singh\r
- * @author Joel Leitch\r
- * @since 1.2\r
- */\r
-public final class JsonNull extends JsonElement {\r
-  /**\r
-   * singleton for JsonNull\r
-   *\r
-   * @since 1.8\r
-   */\r
-  public static final JsonNull INSTANCE = new JsonNull();\r
-\r
-  /**\r
-   * Creates a new JsonNull object.\r
-   * Deprecated since Gson version 1.8. Use {@link #INSTANCE} instead\r
-   */\r
-  @Deprecated\r
-  public JsonNull() {\r
-    // Do nothing\r
-  }\r
-\r
-  @Override\r
-  JsonNull deepCopy() {\r
-    return INSTANCE;\r
-  }\r
-\r
-  /**\r
-   * All instances of JsonNull have the same hash code since they are indistinguishable\r
-   */\r
-  @Override\r
-  public int hashCode() {\r
-    return JsonNull.class.hashCode();\r
-  }\r
-\r
-  /**\r
-   * All instances of JsonNull are the same\r
-   */\r
-  @Override\r
-  public boolean equals(Object other) {\r
-    return this == other || other instanceof JsonNull;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.gson;
+
+/**
+ * A class representing a Json {@code null} value.
+ *
+ * @author Inderjeet Singh
+ * @author Joel Leitch
+ * @since 1.2
+ */
+public final class JsonNull extends JsonElement {
+  /**
+   * singleton for JsonNull
+   *
+   * @since 1.8
+   */
+  public static final JsonNull INSTANCE = new JsonNull();
+
+  /**
+   * Creates a new JsonNull object.
+   * Deprecated since Gson version 1.8. Use {@link #INSTANCE} instead
+   */
+  @Deprecated
+  public JsonNull() {
+    // Do nothing
+  }
+
+  @Override
+  JsonNull deepCopy() {
+    return INSTANCE;
+  }
+
+  /**
+   * All instances of JsonNull have the same hash code since they are indistinguishable
+   */
+  @Override
+  public int hashCode() {
+    return JsonNull.class.hashCode();
+  }
+
+  /**
+   * All instances of JsonNull are the same
+   */
+  @Override
+  public boolean equals(Object other) {
+    return this == other || other instanceof JsonNull;
+  }
+}
index a8ae337badc3f2c3b7a77483ae21e5df732693a6..4865813222e6f607d2e5484b488cc6a4d338b0d8 100644 (file)
@@ -1,93 +1,93 @@
-/*\r
- * Copyright (C) 2009 Google Inc.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.google.gson;\r
-\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.StringReader;\r
-\r
-import com.google.gson.internal.Streams;\r
-import com.google.gson.stream.JsonReader;\r
-import com.google.gson.stream.JsonToken;\r
-import com.google.gson.stream.MalformedJsonException;\r
-\r
-/**\r
- * A parser to parse Json into a parse tree of {@link JsonElement}s\r
- *\r
- * @author Inderjeet Singh\r
- * @author Joel Leitch\r
- * @since 1.3\r
- */\r
-public final class JsonParser {\r
-\r
-  /**\r
-   * Parses the specified JSON string into a parse tree\r
-   *\r
-   * @param json JSON text\r
-   * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON\r
-   * @throws JsonParseException if the specified text is not valid JSON\r
-   * @since 1.3\r
-   */\r
-  public JsonElement parse(String json) throws JsonSyntaxException {\r
-    return parse(new StringReader(json));\r
-  }\r
-\r
-  /**\r
-   * Parses the specified JSON string into a parse tree\r
-   *\r
-   * @param json JSON text\r
-   * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON\r
-   * @throws JsonParseException if the specified text is not valid JSON\r
-   * @since 1.3\r
-   */\r
-  public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {\r
-    try {\r
-      JsonReader jsonReader = new JsonReader(json);\r
-      JsonElement element = parse(jsonReader);\r
-      if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {\r
-        throw new JsonSyntaxException("Did not consume the entire document.");\r
-      }\r
-      return element;\r
-    } catch (MalformedJsonException e) {\r
-      throw new JsonSyntaxException(e);\r
-    } catch (IOException e) {\r
-      throw new JsonIOException(e);\r
-    } catch (NumberFormatException e) {\r
-      throw new JsonSyntaxException(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Returns the next value from the JSON stream as a parse tree.\r
-   *\r
-   * @throws JsonParseException if there is an IOException or if the specified\r
-   *     text is not valid JSON\r
-   * @since 1.6\r
-   */\r
-  public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {\r
-    boolean lenient = json.isLenient();\r
-    json.setLenient(true);\r
-    try {\r
-      return Streams.parse(json);\r
-    } catch (StackOverflowError e) {\r
-      throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);\r
-    } catch (OutOfMemoryError e) {\r
-      throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);\r
-    } finally {\r
-      json.setLenient(lenient);\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.gson;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+
+import com.google.gson.internal.Streams;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
+import com.google.gson.stream.MalformedJsonException;
+
+/**
+ * A parser to parse Json into a parse tree of {@link JsonElement}s
+ *
+ * @author Inderjeet Singh
+ * @author Joel Leitch
+ * @since 1.3
+ */
+public final class JsonParser {
+
+  /**
+   * Parses the specified JSON string into a parse tree
+   *
+   * @param json JSON text
+   * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
+   * @throws JsonParseException if the specified text is not valid JSON
+   * @since 1.3
+   */
+  public JsonElement parse(String json) throws JsonSyntaxException {
+    return parse(new StringReader(json));
+  }
+
+  /**
+   * Parses the specified JSON string into a parse tree
+   *
+   * @param json JSON text
+   * @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
+   * @throws JsonParseException if the specified text is not valid JSON
+   * @since 1.3
+   */
+  public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
+    try {
+      JsonReader jsonReader = new JsonReader(json);
+      JsonElement element = parse(jsonReader);
+      if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
+        throw new JsonSyntaxException("Did not consume the entire document.");
+      }
+      return element;
+    } catch (MalformedJsonException e) {
+      throw new JsonSyntaxException(e);
+    } catch (IOException e) {
+      throw new JsonIOException(e);
+    } catch (NumberFormatException e) {
+      throw new JsonSyntaxException(e);
+    }
+  }
+
+  /**
+   * Returns the next value from the JSON stream as a parse tree.
+   *
+   * @throws JsonParseException if there is an IOException or if the specified
+   *     text is not valid JSON
+   * @since 1.6
+   */
+  public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
+    boolean lenient = json.isLenient();
+    json.setLenient(true);
+    try {
+      return Streams.parse(json);
+    } catch (StackOverflowError e) {
+      throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
+    } catch (OutOfMemoryError e) {
+      throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
+    } finally {
+      json.setLenient(lenient);
+    }
+  }
+}
index f0438db32963b58f040a3ff1b6e16b5d4c321a13..0c66127964380067ba41908d6f0154488696c652 100644 (file)
@@ -30,11 +30,11 @@ import com.google.gson.stream.MalformedJsonException;
 /**
  * A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
  * asynchronously.
- * 
+ *
  * <p>This class is conditionally thread-safe (see Item 70, Effective Java second edition). To
  * properly use this class across multiple threads, you will need to add some external
  * synchronization.  For example:
- * 
+ *
  * <pre>
  * JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'");
  * JsonElement element;
@@ -58,9 +58,9 @@ public final class JsonStreamParser implements Iterator<JsonElement> {
    * @since 1.4
    */
   public JsonStreamParser(String json) {
-    this(new StringReader(json));      
+    this(new StringReader(json));
   }
-  
+
   /**
    * @param reader The data stream containing JSON elements concatenated to each other.
    * @since 1.4
@@ -70,10 +70,10 @@ public final class JsonStreamParser implements Iterator<JsonElement> {
     parser.setLenient(true);
     lock = new Object();
   }
-  
+
   /**
    * Returns the next available {@link JsonElement} on the reader. Null if none available.
-   * 
+   *
    * @return the next available {@link JsonElement} on the reader. Null if none available.
    * @throws JsonParseException if the incoming stream is malformed JSON.
    * @since 1.4
@@ -82,7 +82,7 @@ public final class JsonStreamParser implements Iterator<JsonElement> {
     if (!hasNext()) {
       throw new NoSuchElementException();
     }
-    
+
     try {
       return Streams.parse(parser);
     } catch (StackOverflowError e) {
index 3d9a2da13dbf69ed33a9c01a7bc0cb1f06753452..a141189a5bd263c06bea2f9d1dc8f8e58b8f3059 100644 (file)
@@ -36,9 +36,9 @@ public enum LongSerializationPolicy {
       return new JsonPrimitive(value);
     }
   },
-  
+
   /**
-   * Serializes a long value as a quoted string.  For example, assume an object has a long field 
+   * Serializes a long value as a quoted string.  For example, assume an object has a long field
    * named "f" then the serialized output would be:
    * {@code {"f":"123"}}.
    */
@@ -47,7 +47,7 @@ public enum LongSerializationPolicy {
       return new JsonPrimitive(String.valueOf(value));
     }
   };
-  
+
   /**
    * Serialize this {@code value} using this serialization policy.
    *
index 1b9c70df0840d4c9fc8297bfa1e6975d4922f9aa..99fd86f512023b485713f1cbf2983fc3a50650c1 100644 (file)
@@ -60,7 +60,7 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
 public @interface Expose {
-  
+
   /**
    * If {@code true}, the field marked with this annotation is written out in the JSON while
    * serializing. If {@code false}, the field marked with this annotation is skipped from the
@@ -71,7 +71,7 @@ public @interface Expose {
 
   /**
    * If {@code true}, the field marked with this annotation is deserialized from the JSON.
-   * If {@code false}, the field marked with this annotation is skipped during deserialization. 
+   * If {@code false}, the field marked with this annotation is skipped during deserialization.
    * Defaults to {@code true}.
    * @since 1.4
    */
index 4648b8a2ad07dcc24703921e56ac04b974b7b512..3fe69c4c261269cb45727412bd3044fade148f10 100644 (file)
@@ -46,7 +46,7 @@ import java.lang.annotation.Target;
  * methods will use all the fields for serialization and deserialization. However, if you created
  * Gson with {@code Gson gson = new GsonBuilder().setVersion(1.2).create()} then the
  * {@code toJson()} and {@code fromJson()} methods of Gson will exclude the {@code emailAddress}
- * and {@code password} fields from the example above, because the version number passed to the 
+ * and {@code password} fields from the example above, because the version number passed to the
  * GsonBuilder, {@code 1.2}, exceeds the version number set on the {@code Until} annotation,
  * {@code 1.1}, for those fields.
  *
index 1c461fd685385c40ab0eb20029dbe9330bcfaea9..e14b72a1b678c254664bb4ec869b32934bb19d40 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * This package provides annotations that can be used with {@link com.google.gson.Gson}.
- * 
+ *
  * @author Inderjeet Singh, Joel Leitch
  */
 package com.google.gson.annotations;
\ No newline at end of file
index ccc0390d4f29003ab3c0d7b447b30e63097090ce..2042f4765d5547042c188250bf0e1d477a40d3da 100644 (file)
@@ -1,45 +1,45 @@
-/*\r
- * Copyright (C) 2008 Google Inc.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package com.google.gson.internal;\r
-\r
-/**\r
- * A simple utility class used to check method Preconditions.\r
- *\r
- * <pre>\r
- * public long divideBy(long value) {\r
- *   Preconditions.checkArgument(value != 0);\r
- *   return this.value / value;\r
- * }\r
- * </pre>\r
- *\r
- * @author Inderjeet Singh\r
- * @author Joel Leitch\r
- */\r
-public final class $Gson$Preconditions {\r
-  public static <T> T checkNotNull(T obj) {\r
-    if (obj == null) {\r
-      throw new NullPointerException();\r
-    }\r
-    return obj;\r
-  }\r
-\r
-  public static void checkArgument(boolean condition) {\r
-    if (!condition) {\r
-      throw new IllegalArgumentException();\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.gson.internal;
+
+/**
+ * A simple utility class used to check method Preconditions.
+ *
+ * <pre>
+ * public long divideBy(long value) {
+ *   Preconditions.checkArgument(value != 0);
+ *   return this.value / value;
+ * }
+ * </pre>
+ *
+ * @author Inderjeet Singh
+ * @author Joel Leitch
+ */
+public final class $Gson$Preconditions {
+  public static <T> T checkNotNull(T obj) {
+    if (obj == null) {
+      throw new NullPointerException();
+    }
+    return obj;
+  }
+
+  public static void checkArgument(boolean condition) {
+    if (!condition) {
+      throw new IllegalArgumentException();
+    }
+  }
+}
index 7e52c27d271f3840dfa6b2dbbe615b0ff9c05f6b..839d49c92e04583b687083fe358a40beaf3a0c54 100644 (file)
@@ -1,81 +1,81 @@
-/*\r
- * Copyright (C) 2011 Google Inc.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.google.gson.internal.bind;\r
-\r
-import com.google.gson.Gson;\r
-import com.google.gson.TypeAdapter;\r
-import com.google.gson.reflect.TypeToken;\r
-import com.google.gson.stream.JsonReader;\r
-import com.google.gson.stream.JsonWriter;\r
-import java.io.IOException;\r
-import java.lang.reflect.Type;\r
-import java.lang.reflect.TypeVariable;\r
-\r
-final class TypeAdapterRuntimeTypeWrapper<T> extends TypeAdapter<T> {\r
-  private final Gson context;\r
-  private final TypeAdapter<T> delegate;\r
-  private final Type type;\r
-\r
-  TypeAdapterRuntimeTypeWrapper(Gson context, TypeAdapter<T> delegate, Type type) {\r
-    this.context = context;\r
-    this.delegate = delegate;\r
-    this.type = type;\r
-  }\r
-\r
-  @Override\r
-  public T read(JsonReader in) throws IOException {\r
-    return delegate.read(in);\r
-  }\r
-\r
-  @SuppressWarnings({"rawtypes", "unchecked"})\r
-  @Override\r
-  public void write(JsonWriter out, T value) throws IOException {\r
-    // Order of preference for choosing type adapters\r
-    // First preference: a type adapter registered for the runtime type\r
-    // Second preference: a type adapter registered for the declared type\r
-    // Third preference: reflective type adapter for the runtime type (if it is a sub class of the declared type)\r
-    // Fourth preference: reflective type adapter for the declared type\r
-\r
-    TypeAdapter chosen = delegate;\r
-    Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value);\r
-    if (runtimeType != type) {\r
-      TypeAdapter runtimeTypeAdapter = context.getAdapter(TypeToken.get(runtimeType));\r
-      if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) {\r
-        // The user registered a type adapter for the runtime type, so we will use that\r
-        chosen = runtimeTypeAdapter;\r
-      } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) {\r
-        // The user registered a type adapter for Base class, so we prefer it over the\r
-        // reflective type adapter for the runtime type\r
-        chosen = delegate;\r
-      } else {\r
-        // Use the type adapter for runtime type\r
-        chosen = runtimeTypeAdapter;\r
-      }\r
-    }\r
-    chosen.write(out, value);\r
-  }\r
-\r
-  /**\r
-   * Finds a compatible runtime type if it is more specific\r
-   */\r
-  private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) {\r
-    if (value != null\r
-        && (type == Object.class || type instanceof TypeVariable<?> || type instanceof Class<?>)) {\r
-      type = value.getClass();\r
-    }\r
-    return type;\r
-  }\r
-}\r
+/*
+ * Copyright (C) 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.google.gson.internal.bind;
+
+import com.google.gson.Gson;
+import com.google.gson.TypeAdapter;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+
+final class TypeAdapterRuntimeTypeWrapper<T> extends TypeAdapter<T> {
+  private final Gson context;
+  private final TypeAdapter<T> delegate;
+  private final Type type;
+
+  TypeAdapterRuntimeTypeWrapper(Gson context, TypeAdapter<T> delegate, Type type) {
+    this.context = context;
+    this.delegate = delegate;
+    this.type = type;
+  }
+
+  @Override
+  public T read(JsonReader in) throws IOException {
+    return delegate.read(in);
+  }
+
+  @SuppressWarnings({"rawtypes", "unchecked"})
+  @Override
+  public void write(JsonWriter out, T value) throws IOException {
+    // Order of preference for choosing type adapters
+    // First preference: a type adapter registered for the runtime type
+    // Second preference: a type adapter registered for the declared type
+    // Third preference: reflective type adapter for the runtime type (if it is a sub class of the declared type)
+    // Fourth preference: reflective type adapter for the declared type
+
+    TypeAdapter chosen = delegate;
+    Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value);
+    if (runtimeType != type) {
+      TypeAdapter runtimeTypeAdapter = context.getAdapter(TypeToken.get(runtimeType));
+      if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) {
+        // The user registered a type adapter for the runtime type, so we will use that
+        chosen = runtimeTypeAdapter;
+      } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) {
+        // The user registered a type adapter for Base class, so we prefer it over the
+        // reflective type adapter for the runtime type
+        chosen = delegate;
+      } else {
+        // Use the type adapter for runtime type
+        chosen = runtimeTypeAdapter;
+      }
+    }
+    chosen.write(out, value);
+  }
+
+  /**
+   * Finds a compatible runtime type if it is more specific
+   */
+  private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) {
+    if (value != null
+        && (type == Object.class || type instanceof TypeVariable<?> || type instanceof Class<?>)) {
+      type = value.getClass();
+    }
+    return type;
+  }
+}
index 8412ad533c71c4b6c4cb1b359a8c6dc4fa09e4f7..21a5f64d6797a6502bec2d56cbea7f9a75c7edb3 100644 (file)
@@ -362,7 +362,7 @@ public final class TypeAdapters {
       out.value(value);
     }
   };
-  
+
   public static final TypeAdapter<BigDecimal> BIG_DECIMAL = new TypeAdapter<BigDecimal>() {
     @Override public BigDecimal read(JsonReader in) throws IOException {
       if (in.peek() == JsonToken.NULL) {
@@ -380,7 +380,7 @@ public final class TypeAdapters {
       out.value(value);
     }
   };
-  
+
   public static final TypeAdapter<BigInteger> BIG_INTEGER = new TypeAdapter<BigInteger>() {
     @Override public BigInteger read(JsonReader in) throws IOException {
       if (in.peek() == JsonToken.NULL) {
index e666c431157ff39006d61287b8bddb6b1305ec49..5e43ee9fcb0e6780f7470d0f4df3b44474e5e448 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * This package provides utility classes for finding type information for generic types.
- *  
+ *
  * @author Inderjeet Singh, Joel Leitch
  */
 package com.google.gson.reflect;
\ No newline at end of file
index f48ba3e7ab21714b7ac58bbc1ee587b1d1a543f7..d72c84bb5f2ea9462d9752662da82aaf01b75da5 100644 (file)
Binary files a/res/drawable-hdpi/ic_launcher.png and b/res/drawable-hdpi/ic_launcher.png differ
index 3ff2b76fddaea5f943dce050060b9632c129bd04..42219b60e7d855e3018929bc26b674e15de70bb3 100644 (file)
Binary files a/res/drawable-mdpi/ic_launcher.png and b/res/drawable-mdpi/ic_launcher.png differ
index 774763e0522097c753ceb3d32feea29311715e03..129453f652d8eee6efcee162a959779e4ef103e7 100644 (file)
Binary files a/res/drawable-xhdpi/ic_launcher.png and b/res/drawable-xhdpi/ic_launcher.png differ
index 32da992de27fd2a45a80888677722ea832bc649f..361d98461b98fd47c42a904a23421bc9c9fdd1d7 100644 (file)
Binary files a/res/drawable-xxhdpi/ic_launcher.png and b/res/drawable-xxhdpi/ic_launcher.png differ
index 048a6b32d87dbc17ef8ee914e6a0811ece46a3e2..fb66d8137b1e28c41445aee8ebdaaf35b892d6a0 100644 (file)
@@ -14,7 +14,7 @@
         android:layout_width="match_parent"
         android:layout_height="7dp"
      />
-    
+
     <View
         android:layout_width="match_parent"
         android:layout_height="1dp"
index 67850a8be1b31eefd8818ae48a93fd18d3e9efb9..eb3939bf5ca526d48c36faf9e100a72f94fce0f4 100644 (file)
@@ -2,6 +2,6 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:id="@+id/save" android:icon="@android:drawable/ic_menu_save" android:title="@string/save" android:titleCondensed="SAVE" android:showAsAction="always"></item>
     <item android:id="@+id/cancel" android:icon="@android:drawable/ic_menu_close_clear_cancel" android:title="@string/cancel" android:titleCondensed="CANCEL" android:showAsAction="ifRoom"></item>
-    
+
 
 </menu>
index f4ce2755e5e45d5a44a818db75dc747a76d5fb4e..1dde0581021c42568197e1a8b9b8026850e176ab 100644 (file)
@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:id="@+id/deleteevent" android:icon="@android:drawable/ic_menu_delete" android:title="Delete Event" android:visible="true" android:titleCondensed="DELETE" android:showAsAction="always"></item>
-    <item android:id="@+id/NewEvent" android:title="New event" 
+    <item android:id="@+id/NewEvent" android:title="New event"
         android:visible="true" android:showAsAction="ifRoom"
         android:icon="@android:drawable/ic_menu_add"
     android:titleCondensed="NEW">
-        
+
     </item>
-    <item android:id="@+id/eventlist" 
-        android:title="@string/eventlist" 
-        android:visible="true" 
+    <item android:id="@+id/eventlist"
+        android:title="@string/eventlist"
+        android:visible="true"
         android:showAsAction="never" >
-        
+
     </item>
-    
+
 
 </menu>
index 799568d49daf386e2b311991d06989a8609e7829..757150c6059275bc0f721aa3fc638e5bb6ecb8fb 100644 (file)
@@ -4,8 +4,8 @@
         android:visible="true" android:showAsAction="always"
         android:icon="@android:drawable/ic_menu_add"
     android:titleCondensed="NEW">
-        
+
     </item>
-    
+
 
 </menu>
index e2c68c212ae949cefa2dc579a7cbc554b2b6991a..289dde350a0393b65615990d852598e87a58b39c 100644 (file)
@@ -37,7 +37,7 @@
     <string name="end_label">End: </string>
     <string name="repeat">Repeat</string>
     <string name="repeat_every">Repeat every</string>
-    
+
     <string-array name="repeat_array">
         <item>Daily</item>
         <item>Weekly</item>
index d16b426714859745810799de01414440786195b9..606685fbd2eae228b715e1b3ac54b6ca8c113a9d 100644 (file)
@@ -34,7 +34,7 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                final ActionBar.Tab t1 = actionBar.newTab().setText(this.getString(R.string.addevtab1));
                final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2));
                final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3));
-               
+
                final Fragment f1 = new TrivialFragment();
                final Bundle b1=new Bundle();
                b1.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_basic_tab);
@@ -49,24 +49,24 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                final Bundle b3=new Bundle();
                b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab);
                f3.setArguments(b3);
-               
+
                t1.setTabListener(new AddEventTabListener(f1));
                t2.setTabListener(new AddEventTabListener(f2));
                t3.setTabListener(new AddEventTabListener(f3));
-               
+
                actionBar.addTab(t1);
                actionBar.addTab(t2);
                actionBar.addTab(t3);
-               
+
                handleViews(f1,f2,f3);
-               
+
        }
-       
+
        private void handleViews(Fragment f1,Fragment f2,Fragment f3) {
                Switch repeatSwitch = (Switch) this.getFragmentManager().findFragmentById(f1.getId()).getView().findViewById(R.id.repeat_switch);
                final Spinner repeatSpinner = (Spinner) this.getFragmentManager().findFragmentById(f1.getId()).getView().findViewById(R.id.repeat_spinner);
                repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-                       
+
                        @Override
                        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                                if(isChecked) {
@@ -84,7 +84,7 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                inflater.inflate(R.menu.add_event, menu);
                return true;
        }
-       
+
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
                switch (item.getItemId()) {
@@ -95,7 +95,7 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                                return false;
                }
        }
-       
+
        public void showDateTimePickerDialog(final View v) {
                dateTimeTextView=(TextView) v;
                if(v.getId()==R.id.date_start || v.getId()==R.id.date_end)
index 61ac236fbe224bc60422fdb6f7deeb57cab22ed8..ea67b63f4c7dbf62967a75331e0cd1fd5c873beb 100644 (file)
@@ -25,6 +25,6 @@ public class AddEventTabListener implements ActionBar.TabListener {
        @Override
        public void onTabReselected(final Tab tab, final FragmentTransaction ft) {
                // TODO Auto-generated method stub
-               
+
        }
 }
index 1ab1988a7d27aeb5974d3b90aeadc7e93f86fb29..192c93784a008812ba218eac1843c6ff6f67bd5d 100644 (file)
@@ -27,7 +27,7 @@ final class Calendar {
        public final boolean visible;
        /** Name of the account used to sync this calendar */
        public final String accountName;
-       /** Type of the calendar used to sync this calendar */ 
+       /** Type of the calendar used to sync this calendar */
        public final String accountType;
        /** Calendar colour */
        public final int colour;
index 48b8068bbb9bb43ebdb18161cf36fe31be34b018..798adc68a53d5e0608397b89e46df7e2b4754302 100644 (file)
@@ -28,20 +28,20 @@ public class DisplayEventActivity extends Activity {
                final Event e=getIntent().getParcelableExtra(EXTRA_EVENT);
                setContentView(R.layout.event_view);
                setTitle(e.title);
-               
+
                final TextView startDay= (TextView) findViewById(R.id.startday);
                final TextView endDay= (TextView) findViewById(R.id.endday);
                final TextView startDate= (TextView) findViewById(R.id.startdate);
                final TextView endDate= (TextView) findViewById(R.id.enddate);
                final TextView startTime= (TextView) findViewById(R.id.starttime);
                final TextView endTime= (TextView) findViewById(R.id.endtime);
-               
+
                final Date start=new Date(e.dtstart);
                final Date end=new Date(e.dtend);
                final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.UK);
                final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.UK);
                final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
-               
+
                startDay.setText(dayOfWeekFormat.format(start));
                if(dateFormat.format(start)!=dateFormat.format(end)) {
                        endDay.setText(dayOfWeekFormat.format(end));
@@ -51,14 +51,14 @@ public class DisplayEventActivity extends Activity {
                startTime.setText(timeFormat.format(start));
                endTime.setText(timeFormat.format(end));
        }
-       
+
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
                inflater.inflate(R.menu.event, menu);
                return true;
        }
-       
+
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
                // Handle item selection
index a069a9f0cfa38d39bc9ae0d1758919765ca4f55c..c1648056963e54568c7987551da2a9d5632fb0e7 100644 (file)
@@ -48,7 +48,7 @@ final class Event implements Parcelable{
        public final String description;
        /** Event colour */
        public final int eventColour;
-       /** Event start time (UTC milliseconds since epoch) */ 
+       /** Event start time (UTC milliseconds since epoch) */
        public final long dtstart;
        /** Event end time (UTC milliseconds since epoch) */
        public final long dtend;
@@ -85,7 +85,7 @@ final class Event implements Parcelable{
                cursor.close();
                return events;
        }
-       
+
        public static Event[] getAllEvents(final Context context) {
                final ArrayList<Event> r = new ArrayList<Event>();
                for(final Calendar calendar : Calendar.getAllCalendars(context))
@@ -98,7 +98,7 @@ final class Event implements Parcelable{
                final ContentResolver cr=context.getContentResolver();
                cr.delete(Uri.withAppendedPath(Events.CONTENT_URI, Long.toString(_id)), null, null);
        }
-       
+
        @Override
        public int describeContents() {
                return 0;
index 577ea0c1e4f9a3abb71332aeb86fa67f4e6fa432..a9e01817318d0f4ad0ffb02eafce111a06b1f218 100644 (file)
@@ -18,7 +18,7 @@ public class EventAdapter extends ArrayAdapter<Event> {
                this.context=context;
                this.values=values;
        }
-       
+
        @Override
        public View getView(final int position, final View convertView, final ViewGroup parent) {
                final LayoutInflater inflater = (LayoutInflater) context
@@ -32,7 +32,7 @@ public class EventAdapter extends ArrayAdapter<Event> {
                title.setText(values[position].title);
                dstart.setText(new Date(values[position].dtstart).toString());
                dend.setText(new Date(values[position].dtend).toString());
-               
+
                return rowView;
         }
 }
index 67e0a7f06b8d8e5c85cf2e8badcc3f5774f9398e..b8c81ab30ac5fca68609a710715f316b5605397e 100644 (file)
@@ -17,17 +17,17 @@ import android.widget.ListView;
 
 
 public class EventListActivity extends Activity {
-       
+
        //Used to refresh events if the user wants to display only certain events
        //Sry for bad english
        //Muie la comisie
        private void displayEvents() {
                final Event events[]=Event.getAllEvents(getBaseContext());
                final ListView lv = (ListView) findViewById(R.id.eventlist);
-               
+
                Arrays.sort(events,new EventComparator());
                int idx=-1;//index of the first event to be displayed
-               for(int i=0; i<events.length; ++i) 
+               for(int i=0; i<events.length; ++i)
                        if(idx==-1 && events[i].dtend>new Date().getTime()) idx=i;
                if(idx==-1) idx=0;
 
@@ -41,10 +41,10 @@ public class EventListActivity extends Activity {
                                        final long arg3) {
                                DisplayEventActivity.displayEvent(EventListActivity.this,events[arg2]);
                        }
-                       
+
                });
        }
-       
+
        private static class EventComparator implements Comparator<Event> {
                @Override
                public int compare(final Event lhs, final Event rhs) {
@@ -61,17 +61,17 @@ public class EventListActivity extends Activity {
        protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.event_list);
-               
+
                displayEvents();
        }
-       
+
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
                inflater.inflate(R.menu.main, menu);
                return true;
        }
-       
+
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
                switch (item.getItemId()) {
@@ -83,5 +83,5 @@ public class EventListActivity extends Activity {
                                return false;
                }
        }
-       
+
 }
index 3dd36366fe731f27fac4fc4f2b01f1fc1c9cd1f4..dcda4a86a168f1053ceb4ece9998401c2d3e7bff 100644 (file)
@@ -6,7 +6,7 @@ import android.view.View;
 import android.widget.Button;
 
 public final class LoginActivity extends Activity {
-       
+
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
@@ -16,9 +16,9 @@ public final class LoginActivity extends Activity {
                //final EditText user=(EditText) findViewById(R.id.editText1);
                //final EditText pass=(EditText) findViewById(R.id.editText2);
                final Button logIn=(Button) findViewById(R.id.button1);
-       
+
                logIn.setOnClickListener(new View.OnClickListener() {
-                       
+
                        @Override
                        public void onClick(final View v) {
                                setContentView(R.layout.event_view);
index b779d069ce91e0f88eab68b3bff54e1d927a8065..f94eb5f62ecff27f5fc917499190c04f589af06a 100644 (file)
@@ -8,11 +8,11 @@ import android.view.MenuInflater;
 import android.view.MenuItem;
 
 public class MainActivity extends android.app.Activity {
-       
+
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
-               
+
                final SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
                if(prefs.getBoolean("FirstTime", true)) {
                        prefs.edit().putBoolean("FirstTime", false).commit();
@@ -23,14 +23,14 @@ public class MainActivity extends android.app.Activity {
                final Intent intent=new Intent(this, EventListActivity.class);
                startActivity(intent);
        }
-       
+
        @Override
        public boolean onCreateOptionsMenu(final Menu menu) {
                final MenuInflater inflater = getMenuInflater();
                inflater.inflate(R.menu.main, menu);
                return true;
        }
-       
+
        @Override
        public boolean onOptionsItemSelected(final MenuItem item) {
                switch (item.getItemId()) {
This page took 0.047008 seconds and 4 git commands to generate.