mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1175970 - Tell users about tracking protection the first time they open a new private tab r=margaret
--HG-- extra : commitid : E4VV10gQZGi
This commit is contained in:
parent
450eb77790
commit
4afff5f6f8
@ -241,6 +241,10 @@
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
<activity android:name="org.mozilla.gecko.trackingprotection.TrackingProtectionPrompt"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/OverlayActivity" />
|
||||
|
||||
#ifdef MOZ_ANDROID_TAB_QUEUE
|
||||
<!-- The main reason for the Tab Queue build flag is to not mess with the VIEW intent filter
|
||||
before the rest of the plumbing is in place -->
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
import org.mozilla.gecko.DynamicToolbar.PinReason;
|
||||
import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
|
||||
@ -71,6 +69,7 @@ import org.mozilla.gecko.toolbar.AutocompleteHandler;
|
||||
import org.mozilla.gecko.toolbar.BrowserToolbar;
|
||||
import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
|
||||
import org.mozilla.gecko.toolbar.ToolbarProgressView;
|
||||
import org.mozilla.gecko.trackingprotection.TrackingProtectionPrompt;
|
||||
import org.mozilla.gecko.util.ActivityUtils;
|
||||
import org.mozilla.gecko.util.Clipboard;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
@ -139,6 +138,8 @@ import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ViewFlipper;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -2056,6 +2057,22 @@ public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
public void addPrivateTab() {
|
||||
Tabs.getInstance().addPrivateTab();
|
||||
|
||||
showTrackingProtectionPromptIfApplicable();
|
||||
}
|
||||
|
||||
private void showTrackingProtectionPromptIfApplicable() {
|
||||
final SharedPreferences prefs = getSharedPreferences();
|
||||
|
||||
final boolean hasTrackingProtectionPromptBeShownBefore = prefs.getBoolean(GeckoPreferences.PREFS_TRACKING_PROTECTION_PROMPT_SHOWN, false);
|
||||
|
||||
if (hasTrackingProtectionPromptBeShownBefore) {
|
||||
return;
|
||||
}
|
||||
|
||||
prefs.edit().putBoolean(GeckoPreferences.PREFS_TRACKING_PROTECTION_PROMPT_SHOWN, true).apply();
|
||||
|
||||
startActivity(new Intent(BrowserApp.this, TrackingProtectionPrompt.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,6 +199,11 @@
|
||||
<!ENTITY pref_donottrack_title "Do not track">
|
||||
<!ENTITY pref_donottrack_summary "&brandShortName; will tell sites that you do not want to be tracked">
|
||||
|
||||
<!ENTITY tracking_protection_prompt_title "Now with Tracking Protection">
|
||||
<!ENTITY tracking_protection_prompt_text "Actively block tracking elements so you don\'t have to worry.">
|
||||
<!ENTITY tracking_protection_prompt_tip_text "Visit Privacy settings to learn more">
|
||||
<!ENTITY tracking_protection_prompt_action_button "Got it!">
|
||||
|
||||
<!ENTITY tab_queue_toast_message3 "Tab saved in &brandShortName;">
|
||||
<!ENTITY tab_queue_toast_action "Open now">
|
||||
<!ENTITY tab_queue_prompt_title "Opening multiple links?">
|
||||
|
@ -489,6 +489,7 @@ gbjar.sources += [
|
||||
'toolbar/ToolbarPrefs.java',
|
||||
'toolbar/ToolbarProgressView.java',
|
||||
'TouchEventInterceptor.java',
|
||||
'trackingprotection/TrackingProtectionPrompt.java',
|
||||
'updater/UpdateService.java',
|
||||
'updater/UpdateServiceHelper.java',
|
||||
'Webapp.java',
|
||||
|
@ -100,6 +100,7 @@ OnSharedPreferenceChangeListener
|
||||
|
||||
public static final String NON_PREF_PREFIX = "android.not_a_preference.";
|
||||
public static final String INTENT_EXTRA_RESOURCES = "resource";
|
||||
public static final String PREFS_TRACKING_PROTECTION_PROMPT_SHOWN = NON_PREF_PREFIX + "trackingProtectionPromptShown";
|
||||
public static String PREFS_HEALTHREPORT_UPLOAD_ENABLED = NON_PREF_PREFIX + "healthreport.uploadEnabled";
|
||||
|
||||
private static boolean sIsCharEncodingEnabled;
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -14,7 +14,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tab_queue_container"
|
||||
android:layout_width="@dimen/tab_queue_container_width"
|
||||
android:layout_width="@dimen/overlay_prompt_container_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:background="@android:color/white"
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="@dimen/tab_queue_content_width"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="sans-serif-light"
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="@dimen/tab_queue_content_width"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip_text"
|
||||
android:layout_width="@dimen/tab_queue_content_width"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
@ -88,7 +88,7 @@
|
||||
<TextView
|
||||
android:id="@+id/cancel_button"
|
||||
style="@style/Widget.BaseButton"
|
||||
android:layout_width="@dimen/tab_queue_button_width"
|
||||
android:layout_width="@dimen/overlay_prompt_button_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:background="@color/android:white"
|
||||
@ -101,7 +101,7 @@
|
||||
<Button
|
||||
android:id="@+id/ok_button"
|
||||
style="@style/Widget.BaseButton"
|
||||
android:layout_width="@dimen/tab_queue_button_width"
|
||||
android:layout_width="@dimen/overlay_prompt_button_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/button_background_action_orange_round"
|
||||
|
@ -0,0 +1,91 @@
|
||||
<?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/. -->
|
||||
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/tracking_protection_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tracking_protection_inner_container"
|
||||
android:layout_width="@dimen/overlay_prompt_container_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_tracking_protection"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/tracking_protection_prompt_title"
|
||||
android:textColor="@color/text_and_tabs_tray_grey"
|
||||
android:textSize="20sp"
|
||||
|
||||
tools:text="Now with Tracking Protection"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:lineSpacingMultiplier="1.25"
|
||||
android:paddingTop="20dp"
|
||||
android:text="@string/tracking_protection_prompt_text"
|
||||
android:textColor="@color/placeholder_grey"
|
||||
android:textSize="16sp"
|
||||
|
||||
tools:text="Actively block tracking elements so you don't have to worry."/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/link_text"
|
||||
android:layout_width="@dimen/overlay_prompt_content_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="30dp"
|
||||
android:paddingTop="20dp"
|
||||
android:text="@string/tracking_protection_prompt_tip_text"
|
||||
android:textColor="@color/link_blue"
|
||||
android:textSize="14sp"
|
||||
|
||||
tools:text="Visit Privacy settings to learn more"/>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/ok_button"
|
||||
style="@style/Widget.BaseButton"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="52dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@drawable/button_background_action_orange_round"
|
||||
android:text="@string/tracking_protection_prompt_action_button"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginRight="32dp"
|
||||
tools:text="Got it"/>
|
||||
|
||||
</LinearLayout>
|
||||
</merge>
|
@ -26,7 +26,7 @@
|
||||
<dimen name="reading_list_row_height">96dp</dimen>
|
||||
<dimen name="reading_list_row_padding_right">15dp</dimen>
|
||||
|
||||
<dimen name="tab_queue_container_width">360dp</dimen>
|
||||
<dimen name="overlay_prompt_container_width">360dp</dimen>
|
||||
|
||||
<!-- Should be closer to 0.83 (140/168) but various roundings mean that 0.9 works better -->
|
||||
<item name="thumbnail_aspect_ratio" format="float" type="dimen">0.9</item>
|
||||
|
@ -56,9 +56,9 @@
|
||||
<dimen name="firstrun_content_width">300dp</dimen>
|
||||
<dimen name="firstrun_min_height">180dp</dimen>
|
||||
|
||||
<dimen name="tab_queue_content_width">260dp</dimen>
|
||||
<dimen name="tab_queue_button_width">148dp</dimen>
|
||||
<dimen name="tab_queue_container_width">@dimen/match_parent</dimen>
|
||||
<dimen name="overlay_prompt_content_width">260dp</dimen>
|
||||
<dimen name="overlay_prompt_button_width">148dp</dimen>
|
||||
<dimen name="overlay_prompt_container_width">@dimen/match_parent</dimen>
|
||||
|
||||
<!-- Site security icon -->
|
||||
<dimen name="browser_toolbar_site_security_height">@dimen/match_parent</dimen>
|
||||
|
@ -250,6 +250,11 @@
|
||||
<string name="pref_update_autodownload_disabled">&pref_update_autodownload_never;</string>
|
||||
<string name="pref_update_autodownload_enabled">&pref_update_autodownload_always;</string>
|
||||
|
||||
<string name="tracking_protection_prompt_title">&tracking_protection_prompt_title;</string>
|
||||
<string name="tracking_protection_prompt_text">&tracking_protection_prompt_text;</string>
|
||||
<string name="tracking_protection_prompt_tip_text">&tracking_protection_prompt_tip_text;</string>
|
||||
<string name="tracking_protection_prompt_action_button">&tracking_protection_prompt_action_button;</string>
|
||||
|
||||
<string name="pref_tab_queue_title">&pref_tab_queue_title2;</string>
|
||||
<string name="pref_tab_queue_summary">&pref_tab_queue_summary3;</string>
|
||||
<string name="tab_queue_prompt_title">&tab_queue_prompt_title;</string>
|
||||
|
@ -0,0 +1,134 @@
|
||||
/* -*- 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.trackingprotection;
|
||||
|
||||
import org.mozilla.gecko.Locales;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.animation.TransitionsTracker;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
import com.nineoldandroids.animation.AnimatorSet;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
|
||||
public class TrackingProtectionPrompt extends Locales.LocaleAwareActivity {
|
||||
public static final String LOGTAG = "Gecko" + TrackingProtectionPrompt.class.getSimpleName();
|
||||
|
||||
// Flag set during animation to prevent animation multiple-start.
|
||||
private boolean isAnimating;
|
||||
|
||||
private View containerView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
showPrompt();
|
||||
}
|
||||
|
||||
private void showPrompt() {
|
||||
setContentView(R.layout.tracking_protection_prompt);
|
||||
|
||||
findViewById(R.id.ok_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onConfirmButtonPressed();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.link_text).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
slideOut();
|
||||
final Intent settingsIntent = new Intent(TrackingProtectionPrompt.this, GeckoPreferences.class);
|
||||
GeckoPreferences.setResourceToOpen(settingsIntent, "preferences_privacy");
|
||||
startActivity(settingsIntent);
|
||||
|
||||
// Don't use a transition to settings if we're on a device where that
|
||||
// would look bad.
|
||||
if (HardwareUtils.IS_KINDLE_DEVICE) {
|
||||
overridePendingTransition(0, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
containerView = findViewById(R.id.tracking_protection_inner_container);
|
||||
|
||||
ViewHelper.setTranslationY(containerView, 500);
|
||||
ViewHelper.setAlpha(containerView, 0);
|
||||
|
||||
final Animator translateAnimator = ObjectAnimator.ofFloat(containerView, "translationY", 0);
|
||||
translateAnimator.setDuration(400);
|
||||
|
||||
final Animator alphaAnimator = ObjectAnimator.ofFloat(containerView, "alpha", 1);
|
||||
alphaAnimator.setStartDelay(200);
|
||||
alphaAnimator.setDuration(600);
|
||||
|
||||
final AnimatorSet set = new AnimatorSet();
|
||||
set.playTogether(alphaAnimator, translateAnimator);
|
||||
set.setStartDelay(400);
|
||||
TransitionsTracker.track(set);
|
||||
|
||||
set.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
|
||||
// Don't perform an activity-dismiss animation.
|
||||
overridePendingTransition(0, 0);
|
||||
}
|
||||
|
||||
private void onConfirmButtonPressed() {
|
||||
slideOut();
|
||||
}
|
||||
|
||||
/**
|
||||
* Slide the overlay down off the screen and destroy it.
|
||||
*/
|
||||
private void slideOut() {
|
||||
if (isAnimating) {
|
||||
return;
|
||||
}
|
||||
|
||||
isAnimating = true;
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(containerView, "translationY", containerView.getHeight());
|
||||
animator.addListener(new AnimatorListenerAdapter() {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
finish();
|
||||
}
|
||||
|
||||
});
|
||||
animator.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the dialog if back is pressed.
|
||||
*/
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
slideOut();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the dialog if the anything that isn't a button is tapped.
|
||||
*/
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
slideOut();
|
||||
return true;
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ abstract class PixelTest extends BaseTest {
|
||||
public void addTab(String url, String title, boolean isPrivate) {
|
||||
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
|
||||
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
|
||||
|
||||
if (isPrivate) {
|
||||
selectMenuItem(mStringHelper.NEW_PRIVATE_TAB_LABEL);
|
||||
} else {
|
||||
@ -61,6 +62,12 @@ abstract class PixelTest extends BaseTest {
|
||||
}
|
||||
tabEventExpecter.blockForEvent();
|
||||
contentEventExpecter.blockForEvent();
|
||||
|
||||
if (isPrivate) {
|
||||
waitForText(mStringHelper.TRACKING_PROTECTION_PROMPT_TITLE);
|
||||
mSolo.clickOnText(mStringHelper.TRACKING_PROTECTION_PROMPT_BUTTON);
|
||||
}
|
||||
|
||||
waitForText(mStringHelper.TITLE_PLACE_HOLDER);
|
||||
loadAndPaint(url);
|
||||
tabEventExpecter.unregisterListener();
|
||||
|
@ -144,6 +144,8 @@ public class StringHelper {
|
||||
|
||||
// Privacy
|
||||
public final String TRACKING_PROTECTION_LABEL;
|
||||
public final String TRACKING_PROTECTION_PROMPT_TITLE;
|
||||
public final String TRACKING_PROTECTION_PROMPT_BUTTON;
|
||||
public final String DNT_LABEL;
|
||||
public final String COOKIES_LABEL;
|
||||
public final String REMEMBER_LOGINS_LABEL;
|
||||
@ -327,6 +329,8 @@ public class StringHelper {
|
||||
|
||||
// Privacy
|
||||
TRACKING_PROTECTION_LABEL = res.getString(R.string.pref_tracking_protection_title);
|
||||
TRACKING_PROTECTION_PROMPT_TITLE = res.getString(R.string.tracking_protection_prompt_title);
|
||||
TRACKING_PROTECTION_PROMPT_BUTTON = res.getString(R.string.tracking_protection_prompt_action_button);
|
||||
DNT_LABEL = res.getString(R.string.pref_donottrack_title);
|
||||
COOKIES_LABEL = res.getString(R.string.pref_cookies_menu);
|
||||
REMEMBER_LOGINS_LABEL = res.getString(R.string.pref_remember_signons);
|
||||
|
Loading…
Reference in New Issue
Block a user