apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    //used only for twowayview
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionName project.VERSION_NAME
        versionCode Integer.parseInt(project.VERSION_CODE)
    }

    signingConfigs {
        release
    }

    buildTypes {
        if (isReleaseBuild()) {
            release {
                signingConfig signingConfigs.release
            }
        }

        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
        }
    }

    // This is important, it will run lint checks but won't abort build
    lintOptions {
        abortOnError false
    }
}

dependencies {
    // Cards Library
    compile project(':library-core')
    compile project(':library-cards')
    compile project(':extra:extra-twoway')
    compile project(':extra:extra-staggeredgrid')
    compile project(':extra:extra-dragdrop')

    // Support Libraries
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'

    //OkHttp
    //temporary patch for android-L for Okio packaging problem (see https://gist.github.com/JakeWharton/017738659d4f38adedc2)
    //compile fileTree(dir: 'libs', include: 'repackaged-*.jar')
    compile 'com.squareup.okhttp:okhttp:2.0.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
    //Picasso
    compile 'com.squareup.picasso:picasso:2.3.4'

    //Ion
    //compile 'com.koushikdutta.ion:ion:1.3.1'

    //universal-image-loader
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'

    //Actionbar pull to refresh
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9'

    //lListViewAnimations
    compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
    compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'

    //Crouton
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        // exclusion is not neccessary, but generally a good idea.
        exclude group: 'com.google.android', module: 'support-v4'
    }

    //StickyListHeaders
    compile ('se.emilsjolander:stickylistheaders:2.5.0')

    //Weather Lib
    compile 'com.survivingwithandroid:weatherlib:1.3.2'

    // Fading ActionBar
    //compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.0.0'

    //Google Progress Bar
    //compile 'com.jpardogo.googleprogressbar:library:1.1.0'

    compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'

    //FAB
    compile 'com.melnykov:floatingactionbutton:1.0.6'
}


def Properties props = new Properties()
def propFile = file('../../signing.properties')
if (propFile.canRead()){
    props.load(new FileInputStream(propFile))

    if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
            props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {

        println 'RELEASE BUILD SIGNING'

        android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
        android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
        android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
        android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
    } else {
        println 'RELEASE BUILD NOT FOUND SIGNING PROPERTIES'

        android.buildTypes.release.signingConfig = null
    }
}else {
    println 'RELEASE BUILD NOT FOUND SIGNING FILE'
    android.buildTypes.release.signingConfig = null
}