Commit fb90955b authored by Ricki Hirner's avatar Ricki Hirner

Switch to AndroidX

parent a7f01619
......@@ -63,7 +63,7 @@ android {
}
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
......@@ -75,13 +75,14 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:preference-v14:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.github.yukuku:ambilwarna:2.0.1'
implementation 'com.mikepenz:aboutlibraries:6.0.9'
implementation 'com.mikepenz:aboutlibraries:6.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'commons-io:commons-io:2.6'
......@@ -90,8 +91,8 @@ dependencies {
implementation 'org.apache.commons:commons-collections4:4.1'
// for tests
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.11.0'
......
......@@ -8,7 +8,7 @@
package at.bitfire.davdroid
import android.support.test.InstrumentationRegistry.getInstrumentation
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import at.bitfire.cert4android.CustomCertManager
import okhttp3.OkHttpClient
import okhttp3.Request
......@@ -54,7 +54,7 @@ class CustomTlsSocketFactoryTest {
@Test
fun testSendClientCertificate() {
var public: X509Certificate? = null
javaClass.classLoader.getResourceAsStream("sample.crt").use {
javaClass.classLoader!!.getResourceAsStream("sample.crt").use {
public = CertificateFactory.getInstance("X509").generateCertificate(it) as? X509Certificate
}
assertNotNull(public)
......
......@@ -9,7 +9,7 @@
package at.bitfire.davdroid.model
import android.content.ContentValues
import android.support.test.filters.SmallTest
import androidx.test.filters.SmallTest
import at.bitfire.dav4android.DavResource
import at.bitfire.dav4android.property.ResourceType
import at.bitfire.davdroid.HttpClient
......
......@@ -8,8 +8,7 @@
package at.bitfire.davdroid.settings
import android.support.test.InstrumentationRegistry
import android.support.test.InstrumentationRegistry.getTargetContext
import androidx.test.platform.app.InstrumentationRegistry
import at.bitfire.davdroid.App
import junit.framework.Assert.assertFalse
import junit.framework.Assert.assertTrue
......@@ -23,8 +22,7 @@ class SettingsTest {
@Before
fun init() {
InstrumentationRegistry.getContext().isRestricted
settings = Settings.getInstance(getTargetContext())!!
settings = Settings.getInstance(InstrumentationRegistry.getInstrumentation().targetContext)!!
}
@After
......
......@@ -8,8 +8,8 @@
package at.bitfire.davdroid.ui.setup
import android.support.test.InstrumentationRegistry.getTargetContext
import android.support.test.filters.SmallTest
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import at.bitfire.dav4android.DavResource
import at.bitfire.dav4android.property.AddressbookHomeSet
import at.bitfire.dav4android.property.ResourceType
......@@ -52,7 +52,7 @@ class DavResourceFinderTest {
server.start()
loginInfo = LoginInfo(URI.create("/"), Credentials("mock", "12345"))
finder = DavResourceFinder(getTargetContext(), loginInfo)
finder = DavResourceFinder(InstrumentationRegistry.getInstrumentation().targetContext, loginInfo)
client = HttpClient.Builder()
.addAuthentication(null, loginInfo.credentials)
......
......@@ -106,7 +106,7 @@
android:label="@string/debug_info_title">
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="@string/authority_log_provider"
android:grantUriPermissions="true"
android:exported="false">
......
......@@ -17,7 +17,7 @@ import android.graphics.drawable.BitmapDrawable
import android.net.Uri
import android.os.Build
import android.os.StrictMode
import android.support.v7.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate
import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.ui.NotificationUtils
import kotlin.concurrent.thread
......
......@@ -18,8 +18,8 @@ import android.database.DatabaseUtils
import android.database.sqlite.SQLiteDatabase
import android.os.Binder
import android.os.Bundle
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import at.bitfire.dav4android.DavResource
import at.bitfire.dav4android.Response
import at.bitfire.dav4android.UrlUtils
......
......@@ -14,8 +14,8 @@ import android.content.Intent
import android.content.SharedPreferences
import android.os.Process
import android.preference.PreferenceManager
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import android.util.Log
import at.bitfire.davdroid.R
import at.bitfire.davdroid.ui.AppSettingsActivity
......
......@@ -15,7 +15,7 @@ import android.database.DatabaseUtils
import android.os.Build
import android.os.Bundle
import android.provider.ContactsContract
import android.support.v4.content.ContextCompat
import androidx.core.content.ContextCompat
import at.bitfire.davdroid.AccountSettings
import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.model.CollectionInfo
......
......@@ -13,7 +13,7 @@ import android.content.*
import android.os.Build
import android.os.Bundle
import android.provider.ContactsContract.Groups
import android.support.v4.app.NotificationCompat
import androidx.core.app.NotificationCompat
import at.bitfire.dav4android.DavAddressBook
import at.bitfire.dav4android.DavResource
import at.bitfire.dav4android.DavResponseCallback
......
......@@ -18,9 +18,9 @@ import android.net.ConnectivityManager
import android.net.wifi.WifiManager
import android.os.Build
import android.os.Bundle
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import android.support.v4.content.ContextCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import at.bitfire.davdroid.AccountSettings
import at.bitfire.davdroid.R
import at.bitfire.davdroid.log.Logger
......
......@@ -16,8 +16,8 @@ import android.os.Bundle
import android.os.RemoteException
import android.provider.CalendarContract
import android.provider.ContactsContract
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import at.bitfire.dav4android.*
import at.bitfire.dav4android.exception.*
import at.bitfire.dav4android.property.GetCTag
......
......@@ -15,8 +15,8 @@ import android.database.DatabaseUtils
import android.graphics.drawable.BitmapDrawable
import android.net.Uri
import android.os.Bundle
import android.support.v4.app.NotificationCompat
import android.support.v4.app.NotificationManagerCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import at.bitfire.davdroid.AccountSettings
import at.bitfire.davdroid.R
import at.bitfire.davdroid.log.Logger
......
......@@ -10,16 +10,16 @@ package at.bitfire.davdroid.ui
import android.content.Context
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.app.LoaderManager
import android.support.v4.content.AsyncTaskLoader
import android.support.v4.content.Loader
import android.support.v7.app.AppCompatActivity
import android.text.Html
import android.text.Spanned
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import at.bitfire.davdroid.App
import at.bitfire.davdroid.BuildConfig
import at.bitfire.davdroid.R
......@@ -70,11 +70,11 @@ class AboutActivity: AppCompatActivity() {
override fun getCount() = 2
override fun getPageTitle(position: Int) =
override fun getPageTitle(position: Int): String =
when (position) {
1 -> getString(R.string.about_libraries)
else -> getString(R.string.app_name)
}!!
}
override fun getItem(position: Int) =
when (position) {
......
......@@ -13,7 +13,6 @@ import android.accounts.Account
import android.accounts.AccountManager
import android.annotation.SuppressLint
import android.app.Dialog
import android.app.LoaderManager
import android.content.*
import android.content.pm.PackageManager
import android.database.DatabaseUtils
......@@ -25,15 +24,17 @@ import android.os.Bundle
import android.os.IBinder
import android.provider.CalendarContract
import android.provider.ContactsContract
import android.support.design.widget.Snackbar
import android.support.v4.app.ActivityCompat
import android.support.v4.app.DialogFragment
import android.support.v4.content.ContextCompat
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.*
import android.widget.*
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import at.bitfire.davdroid.DavService
import at.bitfire.davdroid.R
import at.bitfire.davdroid.log.Logger
......@@ -44,6 +45,7 @@ import at.bitfire.davdroid.model.ServiceDB.Collections
import at.bitfire.davdroid.resource.LocalAddressBook
import at.bitfire.davdroid.resource.LocalTaskList
import at.bitfire.ical4android.TaskProvider
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.account_caldav_item.view.*
import kotlinx.android.synthetic.main.activity_account.*
import java.lang.ref.WeakReference
......@@ -107,7 +109,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
webcal_menu.setOnMenuItemClickListener(this)
// load CardDAV/CalDAV collections
loaderManager.initLoader(0, null, this)
LoaderManager.getInstance(this).initLoader(0, null, this)
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
......@@ -355,7 +357,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
AccountLoader(this, account)
fun reload() {
loaderManager.restartLoader(0, null, this)
LoaderManager.getInstance(this).restartLoader(0, null, this)
}
override fun onLoadFinished(loader: Loader<AccountInfo>, info: AccountInfo?) {
......@@ -582,7 +584,10 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
}
}
} finally {
provider.release()
if (Build.VERSION.SDK_INT >= 24)
provider.close()
else
provider.release()
}
}
......@@ -599,7 +604,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
): ArrayAdapter<CollectionInfo>(context, R.layout.account_carddav_item) {
override fun getView(position: Int, v: View?, parent: ViewGroup?): View {
val v = v ?: LayoutInflater.from(context).inflate(R.layout.account_carddav_item, parent, false)
val info = getItem(position)
val info = getItem(position)!!
val checked: CheckBox = v.findViewById(R.id.checked)
checked.isChecked = info.selected
......@@ -703,7 +708,7 @@ class AccountActivity: AppCompatActivity(), Toolbar.OnMenuItemClickListener, Pop
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val oldAccount: Account = arguments!!.getParcelable(ARG_ACCOUNT)
val oldAccount: Account = arguments!!.getParcelable(ARG_ACCOUNT)!!
val editText = EditText(activity)
editText.setText(oldAccount.name)
......
......@@ -11,12 +11,8 @@ package at.bitfire.davdroid.ui
import android.accounts.Account
import android.accounts.AccountManager
import android.accounts.OnAccountsUpdateListener
import android.app.ListFragment
import android.app.LoaderManager
import android.content.AsyncTaskLoader
import android.content.Context
import android.content.Intent
import android.content.Loader
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
......@@ -24,20 +20,24 @@ import android.view.ViewGroup
import android.widget.AbsListView
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.fragment.app.ListFragment
import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import at.bitfire.davdroid.R
import kotlinx.android.synthetic.main.account_list_item.view.*
class AccountListFragment: ListFragment(), LoaderManager.LoaderCallbacks<Array<Account>> {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
listAdapter = AccountListAdapter(activity)
listAdapter = AccountListAdapter(requireActivity())
return inflater.inflate(R.layout.account_list, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
loaderManager.initLoader(0, arguments, this)
LoaderManager.getInstance(this).initLoader(0, arguments, this)
listView.choiceMode = AbsListView.CHOICE_MODE_SINGLE
listView.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
......@@ -52,7 +52,7 @@ class AccountListFragment: ListFragment(), LoaderManager.LoaderCallbacks<Array<A
// loader
override fun onCreateLoader(id: Int, args: Bundle?) =
AccountLoader(activity)
AccountLoader(requireActivity())
override fun onLoadFinished(loader: Loader<Array<Account>>, accounts: Array<Account>) {
val adapter = listAdapter as AccountListAdapter
......@@ -102,7 +102,7 @@ class AccountListFragment: ListFragment(), LoaderManager.LoaderCallbacks<Array<A
): ArrayAdapter<Account>(context, R.layout.account_list_item) {
override fun getView(position: Int, v: View?, parent: ViewGroup?): View {
val account = getItem(position)
val account = getItem(position)!!
val v = v ?: LayoutInflater.from(context).inflate(R.layout.account_list_item, parent, false)
v.account_name.text = account.name
......
......@@ -21,16 +21,16 @@ import android.os.Handler
import android.os.Looper
import android.provider.CalendarContract
import android.security.KeyChain
import android.support.v4.app.ActivityCompat
import android.support.v4.app.DialogFragment
import android.support.v4.app.LoaderManager
import android.support.v4.app.NavUtils
import android.support.v4.content.ContextCompat
import android.support.v4.content.Loader
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import android.support.v7.preference.*
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.app.NavUtils
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.loader.app.LoaderManager
import androidx.loader.content.Loader
import androidx.preference.*
import at.bitfire.davdroid.AccountSettings
import at.bitfire.davdroid.InvalidAccountException
import at.bitfire.davdroid.R
......@@ -81,8 +81,8 @@ class AccountSettingsActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
account = arguments!!.getParcelable(EXTRA_ACCOUNT)
loaderManager.initLoader(0, arguments, this)
account = arguments!!.getParcelable(EXTRA_ACCOUNT)!!
LoaderManager.getInstance(this).initLoader(0, arguments, this)
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
......@@ -108,14 +108,14 @@ class AccountSettingsActivity: AppCompatActivity() {
prefUserName.text = credentials.userName
prefUserName.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.credentials(Credentials(newValue as String, credentials.password))
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
prefPassword.isVisible = true
prefPassword.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.credentials(Credentials(credentials.userName, newValue as String))
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
......@@ -131,7 +131,7 @@ class AccountSettingsActivity: AppCompatActivity() {
KeyChain.choosePrivateKeyAlias(activity, { alias ->
accountSettings.credentials(Credentials(certificateAlias = alias))
Handler(Looper.getMainLooper()).post {
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
}
}, null, null, null, -1, credentials.certificateAlias)
true
......@@ -155,7 +155,7 @@ class AccountSettingsActivity: AppCompatActivity() {
it.summary = getString(R.string.settings_sync_summary_periodically, syncIntervalContacts / 60)
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setSyncInterval(getString(R.string.address_books_authority), (newValue as String).toLong())
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
} else
......@@ -172,7 +172,7 @@ class AccountSettingsActivity: AppCompatActivity() {
it.summary = getString(R.string.settings_sync_summary_periodically, syncIntervalCalendars / 60)
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setSyncInterval(CalendarContract.AUTHORITY, (newValue as String).toLong())
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
} else
......@@ -189,7 +189,7 @@ class AccountSettingsActivity: AppCompatActivity() {
it.summary = getString(R.string.settings_sync_summary_periodically, syncIntervalTasks / 60)
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setSyncInterval(TaskProvider.ProviderName.OpenTasks.authority, (newValue as String).toLong())
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
} else
......@@ -201,7 +201,7 @@ class AccountSettingsActivity: AppCompatActivity() {
prefWifiOnly.isChecked = accountSettings.getSyncWifiOnly()
prefWifiOnly.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, wifiOnly ->
accountSettings.setSyncWiFiOnly(wifiOnly as Boolean)
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
......@@ -214,7 +214,7 @@ class AccountSettingsActivity: AppCompatActivity() {
prefWifiOnlySSIDs.setSummary(R.string.settings_sync_wifi_only_ssids_off)
prefWifiOnlySSIDs.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setSyncWifiOnlySSIDs((newValue as String).split(',').mapNotNull { StringUtils.trimToNull(it) }.distinct())
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
......@@ -243,7 +243,7 @@ class AccountSettingsActivity: AppCompatActivity() {
.setPositiveButton(android.R.string.ok) { _, _ ->
// change group method
accountSettings.setGroupMethod(GroupMethod.valueOf(groupMethod as String))
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
// reload all contacts
val args = Bundle(1)
......@@ -295,7 +295,7 @@ class AccountSettingsActivity: AppCompatActivity() {
}
}
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
} else
......@@ -309,7 +309,7 @@ class AccountSettingsActivity: AppCompatActivity() {
it.isChecked = accountSettings.getManageCalendarColors()
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setManageCalendarColors(newValue as Boolean)
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
false
}
} else
......@@ -324,7 +324,7 @@ class AccountSettingsActivity: AppCompatActivity() {
it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean) {
accountSettings.setEventColors(true)
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
} else
AlertDialog.Builder(requireActivity())
.setIcon(R.drawable.ic_error_dark)
......@@ -333,7 +333,7 @@ class AccountSettingsActivity: AppCompatActivity() {
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { _, _ ->
accountSettings.setEventColors(false)
loaderManager.restartLoader(0, arguments, this)
LoaderManager.getInstance(this).restartLoader(0, arguments, this)
}
.show()
false
......
......@@ -14,18 +14,18 @@ import android.content.Context
import android.content.Intent
import android.content.SyncStatusObserver
import android.os.Bundle
import android.support.design.widget.NavigationView
import android.support.design.widget.Snackbar
import android.support.v4.app.LoaderManager
import android.support.v4.content.Loader
import android.support.v4.view.GravityCompat
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.GravityCompat
import androidx.loader.app.LoaderManager
import androidx.loader.content.Loader
import at.bitfire.davdroid.App
import at.bitfire.davdroid.R
import at.bitfire.davdroid.settings.ISettings
import at.bitfire.davdroid.ui.setup.LoginActivity
import com.google.android.material.navigation.NavigationView
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.accounts_content.*
import kotlinx.android.synthetic.main.activity_accounts.*
......@@ -65,7 +65,7 @@ class AccountsActivity: AppCompatActivity(), NavigationView.OnNavigationItemSele
startService(settingsIntent)
val args = Bundle(1)
supportLoaderManager.initLoader(0, args, this)
LoaderManager.getInstance(this).initLoader(0, args, this)
}
override fun onCreateLoader(code: Int, args: Bundle?) =
......
......@@ -16,12 +16,11 @@ import android.content.ServiceConnection
import android.os.Bundle
import android.os.IBinder
import android.os.Process
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.support.v7.preference.EditTextPreference
import android.support.v7.preference.Preference
import android.support.v7.preference.PreferenceFragmentCompat
import android.support.v7.preference.SwitchPreferenceCompat
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.EditTextPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import at.bitfire.cert4android.CustomCertManager
import at.bitfire.davdroid.App
import at.bitfire.davdroid.BuildConfig
......@@ -30,6 +29,7 @@ import at.bitfire.davdroid.log.Logger
import at.bitfire.davdroid.settings.ISettings
import at.bitfire.davdroid.settings.ISettingsObserver
import at.bitfire.davdroid.settings.Settings
import com.google.android.material.snackbar.Snackbar
import java.net.URI
import java.net.URISyntaxException
......
......@@ -11,8 +11,8 @@ package at.bitfire.davdroid.ui
import android.annotation.SuppressLint
import android.app.Dialog
import android.os.Bundle
import android.support.v4.app.DialogFragment
import android.support.v7.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.appcompat.app.AlertDialog
import at.bitfire.davdroid.R
import at.bitfire.davdroid.model.CollectionInfo
import kotlinx.android.synthetic.main.collection_properties.view.*
......
......@@ -9,17 +9,17 @@
package at.bitfire.davdroid.ui
import android.accounts.Account
import android.app.LoaderManager
import android.content.AsyncTaskLoader
import android.content.Context
import android.content.Intent
import android.content.Loader
import android.os.Bundle
import android.support.v4.app.NavUtils
import android.support.v7.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.NavUtils
import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import at.bitfire.davdroid.R
import at.bitfire.davdroid.model.CollectionInfo
import at.bitfire.davdroid.model.ServiceDB
......@@ -45,7 +45,7 @@ class CreateAddressBookActivity: AppCompatActivity(), LoaderManager.LoaderCallba
supportActionBar?.setDisplayHomeAsUpEnabled(true)
setContentView(R.layout.activity_create_address_book)
loaderManager.initLoader(0, intent.extras, this)
LoaderManager.getInstance(this).initLoader(0, intent.extras, this)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
......
......@@ -9,18 +9,18 @@
package at.bitfire.davdroid.ui
import android.accounts.Account
import android.app.LoaderManager
import android.content.AsyncTaskLoader
import android.content.Context
import android.content.Intent
import android.content.Loader
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.support.v4.app.NavUtils
import android.support.v7.app.AppCompatActivity
import androidx.core.app.NavUtils
import androidx.appcompat.app.AppCompatActivity
import android.view.Menu
import android.view.MenuItem
import android.widget.ArrayAdapter
import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import at.bitfire.davdroid.R
import at.bitfire.davdroid.model.CollectionInfo
import at.bitfire.davdroid.model.ServiceDB
......@@ -43,7 +43,7 @@ class CreateCalendarActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
account = intent.extras.getParcelable(EXTRA_ACCOUNT)
account = intent.extras.getParcelable(EXTRA_ACCOUNT)!!
supportActionBar?.setDisplayHomeAsUpEnabled(true)
......@@ -56,7 +56,7 @@ class CreateCalendarActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks
}).show()
}
loaderManager.initLoader(0, null, this)
LoaderManager.getInstance(this).initLoader(0, null, this)
}