Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile/android/base/BrowserApp.java

Issue 29325561: Issue 2967 - Show about:feedback automatically (Closed)
Patch Set: Created Sept. 2, 2015, 2:55 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public 2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 package org.mozilla.gecko; 6 package org.mozilla.gecko;
7 7
8 import org.mozilla.gecko.AppConstants.Versions; 8 import org.mozilla.gecko.AppConstants.Versions;
9 import org.mozilla.gecko.DynamicToolbar.PinReason; 9 import org.mozilla.gecko.DynamicToolbar.PinReason;
10 import org.mozilla.gecko.DynamicToolbar.VisibilityTransition; 10 import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 @Override 225 @Override
226 public float getInterpolation(float t) { 226 public float getInterpolation(float t) {
227 t -= 1.0f; 227 t -= 1.0f;
228 return t * t * t * t * t + 1.0f; 228 return t * t * t * t * t + 1.0f;
229 } 229 }
230 }; 230 };
231 231
232 private FindInPageBar mFindInPageBar; 232 private FindInPageBar mFindInPageBar;
233 private MediaCastingBar mMediaCastingBar; 233 private MediaCastingBar mMediaCastingBar;
234 234
235 // Don't show about:feedback automatically in Adblock Browser, see 235 // We again show about:feedback automatically in Adblock Browser, after
236 // https://issues.adblockplus.org/ticket/2521 236 // 5 application starts, but only for installations from the PlayStore,
237 private static final int FEEDBACK_LAUNCH_COUNT = 0; 237 // see https://issues.adblockplus.org/ticket/2967
238 private static final int FEEDBACK_LAUNCH_COUNT = 5;
238 239
239 // Stored value of the toolbar height, so we know when it's changed. 240 // Stored value of the toolbar height, so we know when it's changed.
240 private int mToolbarHeight; 241 private int mToolbarHeight;
241 242
242 // Stored value of whether the last metrics change allowed for toolbar 243 // Stored value of whether the last metrics change allowed for toolbar
243 // scrolling. 244 // scrolling.
244 private boolean mDynamicToolbarCanScroll; 245 private boolean mDynamicToolbarCanScroll;
245 246
246 private SharedPreferencesHelper mSharedPreferencesHelper; 247 private SharedPreferencesHelper mSharedPreferencesHelper;
247 248
(...skipping 3287 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 // Faster on main thread with an async apply(). 3536 // Faster on main thread with an async apply().
3536 try { 3537 try {
3537 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); 3538 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE);
3538 int launchCount = settings.getInt(keyName, 0); 3539 int launchCount = settings.getInt(keyName, 0);
3539 if (launchCount < FEEDBACK_LAUNCH_COUNT) { 3540 if (launchCount < FEEDBACK_LAUNCH_COUNT) {
3540 // Increment the launch count and store the new value. 3541 // Increment the launch count and store the new value.
3541 launchCount++; 3542 launchCount++;
3542 settings.edit().putInt(keyName, launchCount).apply(); 3543 settings.edit().putInt(keyName, launchCount).apply();
3543 3544
3544 // If we've reached our magic number, show the feedback page. 3545 // If we've reached our magic number, show the feedback page.
3545 if (launchCount == FEEDBACK_LAUNCH_COUNT) { 3546 if (launchCount == FEEDBACK_LAUNCH_COUNT && wasInstalledFromPlay Store()) {
3546 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null)); 3547 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null));
3547 } 3548 }
3548 } 3549 }
3549 } finally { 3550 } finally {
3550 StrictMode.setThreadPolicy(savedPolicy); 3551 StrictMode.setThreadPolicy(savedPolicy);
3551 } 3552 }
3552 } 3553 }
3553 3554
3555 private boolean wasInstalledFromPlayStore() {
3556 final String installer = this.getPackageManager().getInstallerPackageNam e(this.getPackageName());
3557 return "com.android.vending".equals(installer);
3558 }
3559
3554 private void showTabQueuePromptIfApplicable(final Intent intent) { 3560 private void showTabQueuePromptIfApplicable(final Intent intent) {
3555 ThreadUtils.postToBackgroundThread(new Runnable() { 3561 ThreadUtils.postToBackgroundThread(new Runnable() {
3556 @Override 3562 @Override
3557 public void run() { 3563 public void run() {
3558 // We only want to show the prompt if the browser has been opene d from an external url 3564 // We only want to show the prompt if the browser has been opene d from an external url
3559 if (AppConstants.NIGHTLY_BUILD && AppConstants.MOZ_ANDROID_TAB_Q UEUE 3565 if (AppConstants.NIGHTLY_BUILD && AppConstants.MOZ_ANDROID_TAB_Q UEUE
3560 && mInitialized 3566 && mInitialized
3561 && Intent.ACTION_VIEW.equals(inte nt.getAction()) 3567 && Intent.ACTION_VIEW.equals(inte nt.getAction())
3562 && TabQueueHelper.shouldShowTabQu euePrompt(BrowserApp.this)) { 3568 && TabQueueHelper.shouldShowTabQu euePrompt(BrowserApp.this)) {
3563 Intent promptIntent = new Intent(BrowserApp.this, TabQueuePr ompt.class); 3569 Intent promptIntent = new Intent(BrowserApp.this, TabQueuePr ompt.class);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3791 dispatcher, 3797 dispatcher,
3792 osLocale, 3798 osLocale,
3793 appLocale, 3799 appLocale,
3794 previousSession); 3800 previousSession);
3795 } 3801 }
3796 3802
3797 public static interface Refreshable { 3803 public static interface Refreshable {
3798 public void refresh(); 3804 public void refresh();
3799 } 3805 }
3800 } 3806 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld