系统应用篇(一)--Settings篇

news/2024/10/24 3:22:50/

目录

一、Settings应用的作用和重要性

二、Settings应用的架构和组件

三、Settings应用的定制和扩展

四、总结


一、Settings应用的作用和重要性

Settings应用的作用和重要性如以下表格所示:

作用重要性
提供系统设置选项Settings应用是用户在Android设备上访问和更改系统设置的主要入口。它提供了各种设置选项,包括网络、声音、显示、账户、安全性等。
系统功能的配置和管理Settings应用允许用户对系统的各种功能进行配置和管理。用户可以通过Settings应用设置设备的默认应用程序、权限管理、语言和输入设置等。
调试和故障排除Settings应用中还包含一些高级选项,用于开发者进行调试和故障排除。例如,开发者选项允许开发者启用USB调试、查看应用程序的日志信息等。
设备信息查看用户可以通过Settings应用查看设备的详细信息,包括设备型号、Android版本、内存使用情况、存储空间、电池状态等。这些信息对用户和开发者都很有用。

        Settings应用在Android设备中起着重要的作用,允许用户配置和管理各种系统设置,同时也提供了一些调试和故障排除的功能。


二、Settings应用的架构和组件

Settings应用的架构和组件如以下表格所示:

架构和组件说明
ActivitySettings应用主要由多个Activity组成,每个Activity负责展示和处理不同的设置选项。
Fragment在Settings应用的各个Activity中,使用Fragment来管理和展示具体的设置内容。
PreferenceSettings应用使用Preference来展示和管理设置选项,包括单选项、复选项、开关、输入框等。
Content Provider为了访问和修改系统设置数据,Settings应用使用Content Provider来提供对这些数据的统一访问接口。
IntentSettings应用使用Intent来启动其他应用程序或组件,例如打开应用程序详细信息、启动应用程序的权限管理界面等。
ServiceSettings应用中的一些功能可能需要在后台运行,因此可能会使用Service来处理这些后台任务,例如同步设置数据到云端。

        Settings应用采用了Activity和Fragment来组织界面,使用Preference来展示和管理设置选项,通过Content Provider提供对设置数据的访问,使用Intent启动其他组件,以及可能使用Service来处理后台任务。这些组件共同构成了Settings应用的架构。


三、Settings应用的定制和扩展

  1. 去掉设置中的备份和硬件反馈
  2. 移除“用作额外的手机存储空间” 菜单和设置中的部分选项
  3. 修改输入法无法按键更改的问题
  4. 隐藏语言和输入法选项下无用选项
  5. 去掉移动套餐选项

解决方案:

1.在settings应用的AndroidManifest中将category项给注释掉即可: 

<!--<meta-data android:name="com.android.settings.category"android:value="com.android.settings.category.ia.system" />-->

