Commit 8628211a authored by Ricki Hirner's avatar Ricki Hirner 🐑

Rename to ICSx⁵, update libs

parent ee12c34f
ICSdroid
ICSx⁵
========
Please see the [ICSdroid Web site](https://icsdroid.bitfire.at) for comprehensive information about ICSdroid.
Please see the [ICSx⁵ Web site](https://icsx5.bitfire.at) for comprehensive information about ICSx⁵.
ICSdroid is licensed under the [GPLv3 License](LICENSE).
ICSx⁵ is licensed under the [GPLv3 License](LICENSE).
News and updates: [@icsdroidapp](https://twitter.com/icsdroidapp)
News and updates: [@icsx5app](https://twitter.com/icsx5app)
Help and discussion: [ICSdroid forum](https://icsdroid.bitfire.at/forums/)
Help and discussion: [ICSx⁵ forum](https://icsx5.bitfire.at/forums/)
ICSdroid is a Android 4.0+ app to subscribe to remote or local iCalendar files (like
ICSx⁵ is a Android 4.0+ app to subscribe to remote or local iCalendar files (like
time tables of your school/university or event files of your sports team).
[![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=bitfire&url=https://icsdroid.bitfire.at&title=ICSdroid&category=software)
License
=======
Copyright (C) 2013 – 2016 bitfire web engineering (Ricki Hirner, Bernhard Stockmann).
Copyright (C) [bitfire web engineering](https://www.bitfire.at) (Stockmann, Hirner GesnbR).
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome
to redistribute it under the conditions of the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0.html).
ICSdroid uses these libraries (more information available in the app):
ICSx⁵ uses these libraries (more information available in the app):
* [Android Color Picker](https://github.com/yukuku/ambilwarna) (Apache License 2.0)
* [Ambilwarna Color Picker](https://github.com/yukuku/ambilwarna) (Apache License 2.0)
* [Android Support Library](https://developer.android.com/tools/support-library/) (Apache License 2.0)
* [Apache Commons](https://commons.apache.org) (Apache License 2.0)
* [ical4android](https://gitlab.com/bitfireAT/ical4android) (GPLv3)
......
# ProGuard usage for ICSdroid:
# ProGuard usage for ICSx:
# shrinking yes (main reason for using ProGuard)
# optimization yes
# obfuscation no (ICSdroid is open-source)
# obfuscation no (ICSx is open-source)
# preverification no
-dontobfuscate
......@@ -22,5 +22,5 @@
-keep class net.fortuna.ical4j.** { *; } # keep all model classes (properties/factories, created at runtime)
-keep class org.threeten.bp.** { *; } # keep ThreeTen (for time zone processing)
# keep ICSdroid and ical4android
-keep class at.bitfire.** { *; } # all ICSdroid code is required
# keep ICSx⁵ and ical4android
-keep class at.bitfire.** { *; } # all ICSx⁵ code is required
......@@ -14,7 +14,7 @@
<!-- fetch iCalendar files -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- manage ICSdroid accounts -->
<!-- manage ICSx⁵ accounts -->
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
<!-- add/update/delete events -->
......
......@@ -20,35 +20,42 @@ object AppAccount {
const val SYNC_INTERVAL_MANUALLY = -1L
val account = Account("ICSdroid", "at.bitfire.icsdroid")
fun get(context: Context): Account {
val accountType = context.getString(R.string.account_type)
fun makeAvailable(context: Context) {
val am = AccountManager.get(context)
if (am.getAccountsByType(account.type).isEmpty()) {
Log.i(Constants.TAG, "Account not found, creating")
am.addAccountExplicitly(AppAccount.account, null, null)
val existingAccount = am.getAccountsByType(accountType).firstOrNull()
if (existingAccount != null)
return existingAccount
Log.i(Constants.TAG, "Account not found, creating")
val account = Account(context.getString(R.string.account_name), accountType)
if (am.addAccountExplicitly(account, null, null)) {
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 1)
ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, true)
return account
}
throw IllegalStateException("Couldn't create app account")
}
fun syncInterval(): Long {
fun syncInterval(context: Context): Long {
var syncInterval = SYNC_INTERVAL_MANUALLY
if (ContentResolver.getSyncAutomatically(account, CalendarContract.AUTHORITY))
for (sync in ContentResolver.getPeriodicSyncs(account, CalendarContract.AUTHORITY))
if (ContentResolver.getSyncAutomatically(get(context), CalendarContract.AUTHORITY))
for (sync in ContentResolver.getPeriodicSyncs(get(context), CalendarContract.AUTHORITY))
syncInterval = sync.period
return syncInterval
}
fun syncInterval(syncInterval: Long) {
fun syncInterval(context: Context, syncInterval: Long) {
if (syncInterval == SYNC_INTERVAL_MANUALLY) {
Log.i(Constants.TAG, "Disabling automatic synchronization")
ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, false)
ContentResolver.setSyncAutomatically(get(context), CalendarContract.AUTHORITY, false)
} else {
Log.i(Constants.TAG, "Setting automatic synchronization with interval of $syncInterval seconds")
ContentResolver.setSyncAutomatically(account, CalendarContract.AUTHORITY, true)
ContentResolver.addPeriodicSync(account, CalendarContract.AUTHORITY, Bundle(), syncInterval)
ContentResolver.setSyncAutomatically(get(context), CalendarContract.AUTHORITY, true)
ContentResolver.addPeriodicSync(get(context), CalendarContract.AUTHORITY, Bundle(), syncInterval)
}
}
......
......@@ -14,11 +14,11 @@ import at.bitfire.ical4android.Constants
object Constants {
const val TAG = "icsdroid"
const val TAG = "icsx5"
val USER_AGENT = "ICSdroid/" + BuildConfig.VERSION_NAME + " (ical4j/" + Constants.ical4jVersion + " Android/" + Build.VERSION.RELEASE + ")"
val USER_AGENT = "ICSx5/" + BuildConfig.VERSION_NAME + " (ical4j/" + Constants.ical4jVersion + " Android/" + Build.VERSION.RELEASE + ")"
const val MAX_REDIRECTS = 5
val donationUri = Uri.parse("https://icsdroid.bitfire.at/donate/?pk_campaign=icsdroid-app")!!
val donationUri = Uri.parse("https://icsx5.bitfire.at/donate/?pk_campaign=icsx5-app")!!
}
......@@ -170,7 +170,7 @@ class ProcessEventsTask(
val notification = NotificationCompat.Builder(context, NotificationUtils.CHANNEL_SYNC)
.setSmallIcon(R.drawable.ic_sync_problem_white)
.setCategory(NotificationCompat.CATEGORY_ERROR)
.setGroup("ICSdroid")
.setGroup("ICSx⁵")
.setContentTitle(context.getString(R.string.sync_error_title))
.setContentText(msg)
.setSubText(calendar.displayName)
......
......@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
class SyncWorker(
context: Context,
val context: Context,
workerParams: WorkerParameters
): Worker(context, workerParams) {
......@@ -66,7 +66,7 @@ class SyncWorker(
applicationContext.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)?.let { providerClient ->
try {
syncRunning.set(true)
return performSync(AppAccount.account, providerClient)
return performSync(AppAccount.get(context), providerClient)
} finally {
syncRunning.set(false)
if (Build.VERSION.SDK_INT >= 24)
......
......@@ -14,10 +14,10 @@ import android.content.ContentValues
import android.os.Bundle
import android.provider.CalendarContract
import android.provider.CalendarContract.Calendars
import androidx.fragment.app.Fragment
import android.util.Log
import android.view.*
import android.widget.Toast
import androidx.fragment.app.Fragment
import at.bitfire.ical4android.AndroidCalendar
import at.bitfire.icsdroid.AppAccount
import at.bitfire.icsdroid.Constants
......@@ -116,15 +116,15 @@ class AddCalendarDetailsFragment: Fragment(), TitleColorFragment.OnChangeListene
private fun createCalendar(): Boolean {
AppAccount.makeAvailable(requireActivity())
val account = AppAccount.get(requireActivity())
val calInfo = ContentValues(9)
calInfo.put(Calendars.ACCOUNT_NAME, AppAccount.account.name)
calInfo.put(Calendars.ACCOUNT_TYPE, AppAccount.account.type)
calInfo.put(Calendars.ACCOUNT_NAME, account.name)
calInfo.put(Calendars.ACCOUNT_TYPE, account.type)
calInfo.put(Calendars.NAME, info.url.toString())
calInfo.put(Calendars.CALENDAR_DISPLAY_NAME, title)
calInfo.put(Calendars.CALENDAR_COLOR, color)
calInfo.put(Calendars.OWNER_ACCOUNT, AppAccount.account.name)
calInfo.put(Calendars.OWNER_ACCOUNT, account.name)
calInfo.put(Calendars.SYNC_EVENTS, 1)
calInfo.put(Calendars.VISIBLE, 1)
calInfo.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_READ)
......@@ -132,8 +132,8 @@ class AddCalendarDetailsFragment: Fragment(), TitleColorFragment.OnChangeListene
val client: ContentProviderClient? = requireActivity().contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)
return try {
client?.let {
val uri = AndroidCalendar.create(AppAccount.account, it, calInfo)
val calendar = LocalCalendar.findById(AppAccount.account, client, ContentUris.parseId(uri))
val uri = AndroidCalendar.create(account, it, calInfo)
val calendar = LocalCalendar.findById(account, client, ContentUris.parseId(uri))
CalendarCredentials.putCredentials(requireActivity(), calendar, info.username, info.password)
}
Toast.makeText(activity, getString(R.string.add_calendar_created), Toast.LENGTH_LONG).show()
......
......@@ -128,7 +128,7 @@ class CalendarListActivity:
when {
// periodic sync not enabled
AppAccount.syncInterval() == AppAccount.SYNC_INTERVAL_MANUALLY -> {
AppAccount.syncInterval(this) == AppAccount.SYNC_INTERVAL_MANUALLY -> {
snackBar = Snackbar.make(coordinator, R.string.calendar_list_sync_interval_manually, Snackbar.LENGTH_INDEFINITE)
snackBar?.show()
}
......@@ -145,7 +145,7 @@ class CalendarListActivity:
// periodic sync enabled AND Android >= 6 AND not whitelisted from battery saving AND sync interval < 1 day
Build.VERSION.SDK_INT >= 23 &&
!(getSystemService(Context.POWER_SERVICE) as PowerManager).isIgnoringBatteryOptimizations(BuildConfig.APPLICATION_ID) &&
AppAccount.syncInterval() < 86400 -> {
AppAccount.syncInterval(this) < 86400 -> {
snackBar = Snackbar.make(coordinator, R.string.calendar_list_battery_whitelist, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.calendar_list_battery_whitelist_settings) { _ ->
val intent = Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS)
......@@ -271,7 +271,7 @@ class CalendarListActivity:
try {
var calendars: List<LocalCalendar>? = null
provider?.let {
calendars = LocalCalendar.findAll(AppAccount.account, it)
calendars = LocalCalendar.findAll(AppAccount.get(context), it)
}
deliverResult(calendars)
} catch(e: CalendarStorageException) {
......
......@@ -254,7 +254,7 @@ class EditCalendarActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks<L
private val uri: Uri
): Loader<LocalCalendar>(context) {
companion object {
const val TAG = "ICSdroid.Calendar"
const val TAG = "ICSx5.Calendar"
}
private var loaded = false
......@@ -283,7 +283,7 @@ class EditCalendarActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks<L
var calendar: LocalCalendar? = null
provider?.let {
try {
calendar = LocalCalendar.findById(AppAccount.account, it, ContentUris.parseId(uri))
calendar = LocalCalendar.findById(AppAccount.get(context), it, ContentUris.parseId(uri))
} catch(e: Exception) {
Log.e(TAG, "Couldn't load calendar data", e)
}
......
......@@ -38,7 +38,7 @@ class InfoActivity: AppCompatActivity() {
companion object {
val components = arrayOf(
arrayOf("ICSdroid", "ICSdroid/${BuildConfig.VERSION_NAME}", "Ricki Hirner, Bernhard Stockmann (bitfire.at)", "https://icsdroid.bitfire.at", "gpl-3.0-standalone.html"),
arrayOf("ICSx⁵", "ICSx⁵/${BuildConfig.VERSION_NAME}", "Ricki Hirner, Bernhard Stockmann (bitfire.at)", "https://icsx5.bitfire.at", "gpl-3.0-standalone.html"),
arrayOf("AmbilWarna", "AmbilWarna (Android Color Picker)", "Yuku", "https://github.com/yukuku/ambilwarna", "apache2.html"),
arrayOf("Apache Commons", "Apache Commons", "Apache Software Foundation", "http://commons.apache.org/", "apache2.html"),
arrayOf("ical4j", "ical4j", "Ben Fortuna", "https://ical4j.github.io", "bsd-3clause.html")
......@@ -63,11 +63,11 @@ class InfoActivity: AppCompatActivity() {
}
fun showWebSite(item: MenuItem) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://icsdroid.bitfire.at/?pk_campaign=icsdroid-app&pk_kwd=info-activity")))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://icsx5.bitfire.at/?pk_campaign=icsx5-app&pk_kwd=info-activity")))
}
fun showTwitter(item: MenuItem) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/icsdroidapp")))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/icsx5app")))
}
......
......@@ -29,13 +29,13 @@ class SyncIntervalDialogFragment: DialogFragment() {
val v = requireActivity().layoutInflater.inflate(R.layout.set_sync_interval, null)
val currentSyncInterval = AppAccount.syncInterval()
val currentSyncInterval = AppAccount.syncInterval(requireActivity())
if (syncIntervalSeconds.contains(currentSyncInterval))
v.sync_interval.setSelection(syncIntervalSeconds.indexOf(currentSyncInterval))
builder .setView(v)
.setPositiveButton(R.string.set_sync_interval_save) { _, _ ->
AppAccount.syncInterval(syncIntervalSeconds[v.sync_interval.selectedItemPosition])
AppAccount.syncInterval(requireActivity(), syncIntervalSeconds[v.sync_interval.selectedItemPosition])
}
return builder.create()
......
......@@ -8,20 +8,23 @@
-->
<resources>
<string name="app_name">ICSdroid</string>
<string name="notification_channel_sync_problem">Sync problems</string>
<string name="app_name">ICSx⁵</string>
<string name="account_name">Calendar subscriptions</string>
<string name="account_type" translatable="false">at.bitfire.icsdroid</string>
<!-- common strings -->
<string name="action_next">Next</string>
<string name="notification_channel_sync_problem">Sync problems</string>
<string name="calendar_list_empty_info">To subscribe to a Webcal feed, use the + button or open a Webcal URL.</string>
<string name="calendar_list_info">About ICSdroid</string>
<string name="calendar_list_info">About ICSx⁵</string>
<string name="calendar_list_not_synced_yet">not synchronized yet</string>
<string name="calendar_list_set_sync_interval">Set sync. interval</string>
<string name="calendar_list_sync_disabled">Sync. disabled</string>
<string name="calendar_list_sync_interval_manually">Automatic sync disabled</string>
<string name="calendar_list_master_sync_disabled">System-wide automatic sync is disabled</string>
<string name="calendar_list_master_sync_enable">Activate</string>
<string name="calendar_list_battery_whitelist">Battery: Whitelist ICSdroid for short sync intervals</string>
<string name="calendar_list_battery_whitelist">Battery: Whitelist ICSx⁵ for short sync intervals</string>
<string name="calendar_list_battery_whitelist_settings">Settings</string>
<string name="title_activity_calendar_list">My subscriptions</string>
......@@ -55,7 +58,7 @@
<string name="sync_error_title">Synchronization error</string>
<string name="set_sync_interval_save">Save</string>
<string name="set_sync_interval_title">Set sync. interval:</string>
<string-array name="set_sync_interval_seconds">
<string-array name="set_sync_interval_seconds" translatable="false">
<item>-1</item>
<item>300</item>
<item>600</item>
......@@ -84,7 +87,7 @@
<string name="app_info_web_site">Web site</string>
<string name="donate_title">Open-Source Information</string>
<string name="donate_message">We\'re happy that you use ICSdroid, which is open-source software (GPLv3). Because it was and still is much work to develop and maintain ICSdroid, please consider a donation.</string>
<string name="donate_message">We\'re happy that you use ICSx⁵, which is open-source software (GPLv3). Because it was and still is much work to develop and maintain ICSx⁵, please consider a donation.</string>
<string name="donate_now">Show donation page</string>
<string name="donate_later">Maybe later</string>
......
......@@ -7,7 +7,7 @@
-->
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="at.bitfire.icsdroid"
android:accountType="@string/account_type"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:smallIcon="@mipmap/ic_launcher"
......
......@@ -7,7 +7,7 @@
-->
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="at.bitfire.icsdroid"
android:accountType="@string/account_type"
android:contentAuthority="com.android.calendar"
android:allowParallelSyncs="true"
android:supportsUploading="false"
......
Subproject commit 4fac9b14bc4e35fd317bcb75ae5e7f39c22b3c75
Subproject commit 960d33c71956e96decb9699b589427989e501f51
ICSdroid allows you to add/subscribe and manage external (Webcal) and local (i.e. Dropbox, adb push etc) iCalendar/.ics files on your Android device.
ICSx⁵ allows you to add/subscribe and manage external (Webcal) and local (i.e. Dropbox, adb push etc) iCalendar/.ics files on your Android device.
Add high days and holidays, your sports teams events, time tables of your school/university or any other event files that come in ics/ical format. The app will import these events for you and displays it in your favorite calendar app on your Android – it integrates seamlessly into your device.
......
Subproject commit 913105c5f33528b64b34ad4273050d149c750234
Subproject commit e04df070148adaf4ddc454a97350ffe46280ee2b
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