Use PrecomputedTextView
Use PrecomputedTextView when PRECOMPUTED_TEXT is enabled. Bug: 289250881 Test: Check Notification Layouts with dump or LayoutInspector. Change-Id: I9e2a74f555a0bd95103d94bca63cb70772e8b717
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.row;
|
||||
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.flags.FeatureFlags;
|
||||
import com.android.systemui.flags.Flags;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
@@ -58,9 +59,13 @@ public abstract class NotificationRowModule {
|
||||
@ElementsIntoSet
|
||||
@Named(NOTIF_REMOTEVIEWS_FACTORIES)
|
||||
static Set<NotifRemoteViewsFactory> provideNotifRemoteViewsFactories(
|
||||
FeatureFlags featureFlags
|
||||
FeatureFlags featureFlags,
|
||||
PrecomputedTextViewFactory precomputedTextViewFactory
|
||||
) {
|
||||
final Set<NotifRemoteViewsFactory> replacementFactories = new HashSet<>();
|
||||
if (featureFlags.isEnabled(Flags.PRECOMPUTED_TEXT)) {
|
||||
replacementFactories.add(precomputedTextViewFactory);
|
||||
}
|
||||
return replacementFactories;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.notification.row
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.android.internal.widget.ImageFloatingTextView
|
||||
import javax.inject.Inject
|
||||
|
||||
class PrecomputedTextViewFactory @Inject constructor() : NotifRemoteViewsFactory {
|
||||
override fun instantiate(
|
||||
parent: View?,
|
||||
name: String,
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
): View? {
|
||||
return when (name) {
|
||||
TextView::class.java.name,
|
||||
TextView::class.java.simpleName -> PrecomputedTextView(context, attrs)
|
||||
ImageFloatingTextView::class.java.name ->
|
||||
PrecomputedImageFloatingTextView(context, attrs)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user