mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 879558 - Add entry point to about:healthreport in Settings > Data choices on Android. r=rnewman
This commit is contained in:
parent
98a93ac63d
commit
be929a2ba6
22
mobile/android/base/AlignRightLinkPreference.java
Normal file
22
mobile/android/base/AlignRightLinkPreference.java
Normal file
@ -0,0 +1,22 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
class AlignRightLinkPreference extends LinkPreference {
|
||||
|
||||
public AlignRightLinkPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setLayoutResource(R.layout.preference_rightalign_icon);
|
||||
}
|
||||
|
||||
public AlignRightLinkPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setLayoutResource(R.layout.preference_rightalign_icon);
|
||||
}
|
||||
}
|
@ -15,8 +15,10 @@ import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -71,6 +73,9 @@ public class GeckoPreferences
|
||||
private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
|
||||
private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
|
||||
private static String PREFS_GEO_REPORTING = "app.geo.reportdata";
|
||||
private static String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link";
|
||||
|
||||
private static int REQUEST_CODE_PREF_SCREEN = 5;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -177,6 +182,37 @@ public class GeckoPreferences
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
// For settings, we want to be able to pass results up the chain
|
||||
// of preference screens so Settings can behave as a single unit.
|
||||
// Specifically, when we open a link, we want to back out of all
|
||||
// the settings screens.
|
||||
// We need to start nested PreferenceScreens withStartActivityForResult().
|
||||
// Android doesn't let us do that (see Preference.onClick), so we're overriding here.
|
||||
startActivityForResult(intent, REQUEST_CODE_PREF_SCREEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startWithFragment(String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) {
|
||||
// Overriding because we want to use startActivityForResult for Fragment intents.
|
||||
Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes);
|
||||
if (resultTo == null) {
|
||||
startActivityForResult(intent, REQUEST_CODE_PREF_SCREEN);
|
||||
} else {
|
||||
resultTo.startActivityForResult(intent, resultRequestCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (REQUEST_CODE_PREF_SCREEN == requestCode && Activity.RESULT_CANCELED == resultCode) {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
@ -235,19 +271,24 @@ public class GeckoPreferences
|
||||
setupPreferences((PreferenceGroup) pref, prefs);
|
||||
} else {
|
||||
pref.setOnPreferenceChangeListener(this);
|
||||
if (PREFS_UPDATER_AUTODOWNLOAD.equals(key) && !AppConstants.MOZ_UPDATER) {
|
||||
if (!AppConstants.MOZ_UPDATER &&
|
||||
PREFS_UPDATER_AUTODOWNLOAD.equals(key)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_TELEMETRY_ENABLED.equals(key) && !AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
} else if (!AppConstants.MOZ_TELEMETRY_REPORTING &&
|
||||
PREFS_TELEMETRY_ENABLED.equals(key)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) && !AppConstants.MOZ_SERVICES_HEALTHREPORT) {
|
||||
} else if (!AppConstants.MOZ_SERVICES_HEALTHREPORT &&
|
||||
(PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) ||
|
||||
PREFS_HEALTHREPORT_LINK.equals(key))) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
} else if (PREFS_CRASHREPORTER_ENABLED.equals(key) && !AppConstants.MOZ_CRASHREPORTER) {
|
||||
} else if (!AppConstants.MOZ_CRASHREPORTER &&
|
||||
PREFS_CRASHREPORTER_ENABLED.equals(key)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
@ -413,6 +454,7 @@ public class GeckoPreferences
|
||||
CharSequence newEntry = ((ListPreference) preference).getEntries()[newIndex];
|
||||
((ListPreference) preference).setSummary(newEntry);
|
||||
} else if (preference instanceof LinkPreference) {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
finish();
|
||||
} else if (preference instanceof FontSizePreference) {
|
||||
final FontSizePreference fontSizePref = (FontSizePreference) preference;
|
||||
|
@ -52,6 +52,7 @@ FENNEC_JAVA_FILES = \
|
||||
ANRReporter.java \
|
||||
ActivityHandlerHelper.java \
|
||||
AlertNotification.java \
|
||||
AlignRightLinkPreference.java \
|
||||
AllCapsTextView.java \
|
||||
AndroidImport.java \
|
||||
AndroidImportPreference.java \
|
||||
@ -473,6 +474,7 @@ RES_LAYOUT = \
|
||||
res/layout/notification_icon_text.xml \
|
||||
res/layout/notification_progress.xml \
|
||||
res/layout/notification_progress_text.xml \
|
||||
res/layout/preference_rightalign_icon.xml \
|
||||
res/layout/site_setting_item.xml \
|
||||
res/layout/site_setting_title.xml \
|
||||
res/layout/setup_screen.xml \
|
||||
|
@ -147,7 +147,8 @@ size. -->
|
||||
healthReportDesc.label, telemetrySection.label, telemetryDesc.label,
|
||||
crashReporterDesc.label). -->
|
||||
<!ENTITY datareporting_fhr_title "&brandShortName; Health Report">
|
||||
<!ENTITY datareporting_fhr_summary "Helps you understand your browser performance and shares data with &vendorShortName; about your browser health">
|
||||
<!ENTITY datareporting_fhr_summary "Shares data with &vendorShortName; about your browser health and helps you understand your browser performance">
|
||||
<!ENTITY datareporting_abouthr_title "View my Health Report">
|
||||
<!ENTITY datareporting_telemetry_title "Telemetry">
|
||||
<!ENTITY datareporting_telemetry_summary "Shares performance, usage, hardware and customization data about your browser with &vendorShortName; to help us make &brandShortName; better">
|
||||
<!ENTITY datareporting_crashreporter_summary "&brandShortName; submits crash reports to help &vendorShortName; make your browser more stable and secure">
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!-- This custom layout matches the Android layout for preferences in
|
||||
padding and margins, so it is visually consistent. -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="?android:attr/scrollbarSize">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:layout_marginLeft="15dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:paddingRight="6dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:id="@+android:id/title"
|
||||
android:layout_gravity="right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView android:src="@drawable/menu_item_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="16dp" />
|
||||
|
||||
</LinearLayout>
|
@ -13,11 +13,6 @@
|
||||
android:title="@string/datareporting_telemetry_title"
|
||||
android:summary="@string/datareporting_telemetry_summary" />
|
||||
|
||||
<CheckBoxPreference android:key="android.not_a_preference.healthreport.uploadEnabled"
|
||||
android:title="@string/datareporting_fhr_title"
|
||||
android:summary="@string/datareporting_fhr_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference android:key="datareporting.crashreporter.submitEnabled"
|
||||
android:title="@string/datareporting_crashreporter_title_short"
|
||||
android:summary="@string/datareporting_crashreporter_summary"
|
||||
@ -27,4 +22,12 @@
|
||||
android:title="@string/datareporting_wifi_title"
|
||||
android:summary="@string/datareporting_wifi_summary" />
|
||||
|
||||
<CheckBoxPreference android:key="android.not_a_preference.healthreport.uploadEnabled"
|
||||
android:title="@string/datareporting_fhr_title"
|
||||
android:summary="@string/datareporting_fhr_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<org.mozilla.gecko.AlignRightLinkPreference android:key="android.not_a_preference.healthreport.link"
|
||||
android:title="@string/datareporting_abouthr_title"
|
||||
url="about:healthreport" />
|
||||
</PreferenceScreen>
|
||||
|
@ -145,6 +145,7 @@
|
||||
<string name="datareporting_telemetry_summary">&datareporting_telemetry_summary;</string>
|
||||
<string name="datareporting_fhr_title">&datareporting_fhr_title;</string>
|
||||
<string name="datareporting_fhr_summary">&datareporting_fhr_summary;</string>
|
||||
<string name="datareporting_abouthr_title">&datareporting_abouthr_title;</string>
|
||||
<string name="datareporting_crashreporter_title_short">&datareporting_crashreporter_title_short;</string>
|
||||
<string name="datareporting_crashreporter_summary">&datareporting_crashreporter_summary;</string>
|
||||
<string name="datareporting_wifi_title">&datareporting_wifi_title;</string>
|
||||
|
Loading…
Reference in New Issue
Block a user