Android 11 修改重启和恢复出厂设置动画页面

废话不多说,直接上源码》

需要修改的目录

frameworks/base/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java

    @Override
    public void showShutdownUi(boolean isReboot, String reason) {
  

              。。。。
        d.setContentView(R.layout.shutdown_dialog);
        d.setCancelable(false);

        int color = Utils.getColorAttrDefaultColor(mContext,
                com.android.systemui.R.attr.wallpaperTextColor);

        ProgressBar bar = d.findViewById(R.id.progress);
        bar.getIndeterminateDrawable().setTint(color);
        bar.setIndeterminateDrawable(mContext.getResources().getDrawable(com.android.systemui.R.drawable.loadding_anim));

//        TextView reasonView = d.findViewById(R.id.text1);
        TextView messageView = d.findViewById(R.id.text2);

//        reasonView.setTextColor(color);
        messageView.setTextColor(color);

        messageView.setText(getRebootMessage(isReboot, reason));
//        String rebootReasonMessage = getReasonMessage(reason);
//        if (rebootReasonMessage != null) {
//            reasonView.setVisibility(View.VISIBLE);
//            reasonView.setText(rebootReasonMessage);
//        }
        d.show();
    }

根据以上可以知道重启和恢复出厂设置都在这个类里面处理的,就是一个progressBar,我们需要修改的loadding动画 

而引用的布局是:framework/base/core/res/res/layout/shutdown_dialog.xml

<?xml version="1.0" encoding="utf-8"?><!--

-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal">


       <TextView
           android:id="@id/text1"
           android:layout_width="wrap_content"
           android:layout_height="32sp"
           android:layout_marginBottom="24dp"
           android:fontFamily="@string/config_headlineFontFamily"
           android:gravity="center"
           android:text="@string/shutdown_progress"
           android:textAppearance="?attr/textAppearanceMedium"
           android:textDirection="locale"
           android:textSize="18sp"
           android:visibility="gone" />

     <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:orientation="vertical">
    <ProgressBar
        android:id="@id/progress"
        style="?attr/progressBarStyleLarge"
        android:layout_width="42dp"
        android:layout_height="42dp"
        android:layout_gravity="center_horizontal"
        />

    <TextView
        android:id="@id/text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:fontFamily="@string/config_headlineFontFamily"
        android:text="@string/shutdown_progress"
        android:textAppearance="?attr/textAppearanceLarge"
        android:textDirection="locale"
                android:layout_gravity="center" 
        android:textSize="30sp" />

   </LinearLayout>



</FrameLayout>

  3.在看他的文本显示的获取:

  @StringRes
    private int getRebootMessage(boolean isReboot, @Nullable String reason) {
        if (reason != null && reason.startsWith(PowerManager.REBOOT_RECOVERY_UPDATE)) {
            return R.string.reboot_to_update_reboot;
        } else if (reason != null && reason.equals(PowerManager.REBOOT_RECOVERY)) {
            return R.string.reboot_to_reset_title;
        } else if (isReboot) {
            return R.string.reboot_to_reset_message;
        } else {
            return R.string.shutdown_progress;
        }
    }

    @Nullable
    private String getReasonMessage(@Nullable String reason) {
        if (reason != null && reason.startsWith(PowerManager.REBOOT_RECOVERY_UPDATE)) {
            return mContext.getString(R.string.reboot_to_update_title);
        } else if (reason != null && reason.equals(PowerManager.REBOOT_RECOVERY)) {
            return mContext.getString(R.string.reboot_to_reset_title);
        } else {
            return null;
        }
    }

相信大家看到这里已经知道这个界面如何修改了,我这里就不过多阐述了

觉得我写的好的兄弟,帮忙点个赞!!!

你们的支持是我写下去的动力

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值