SUW: remove privacy policy link on large-notouch

TV's don't have any way to open links.

Change-Id: Ia7123e37668199b76e1e12803223b1cef4e25175
This commit is contained in:
Timi Rautamäki
2021-11-04 08:37:16 +00:00
committed by Nolen Johnson
parent 161a3a68a6
commit 829c0d85c9
3 changed files with 40 additions and 18 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 The CyanogenMod Project
Licensed 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 at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed 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 and
limitations under the License.
-->
<resources>
<bool name="config_isLargeNoTouch">true</bool>
</resources>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The CyanogenMod Project
2021 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -22,5 +23,5 @@
<bool name="check_custom_theme_by_default">true</bool>
<string name="wizard_script_uri" translatable="false">android.resource://org.lineageos.setupwizard/raw/wizard_script</string>
<string name="wizard_script_user_uri" translatable="false">android.resource://org.lineageos.setupwizard/raw/wizard_script_user</string>
<bool name="config_isLargeNoTouch">false</bool>
</resources>

View File

@@ -76,24 +76,26 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
String privacy_policy = getString(R.string.services_privacy_policy);
String policySummary = getString(R.string.services_explanation, os_name, privacy_policy);
SpannableString ss = new SpannableString(policySummary);
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
// At this point of the setup, the device has already been unlocked (if frp
// had been enabled), so there should be no issues regarding security
final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(PRIVACY_POLICY_URI));
try {
startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "Unable to start activity " + intent.toString(), e);
if (!getResources().getBoolean(R.bool.config_isLargeNoTouch)) {
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
// At this point of the setup, the device has already been unlocked (if frp
// had been enabled), so there should be no issues regarding security
final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(PRIVACY_POLICY_URI));
try {
startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "Unable to start activity " + intent.toString(), e);
}
}
}
};
int ppStartIndex = policySummary.indexOf(privacy_policy);
ss.setSpan(clickableSpan,
ppStartIndex, ppStartIndex + privacy_policy.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
};
int ppStartIndex = policySummary.indexOf(privacy_policy);
ss.setSpan(clickableSpan,
ppStartIndex, ppStartIndex + privacy_policy.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
TextView privacyPolicy = (TextView) findViewById(R.id.privacy_policy);
privacyPolicy.setMovementMethod(LinkMovementMethod.getInstance());
privacyPolicy.setText(ss);