Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 216c21c2 authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Merge branch 'more_webdav_properties' into 'master'

Include CreationDate, GetContentLength and quota properties

See merge request bitfireAT/dav4android!4
parents 3911d771 d23a8575
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,4 +28,5 @@ Email: [play@bitfire.at](mailto:play@bitfire.at)
## Contributors

  * Ricki Hirner (initial contributor)
  * David González Verdugo (dgonzalez@owncloud.com)
+32 −0
Original line number Diff line number Diff line
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class CreationDate(
        var creationDate: String
): Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "creationdate")
    }

    class Factory: PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): CreationDate? {
            XmlUtils.readText(parser)?.let { it ->
                return CreationDate(it)
            }
            return null
        }
    }
}
 No newline at end of file
+32 −0
Original line number Diff line number Diff line
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class GetContentLength(
        val contentLength: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getcontentlength")
    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): GetContentLength? {
            XmlUtils.readText(parser)?.let {
                return GetContentLength(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
+32 −0
Original line number Diff line number Diff line
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class QuotaAvailableBytes(
        val quotaAvailableBytes: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "quota-available-bytes")
    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): QuotaAvailableBytes? {
            XmlUtils.readText(parser)?.let {
                return QuotaAvailableBytes(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
+33 −0
Original line number Diff line number Diff line
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class QuotaUsedBytes(
        val quotaUsedBytes: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "quota-used-bytes")

    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): QuotaUsedBytes? {
            XmlUtils.readText(parser)?.let {
                return QuotaUsedBytes(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
Loading