Skip to content

Commit

Permalink
#96 fix force tablet crash and remove and removes non-functional tabs…
Browse files Browse the repository at this point in the history
… with the bar at the bottom
  • Loading branch information
uazo committed Aug 1, 2023
1 parent 19f3914 commit 48a833d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
18 changes: 17 additions & 1 deletion build/patches/Add-option-to-force-tablet-UI.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
.../LegacyChromePreferenceKeys.java | 1 +
.../omnibox/LocationBarCoordinator.java | 2 +-
.../strings/android_chrome_strings.grd | 6 ++++++
.../toolbar/top/ToolbarControlContainer.java | 5 ++---
components/BUILD.gn | 6 +++---
.../res/xml/accessibility_preferences.xml | 5 +++++
.../accessibility/AccessibilitySettings.java | 11 +++++++++++
.../AccessibilitySettingsDelegate.java | 2 ++
ui/android/BUILD.gn | 2 ++
.../chromium/ui/base/DeviceFormFactor.java | 5 +++++
11 files changed, 56 insertions(+), 4 deletions(-)
12 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java
Expand Down Expand Up @@ -96,6 +97,21 @@ diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chro

<!-- Safety check -->
<message name="IDS_PREFS_SAFETY_CHECK" desc="Title of the Safety check element in settings, allowing the user to check multiple areas of browser safety. [CHAR_LIMIT=32]">
diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java
--- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java
+++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java
@@ -165,9 +165,8 @@ public class ToolbarControlContainer extends OptimizedFrameLayout implements Con

return backgroundDrawable;
} else {
- final Drawable backgroundDrawable =
- AppCompatResources.getDrawable(getContext(), R.drawable.toolbar_background)
- .mutate();
+ Drawable backgroundDrawable = new ColorDrawable(
+ ChromeColors.getPrimaryBackgroundColor(getContext(), incognito));
backgroundDrawable.setTint(ChromeColors.getDefaultThemeColor(getContext(), incognito));
backgroundDrawable.setTintMode(PorterDuff.Mode.MULTIPLY);

diff --git a/components/BUILD.gn b/components/BUILD.gn
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
Expand Down
27 changes: 17 additions & 10 deletions build/patches/Move-navigation-bar-to-bottom.patch
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
.../strip/StripLayoutHelperManager.java | 34 +++++++-
.../scene_layer/StaticTabSceneLayer.java | 8 +-
.../scene_layer/TabListSceneLayer.java | 14 ++++
.../scene_layer/TabStripSceneLayer.java | 15 +++-
.../scene_layer/TabStripSceneLayer.java | 22 ++++-
.../browser/findinpage/FindToolbarTablet.java | 11 ++-
.../fullscreen/BrowserControlsManager.java | 13 +++
.../messages/MessageContainerCoordinator.java | 17 +++-
Expand Down Expand Up @@ -88,7 +88,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
.../accessibility/AccessibilitySettings.java | 16 ++++
.../AccessibilitySettingsDelegate.java | 6 ++
.../render_widget_host_view_android.cc | 3 +
76 files changed, 894 insertions(+), 63 deletions(-)
76 files changed, 901 insertions(+), 63 deletions(-)

diff --git a/cc/base/features.cc b/cc/base/features.cc
--- a/cc/base/features.cc
Expand Down Expand Up @@ -1082,16 +1082,18 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scen
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
@@ -22,6 +22,8 @@ import org.chromium.chrome.browser.layouts.scene_layer.SceneOverlayLayer;
@@ -22,6 +22,10 @@ import org.chromium.chrome.browser.layouts.scene_layer.SceneOverlayLayer;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.resources.ResourceManager;
+import org.chromium.ui.base.DeviceFormFactor;
+import org.chromium.base.ContextUtils;
+import org.chromium.chrome.browser.flags.ChromeFeatureList;
+import org.chromium.chrome.browser.flags.CachedFeatureFlags;

/**
* The Java component of what is basically a CC Layer that manages drawing the Tab Strip (which is
@@ -75,9 +77,18 @@ public class TabStripSceneLayer extends SceneOverlayLayer {
@@ -75,9 +79,23 @@ public class TabStripSceneLayer extends SceneOverlayLayer {
*/
public void pushAndUpdateStrip(StripLayoutHelperManager layoutHelper,
LayerTitleCache layerTitleCache, ResourceManager resourceManager,
Expand All @@ -1102,12 +1104,17 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scen
- final boolean visible = yOffset > -layoutHelper.getHeight();
+ boolean visible = yOffset > -layoutHelper.getHeight();
+ if (ChromeFeatureList.sMoveTopToolbarToBottom.isEnabled()) {
+ // the list of open tabs (in tablet mode) is moved down, above the top
+ // toolbar which is also below.
+ // values are in pixel.
+ yOffset = (((int)viewportHeight - topControlsHeight) / mDpToPx) - yOffset;
+ // and it disappears along with the moving toolbar with a higher range
+ visible = yOffset > (-layoutHelper.getHeight() - topControlsHeight);
+ // check if force tablet mode is active
+ // is active if(isTablet != isNonMultiDisplayContextOnTablet)
+ if (DeviceFormFactor.isTablet() ==
+ DeviceFormFactor.isNonMultiDisplayContextOnTablet(ContextUtils.getApplicationContext())) {
+ // the list of open tabs (in tablet mode not forced) is moved down, above the top
+ // toolbar which is also below.
+ // values are in pixel.
+ yOffset = (((int)viewportHeight - topControlsHeight) / mDpToPx) - yOffset;
+ // and it disappears along with the moving toolbar with a higher range
+ visible = yOffset > (-layoutHelper.getHeight() - topControlsHeight);
+ }
+ }
// This will hide the tab strips if necessary.
TabStripSceneLayerJni.get().beginBuildingFrame(
Expand Down

0 comments on commit 48a833d

Please sign in to comment.