Android 10.0 Settings增加隐私菜单

介绍

在一些客户定制的需求中客户想要在设置中添加新的隐私菜单

修改

路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/AndroidManifest.xml

    <activity
            android:name="PrivacyPolicyActivity"
            android:exported="true"
            android:label="@string/privacy_policy_title"
            android:parentActivityName="Settings">
            <intent-filter>
                <action android:name="android.settings.PrivacyPolicyActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

新增-路径:此处就是添加隐私政策的布局 想要现实的内容加到此处即可vendor/mediatek/proprietary/packages/apps/MtkSettings/res/layout/privacy_policy_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fadingEdge="vertical"
    android:scrollbars="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:text="Privacy Policy"
            android:textColor="#000"
            android:textSize="18sp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:text=" (Effective Date:February 1, 2018) "
            android:textColor="#000" />
    </LinearLayout>

</ScrollView>

新增-路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/PrivacyPolicyActivity.java

package com.android.settings;

import android.app.Activity;

import android.os.Bundle;

public class PrivacyPolicyActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.privacy_policy_activity);
    }
}

增加菜单项字符串

路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/strings.xml

    <string name="privacy_policy_title">"Privacy Policy"</string>

路径:vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml

<string name="privacy_policy_title">隐私政策</string>

增加点击项:vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/about_legal.xml

    <Preference
        android:key="privacy_policy"
        android:title="@string/privacy_policy_title">
        <intent android:action="android.settings.PrivacyPolicyActivity"/>
    </Preference>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不太正常的移动开发工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值