美文网首页
android个人信息收集问题

android个人信息收集问题

作者: jiluyixia | 来源:发表于2020-12-01 10:55 被阅读0次

根据最新规定,第一次打开app需要弹出提示。


zzzz.png

首先布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="280dp"
              android:paddingBottom="15dp"
              android:orientation="vertical"
              android:layout_height="wrap_content">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textSize="18sp"
            android:layout_marginTop="6dp"
            android:textColor="@color/color_333333"
            android:text="温馨提示"
            android:textStyle="bold"
            android:id="@+id/title"/>

    </FrameLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_gravity="center_horizontal"
        android:textSize="14sp"
        android:layout_marginTop="15dp"
        android:textColor="@color/color_333333"
        android:text="1. 200积分起用。"
        android:id="@+id/text_counter"/>

    <!--<TextView
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:layout_marginTop="10dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:background="@color/color_efefef" />-->


    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="10dp"
        >

        <RelativeLayout android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            >

        <com.yijiago.ecstore.widget.StateButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:id="@+id/refuse"
            android:text="拒绝"
            android:minHeight="0dp"
            android:paddingTop="@dimen/dp_6"
            android:paddingBottom="@dimen/dp_6"
            android:paddingLeft="26dp"
            android:paddingRight="26dp"
            android:stateListAnimator="@null"
            android:textSize="@dimen/sp_16"
            app:animationDuration="100"
            app:normalBackgroundColor="#e0e0e0"
            app:normalTextColor="@color/color_black"
            app:pressedBackgroundColor="@color/color_b1b1b1"
            app:pressedTextColor="@color/color_white"
            app:radius="@dimen/dp_28"
            app:unableBackgroundColor="@color/color_666666"
            app:unableTextColor="@color/color_white"
            />

        </RelativeLayout>

        <RelativeLayout android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            >
        <com.yijiago.ecstore.widget.StateButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:id="@+id/agree"
            android:text="同意"
            android:minHeight="0dp"
            android:paddingTop="@dimen/dp_6"
            android:paddingBottom="@dimen/dp_6"
            android:paddingLeft="26dp"
            android:paddingRight="26dp"
            android:stateListAnimator="@null"
            android:textSize="@dimen/sp_16"
            app:animationDuration="100"
            app:normalBackgroundColor="#ff4050"
            app:normalTextColor="@color/color_white"
            app:pressedBackgroundColor="@color/color_b1b1b1"
            app:pressedTextColor="@color/color_white"
            app:radius="@dimen/dp_28"
            app:unableBackgroundColor="@color/color_666666"
            app:unableTextColor="@color/color_white"
            />
    </RelativeLayout>
    </LinearLayout>
</LinearLayout>

text_counter里面设置弹框内容。
在assets文件夹里创建一个protocol.txt文件:

尊敬的会员,感谢您对xxx一直以来的信任!<br />
我们依据相关的法律制定了<a href= "https://baidu.com/agreement.html">《用户协议》
</a>和<a href="https://baidu.com/agreement.html">《隐私政策》</a ></font>,
请您在点击同意之前仔细阅读并充分 理解相关条款,其中的重点条款已为您标注,方便您了解自己的权利。<br />

我们将通过《隐私政策》向您说明:<br />
1.为了您可以更好的享受周边商户提供的服务, 我们会根据您的授权内容,收集和使用对应的 必要信息(例如您的联系电话、位置信息、收货地址等)。<br />
2.您可以对上述信息进行访问、更正、删除及 注销账户。<br />
3.未经您的授权同意,我们不会将上述信息共 享给第三方或用于您未售券的其他用途。<br />

需要监听链接点击事件,以及去掉下划线:

textCounter = view.findViewById(R.id.text_counter);
textCounter.setText(getClickableHtml(geFileFromAssetsForAS(mContext, "protocol.txt")));
//这一句很重要,否则ClickableSpan内的onClick方法将无法触发!!
textCounter.setMovementMethod(LinkMovementMethod.getInstance());

