问题描述:
安卓13锁屏界面的提示语有三种,相机提示语(点击右下角相机图标触发)、锁屏提示语(点击屏幕空白处触发)、充电提示语。这几个提示语是如何从屏幕点击事件到最后的动画展示,本章节将详细解答这个问题。
KeyguardIndicationController.java
在安卓13机制里,前面讲到的三种语句都是在同一个布局中展示,也就是在同一个地方展示,具体展示逻辑就是由这个控制类控制。这个类定义了一个成员变量
private KeyguardIndicationTextView mLockScreenIndicationView;
mLockScreenIndicationView = indicationArea.findViewById(
R.id.keyguard_indication_text_bottom);
如果我们要简单的修改展示的位置,就去修改这个应用的布局文件了。
相比于安卓11,13上并没有直接在这个类里面进行展示操作,而是将这个成员变量作为参数传入到
mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
mLockScreenIndicationView,
mExecutor,
mStatusBarStateController);
然后展示的方法就是:
if (!TextUtils.isEmpty(mBiometricMessage)) {
mRotateTextViewController.updateIndication(
INDICATION_TYPE_BIOMETRIC_MESSAGE,
new KeyguardIndication.Builder()
.setMessage(mBiometricMessage)
.setMinVisibilityMillis(IMPORTANT_MSG_MIN_DURATION)
.setTextColor(mInitialTextColorState)
.build(),
true
);
当用户点击相机图标的时候,会调用showTransientIndication(CharSequence transientIndication)
传入的参数transientIndication="滑动打开相机"
private void showTransientIndication(CharSequence transientIndication) {
mTransientIndication = transientIndication;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
//短暂时间后调用hideTransient()
updateTransient();
}