Bug 1247637 - Remove browser_intent_*; use ActivityUtils to open FxA links. r=sebastian

This fixes a crash, since Bug 1242213 removed the .App
<activity-alias> that browser_intent_class references.

I debated just updating the strings, and decided that it was best to
remove a pattern that is used only once in our codebase, even though
it moves more functionality to code.

MozReview-Commit-ID: 4Wgw0oITgue
This commit is contained in:
Nick Alexander 2016-02-11 10:07:20 -08:00
parent 227108c75c
commit 94bd918d8c
3 changed files with 23 additions and 17 deletions

View File

@ -213,6 +213,9 @@ public class FxAccountStatusFragment
syncNowPreference = ensureFindPreference("sync_now");
syncNowPreference.setEnabled(true);
syncNowPreference.setOnPreferenceClickListener(this);
ensureFindPreference("linktos").setOnPreferenceClickListener(this);
ensureFindPreference("linkprivacy").setOnPreferenceClickListener(this);
}
/**
@ -294,6 +297,16 @@ public class FxAccountStatusFragment
return true;
}
if (TextUtils.equals("linktos", preference.getKey())) {
ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), getResources().getString(R.string.fxaccount_link_tos));
return true;
}
if (TextUtils.equals("linkprivacy", preference.getKey())) {
ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), getResources().getString(R.string.fxaccount_link_pn));
return true;
}
return false;
}

View File

@ -114,20 +114,16 @@
<PreferenceCategory
android:key="legal_category"
android:title="@string/fxaccount_status_legal" >
<Preference android:title="@string/fxaccount_status_linktos" >
<intent
android:action="android.intent.action.VIEW"
android:data="@string/fxaccount_link_tos"
android:targetClass="@string/browser_intent_class"
android:targetPackage="@string/browser_intent_package" />
</Preference>
<Preference android:title="@string/fxaccount_status_linkprivacy" >
<intent
android:action="android.intent.action.VIEW"
android:data="@string/fxaccount_link_pn"
android:targetClass="@string/browser_intent_class"
android:targetPackage="@string/browser_intent_package" />
</Preference>
<Preference
android:editable="false"
android:key="linktos"
android:persistent="false"
android:title="@string/fxaccount_status_linktos" />
<Preference
android:editable="false"
android:key="linkprivacy"
android:persistent="false"
android:title="@string/fxaccount_status_linkprivacy" />
</PreferenceCategory>
<PreferenceCategory
android:key="debug_category" >

View File

@ -28,9 +28,6 @@
<string name="sync_text_tab_not_sent">&sync.text.tab.not.sent.label;</string>
<string name="sync_default_client_name">&sync.default.client.name;</string>
<string name="browser_intent_package">@ANDROID_PACKAGE_NAME@</string>
<string name="browser_intent_class">@ANDROID_PACKAGE_NAME@.App</string>
<!-- Firefox Account strings. -->
<string name="fxaccount_full_label">&fxaccount_full_label;</string>