OLD | NEW |
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.adjust.AdjustHelperInterface; | 8 import org.mozilla.gecko.adjust.AdjustHelperInterface; |
9 import org.mozilla.gecko.annotation.RobocopTarget; | 9 import org.mozilla.gecko.annotation.RobocopTarget; |
10 import org.mozilla.gecko.AdjustConstants; | 10 import org.mozilla.gecko.AdjustConstants; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 import android.view.animation.Interpolator; | 129 import android.view.animation.Interpolator; |
130 import android.widget.Button; | 130 import android.widget.Button; |
131 import android.widget.ListView; | 131 import android.widget.ListView; |
132 import android.widget.RelativeLayout; | 132 import android.widget.RelativeLayout; |
133 import android.widget.Toast; | 133 import android.widget.Toast; |
134 import android.widget.ViewFlipper; | 134 import android.widget.ViewFlipper; |
135 import com.keepsafe.switchboard.AsyncConfigLoader; | 135 import com.keepsafe.switchboard.AsyncConfigLoader; |
136 import com.keepsafe.switchboard.SwitchBoard; | 136 import com.keepsafe.switchboard.SwitchBoard; |
137 import com.nineoldandroids.animation.Animator; | 137 import com.nineoldandroids.animation.Animator; |
138 import com.nineoldandroids.animation.ObjectAnimator; | 138 import com.nineoldandroids.animation.ObjectAnimator; |
| 139 import org.adblockplus.browser.BrowserAppUtils; |
| 140 import org.adblockplus.browser.StartPane; |
139 import org.json.JSONException; | 141 import org.json.JSONException; |
140 import org.json.JSONObject; | 142 import org.json.JSONObject; |
141 | 143 |
142 import java.io.ByteArrayOutputStream; | 144 import java.io.ByteArrayOutputStream; |
143 import java.io.File; | 145 import java.io.File; |
144 import java.io.FileNotFoundException; | 146 import java.io.FileNotFoundException; |
145 import java.io.IOException; | 147 import java.io.IOException; |
146 import java.lang.reflect.Method; | 148 import java.lang.reflect.Method; |
147 import java.net.URLEncoder; | 149 import java.net.URLEncoder; |
148 import java.util.EnumSet; | 150 import java.util.EnumSet; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMAT
E); | 301 mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMAT
E); |
300 } | 302 } |
301 // fall through | 303 // fall through |
302 case LOCATION_CHANGE: | 304 case LOCATION_CHANGE: |
303 if (mZoomedView != null) { | 305 if (mZoomedView != null) { |
304 mZoomedView.stopZoomDisplay(false); | 306 mZoomedView.stopZoomDisplay(false); |
305 } | 307 } |
306 if (Tabs.getInstance().isSelectedTab(tab)) { | 308 if (Tabs.getInstance().isSelectedTab(tab)) { |
307 updateHomePagerForTab(tab); | 309 updateHomePagerForTab(tab); |
308 if (mMenu != null) | 310 if (mMenu != null) |
309 org.adblockplus.browser.BrowserAppUtils.updateBlockAdsMe
nuItem( | 311 BrowserAppUtils.updateBlockAdsMenuItem(mMenu.findItem(R.
id.abb_block_ads)); |
310 mMenu.findItem(R.id.abb_block_ads)); | |
311 } | 312 } |
312 | 313 |
313 mDynamicToolbar.persistTemporaryVisibility(); | 314 mDynamicToolbar.persistTemporaryVisibility(); |
314 break; | 315 break; |
315 case START: | 316 case START: |
316 if (Tabs.getInstance().isSelectedTab(tab)) { | 317 if (Tabs.getInstance().isSelectedTab(tab)) { |
317 invalidateOptionsMenu(); | 318 invalidateOptionsMenu(); |
318 | 319 |
319 if (mDynamicToolbar.isEnabled()) { | 320 if (mDynamicToolbar.isEnabled()) { |
320 mDynamicToolbar.setVisible(true, VisibilityTransition.AN
IMATE); | 321 mDynamicToolbar.setVisible(true, VisibilityTransition.AN
IMATE); |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2421 case ACTIVITY_REQUEST_TAB_QUEUE: | 2422 case ACTIVITY_REQUEST_TAB_QUEUE: |
2422 TabQueueHelper.processTabQueuePromptResponse(resultCode, this); | 2423 TabQueueHelper.processTabQueuePromptResponse(resultCode, this); |
2423 break; | 2424 break; |
2424 | 2425 |
2425 default: | 2426 default: |
2426 super.onActivityResult(requestCode, resultCode, data); | 2427 super.onActivityResult(requestCode, resultCode, data); |
2427 } | 2428 } |
2428 } | 2429 } |
2429 | 2430 |
2430 private void showFirstrunPager() { | 2431 private void showFirstrunPager() { |
2431 final DialogFragment dialog = new org.adblockplus.browser.StartPane(); | 2432 final DialogFragment dialog = new StartPane(); |
2432 dialog.show(getSupportFragmentManager(), "start_pane"); | 2433 dialog.show(getSupportFragmentManager(), "start_pane"); |
2433 | 2434 |
2434 // Exiting here because we want to show our first run page instead of Mo
zilla's | 2435 // Exiting here because we want to show our first run page instead of Mo
zilla's |
2435 // see https://issues.adblockplus.org/ticket/2774 | 2436 // see https://issues.adblockplus.org/ticket/2774 |
2436 if (true) | 2437 if (true) |
2437 { | 2438 { |
2438 return; | 2439 return; |
2439 } | 2440 } |
2440 | 2441 |
2441 if (mFirstrunPane == null) { | 2442 if (mFirstrunPane == null) { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2881 if (Versions.feature14Plus) { | 2882 if (Versions.feature14Plus) { |
2882 GeckoMenuItem share = (GeckoMenuItem) mMenu.findItem(R.id.share); | 2883 GeckoMenuItem share = (GeckoMenuItem) mMenu.findItem(R.id.share); |
2883 final GeckoMenuItem quickShare = (GeckoMenuItem) mMenu.findItem(R.id
.quickshare); | 2884 final GeckoMenuItem quickShare = (GeckoMenuItem) mMenu.findItem(R.id
.quickshare); |
2884 | 2885 |
2885 GeckoActionProvider provider = GeckoActionProvider.getForType(GeckoA
ctionProvider.DEFAULT_MIME_TYPE, this); | 2886 GeckoActionProvider provider = GeckoActionProvider.getForType(GeckoA
ctionProvider.DEFAULT_MIME_TYPE, this); |
2886 | 2887 |
2887 share.setActionProvider(provider); | 2888 share.setActionProvider(provider); |
2888 quickShare.setActionProvider(provider); | 2889 quickShare.setActionProvider(provider); |
2889 } | 2890 } |
2890 | 2891 |
2891 org.adblockplus.browser.BrowserAppUtils.updateBlockAdsMenuItem( | 2892 BrowserAppUtils.updateBlockAdsMenuItem(mMenu.findItem(R.id.abb_block_ads
)); |
2892 mMenu.findItem(R.id.abb_block_ads)); | |
2893 | 2893 |
2894 return true; | 2894 return true; |
2895 } | 2895 } |
2896 | 2896 |
2897 @Override | 2897 @Override |
2898 public void openOptionsMenu() { | 2898 public void openOptionsMenu() { |
2899 // Disable menu access (for hardware buttons) when the software menu but
ton is inaccessible. | 2899 // Disable menu access (for hardware buttons) when the software menu but
ton is inaccessible. |
2900 // Note that the software button is always accessible on new tablet. | 2900 // Note that the software button is always accessible on new tablet. |
2901 if (mBrowserToolbar.isEditing() && !HardwareUtils.isTablet()) { | 2901 if (mBrowserToolbar.isEditing() && !HardwareUtils.isTablet()) { |
2902 return; | 2902 return; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3370 args.put("desktopMode", !item.isChecked()); | 3370 args.put("desktopMode", !item.isChecked()); |
3371 args.put("tabId", selectedTab.getId()); | 3371 args.put("tabId", selectedTab.getId()); |
3372 } catch (JSONException e) { | 3372 } catch (JSONException e) { |
3373 Log.e(LOGTAG, "error building json arguments", e); | 3373 Log.e(LOGTAG, "error building json arguments", e); |
3374 } | 3374 } |
3375 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Desk
topMode:Change", args.toString())); | 3375 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Desk
topMode:Change", args.toString())); |
3376 return true; | 3376 return true; |
3377 } | 3377 } |
3378 | 3378 |
3379 if (itemId == R.id.abb_block_ads) { | 3379 if (itemId == R.id.abb_block_ads) { |
3380 org.adblockplus.browser.BrowserAppUtils.updateCurrentTabWhitelisting
(item); | 3380 BrowserAppUtils.updateCurrentTabWhitelisting(item); |
3381 return true; | 3381 return true; |
3382 } | 3382 } |
3383 | 3383 |
3384 if (itemId == R.id.new_tab) { | 3384 if (itemId == R.id.new_tab) { |
3385 addTab(); | 3385 addTab(); |
3386 return true; | 3386 return true; |
3387 } | 3387 } |
3388 | 3388 |
3389 if (itemId == R.id.new_private_tab) { | 3389 if (itemId == R.id.new_private_tab) { |
3390 addPrivateTab(); | 3390 addPrivateTab(); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3810 final boolean inGuestMode = GeckoProfile.get(this).inGuestMode(); | 3810 final boolean inGuestMode = GeckoProfile.get(this).inGuestMode(); |
3811 if (inGuestMode) { | 3811 if (inGuestMode) { |
3812 return StartupAction.GUEST; | 3812 return StartupAction.GUEST; |
3813 } | 3813 } |
3814 if (RestrictedProfiles.isRestrictedProfile(this)) { | 3814 if (RestrictedProfiles.isRestrictedProfile(this)) { |
3815 return StartupAction.RESTRICTED; | 3815 return StartupAction.RESTRICTED; |
3816 } | 3816 } |
3817 return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL); | 3817 return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL); |
3818 } | 3818 } |
3819 } | 3819 } |
OLD | NEW |