diff --git a/litho-core/src/main/java/com/facebook/litho/DynamicPropsManager.kt b/litho-core/src/main/java/com/facebook/litho/DynamicPropsManager.kt index 4cd2a0faea2..4a137a0d6f0 100644 --- a/litho-core/src/main/java/com/facebook/litho/DynamicPropsManager.kt +++ b/litho-core/src/main/java/com/facebook/litho/DynamicPropsManager.kt @@ -16,7 +16,6 @@ package com.facebook.litho -import android.os.Build import android.util.Pair import android.util.SparseArray import android.view.View @@ -24,6 +23,7 @@ import androidx.annotation.VisibleForTesting import com.facebook.litho.CollectionsUtils.isNotNullOrEmpty import com.facebook.litho.ComponentUtils.handle import com.facebook.litho.ComponentUtils.rethrow +import com.facebook.litho.drawable.ComparableColorDrawable /** * Takes care of dynamic Props @@ -241,8 +241,8 @@ class DynamicPropsManager : DynamicValue.OnValueChangeListener { content.background = null } KEY_FOREGROUND_COLOR -> - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && content.foreground != null) { - setViewForeground(content, null) + if (content.foreground != null) { + content.foreground = null } } } @@ -261,7 +261,7 @@ class DynamicPropsManager : DynamicValue.OnValueChangeListener { KEY_ROTATION_X -> target.rotationX = resolve(value) KEY_ROTATION_Y -> target.rotationY = resolve(value) KEY_BACKGROUND_DRAWABLE -> target.background = resolve(value) - KEY_FOREGROUND_COLOR -> setViewForeground(target, resolve(value)) + KEY_FOREGROUND_COLOR -> target.foreground = ComparableColorDrawable.create(resolve(value)) } } diff --git a/litho-core/src/main/java/com/facebook/litho/LithoNodeUtils.kt b/litho-core/src/main/java/com/facebook/litho/LithoNodeUtils.kt index ee4bd7b10e9..fe4348c87d4 100644 --- a/litho-core/src/main/java/com/facebook/litho/LithoNodeUtils.kt +++ b/litho-core/src/main/java/com/facebook/litho/LithoNodeUtils.kt @@ -17,7 +17,6 @@ package com.facebook.litho import android.graphics.drawable.Drawable -import android.os.Build import android.util.SparseArray import androidx.core.util.isNotEmpty import androidx.core.view.ViewCompat @@ -28,7 +27,6 @@ import com.facebook.litho.annotations.ImportantForAccessibility import com.facebook.litho.config.LithoDebugConfigurations import com.facebook.litho.drawable.BorderColorDrawable import com.facebook.litho.host.HostViewAttributesCleanupBinder -import com.facebook.litho.utils.VersionedAndroidApis import com.facebook.rendercore.MountState import com.facebook.rendercore.RenderUnit import com.facebook.rendercore.primitives.Primitive @@ -217,8 +215,7 @@ object LithoNodeUtils { /// Only create a foreground output when the component does not mount a View because // the foreground has already been set in the output of the component. - return if (foreground != null && - (!node.willMountView || Build.VERSION.SDK_INT < Build.VERSION_CODES.M)) { + return if (foreground != null && (!node.willMountView)) { createDrawableRenderUnit(node, foreground, width, height, OutputUnitType.FOREGROUND, diffNode) } else { null @@ -502,9 +499,7 @@ object LithoNodeUtils { // will be created for backgrounds and foreground. if (disableBgFgOutputs || !attrs.isHostSpec) { attrs.background = lithoNode.background - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - VersionedAndroidApis.M.setForeground(attrs, lithoNode.foreground) - } + attrs.foreground = lithoNode.foreground } attrs.layoutDirection = lithoNode.layoutDirection attrs.layerType = lithoNode.layerType diff --git a/litho-core/src/main/java/com/facebook/litho/ViewAttributes.kt b/litho-core/src/main/java/com/facebook/litho/ViewAttributes.kt index 780bfbaa3da..2462016ed4d 100644 --- a/litho-core/src/main/java/com/facebook/litho/ViewAttributes.kt +++ b/litho-core/src/main/java/com/facebook/litho/ViewAttributes.kt @@ -460,7 +460,7 @@ class ViewAttributes { setViewStateListAnimator(content, attributes, cloneStateListAnimators) if (attributes.disableDrawableOutputs) { setViewBackground(content, attributes) - setViewForeground(content, attributes.foreground) + setViewForeground(content, attributes) // when background outputs are disabled, they are wrapped by a ComponentHost. // A background can set the padding of a view, but ComponentHost should not have @@ -474,7 +474,7 @@ class ViewAttributes { // Set view background, if applicable. Do this before padding // as it otherwise overrides the padding. setViewBackground(content, attributes) - setViewForeground(content, attributes.foreground) + setViewForeground(content, attributes) setViewLayoutDirection(content, attributes) } @@ -1050,18 +1050,18 @@ class ViewAttributes { view.background = drawable } - private fun unsetViewForeground(view: View, attributes: ViewAttributes) { + private fun setViewForeground(view: View, attributes: ViewAttributes) { val foreground = attributes.foreground if (foreground != null) { - unsetForeground(view) + view.foreground = foreground } } - fun unsetForeground(view: View) { - check(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ("MountState has a ViewAttributes with foreground however the current Android version doesn't support foreground on Views") + private fun unsetViewForeground(view: View, attributes: ViewAttributes) { + val foreground = attributes.foreground + if (foreground != null) { + view.foreground = null } - view.foreground = null } private fun setViewLayoutDirection(view: View, attributes: ViewAttributes) { diff --git a/litho-core/src/main/java/com/facebook/litho/ViewUtils.kt b/litho-core/src/main/java/com/facebook/litho/ViewUtils.kt deleted file mode 100644 index 2a2c0325c13..00000000000 --- a/litho-core/src/main/java/com/facebook/litho/ViewUtils.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:JvmName("ViewUtils") - -package com.facebook.litho - -import android.graphics.drawable.Drawable -import android.os.Build -import android.view.View -import com.facebook.litho.drawable.ComparableColorDrawable - -fun setViewForeground(view: View, foreground: Drawable?) { - foreground?.let { - check(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ("MountState has a ViewNodeInfo with foreground however " + - "the current Android version doesn't support foreground on Views") - } - view.foreground = it - } -} - -fun setViewForeground(view: View, foregroundColor: Int) { - check(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ("MountState has a ViewNodeInfo with foreground however " + - "the current Android version doesn't support foreground on Views") - } - view.foreground = ComparableColorDrawable.create(foregroundColor) -} diff --git a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.kt b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.kt index 8e14f4346c9..aabf653e4ef 100644 --- a/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.kt +++ b/litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.kt @@ -16,7 +16,6 @@ package com.facebook.litho.config -import android.os.Build import com.facebook.litho.BuildConfig import com.facebook.litho.ComponentHost import com.facebook.litho.ComponentHost.UnsafeModificationPolicy @@ -194,11 +193,6 @@ internal constructor( /** Indicates that the incremental mount helper is required for this build. */ @JvmField val USE_INCREMENTAL_MOUNT_HELPER: Boolean = BuildConfig.USE_INCREMENTAL_MOUNT_HELPER - /** Whether we need to account for lack of synchronization while accessing Themes. */ - @JvmField - val NEEDS_THEME_SYNCHRONIZATION: Boolean = - Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 - /** The default priority for threads that perform background layout calculations. */ @JvmField var DEFAULT_BACKGROUND_THREAD_PRIORITY: Int = 5 diff --git a/litho-core/src/main/java/com/facebook/litho/host/HostViewAttributesCleanupBinder.kt b/litho-core/src/main/java/com/facebook/litho/host/HostViewAttributesCleanupBinder.kt index 3efc8fc71dc..b2950fd0fa5 100644 --- a/litho-core/src/main/java/com/facebook/litho/host/HostViewAttributesCleanupBinder.kt +++ b/litho-core/src/main/java/com/facebook/litho/host/HostViewAttributesCleanupBinder.kt @@ -3,7 +3,6 @@ package com.facebook.litho.host import android.content.Context -import android.os.Build import android.view.View import android.view.ViewOutlineProvider import androidx.core.view.ViewCompat @@ -14,7 +13,6 @@ import com.facebook.litho.ViewAttributes.Companion.unsetAmbientShadowColor import com.facebook.litho.ViewAttributes.Companion.unsetClickHandler import com.facebook.litho.ViewAttributes.Companion.unsetContentDescription import com.facebook.litho.ViewAttributes.Companion.unsetFocusChangeHandler -import com.facebook.litho.ViewAttributes.Companion.unsetForeground import com.facebook.litho.ViewAttributes.Companion.unsetInterceptTouchEventHandler import com.facebook.litho.ViewAttributes.Companion.unsetLongClickHandler import com.facebook.litho.ViewAttributes.Companion.unsetSpotShadowColor @@ -74,12 +72,8 @@ private fun unsetAllViewAttributes(content: Host) { ViewCompat.setElevation(content, 0f) unsetAmbientShadowColor(content, -1) unsetSpotShadowColor(content, -1) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - content.outlineProvider = ViewOutlineProvider.BACKGROUND - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - content.clipToOutline = false - } + content.outlineProvider = ViewOutlineProvider.BACKGROUND + content.clipToOutline = false content.clipChildren = true unsetContentDescription(content) unsetTooltipText(content) @@ -94,11 +88,11 @@ private fun unsetAllViewAttributes(content: Host) { content.isFocusable = false content.isEnabled = true content.isSelected = false + content.foreground = null ViewCompat.setKeyboardNavigationCluster(content, false) ViewCompat.setImportantForAccessibility(content, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) unsetAccessibilityDelegate(content) setBackgroundCompat(content, null) - unsetForeground(content) unsetViewLayoutDirection(content) content.setLayerType(View.LAYER_TYPE_NONE, null) ViewCompat.setSystemGestureExclusionRects(content, emptyList()) diff --git a/litho-core/src/main/java/com/facebook/litho/utils/VersionedAndroidApis.kt b/litho-core/src/main/java/com/facebook/litho/utils/VersionedAndroidApis.kt index e46fbe45f16..87a7e0d9088 100644 --- a/litho-core/src/main/java/com/facebook/litho/utils/VersionedAndroidApis.kt +++ b/litho-core/src/main/java/com/facebook/litho/utils/VersionedAndroidApis.kt @@ -17,43 +17,17 @@ package com.facebook.litho.utils import android.graphics.Paint -import android.graphics.drawable.Drawable import android.icu.text.BreakIterator import android.os.Build -import android.text.Layout import android.view.View import android.widget.EditText import androidx.annotation.ColorInt import androidx.annotation.DoNotInline import androidx.annotation.DrawableRes import androidx.annotation.RequiresApi -import com.facebook.litho.ViewAttributes object VersionedAndroidApis { - @RequiresApi(Build.VERSION_CODES.M) - object M { - @DoNotInline - fun setForeground(attrs: ViewAttributes, foreground: Drawable?) { - attrs.foreground = foreground - } - - @DoNotInline - @JvmStatic - fun getEllipsisOffsetFromPaintAdvance( - layout: Layout, - text: CharSequence?, - isRtl: Boolean, - line: Int, - advance: Float - ): Int { - val paint: Paint = layout.paint - val lineStart = layout.getLineStart(line) - val lineEnd = layout.getLineEnd(line) - return paint.getOffsetForAdvance(text, lineStart, lineEnd, lineStart, lineEnd, isRtl, advance) - } - } - @RequiresApi(Build.VERSION_CODES.P) object P { @DoNotInline diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ComponentQueries.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ComponentQueries.java index c2de2155130..97fabfdc766 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ComponentQueries.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ComponentQueries.java @@ -17,7 +17,6 @@ package com.facebook.litho.testing.viewtree; import android.graphics.drawable.Drawable; -import android.os.Build; import android.view.View; import com.facebook.infer.annotation.Nullsafe; import com.facebook.litho.ComponentHost; @@ -131,10 +130,8 @@ private static boolean satisfiesPredicate( if (host.getBackground() != null) { drawables.add(host.getBackground()); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - if (host.getForeground() != null) { - drawables.add(host.getForeground()); - } + if (host.getForeground() != null) { + drawables.add(host.getForeground()); } for (final Drawable drawable : drawables) { if (predicate.apply(drawable)) { diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewExtractors.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewExtractors.java index 3f94d87f15f..a0a15870690 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewExtractors.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewExtractors.java @@ -17,7 +17,6 @@ package com.facebook.litho.testing.viewtree; import android.graphics.drawable.Drawable; -import android.os.Build; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; @@ -84,10 +83,8 @@ public String apply(@Nullable View input) { if (host.getBackground() != null) { drawables.add(String.valueOf(host.getBackground())); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - if (host.getForeground() != null) { - drawables.add(String.valueOf(host.getForeground())); - } + if (host.getForeground() != null) { + drawables.add(String.valueOf(host.getForeground())); } return String.format( "Found drawables: \"%s\", view is %s", diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java index 23a54d7496a..2b4037148e2 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java @@ -18,7 +18,6 @@ import static android.graphics.Color.TRANSPARENT; import static android.os.Build.VERSION.SDK_INT; -import static android.os.Build.VERSION_CODES.M; import static android.view.View.TEXT_ALIGNMENT_GRAVITY; import android.content.Context; @@ -920,10 +919,7 @@ static void onBindEditText( EventHandler textPastedEventHandler) { editText.attachWatchers(textWatchers); editText.setCustomSelectionActionModeCallback(selectionActionModeCallback); - if (SDK_INT >= M) { - editText.setCustomInsertionActionModeCallback(insertionActionModeCallback); - } - + editText.setCustomInsertionActionModeCallback(insertionActionModeCallback); editText.setComponentContext(c); editText.setTextChangedEventHandler(textChangedEventHandler); editText.setSelectionChangedEventHandler(selectionChangedEventHandler); @@ -964,9 +960,7 @@ static void onUnbind(final ComponentContext c, EditTextWithEventHandlers editTex editText.setEditorActionEventHandler(null); editText.setInputConnectionEventHandler(null); editText.setCustomSelectionActionModeCallback(null); - if (SDK_INT >= M) { - editText.setCustomInsertionActionModeCallback(null); - } + editText.setCustomInsertionActionModeCallback(null); editText.setTextPastedEventHandler(null); } @@ -1215,16 +1209,6 @@ public EditTextWithEventHandlers(Context context) { this.setOnEditorActionListener(this); } - @Override - public void requestLayout() { - // TextInputSpec$ForMeasureEditText.setText in API23 causing relayout for - // EditTextWithEventHandlers https://fburl.com/mgq76t3l - if (SDK_INT == M && !ThreadUtils.isMainThread()) { - return; - } - super.requestLayout(); - } - @Override protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { super.onTextChanged(text, start, lengthBefore, lengthAfter); diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java index c7c688d20ea..5b0489941e7 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextSpec.java @@ -33,6 +33,7 @@ import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Color; +import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; @@ -845,15 +846,12 @@ private static CharSequence truncateText( ellipsisTarget = customEllipsisTextWidth; } // Get character offset number corresponding to that X position: - - int ellipsisOffset; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ellipsisOffset = - VersionedAndroidApis.M.getEllipsisOffsetFromPaintAdvance( - newLayout, text, isRtl, ellipsizedLineNumber, ellipsisTarget); - } else { - ellipsisOffset = newLayout.getOffsetForHorizontal(ellipsizedLineNumber, ellipsisTarget); - } + final Paint paint = newLayout.getPaint(); + final int lineStart = newLayout.getLineStart(ellipsizedLineNumber); + final int lineEnd = newLayout.getLineEnd(ellipsizedLineNumber); + int ellipsisOffset = + paint.getOffsetForAdvance( + text, lineStart, lineEnd, lineStart, lineEnd, isRtl, ellipsisTarget); if (ellipsisOffset > 0) { // getOffsetForHorizontal returns the closest character, but we need to guarantee no diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextStylesHelper.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextStylesHelper.java index 7857cb092a5..cc33bb4c6b9 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextStylesHelper.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextStylesHelper.java @@ -24,14 +24,12 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Typeface; -import android.os.Build; import android.text.TextUtils.TruncateAt; import android.view.Gravity; import android.view.View; import com.facebook.litho.ComponentContext; import com.facebook.litho.Output; import com.facebook.litho.R; -import com.facebook.litho.config.ComponentsConfiguration; import com.facebook.rendercore.utils.SynchronizedTypefaceHelper; public final class TextStylesHelper { @@ -89,26 +87,13 @@ public static void onLoadStyle( // behavior, // we will parse textAppearance attributes first and then will override leftovers from main // style - TypedArray a; - if (ComponentsConfiguration.NEEDS_THEME_SYNCHRONIZATION) { - synchronized (theme) { - a = c.obtainStyledAttributes(R.styleable.Text_TextAppearanceAttr, 0); - } - } else { - a = c.obtainStyledAttributes(R.styleable.Text_TextAppearanceAttr, 0); - } + TypedArray a = c.obtainStyledAttributes(R.styleable.Text_TextAppearanceAttr, 0); int textAppearanceResId = a.getResourceId(R.styleable.Text_TextAppearanceAttr_android_textAppearance, -1); a.recycle(); if (textAppearanceResId != -1) { - if (ComponentsConfiguration.NEEDS_THEME_SYNCHRONIZATION) { - synchronized (theme) { - a = theme.obtainStyledAttributes(textAppearanceResId, R.styleable.Text); - } - } else { - a = theme.obtainStyledAttributes(textAppearanceResId, R.styleable.Text); - } + a = theme.obtainStyledAttributes(textAppearanceResId, R.styleable.Text); resolveStyleAttrsForTypedArray( a, ellipsize, @@ -142,13 +127,7 @@ public static void onLoadStyle( } // now (after we parsed textAppearance) we can move on to main style attributes - if (ComponentsConfiguration.NEEDS_THEME_SYNCHRONIZATION) { - synchronized (theme) { - a = c.obtainStyledAttributes(R.styleable.Text, 0); - } - } else { - a = c.obtainStyledAttributes(R.styleable.Text, 0); - } + a = c.obtainStyledAttributes(R.styleable.Text, 0); resolveStyleAttrsForTypedArray( a, ellipsize, @@ -273,17 +252,11 @@ private static void resolveStyleAttrsForTypedArray( } else if (attr == R.styleable.Text_android_fontFamily) { fontFamily = a.getString(attr); } else if (attr == R.styleable.Text_android_breakStrategy) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - breakStrategy.set(a.getInt(attr, DEFAULT_BREAK_STRATEGY)); - } + breakStrategy.set(a.getInt(attr, DEFAULT_BREAK_STRATEGY)); } else if (attr == R.styleable.Text_android_hyphenationFrequency) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - hyphenationFrequency.set(a.getInt(attr, DEFAULT_HYPHENATION_FREQUENCY)); - } + hyphenationFrequency.set(a.getInt(attr, DEFAULT_HYPHENATION_FREQUENCY)); } else if (attr == R.styleable.Text_android_justificationMode) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - justificationMode.set(a.getInt(attr, DEFAULT_JUSTIFICATION_MODE)); - } + justificationMode.set(a.getInt(attr, DEFAULT_JUSTIFICATION_MODE)); } } diff --git a/sample/src/main/java/com/facebook/samples/litho/kotlin/primitives/controllers/TimePickerPrimitiveComponent.kt b/sample/src/main/java/com/facebook/samples/litho/kotlin/primitives/controllers/TimePickerPrimitiveComponent.kt index d847b6ac447..f2405de8215 100644 --- a/sample/src/main/java/com/facebook/samples/litho/kotlin/primitives/controllers/TimePickerPrimitiveComponent.kt +++ b/sample/src/main/java/com/facebook/samples/litho/kotlin/primitives/controllers/TimePickerPrimitiveComponent.kt @@ -16,7 +16,6 @@ package com.facebook.samples.litho.kotlin.primitives.controllers -import android.os.Build import android.widget.TimePicker import com.facebook.litho.LithoPrimitive import com.facebook.litho.PrimitiveComponent @@ -64,39 +63,23 @@ class TimePickerController(private var currentHour: Int, private var currentMinu var minute: Int get() { ThreadUtils.assertMainThread() - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - content?.minute ?: currentMinute - } else { - content?.currentMinute ?: currentMinute - } + return content?.minute ?: currentMinute } set(value) { ThreadUtils.assertMainThread() currentMinute = value - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - content?.minute = value - } else { - content?.currentMinute = value - } + content?.minute = value } var hour: Int get() { ThreadUtils.assertMainThread() - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - content?.hour ?: currentHour - } else { - content?.currentHour ?: currentHour - } + return content?.hour ?: currentHour } set(value) { ThreadUtils.assertMainThread() currentHour = value - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - content?.hour = value - } else { - content?.currentHour = value - } + content?.hour = value } private val onTimeChangedListener =