Commit 8aa7797c authored by Ricki Hirner's avatar Ricki Hirner

Update cert4android, ical4android, Kotlin, gradle, support libraries

parent fe73d258
......@@ -12,7 +12,7 @@ apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "at.bitfire.icsdroid"
......@@ -41,12 +41,14 @@ android {
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile project(':cert4android')
compile project(':ical4android')
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
compile 'com.github.yukuku:ambilwarna:2.0.1'
compile 'commons-io:commons-io:2.6'
......
......@@ -30,23 +30,21 @@ class LocalCalendar private constructor(
companion object {
val DEFAULT_COLOR = 0xFF2F80C7.toInt()
const val DEFAULT_COLOR = 0xFF2F80C7.toInt()
val COLUMN_ETAG = Calendars.CAL_SYNC1
val COLUMN_LAST_MODIFIED = Calendars.CAL_SYNC4
val COLUMN_LAST_SYNC = Calendars.CAL_SYNC5
val COLUMN_ERROR_MESSAGE = Calendars.CAL_SYNC6
const val COLUMN_ETAG = Calendars.CAL_SYNC1
const val COLUMN_LAST_MODIFIED = Calendars.CAL_SYNC4
const val COLUMN_LAST_SYNC = Calendars.CAL_SYNC5
const val COLUMN_ERROR_MESSAGE = Calendars.CAL_SYNC6
@Deprecated("for compatibility only (read-only); see CalendarCredentials instead")
val COLUMN_USERNAME = Calendars.CAL_SYNC2
@Deprecated("for compatibility only (read-only); see CalendarCredentials instead")
val COLUMN_PASSWORD = Calendars.CAL_SYNC3
@Throws(FileNotFoundException::class, CalendarStorageException::class)
fun findById(account: Account, provider: ContentProviderClient, id: Long) =
AndroidCalendar.findByID(account, provider, Factory, id)
@Throws(CalendarStorageException::class)
fun findAll(account: Account, provider: ContentProviderClient) =
AndroidCalendar.find(account, provider, Factory, null, null)
......@@ -65,10 +63,6 @@ class LocalCalendar private constructor(
var errorMessage: String? = null // error message (HTTP status or exception name) of last sync (or null)
override fun eventBaseInfoColumns() =
arrayOf(CalendarContract.Events._ID, CalendarContract.Events._SYNC_ID, LocalEvent.COLUMN_LAST_MODIFIED)
override fun populate(info: ContentValues) {
super.populate(info)
url = info.getAsString(Calendars.NAME)
......@@ -83,7 +77,6 @@ class LocalCalendar private constructor(
errorMessage = info.getAsString(COLUMN_ERROR_MESSAGE)
}
@Throws(CalendarStorageException::class)
fun updateStatusSuccess(eTag: String?, lastModified: Long) {
this.eTag = eTag
this.lastModified = lastModified
......@@ -97,7 +90,6 @@ class LocalCalendar private constructor(
update(values)
}
@Throws(CalendarStorageException::class)
fun updateStatusNotModified() {
lastSync = System.currentTimeMillis()
......@@ -106,7 +98,6 @@ class LocalCalendar private constructor(
update(values)
}
@Throws(CalendarStorageException::class)
fun updateStatusError(message: String) {
eTag = null
lastModified = 0
......@@ -121,7 +112,6 @@ class LocalCalendar private constructor(
update(values)
}
@Throws(CalendarStorageException::class)
fun updateUrl(url: String) {
this.url = url
......@@ -130,11 +120,9 @@ class LocalCalendar private constructor(
update(values)
}
@Throws(CalendarStorageException::class)
fun queryByUID(uid: String) =
queryEvents("${Events._SYNC_ID}=?", arrayOf(uid))
@Throws(CalendarStorageException::class)
fun retainByUID(uids: Set<String>): Int {
var deleted = 0
try {
......
......@@ -21,15 +21,15 @@ import net.fortuna.ical4j.model.property.LastModified
class LocalEvent: AndroidEvent {
companion object {
val COLUMN_LAST_MODIFIED = CalendarContract.Events.SYNC_DATA2
const val COLUMN_LAST_MODIFIED = CalendarContract.Events.SYNC_DATA2
}
var uid: String? = null
var lastModified = 0L
private constructor(calendar: AndroidCalendar<AndroidEvent>, id: Long, baseInfo: ContentValues?): super(calendar, id, baseInfo) {
uid = baseInfo?.getAsString(CalendarContract.Events._SYNC_ID)
lastModified = baseInfo?.getAsLong(COLUMN_LAST_MODIFIED) ?: 0
private constructor(calendar: AndroidCalendar<AndroidEvent>, values: ContentValues): super(calendar, values) {
uid = values.getAsString(CalendarContract.Events._SYNC_ID)
lastModified = values.getAsLong(COLUMN_LAST_MODIFIED) ?: 0
}
constructor(calendar: AndroidCalendar<AndroidEvent>, event: Event): super(calendar, event) {
......@@ -64,11 +64,8 @@ class LocalEvent: AndroidEvent {
object Factory: AndroidEventFactory<LocalEvent> {
override fun newInstance(calendar: AndroidCalendar<AndroidEvent>, id: Long, baseInfo: ContentValues?) =
LocalEvent(calendar, id, baseInfo)
override fun newInstance(calendar: AndroidCalendar<AndroidEvent>, event: Event) =
LocalEvent(calendar, event)
override fun fromProvider(calendar: AndroidCalendar<AndroidEvent>, values: ContentValues) =
LocalEvent(calendar, values)
}
......
......@@ -8,6 +8,7 @@
package at.bitfire.icsdroid.ui
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.Uri
......@@ -32,6 +33,7 @@ import kotlinx.android.synthetic.main.app_info_component.view.*
import org.apache.commons.codec.Charsets
import org.apache.commons.io.IOUtils
import java.io.IOException
import java.nio.charset.StandardCharsets
class InfoActivity: AppCompatActivity() {
......@@ -80,7 +82,7 @@ class InfoActivity: AppCompatActivity() {
}
class ComponentFragment: Fragment(), LoaderManager.LoaderCallbacks<Spanned?> {
class ComponentFragment: Fragment(), LoaderManager.LoaderCallbacks<Spanned> {
companion object {
......@@ -97,6 +99,7 @@ class InfoActivity: AppCompatActivity() {
}
@SuppressLint("SetTextI18n")
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val info = components[arguments!!.getInt(KEY_POSITION)]
......@@ -116,8 +119,8 @@ class InfoActivity: AppCompatActivity() {
return v
}
override fun onCreateLoader(id: Int, args: Bundle) =
LicenseLoader(activity!!, args.getString(KEY_LICENSE_FILE))
override fun onCreateLoader(id: Int, args: Bundle?) =
LicenseLoader(activity!!, args!!.getString(KEY_LICENSE_FILE))
override fun onLoadFinished(loader: Loader<Spanned?>, text: Spanned?) {
text?.let {
......@@ -128,7 +131,7 @@ class InfoActivity: AppCompatActivity() {
}
}
override fun onLoaderReset(loader: Loader<Spanned?>) {
override fun onLoaderReset(loader: Loader<Spanned>) {
}
}
......@@ -136,7 +139,7 @@ class InfoActivity: AppCompatActivity() {
class LicenseLoader(
context: Context,
private val fileName: String
): AsyncTaskLoader<Spanned?>(context) {
): AsyncTaskLoader<Spanned>(context) {
var text: Spanned? = null
......@@ -151,7 +154,7 @@ class InfoActivity: AppCompatActivity() {
override fun loadInBackground(): Spanned? {
try {
context.resources.assets.open(fileName)?.use {
val html = IOUtils.toString(it, Charsets.UTF_8 /* UTF-8 */)
val html = IOUtils.toString(it, StandardCharsets.UTF_8)
text = Html.fromHtml(html)
return text
}
......
......@@ -7,16 +7,14 @@
*/
buildscript {
ext.kotlin_version = '1.1.61'
ext.kotlin_version = '1.2.31'
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......@@ -24,8 +22,6 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
Subproject commit b10d431c5cfa2216845eb242a1cebd1a7510d761
Subproject commit da4283683225602ce7d783da8fa97a7402736282
......@@ -15,4 +15,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Subproject commit bff8e5b8857605da0ac754c99eaed603a71f7bcb
Subproject commit d5f37330c8f5998c9075ae67f6021c469bb0b9f4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment