Merge "Use PrecomputedTextView" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
39759a9ed1
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.row;
|
|||||||
|
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.flags.FeatureFlags;
|
import com.android.systemui.flags.FeatureFlags;
|
||||||
|
import com.android.systemui.flags.Flags;
|
||||||
|
|
||||||
import dagger.Binds;
|
import dagger.Binds;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
@@ -58,9 +59,13 @@ public abstract class NotificationRowModule {
|
|||||||
@ElementsIntoSet
|
@ElementsIntoSet
|
||||||
@Named(NOTIF_REMOTEVIEWS_FACTORIES)
|
@Named(NOTIF_REMOTEVIEWS_FACTORIES)
|
||||||
static Set<NotifRemoteViewsFactory> provideNotifRemoteViewsFactories(
|
static Set<NotifRemoteViewsFactory> provideNotifRemoteViewsFactories(
|
||||||
FeatureFlags featureFlags
|
FeatureFlags featureFlags,
|
||||||
|
PrecomputedTextViewFactory precomputedTextViewFactory
|
||||||
) {
|
) {
|
||||||
final Set<NotifRemoteViewsFactory> replacementFactories = new HashSet<>();
|
final Set<NotifRemoteViewsFactory> replacementFactories = new HashSet<>();
|
||||||
|
if (featureFlags.isEnabled(Flags.PRECOMPUTED_TEXT)) {
|
||||||
|
replacementFactories.add(precomputedTextViewFactory);
|
||||||
|
}
|
||||||
return replacementFactories;
|
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