Skip to content

Commit

Permalink
Hide various internal APIs from public API
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxr1998 committed Dec 24, 2021
1 parent 686eee0 commit 0ac4734
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ViewTreeLifecycleOwner
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import de.Maxr1998.modernpreferences.helpers.emptyScreen
import de.Maxr1998.modernpreferences.preferences.AccentButtonPreference
import de.Maxr1998.modernpreferences.preferences.CategoryHeader
import de.Maxr1998.modernpreferences.preferences.CollapsePreference
Expand All @@ -55,6 +54,12 @@ class PreferencesAdapter @VisibleForTesting constructor(
) : RecyclerView.Adapter<PreferencesAdapter.ViewHolder>(),
LifecycleEventObserver {

private companion object {
private val emptyScreen: PreferenceScreen by lazy {
PreferenceScreen.Builder(null).build()
}
}

constructor(root: PreferenceScreen? = null) : this(root, true)

private val screenStack: Stack<PreferenceScreen> = Stack<PreferenceScreen>().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package de.Maxr1998.modernpreferences.helpers

@DslMarker
@Retention(AnnotationRetention.SOURCE)
annotation class PreferenceMarker
internal annotation class PreferenceMarker
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ inline fun screen(context: Context?, block: PreferenceScreen.Builder.() -> Unit)
return PreferenceScreen.Builder(context).apply(block).build()
}

val emptyScreen: PreferenceScreen by lazy { screen(null) {} }

inline fun PreferenceScreen.Builder.subScreen(key: String = "", block: PreferenceScreen.Builder.() -> Unit): PreferenceScreen {
return PreferenceScreen.Builder(this, key).apply(block).build().also(::addPreferenceItem)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AccentButtonPreference(key: String) : Preference(key) {
@SuppressLint("ResourceType")
override fun getWidgetLayoutResource() = RESOURCE_CONST

companion object {
const val RESOURCE_CONST = -3
internal companion object {
internal const val RESOURCE_CONST = -3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CategoryHeader(key: String) : Preference(key) {
@SuppressLint("ResourceType")
override fun getWidgetLayoutResource() = RESOURCE_CONST

companion object {
const val RESOURCE_CONST = -2
internal companion object {
internal const val RESOURCE_CONST = -2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class CollapsePreference(screen: PreferenceScreen.Builder, key: String) : Prefer
parent?.requestRebind(screenPosition, 1 + preferences.size)
}

companion object {
const val MARKER_RES_ID = -10
const val MAX_PREFS_IN_SUMMARY = 5
internal companion object {
internal const val MARKER_RES_ID = -10
internal const val MAX_PREFS_IN_SUMMARY = 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ImagePreference(key: String) : Preference(key) {
holder.root.findViewById<ImageView>(R.id.map_image_scrim).isVisible = showScrim && title.isNotBlank()
}

companion object {
const val RESOURCE_CONST = -4
internal companion object {
internal const val RESOURCE_CONST = -4
}
}

0 comments on commit 0ac4734

Please sign in to comment.