package com.sarality.app.data.image;

/**
 * An image that is displayed in the Application.
 *
 * @author abhideep@ (Abhideep Singh)
 */
public class AppImage {
  private final Integer resourceId;
  private final String url;
  private final String filename;
  private final ImageSource imageSource;

  public enum ImageSource {
    NONE, // No Image specified.
    APP_RESOURCE, // An image resource defined in the App itself
    URL, // Url to load the image from
    LOCAL_FILE, // Image cached on local drive, used in conjunction with URL
  }

  public AppImage(Integer resourceId, String url, String filename) {
    this.resourceId = resourceId;
    this.url = url;
    this.filename = filename;
    if (resourceId != null) {
      imageSource = ImageSource.APP_RESOURCE;
    } else if (filename != null) {
      imageSource = ImageSource.LOCAL_FILE;
    } else if (url != null) {
      imageSource = ImageSource.URL;
    } else {
      imageSource = ImageSource.NONE;
    }
  }

  public final Integer getResourceId() {
    return resourceId;
  }

  public final String getUrl() {
    return url;
  }

  public final String getFilename() {
    return filename;
  }

  public ImageSource getImageSource() {
    return imageSource;
  }
}

@@ -291,16 +291,46 @@
 eSource;
+%0A  private final String label;
 %0A%0A  publ
@@ -635,16 +635,30 @@
 filename
+, String label
 ) %7B%0A    
@@ -1016,16 +1016,40 @@
 ;%0A    %7D%0A
+    this.label = label;%0A
   %7D%0A%0A  p
@@ -1268,24 +1268,24 @@
 eSource() %7B%0A
-
     return i
@@ -1299,11 +1299,63 @@
 rce;%0A  %7D
+%0A%0A  public String getLabel() %7B%0A    return label;%0A  %7D
 %0A%7D%0A

Add Label to Image.