// Path: app/src/main/java/io/gresse/hugo/anecdote/api/model/Website.java
// public class Website {
// 
//     public static final String SOURCE_LOCAL  = "local";
//     public static final String SOURCE_REMOTE = "remote";
//     public static final String SOURCE_CALCULATED = "calc";
// 
//     public int    version;
//     public String slug;
//     public String name;
//     public int    color;
//     public int    like;
//     public String source;
//     public String userAgent;
// 
//     public List<WebsitePage> pages;
// 
//     public Website() {
//         this(null, SOURCE_LOCAL);
//     }
// 
//     public Website(String name, String source) {
//         this.pages = new ArrayList<>();
//         this.source = source;
//         this.name = name;
//     }
// 
//     /**
//      * Validate this object by preventing any crash when using it
//      */
//     public void validateData() {
//         if (TextUtils.isEmpty(name)) {
//             name = Long.toHexString(Double.doubleToLongBits(Math.random()));
//         }
// 
//         for(WebsitePage websitePage : pages){
//             websitePage.validate();
//         }
// 
//         if (TextUtils.isEmpty(slug)) {
//             if (source.equals(SOURCE_REMOTE)) {
//                 slug = "api-" + name;
//             } else if (source.equals(SOURCE_CALCULATED)) {
//                 slug = "calc-" + name;
//             } else {
//                 slug = "local-" + name;
//             }
//         }
//     }
// 
//     /**
//      * Check if the version missmatch between the two object
//      *
//      * @param website the new website
//      * @return true if up to date, false otherweise
//      */
//     public boolean isUpToDate(Website website) {
//         return website.version <= version;
//     }
// 
//     /**
//      * Check if the user can edit this website manually or not
//      *
//      * @return true if editable
//      */
//     public boolean isEditable() {
//         return source.equals(SOURCE_LOCAL);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         Website website = (Website) o;
// 
//         if (!slug.equals(website.slug)) return false;
//         return source.equals(website.source);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = slug.hashCode();
//         result = 31 * result + source.hashCode();
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "Website{" +
//                 "version=" + version +
//                 ", slug='" + slug + '\'' +
//                 ", name='" + name + '\'' +
//                 ", color=" + color +
//                 ", like=" + like +
//                 ", source='" + source + '\'' +
//                 ", userAgent='" + userAgent + '\'' +
//                 ", pages=" + pages +
//                 '}';
//     }
// }


import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.TextUtils;
import io.gresse.hugo.anecdote.api.model.Website;
package io.gresse.hugo.anecdote.util;



/**
 * Generals utils
 * <p/>
 * Created by Hugo Gresse on 13/02/16.
 */
public class Utils {

    /**
     * Return the user agent sent on all request. It's not default Android user agent as we don't really want that
     * websites see the app trafic (for now at least).
     * <p/>
     * Be only replace the device by the correct one.
     *
     * @return the user agent
     */
    public static String getUserAgent() {
        return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1 " + Build.MODEL +
                ") AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.95 Mobile Safari/537.36";
    }

    /**
     * Return the user agent sent on all request. It will choose between our local custom user agent or given
     * useragent for this website.
     *
     * @return the user agent
     */
// Path: app/src/main/java/io/gresse/hugo/anecdote/api/model/Website.java
// public class Website {
// 
//     public static final String SOURCE_LOCAL  = "local";
//     public static final String SOURCE_REMOTE = "remote";
//     public static final String SOURCE_CALCULATED = "calc";
// 
//     public int    version;
//     public String slug;
//     public String name;
//     public int    color;
//     public int    like;
//     public String source;
//     public String userAgent;
// 
//     public List<WebsitePage> pages;
// 
//     public Website() {
//         this(null, SOURCE_LOCAL);
//     }
// 
//     public Website(String name, String source) {
//         this.pages = new ArrayList<>();
//         this.source = source;
//         this.name = name;
//     }
// 
//     /**
//      * Validate this object by preventing any crash when using it
//      */
//     public void validateData() {
//         if (TextUtils.isEmpty(name)) {
//             name = Long.toHexString(Double.doubleToLongBits(Math.random()));
//         }
// 
//         for(WebsitePage websitePage : pages){
//             websitePage.validate();
//         }
// 
//         if (TextUtils.isEmpty(slug)) {
//             if (source.equals(SOURCE_REMOTE)) {
//                 slug = "api-" + name;
//             } else if (source.equals(SOURCE_CALCULATED)) {
//                 slug = "calc-" + name;
//             } else {
//                 slug = "local-" + name;
//             }
//         }
//     }
// 
//     /**
//      * Check if the version missmatch between the two object
//      *
//      * @param website the new website
//      * @return true if up to date, false otherweise
//      */
//     public boolean isUpToDate(Website website) {
//         return website.version <= version;
//     }
// 
//     /**
//      * Check if the user can edit this website manually or not
//      *
//      * @return true if editable
//      */
//     public boolean isEditable() {
//         return source.equals(SOURCE_LOCAL);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         Website website = (Website) o;
// 
//         if (!slug.equals(website.slug)) return false;
//         return source.equals(website.source);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = slug.hashCode();
//         result = 31 * result + source.hashCode();
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "Website{" +
//                 "version=" + version +
//                 ", slug='" + slug + '\'' +
//                 ", name='" + name + '\'' +
//                 ", color=" + color +
//                 ", like=" + like +
//                 ", source='" + source + '\'' +
//                 ", userAgent='" + userAgent + '\'' +
//                 ", pages=" + pages +
//                 '}';
//     }
// }


// Path: app/src/main/java/io/gresse/hugo/anecdote/util/Utils.java
import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.TextUtils;
import io.gresse.hugo.anecdote.api.model.Website;

package io.gresse.hugo.anecdote.util;



/**
 * Generals utils
 * <p/>
 * Created by Hugo Gresse on 13/02/16.
 */
public class Utils {

    /**
     * Return the user agent sent on all request. It's not default Android user agent as we don't really want that
     * websites see the app trafic (for now at least).
     * <p/>
     * Be only replace the device by the correct one.
     *
     * @return the user agent
     */
    public static String getUserAgent() {
        return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1 " + Build.MODEL +
                ") AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.95 Mobile Safari/537.36";
    }

    /**
     * Return the user agent sent on all request. It will choose between our local custom user agent or given
     * useragent for this website.
     *
     * @return the user agent
     */
    public static String getUserAgent(Website website) {