public static String geFileFromAssetsForAS(Context context, String fileName) {
        if (context == null || TextUtils.isEmpty(fileName)) {
            return null;
        }

        StringBuilder s = new StringBuilder("");
        try {
            InputStreamReader in = new InputStreamReader(context.getClass().getClassLoader().getResourceAsStream("assets/"+fileName));
            BufferedReader br = new BufferedReader(in);
            String line;
            while ((line = br.readLine()) != null) {
                s.append(line);
            }
            return s.toString();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

/**
     * 格式化超链接文本内容并设置点击处理
     * */
    private CharSequence getClickableHtml(String html) {
        Spanned spannedHtml = Html.fromHtml(html);
        SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml);
        URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class);
        for(final URLSpan span : urls) {
            setLinkClickable(clickableHtmlBuilder, span);
        }
        return clickableHtmlBuilder;
    }

    /**
     * 设置点击超链接对应的处理内容
     * */
    private void setLinkClickable(final SpannableStringBuilder clickableHtmlBuilder,final URLSpan urlSpan) {
        int start = clickableHtmlBuilder.getSpanStart(urlSpan);
        int end = clickableHtmlBuilder.getSpanEnd(urlSpan);
        int flags = clickableHtmlBuilder.getSpanFlags(urlSpan);

        ClickableSpan clickableSpan = new ClickableSpan() {
            @Override
            public void updateDrawState(TextPaint ds) {
                super.updateDrawState(ds);
                //链接去掉下划线
                ds.setUnderlineText(false);
            }
            @Override
            public void onClick(View view) {
                AppWebFragment.open(getContext(), urlSpan.getURL());
            }
        };
        clickableHtmlBuilder.removeSpan(urlSpan);//解决方法
        clickableHtmlBuilder.setSpan(clickableSpan, start, end, flags);
    }

注意:ds.setUnderlineText(false);要放在super.updateDrawState(ds);下面,否则无效。
setSpan前,要加上clickableHtmlBuilder.removeSpan(urlSpan);

参考资料:
https://www.jianshu.com/p/075c539f9feb
https://www.jianshu.com/p/870619211d77
https://www.jianshu.com/p/0c13d74351f6?t=1491463081507
https://blog.csdn.net/a641832648/article/details/50460898

相关文章

  • android个人信息收集问题

    根据最新规定,第一次打开app需要弹出提示。 首先布局文件: text_counter里面设置弹框内容。在asse...

  • 智能家居的理解

    个人认为智能家居的问题 个人信息被收集 硬件提供商收集用户的个人信息或者硬件使用信息 黑客通过破解路由器、硬件服务...

  • 【APP隐私政策问题】应用宝官方回复建议

    关于您违规违规收集个人信息问题,可能存在以下问题: 1、隐私政策没有明示,提前收集信息 2、隐私政策有明示,但用户...

  • 个人信息收集公示

    收集个人信息场景收集个人信息的范围收集个人信息的目的拒绝后果手机号登录及手机号验证手机号完成账号登录或身份验证无法...

  • 个人信息安全规范(二):数据生命周期--个人信息收集

    《个人信息安全规范》在数据生命周期第一步个人信息收集环节,严格界定了个人信息控制者的权利和义务,规定在收集个人信息...

  • 《个人信息保护法》的畅想

    近年来,过度收集个人信息、信息滥用、大数据杀熟等问题在国内备受关注。2021年8月20日,《个人信息保护法》正式...

  • 客户隐私政策

    收集和使用非个人信息 我们也会收集非个人信息——即不会与任何特定个人直接相关联的数据。我们可出于任何目的而收集、使...

  • 隐私政策

    收集和使用非个人信息 我们也会收集非个人信息——即不会与任何特定个人直接相关联的数据。我们可出于任何目的而收集、使...

  • 客户隐私政策

    收集和使用非个人信息 我们也会收集非个人信息——即不会与任何特定个人直接相关联的数据。我们可出于任何目的而收集、使...

  • App违法违规收集使用个人信息行为认定方法

    根据《关于开展App违法违规收集使用个人信息专项治理的公告》,为监督管理部门认定App违法违规收集使用个人信息...

网友评论

      本文标题:android个人信息收集问题

      本文链接:https://www.haomeiwen.com/subject/otbjwktx.html