Commit a4a81629 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Refactoring

parent 65db706e
Pipeline #15678936 passed with stages
in 6 minutes and 6 seconds
......@@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*/
package at.bitfire.davdroid;
package at.bitfire.davdroid
object Constants {
......
......@@ -162,13 +162,13 @@ class DavService: Service() {
when (serviceType) {
Services.SERVICE_CARDDAV -> {
dav.propfind(0, AddressbookHomeSet.NAME, GroupMembership.NAME)
for ((resource, addressbookHomeSet) in dav.findProperties(AddressbookHomeSet.NAME) as List<Pair<DavResource, AddressbookHomeSet>>)
for ((resource, addressbookHomeSet) in dav.findProperties(AddressbookHomeSet::class.java))
for (href in addressbookHomeSet.hrefs)
resource.location.resolve(href)?.let { homeSets += UrlUtils.withTrailingSlash(it) }
}
Services.SERVICE_CALDAV -> {
dav.propfind(0, CalendarHomeSet.NAME, CalendarProxyReadFor.NAME, CalendarProxyWriteFor.NAME, GroupMembership.NAME)
for ((resource, calendarHomeSet) in dav.findProperties(CalendarHomeSet.NAME) as List<Pair<DavResource, CalendarHomeSet>>)
for ((resource, calendarHomeSet) in dav.findProperties(CalendarHomeSet::class.java))
for (href in calendarHomeSet.hrefs)
resource.location.resolve(href)?.let { homeSets.add(UrlUtils.withTrailingSlash(it)) }
}
......@@ -213,19 +213,19 @@ class DavService: Service() {
queryHomeSets(principal)
// refresh home sets: calendar-proxy-read/write-for
for ((resource, proxyRead) in principal.findProperties(CalendarProxyReadFor.NAME) as List<Pair<DavResource, CalendarProxyReadFor>>)
for ((resource, proxyRead) in principal.findProperties(CalendarProxyReadFor::class.java))
for (href in proxyRead.hrefs) {
Logger.log.fine("Principal is a read-only proxy for $href, checking for home sets")
resource.location.resolve(href)?.let { queryHomeSets(DavResource(httpClient, it)) }
}
for ((resource, proxyWrite) in principal.findProperties(CalendarProxyWriteFor.NAME) as List<Pair<DavResource, CalendarProxyWriteFor>>)
for ((resource, proxyWrite) in principal.findProperties(CalendarProxyWriteFor::class.java))
for (href in proxyWrite.hrefs) {
Logger.log.fine("Principal is a read/write proxy for $href, checking for home sets")
resource.location.resolve(href)?.let { queryHomeSets(DavResource(httpClient, it)) }
}
// refresh home sets: direct group memberships
(principal.properties[GroupMembership.NAME] as GroupMembership?)?.let { groupMembership ->
principal.properties[GroupMembership::class.java]?.let { groupMembership ->
for (href in groupMembership.hrefs) {
Logger.log.fine("Principal is member of group $href, checking for home sets")
principal.location.resolve(href)?.let { url ->
......
......@@ -6,7 +6,7 @@
* http://www.gnu.org/licenses/gpl.html
*/
package at.bitfire.davdroid;
package at.bitfire.davdroid
import android.annotation.TargetApi
import android.content.Context
......@@ -37,11 +37,7 @@ object DavUtils {
val segments = LinkedList<String>(httpUrl.pathSegments())
Collections.reverse(segments)
for (segment in segments)
if (segment.isNotEmpty())
return segment
return "/"
return segments.firstOrNull { it.isNotEmpty() } ?: "/"
}
fun prepareLookup(context: Context, lookup: Lookup) {
......
......@@ -50,7 +50,7 @@ class PackageChangedReceiver: BroadcastReceiver() {
if (ContentResolver.getIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority) <= 0) {
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 1)
ContentResolver.setSyncAutomatically(account, TaskProvider.ProviderName.OpenTasks.authority, true)
ContentResolver.addPeriodicSync(account, TaskProvider.ProviderName.OpenTasks.authority, Bundle(), Constants.DEFAULT_SYNC_INTERVAL.toLong())
ContentResolver.addPeriodicSync(account, TaskProvider.ProviderName.OpenTasks.authority, Bundle(), Constants.DEFAULT_SYNC_INTERVAL)
}
} else
ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 0)
......
......@@ -54,7 +54,7 @@ class SSLSocketFactoryCompat(
protocols = _protocols.toTypedArray()
/* set up reasonable cipher suites */
val knownCiphers = arrayOf<String>(
val knownCiphers = arrayOf(
// TLS 1.2
"TLS_RSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_AES_128_GCM_SHA256",
......
......@@ -8,8 +8,8 @@
package at.bitfire.davdroid.log
import java.util.logging.Handler;
import java.util.logging.LogRecord;
import java.util.logging.Handler
import java.util.logging.LogRecord
class StringHandler: Handler() {
......
......@@ -62,7 +62,7 @@ data class CollectionInfo @JvmOverloads constructor(
constructor(dav: DavResource): this(dav.location.toString()) {
(dav.properties[ResourceType.NAME] as ResourceType?)?.let { type ->
dav.properties[ResourceType::class.java]?.let { type ->
when {
type.types.contains(ResourceType.ADDRESSBOOK) -> this.type = Type.ADDRESS_BOOK
type.types.contains(ResourceType.CALENDAR) -> this.type = Type.CALENDAR
......@@ -70,33 +70,33 @@ data class CollectionInfo @JvmOverloads constructor(
}
}
(dav.properties[CurrentUserPrivilegeSet.NAME] as CurrentUserPrivilegeSet?)?.let { privilegeSet ->
dav.properties[CurrentUserPrivilegeSet::class.java]?.let { privilegeSet ->
readOnly = !privilegeSet.mayWriteContent
}
(dav.properties[DisplayName.NAME] as DisplayName?)?.let {
dav.properties[DisplayName::class.java]?.let {
if (!it.displayName.isNullOrEmpty())
displayName = it.displayName
}
when (type) {
Type.ADDRESS_BOOK -> {
(dav.properties[AddressbookDescription.NAME] as AddressbookDescription?)?.let { description = it.description }
dav.properties[AddressbookDescription::class.java]?.let { description = it.description }
}
Type.CALENDAR, Type.WEBCAL -> {
(dav.properties[CalendarDescription.NAME] as CalendarDescription?)?.let { description = it.description }
(dav.properties[CalendarColor.NAME] as CalendarColor?)?.let { color = it.color }
(dav.properties[CalendarTimezone.NAME] as CalendarTimezone?)?.let { timeZone = it.vTimeZone }
dav.properties[CalendarDescription::class.java]?.let { description = it.description }
dav.properties[CalendarColor::class.java]?.let { color = it.color }
dav.properties[CalendarTimezone::class.java]?.let { timeZone = it.vTimeZone }
if (type == Type.CALENDAR) {
supportsVEVENT = true
supportsVTODO = true
(dav.properties[SupportedCalendarComponentSet.NAME] as SupportedCalendarComponentSet?)?.let {
dav.properties[SupportedCalendarComponentSet::class.java]?.let {
supportsVEVENT = it.supportsEvents
supportsVTODO = it.supportsTasks
}
} else { // Type.WEBCAL
(dav.properties[Source.NAME] as Source?)?.let { source = it.hrefs.firstOrNull() }
dav.properties[Source::class.java]?.let { source = it.hrefs.firstOrNull() }
supportsVEVENT = true
}
}
......
......@@ -193,7 +193,7 @@ class ServiceDB {
// print columns
val cols = cursor.columnCount
sb.append("\t| ")
for (i in 0 .. cols-1)
for (i in 0 until cols)
sb .append(" ")
.append(cursor.getColumnName(i))
.append(" |")
......@@ -202,7 +202,7 @@ class ServiceDB {
// print rows
while (cursor.moveToNext()) {
sb.append("\t| ")
for (i in 0 .. cols-1) {
for (i in 0 until cols) {
sb.append(" ")
try {
val value = cursor.getString(i)
......
......@@ -6,9 +6,9 @@
* http://www.gnu.org/licenses/gpl.html
*/
package at.bitfire.davdroid.model;
package at.bitfire.davdroid.model
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.RawContacts
object UnknownProperties {
......
......@@ -56,9 +56,7 @@ class LocalCalendar private constructor(
// flag as visible & synchronizable at creation, might be changed by user at any time
values.put(Calendars.VISIBLE, 1)
values.put(Calendars.SYNC_EVENTS, 1)
val uri = create(account, provider, values)
return uri
return create(account, provider, values)
}
private fun valuesFromCollectionInfo(info: CollectionInfo, withColor: Boolean): ContentValues {
......
......@@ -102,7 +102,7 @@ class LocalTaskList private constructor(
@Throws(CalendarStorageException::class)
fun update(info: CollectionInfo, updateColor: Boolean) {
update(valuesFromCollectionInfo(info, updateColor));
update(valuesFromCollectionInfo(info, updateColor))
}
......
......@@ -14,18 +14,18 @@ open class DefaultsProvider(
private val allowOverride: Boolean = true
): Provider {
open val booleanDefaults = mapOf<String, Boolean>(
open val booleanDefaults = mapOf(
Pair(App.DISTRUST_SYSTEM_CERTIFICATES, false),
Pair(App.OVERRIDE_PROXY, false)
)
open val intDefaults = mapOf<String, Int>(
open val intDefaults = mapOf(
Pair(App.OVERRIDE_PROXY_PORT, App.OVERRIDE_PROXY_PORT_DEFAULT)
)
open val longDefaults = mapOf<String, Long>()
open val stringDefaults = mapOf<String, String>(
open val stringDefaults = mapOf(
Pair(App.OVERRIDE_PROXY_HOST, App.OVERRIDE_PROXY_HOST_DEFAULT)
)
......
......@@ -136,7 +136,7 @@ class CalendarSyncManager(
val body = remote.get("text/calendar")
// CalDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc4791#section-5.3.4]
val eTag = remote.properties[GetETag.NAME] as GetETag?
val eTag = remote.properties[GetETag::class.java]
if (eTag == null || eTag.eTag.isNullOrEmpty())
throw DavException("Received CalDAV GET response without ETag for ${remote.location}")
......@@ -154,10 +154,10 @@ class CalendarSyncManager(
for (remote in davCollection.members) {
currentDavResource = remote
val eTag = (remote.properties[GetETag.NAME] as GetETag?)?.eTag
val eTag = remote.properties[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
val calendarData = remote.properties[CalendarData.NAME] as CalendarData?
val calendarData = remote.properties[CalendarData::class.java]
val iCalendar = calendarData?.iCalendar
?: throw DavException("Received multi-get response without event data")
......
......@@ -94,6 +94,7 @@ class ContactsSyncManager(
private var numDiscarded = 0
private var hasVCard4 = false
private var hasCollectionSync = false
private val groupMethod = accountSettings.getGroupMethod()
......@@ -125,12 +126,19 @@ class ContactsSyncManager(
override fun queryCapabilities() {
// prepare remote address book
davCollection.propfind(0, SupportedAddressData.NAME, GetCTag.NAME)
(davCollection.properties[SupportedAddressData.NAME] as SupportedAddressData?)?.let {
davCollection.propfind(0, SupportedAddressData.NAME, GetCTag.NAME, SupportedReportSet.NAME)
val properties = davCollection.properties
properties[SupportedAddressData::class.java]?.let {
hasVCard4 = it.hasVCard4()
}
Logger.log.info("Server advertises VCard/4 support: $hasVCard4")
properties[SupportedReportSet::class.java]?.let {
hasCollectionSync = it.reports.contains(SupportedReportSet.SYNC_COLLECTION)
}
Logger.log.info("Server advertises collection synchronization support: $hasCollectionSync")
Logger.log.info("Contact group method: $groupMethod")
// in case of GROUP_VCARDs, treat groups as contacts in the local address book
localAddressBook.includeGroups = groupMethod == GroupMethod.GROUP_VCARDS
......@@ -286,8 +294,12 @@ class ContactsSyncManager(
remoteResources = HashMap(davCollection.members.size)
for (vCard in davCollection.members) {
// ignore member collections
val type = vCard.properties[ResourceType.NAME] as ResourceType?
if (type != null && type.types.contains(ResourceType.COLLECTION))
var ignore = false
vCard.properties[ResourceType::class.java]?.let { type ->
if (type.types.contains(ResourceType.COLLECTION))
ignore = true
}
if (ignore)
continue
val fileName = vCard.fileName()
......@@ -319,7 +331,7 @@ class ContactsSyncManager(
val body = remote.get("text/vcard;version=4.0, text/vcard;charset=utf-8;q=0.8, text/vcard;q=0.5")
// CardDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc6352#section-6.3.2.3]
val eTag = remote.properties[GetETag.NAME] as GetETag?
val eTag = remote.properties[GetETag::class.java]
if (eTag == null || eTag.eTag.isNullOrEmpty())
throw DavException("Received CardDAV GET response without ETag for ${remote.location}")
......@@ -337,10 +349,10 @@ class ContactsSyncManager(
for (remote in davCollection.members) {
currentDavResource = remote
val eTag = (remote.properties[GetETag.NAME] as GetETag?)?.eTag
val eTag = remote.properties[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
val addressData = remote.properties[AddressData.NAME] as AddressData?
val addressData = remote.properties[AddressData::class.java]
val vCard = addressData?.vCard
?: throw DavException("Received multi-get response without address data")
......
......@@ -31,7 +31,7 @@ import java.util.logging.Level
abstract class SyncAdapterService: Service() {
companion object {
val runningSyncs = Collections.synchronizedSet(mutableSetOf<Pair<String, Account>>())
val runningSyncs = Collections.synchronizedSet(mutableSetOf<Pair<String, Account>>())!!
}
abstract protected fun syncAdapter(): AbstractThreadedSyncAdapter
......
......@@ -336,7 +336,7 @@ abstract class SyncManager(
Logger.log.log(Level.INFO, "Resource has been modified on the server before upload, ignoring", e)
}
val newETag = remote.properties[GetETag.NAME] as GetETag?
val newETag = remote.properties[GetETag::class.java]
val eTag: String?
if (newETag != null) {
eTag = newETag.eTag
......@@ -362,7 +362,7 @@ abstract class SyncManager(
*/
protected open fun checkSyncState(): Boolean {
// check CTag (ignore on manual sync)
(davCollection.properties[GetCTag.NAME] as GetCTag?)?.let { remoteCTag = it.cTag }
davCollection.properties[GetCTag::class.java]?.let { remoteCTag = it.cTag }
val localCTag = if (extras.containsKey(ContentResolver.SYNC_EXTRAS_MANUAL)) {
Logger.log.info("Manual sync, ignoring CTag")
......@@ -423,7 +423,7 @@ abstract class SyncManager(
} else {
// contact is still on server, check whether it has been updated remotely
val localETag = local.eTag
val getETag = remote.properties[GetETag.NAME] as GetETag?
val getETag = remote.properties[GetETag::class.java]
val remoteETag = getETag?.eTag ?: throw DavException("Server didn't provide ETag")
if (remoteETag == localETag) {
Logger.log.fine("$name has not been changed on server (ETag still $remoteETag)")
......
......@@ -121,7 +121,7 @@ class TasksSyncManager(
val body = remote.get("text/calendar")
// CalDAV servers MUST return ETag on GET [https://tools.ietf.org/html/rfc4791#section-5.3.4]
val eTag = remote.properties[GetETag.NAME] as GetETag?
val eTag = remote.properties[GetETag::class.java]
if (eTag == null || eTag.eTag.isNullOrEmpty())
throw DavException("Received CalDAV GET response without ETag for ${remote.location}")
......@@ -139,10 +139,10 @@ class TasksSyncManager(
for (remote in davCollection.members) {
currentDavResource = remote
val eTag = (remote.properties[GetETag.NAME] as GetETag?)?.eTag
val eTag = remote.properties[GetETag::class.java]?.eTag
?: throw DavException("Received multi-get response without ETag")
val calendarData = remote.properties[CalendarData.NAME] as CalendarData?
val calendarData = remote.properties[CalendarData::class.java]
val iCalendar = calendarData?.iCalendar
?: throw DavException("Received multi-get response without task data")
......
......@@ -175,7 +175,7 @@ class AccountSettingsActivity: AppCompatActivity() {
else
prefWifiOnlySSIDs.setSummary(R.string.settings_sync_wifi_only_ssids_off)
prefWifiOnlySSIDs.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
accountSettings.setSyncWifiOnlySSIDs((newValue as String).split(',').map { StringUtils.trimToNull(it) }.filterNotNull().distinct())
accountSettings.setSyncWifiOnlySSIDs((newValue as String).split(',').mapNotNull { StringUtils.trimToNull(it) }.distinct())
loaderManager.restartLoader(0, arguments, this)
false
}
......
......@@ -121,7 +121,7 @@ class CreateCalendarActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks
// select system time zone
val defaultTimeZone = TimeZone.getDefault().id
for (i in 0 .. timeZones.size - 1)
for (i in 0 until timeZones.size)
if (timeZones[i] == defaultTimeZone) {
time_zone.setSelection(i)
break
......
......@@ -35,12 +35,12 @@ class PermissionsActivity: AppCompatActivity() {
private fun refresh() {
val noCalendarPermissions =
ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CALENDAR) != PackageManager.PERMISSION_GRANTED;
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CALENDAR) != PackageManager.PERMISSION_GRANTED
calendar_permissions.visibility = if (noCalendarPermissions) View.VISIBLE else View.GONE
val noContactsPermissions =
ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED;
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED
contacts_permissions.visibility = if (noContactsPermissions) View.VISIBLE else View.GONE
val noTaskPermissions: Boolean
......@@ -50,7 +50,7 @@ class PermissionsActivity: AppCompatActivity() {
ActivityCompat.checkSelfPermission(this, TaskProvider.PERMISSION_WRITE_TASKS) != PackageManager.PERMISSION_GRANTED
findViewById<View>(R.id.opentasks_permissions).visibility = if (noTaskPermissions) View.VISIBLE else View.GONE
} else {
findViewById<View>(R.id.opentasks_permissions).visibility = View.GONE;
findViewById<View>(R.id.opentasks_permissions).visibility = View.GONE
noTaskPermissions = false
}
......
......@@ -62,7 +62,7 @@ class AccountDetailsFragment: Fragment(), LoaderManager.LoaderCallbacks<CreateSe
val config = arguments.getSerializable(KEY_CONFIG) as DavResourceFinder.Configuration
v.account_name.setText(if (config.calDAV != null && config.calDAV.email != null)
v.account_name.setText(if (config.calDAV?.email != null)
config.calDAV.email
else
config.userName)
......
......@@ -131,7 +131,7 @@ class DavResourceFinder(
val davPrincipal = DavResource(httpClient.okHttpClient, HttpUrl.get(config.principal)!!, log)
try {
davPrincipal.propfind(0, CalendarUserAddressSet.NAME)
(davPrincipal.properties[CalendarUserAddressSet.NAME] as CalendarUserAddressSet?)?.let { addressSet ->
davPrincipal.properties[CalendarUserAddressSet::class.java]?.let { addressSet ->
for (href in addressSet.hrefs)
try {
val uri = URI(href)
......@@ -181,18 +181,16 @@ class DavResourceFinder(
}
// check for current-user-principal
davBase.findProperty(CurrentUserPrincipal.NAME)?.let { (dav, second) ->
val currentUserPrincipal = second as CurrentUserPrincipal?
currentUserPrincipal?.href?.let {
davBase.findProperty(CurrentUserPrincipal::class.java)?.let { (dav, currentUserPrincipal) ->
currentUserPrincipal.href?.let {
principal = dav.location.resolve(it)
}
}
// check for resource type "principal"
if (principal == null)
for ((dav, second) in davBase.findProperties(ResourceType.NAME)) {
val resourceType = second as ResourceType?
if (resourceType != null && resourceType.types.contains(ResourceType.PRINCIPAL)) {
for ((dav, resourceType) in davBase.findProperties(ResourceType::class.java)) {
if (resourceType.types.contains(ResourceType.PRINCIPAL)) {
principal = dav.location
break
}
......@@ -217,8 +215,7 @@ class DavResourceFinder(
*/
fun rememberIfAddressBookOrHomeset(dav: DavResource, config: Configuration.ServiceInfo) {
// Is there an address book?
for ((addressBook, second) in dav.findProperties(ResourceType.NAME)) {
val resourceType = second as ResourceType
for ((addressBook, resourceType) in dav.findProperties(ResourceType::class.java)) {
if (resourceType.types.contains(ResourceType.ADDRESSBOOK)) {
addressBook.location = UrlUtils.withTrailingSlash(addressBook.location)
log.info("Found address book at ${addressBook.location}")
......@@ -227,8 +224,7 @@ class DavResourceFinder(
}
// Is there an addressbook-home-set?
for ((dav, second) in dav.findProperties(AddressbookHomeSet.NAME)) {
val homeSet = second as AddressbookHomeSet
for ((dav, homeSet) in dav.findProperties(AddressbookHomeSet::class.java)) {
for (href in homeSet.hrefs) {
dav.location.resolve(href)?.let {
val location = UrlUtils.withTrailingSlash(it)
......@@ -239,10 +235,9 @@ class DavResourceFinder(
}
}
fun rememberIfCalendarOrHomeset(dav: DavResource, config: Configuration.ServiceInfo) {
private fun rememberIfCalendarOrHomeset(dav: DavResource, config: Configuration.ServiceInfo) {
// Is the collection a calendar collection?
for ((calendar, second) in dav.findProperties(ResourceType.NAME)) {
val resourceType = second as ResourceType
for ((calendar, resourceType) in dav.findProperties(ResourceType::class.java)) {
if (resourceType.types.contains(ResourceType.CALENDAR)) {
calendar.location = UrlUtils.withTrailingSlash(calendar.location)
log.info("Found calendar at ${calendar.location}")
......@@ -251,8 +246,7 @@ class DavResourceFinder(
}
// Is there an calendar-home-set?
for ((dav, second) in dav.findProperties(CalendarHomeSet.NAME)) {
val homeSet = second as CalendarHomeSet
for ((dav, homeSet) in dav.findProperties(CalendarHomeSet::class.java)) {
for (href in homeSet.hrefs) {
dav.location.resolve(href)?.let {
val location = UrlUtils.withTrailingSlash(it)
......@@ -355,8 +349,7 @@ class DavResourceFinder(
val dav = DavResource(httpClient.okHttpClient, url, log)
dav.propfind(0, CurrentUserPrincipal.NAME)
dav.findProperty(CurrentUserPrincipal.NAME)?.let { (dav, second) ->
val currentUserPrincipal = second as CurrentUserPrincipal
dav.findProperty(CurrentUserPrincipal::class.java)?.let { (dav, currentUserPrincipal) ->
currentUserPrincipal.href?.let { href ->
dav.location.resolve(href)?.let { principal ->
log.info("Found current-user-principal: $principal")
......
......@@ -20,7 +20,7 @@ class EditPassword(
context: Context,
attrs: AttributeSet?
): LinearLayout(context, attrs) {
val NS_ANDROID = "http://schemas.android.com/apk/res/android";
val NS_ANDROID = "http://schemas.android.com/apk/res/android"
constructor(context: Context): this(context, null)
......
......@@ -37,7 +37,7 @@ class MaximizedListView(
else {
adapter?.let { listAdapter ->
val widthSpec = View.MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY)
for (i in 0 .. listAdapter.count - 1) {
for (i in 0 until listAdapter.count) {
val listItem = listAdapter.getView(i, null, this)
listItem.measure(widthSpec, View.MeasureSpec.UNSPECIFIED)
height += listItem.measuredHeight
......
Subproject commit b4b0e6bb86907305596430894a3ef64645bfc789
Subproject commit c1a82b27fd764042cba7e18ca3af9f538762118b
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