From 8d7af187e6dcf16a17cde345ee961a6203eb3391 Mon Sep 17 00:00:00 2001 From: Oliver Spryn <2717340+oliverspryn@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:06:05 -0400 Subject: [PATCH] Open the method --- .../com/oliverspryn/android/multimodal/Classifier.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/multimodal/src/main/kotlin/com/oliverspryn/android/multimodal/Classifier.kt b/multimodal/src/main/kotlin/com/oliverspryn/android/multimodal/Classifier.kt index f6892df..43a9ec6 100644 --- a/multimodal/src/main/kotlin/com/oliverspryn/android/multimodal/Classifier.kt +++ b/multimodal/src/main/kotlin/com/oliverspryn/android/multimodal/Classifier.kt @@ -13,6 +13,9 @@ import com.oliverspryn.android.multimodal.model.WindowSizeClass * that can be extracted about the size of the screen and where its hinge * is located. * + * This class and all of its methods are open for extension and override, + * particularly for creating fakes for testing purposes. + * * @constructor A default instance of this class without any initialization * or other actions. */ @@ -36,6 +39,9 @@ open class Classifier { * practices, as defined here: * [Window Size Classes](https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes#window_size_classes). * + * This method is open for extension and override, particularly for + * creating fakes for testing purposes. + * * @param foldingFeature A physical description of the screen's folded * state, if a hinge is present. * @param windowDpSize A rectangle indicating the X and Y dimensions of the @@ -43,7 +49,7 @@ open class Classifier { * @return Data modeling the complete posture and size of the device's * screen. */ - fun createClassifier(foldingFeature: FoldingFeature?, windowDpSize: DpSize) = when { + open fun createClassifier(foldingFeature: FoldingFeature?, windowDpSize: DpSize) = when { foldingFeature == null -> createFullyOpenedDevice(windowDpSize) isBookMode(foldingFeature) -> createBookModeObject(foldingFeature) isTableTopMode(foldingFeature) -> createTableTopObject(foldingFeature)