2. 在storage_wizard_init.xml中设置gone属性将其隐藏,和设置Preference为不可见:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source ProjectLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
--><com.google.android.setupdesign.GlifLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/setup_wizard_layout"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutstyle="@style/SudContentFrame"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="@dimen/sud_description_margin_top"android:orientation="horizontal"android:gravity="center_vertical"><ImageViewandroid:layout_width="144dp"android:layout_height="144dp"android:scaleType="centerInside"android:visibility="gone"android:src="@drawable/ic_storage_wizard_internal" /><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:layout_marginStart="@dimen/sud_glif_margin_sides"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:visibility="gone"android:layout_marginBottom="@dimen/sud_description_margin_bottom"android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"android:text="@string/storage_wizard_init_v2_internal_title" /><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:visibility="gone"android:layout_marginBottom="@dimen/sud_description_margin_bottom"android:textColor="?android:attr/textColorSecondary"android:text="@string/storage_wizard_init_v2_internal_summary" /><Buttonandroid:id="@+id/storage_wizard_init_internal"style="@style/SudGlifButton.Primary"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/storage_wizard_init_v2_internal_action"android:onClick="onNavigateInternal" /></LinearLayout></LinearLayout><!--<LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="@dimen/sud_description_margin_top"android:orientation="horizontal"android:gravity="center_vertical"><Viewandroid:layout_width="0dp"android:layout_height="1dp"android:layout_weight="1"android:background="@android:color/black"android:backgroundTint="?android:attr/textColorTertiary" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginStart="8dp"android:layout_marginEnd="8dp"android:text="@string/storage_wizard_init_v2_or"android:textColor="?android:attr/textColorTertiary"android:textAllCaps="true" /><Viewandroid:layout_width="0dp"android:layout_height="1dp"android:layout_weight="1"android:background="@android:color/black"android:backgroundTint="?android:attr/textColorTertiary" /></LinearLayout>--><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="@dimen/sud_description_margin_top"android:orientation="horizontal"android:gravity="center_vertical"><ImageViewandroid:layout_width="144dp"android:layout_height="144dp"android:scaleType="centerInside"android:src="@drawable/ic_storage_wizard_external" /><LinearLayoutandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:layout_marginStart="@dimen/sud_glif_margin_sides"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginBottom="@dimen/sud_description_margin_bottom"android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"android:text="@string/storage_wizard_init_v2_external_title" /><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginBottom="@dimen/sud_description_margin_bottom"android:textColor="?android:attr/textColorSecondary"android:text="@string/storage_wizard_init_v2_external_summary" /><Buttonandroid:id="@+id/storage_wizard_init_external"style="@style/SudGlifButton.Primary"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/storage_wizard_init_v2_external_action"android:onClick="onNavigateExternal" /></LinearLayout></LinearLayout></LinearLayout></com.google.android.setupdesign.GlifLayout>
    private Preference mFormatPrivate;if (mIsPermittedToAdopt) {mFormatPrivate = buildAction(R.string.storage_menu_format_private);//add beginmFormatPrivate.setVisible(false);}

3. 在LocaleDragAndDragAdapter.java中添加输入法可以通过按键更改的代码:

    private int mSourcePosition;public CustomViewHolder(LocaleDragCell view) {super(view);mLocaleDragCell = view;mLocaleDragCell.getDragHandle().setOnTouchListener(this);//add beginmLocaleDragCell.getDragHandle().setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {mSourcePosition = getPosition();onItemMove(mSourcePosition,0);doTheUpdate();}});}@Overridepublic void onBindViewHolder(final CustomViewHolder holder, int i) {final LocaleStore.LocaleInfo feedItem = mFeedItemList.get(i);final LocaleDragCell dragCell = holder.getLocaleDragCell();final String label = feedItem.getFullNameNative();final String description = feedItem.getFullNameInUiLanguage();dragCell.setLabelAndDescription(label, description);dragCell.setLocalized(feedItem.isTranslated());dragCell.setMiniLabel(mNumberFormatter.format(i + 1));dragCell.setShowCheckbox(mRemoveMode);dragCell.setShowMiniLabel(!mRemoveMode);dragCell.setShowHandle(!mRemoveMode && mDragEnabled);dragCell.setTag(feedItem);CheckBox checkbox = dragCell.getCheckbox();// clear listener before setChecked() in case another item already bind to// current ViewHolder and checked event is triggered on stale listener mistakenly.checkbox.setOnCheckedChangeListener(null);checkbox.setChecked(mRemoveMode ? feedItem.getChecked() : false);checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {LocaleStore.LocaleInfo feedItem =(LocaleStore.LocaleInfo) dragCell.getTag();feedItem.setChecked(isChecked);}});//add beginif (i == mSourcePosition) {dragCell.getDragHandle().setChecked(true);} else {dragCell.getDragHandle().setChecked(false);}}

4.在LanguageAndInputSettings.java中的buildPreferenceControllers注释掉相关代码即可:

private static List<AbstractPreferenceController> buildPreferenceControllers(@NonNull Context context, @Nullable Lifecycle lifecycle) {final List<AbstractPreferenceController> controllers = new ArrayList<>();// Languagecontrollers.add(new PhoneLanguagePreferenceController(context));// Inputfinal VirtualKeyboardPreferenceController virtualKeyboardPreferenceController =new VirtualKeyboardPreferenceController(context);final PhysicalKeyboardPreferenceController physicalKeyboardPreferenceController =new PhysicalKeyboardPreferenceController(context, lifecycle);controllers.add(virtualKeyboardPreferenceController);//controllers.add(physicalKeyboardPreferenceController);//controllers.add(new PreferenceCategoryController(context,//        KEY_KEYBOARDS_CATEGORY).setChildren(//        Arrays.asList(virtualKeyboardPreferenceController,//                physicalKeyboardPreferenceController)));// Pointer and Ttsfinal TtsPreferenceController ttsPreferenceController =new TtsPreferenceController(context, KEY_TEXT_TO_SPEECH);//controllers.add(ttsPreferenceController);final PointerSpeedController pointerController = new PointerSpeedController(context);//controllers.add(pointerController);//controllers.add(new PreferenceCategoryController(context,//        KEY_POINTER_AND_TTS_CATEGORY).setChildren(//        Arrays.asList(pointerController, ttsPreferenceController)));// Input Assistance//controllers.add(new SpellCheckerPreferenceController(context));return controllers;}

5.在config.xml中将id为config_show_mobile_plan的属性设置为false即可去掉:

<!-- Whether to show a preference item for mobile plan --><bool name="config_show_mobile_plan">false</bool>

四、总结

  1. Settings应用是Android系统中的重要应用之一,用于管理和配置设备的各种设置选项。
  2. Settings应用的作用非常重要,它允许用户对设备进行个性化配置,调整系统设置,管理应用程序和权限,以及访问设备的各种功能和服务。
  3. Settings应用的架构主要由Activity、Fragment、Preference、Content Provider、Intent和Service等组件构成。
  4. Activity和Fragment用于展示不同的设置选项界面,Preference用于展示和管理设置选项的UI元素,Content Provider提供对设置数据的访问接口,Intent用于启动其他应用程序或组件,Service用于处理后台任务。
  5. 通过Settings应用,用户可以调整网络、声音、显示、安全、账户、应用管理等各种设置,以满足个性化需求和优化设备使用体验。

        通过Settings应用,用户可以方便地管理和配置Android设备的各种设置,使设备符合个人喜好和需求。它是Android系统中不可或缺的一部分,为用户提供了丰富的个性化和管理选项。


本文仅代表个人观点和经验,难免存在不足之处。如果有任何错误或改进的建议,欢迎指正和交流,共同进步。


http://www.ppmy.cn/news/211426.html

相关文章

电动车头盔检测系统(毕设)

有没有做这个毕设的伙伴,可以一起交流下(交流群:718700435) 电动车头盔检测系统 技术选型: yolov5pyqtmysql1: 系统:前台检测系统 1.1信息采集 字段 录入 展示 修改 删除1.2实时检测报警 实时画面 违章信息1.3视频留存管理模块 视频保存 视频列表 时间查询2: 后台管理员…

微应用如何实现自动更新提示

首先, 先讲一下本次文章所讲的场景, 经过调研, 公司内部使用后台, 当有需求功能迭代的时候, 通常使用者会没有感知, 使用者只会在浏览器内一直打开这个页面, 当需要使用的时候, 再切换这个tab来使用. 这就导致使用者一直不知道系统更新了, 一直没有访问最新的页面(由于最新页面…

ICV报告:乘光伏新能源汽车之势,功率器件蓄势待发

前言&#xff1a; 电力电子器件&#xff08;Power Electronic Device&#xff09;&#xff0c;又称为功率半导体器件&#xff0c;用于电能变换和电能控制电路中的大功率(通常指电流为数十至数千安&#xff0c;电压为数百伏以上)电子器件。功率器件能够承受和控制较大电流、电压…

matplotlib实操

matplotlib实操 问题1.分析离网用户的基本特征:包括但不限于地市、年龄、网龄、融合类型、套餐分布、用户价值等&#xff0c;年龄、网龄、用户价值(ARPU)、MOU、DOU;数据预处理处理异常值地市分布县级分布年龄分布网龄分布性别与年龄分布融合类型套餐分布用户价值(ARPU)MOU(每用…

iOS性能优化-异步绘制与异步底层View处理

前言&#xff1a; 基于UIKit的性能优化似乎已经到了瓶颈&#xff0c;无论是使用frame代理snpakit&#xff0c;缓存高度&#xff0c;减少布局层次&#xff0c;diff刷新&#xff0c;压缩图片&#xff0c;选择合适队列&#xff0c;选择高性能锁&#xff0c;也不能满足当前庞大而又…

家用计算机的内存容量大约是多少升,家用旧电脑最佳升级方案:8G内存、混合硬盘足够了!...

在讲加内存条、换硬盘、加固态硬盘之前&#xff0c;内存、硬盘、固态硬盘在广义上属于存储器的一种&#xff0c;它们的主要作用就是存储数据。不过他们之间爷爷很多不同之处&#xff0c;下面先来了解一下他们的基本工作原理。 台式机内存条 在问题中提到的内存&#xff0c;它是…

8g内存一般占用多少_8g内存开机占用一半|Windows操作系统内存使用率多少正常?...

Windows操作系统内存使用率多少正常?内存使用率根据不同用户的使用习惯和软件安装,笔者总结并模拟了一下资源占用情况,可以根据数据预测XP、Win7、Win8、Win8.1、Win10的开机资源占用率上下浮动,以供参考。 Windows操作系统内存使用率多少正常? 如果使用是2G内存的情况下,…

8g内存一般占用多少_你到底需要多大内存?4G、8G还是16G

1你到底需要多大内存&#xff1f; 很多老DIY玩家或许还依稀记得&#xff0c;在DDR2时代(大概2007年左右)&#xff0c;2GB和4GB内存的游戏性能相差并不大&#xff0c;所以在当时很长一段时间内&#xff0c;看上去很美的4G容量往往会被扣上华而不实的帽子。如今&#xff0c;内存已…