| OLD | NEW |
| 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- | 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; 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 file, | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | 5 |
| 6 package org.mozilla.gecko.tabs; | 6 package org.mozilla.gecko.tabs; |
| 7 | 7 |
| 8 import org.mozilla.gecko.Experiments; | 8 import org.mozilla.gecko.Experiments; |
| 9 import org.mozilla.gecko.GeckoApp; | 9 import org.mozilla.gecko.GeckoApp; |
| 10 import org.mozilla.gecko.GeckoApplication; | 10 import org.mozilla.gecko.GeckoApplication; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 super.onDetachedFromWindow(); | 287 super.onDetachedFromWindow(); |
| 288 mTheme.removeListener(this); | 288 mTheme.removeListener(this); |
| 289 if (!HardwareUtils.isTablet()) { | 289 if (!HardwareUtils.isTablet()) { |
| 290 GeckoSharedPrefs.forApp(getContext()).unregisterOnSharedPreferenceCh
angeListener(this); | 290 GeckoSharedPrefs.forApp(getContext()).unregisterOnSharedPreferenceCh
angeListener(this); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 @Override | 294 @Override |
| 295 @SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by API
level 16 | 295 @SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by API
level 16 |
| 296 public void onLightweightThemeChanged() { | 296 public void onLightweightThemeChanged() { |
| 297 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37
69 | 297 final int background = ContextCompat.getColor(getContext(), R.color.text
_and_tabs_tray_grey); |
| 298 final int background = ContextCompat.getColor(getContext(), R.color.abb_
background_light_grey); | |
| 299 final LightweightThemeDrawable drawable = mTheme.getColorDrawable(this,
background, true); | 298 final LightweightThemeDrawable drawable = mTheme.getColorDrawable(this,
background, true); |
| 300 if (drawable == null) | 299 if (drawable == null) |
| 301 return; | 300 return; |
| 302 | 301 |
| 303 drawable.setAlpha(34, 0); | 302 drawable.setAlpha(34, 0); |
| 304 setBackgroundDrawable(drawable); | 303 setBackgroundDrawable(drawable); |
| 305 } | 304 } |
| 306 | 305 |
| 307 @Override | 306 @Override |
| 308 public void onLightweightThemeReset() { | 307 public void onLightweightThemeReset() { |
| 309 // Using ABB color palette. See https://issues.adblockplus.org/ticket/37
69 | 308 setBackgroundColor(ContextCompat.getColor(getContext(), R.color.text_and
_tabs_tray_grey)); |
| 310 setBackgroundColor(ContextCompat.getColor(getContext(), R.color.abb_back
ground_light_grey)); | |
| 311 } | 309 } |
| 312 | 310 |
| 313 @Override | 311 @Override |
| 314 protected void onLayout(boolean changed, int left, int top, int right, int b
ottom) { | 312 protected void onLayout(boolean changed, int left, int top, int right, int b
ottom) { |
| 315 super.onLayout(changed, left, top, right, bottom); | 313 super.onLayout(changed, left, top, right, bottom); |
| 316 onLightweightThemeChanged(); | 314 onLightweightThemeChanged(); |
| 317 } | 315 } |
| 318 | 316 |
| 319 // Tabs Panel Toolbar contains the Buttons | 317 // Tabs Panel Toolbar contains the Buttons |
| 320 static class TabsPanelToolbar extends LinearLayout | 318 static class TabsPanelToolbar extends LinearLayout |
| (...skipping 13 matching lines...) Expand all Loading... |
| 334 | 332 |
| 335 @Override | 333 @Override |
| 336 public void onDetachedFromWindow() { | 334 public void onDetachedFromWindow() { |
| 337 super.onDetachedFromWindow(); | 335 super.onDetachedFromWindow(); |
| 338 mTheme.removeListener(this); | 336 mTheme.removeListener(this); |
| 339 } | 337 } |
| 340 | 338 |
| 341 @Override | 339 @Override |
| 342 @SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by
API level 16 | 340 @SuppressWarnings("deprecation") // setBackgroundDrawable deprecated by
API level 16 |
| 343 public void onLightweightThemeChanged() { | 341 public void onLightweightThemeChanged() { |
| 344 // Using ABB color palette. See https://issues.adblockplus.org/ticke
t/3769 | 342 final int background = ContextCompat.getColor(getContext(), R.color.
text_and_tabs_tray_grey); |
| 345 final int background = ContextCompat.getColor(getContext(), R.color.
abb_background_light_grey); | |
| 346 final LightweightThemeDrawable drawable = mTheme.getColorDrawable(th
is, background); | 343 final LightweightThemeDrawable drawable = mTheme.getColorDrawable(th
is, background); |
| 347 if (drawable == null) | 344 if (drawable == null) |
| 348 return; | 345 return; |
| 349 | 346 |
| 350 drawable.setAlpha(34, 34); | 347 drawable.setAlpha(34, 34); |
| 351 setBackgroundDrawable(drawable); | 348 setBackgroundDrawable(drawable); |
| 352 } | 349 } |
| 353 | 350 |
| 354 @Override | 351 @Override |
| 355 public void onLightweightThemeReset() { | 352 public void onLightweightThemeReset() { |
| 356 // Using ABB color palette. See https://issues.adblockplus.org/ticke
t/3769 | 353 setBackgroundColor(ContextCompat.getColor(getContext(), R.color.text
_and_tabs_tray_grey)); |
| 357 setBackgroundColor(ContextCompat.getColor(getContext(), R.color.abb_
background_light_grey)); | |
| 358 } | 354 } |
| 359 | 355 |
| 360 @Override | 356 @Override |
| 361 protected void onLayout(boolean changed, int left, int top, int right, i
nt bottom) { | 357 protected void onLayout(boolean changed, int left, int top, int right, i
nt bottom) { |
| 362 super.onLayout(changed, left, top, right, bottom); | 358 super.onLayout(changed, left, top, right, bottom); |
| 363 onLightweightThemeChanged(); | 359 onLightweightThemeChanged(); |
| 364 } | 360 } |
| 365 } | 361 } |
| 366 | 362 |
| 367 public void show(Panel panelToShow) { | 363 public void show(Panel panelToShow) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 @UiThread // according to the docs. | 505 @UiThread // according to the docs. |
| 510 @Override | 506 @Override |
| 511 public void onSharedPreferenceChanged(final SharedPreferences sharedPreferen
ces, final String key) { | 507 public void onSharedPreferenceChanged(final SharedPreferences sharedPreferen
ces, final String key) { |
| 512 if (!TextUtils.equals(GeckoPreferences.PREFS_COMPACT_TABS, key)) { | 508 if (!TextUtils.equals(GeckoPreferences.PREFS_COMPACT_TABS, key)) { |
| 513 return; | 509 return; |
| 514 } | 510 } |
| 515 | 511 |
| 516 refresh(); | 512 refresh(); |
| 517 } | 513 } |
| 518 } | 514 } |
| OLD | NEW |