废话不多说,直接上源码》
需要修改的目录
frameworks/base/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@Overridepublic 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="/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center_horizontal"><TextViewandroid: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" /><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:orientation="vertical"><ProgressBarandroid:id="@id/progress"style="?attr/progressBarStyleLarge"android:layout_width="42dp"android:layout_height="42dp"android:layout_gravity="center_horizontal"/><TextViewandroid: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.在看他的文本显示的获取:
@StringResprivate 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;}}@Nullableprivate 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;}}
相信大家看到这里已经知道这个界面如何修改了,我这里就不过多阐述了
觉得我写的好的兄弟,帮忙点个赞!!!
你们的支持是我写下去的动力