Merge pull request #182 from gz83/main
[Android] Remove discovery module from NTP
This commit is contained in:
commit
3ddfbcde24
5 changed files with 239 additions and 0 deletions
|
@ -201,4 +201,7 @@ Patches for mini_installer and abseil when using AVX on Windows. Credit goes to
|
|||
The Thorium .desktop file and content-shell .desktop file have flags added for experimental and useful features, namely: Disabling the Default Browser check and InfoBar, Experimental web platform features, and Experimental Canvas2D.
|
||||
- Modified by me.
|
||||
|
||||
Remove discovery module from NTP on Android
|
||||
- Made by @gz83.
|
||||
|
||||
- Any other code/patches are written from scratch by me.
|
||||
|
|
78
other/Android-Remove-discovery-module-from-NTP.patch
Normal file
78
other/Android-Remove-discovery-module-from-NTP.patch
Normal file
|
@ -0,0 +1,78 @@
|
|||
From 9d07f991a3996c0219320b77b6611e80053db0e3 Mon Sep 17 00:00:00 2001
|
||||
From: Ho Cheung <uioptt24@gmail.com>
|
||||
Date: Wed, 28 Jun 2023 02:52:35 +0800
|
||||
Subject: [PATCH] [Android] Remove discovery module from NTP
|
||||
|
||||
Change-Id: Ied94517abba26e45e18b5a98ca5851a2c37b1c42
|
||||
---
|
||||
.../res/layout/new_tab_page_feed_v2_expandable_header.xml | 5 +++--
|
||||
.../java/res/layout/new_tab_page_multi_feed_header.xml | 5 +++--
|
||||
components/feed/core/shared_prefs/pref_names.cc | 4 ++--
|
||||
3 files changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml b/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml
|
||||
index ee1283cb9a6a0..e15ddc9532cce 100644
|
||||
--- a/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml
|
||||
+++ b/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
-Copyright 2020 The Chromium Authors
|
||||
+Copyright 2020 The Chromium Authors, Alex313031 and gz83
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file.
|
||||
-->
|
||||
@@ -14,7 +14,8 @@ found in the LICENSE file.
|
||||
android:minHeight="@dimen/snippets_article_header_height"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical"
|
||||
- android:layoutDirection="locale" >
|
||||
+ android:layoutDirection="locale"
|
||||
+ android:visibility="gone" >
|
||||
|
||||
<RelativeLayout
|
||||
tools:ignore="RelativeOverlap"
|
||||
diff --git a/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml b/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml
|
||||
index 9c7aa0fb74cb1..df79f5c27f07e 100644
|
||||
--- a/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml
|
||||
+++ b/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
-Copyright 2021 The Chromium Authors
|
||||
+Copyright 2021 The Chromium Authors, Alex313031 and gz83
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file.
|
||||
-->
|
||||
@@ -11,7 +11,8 @@ found in the LICENSE file.
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
- android:orientation="vertical" >
|
||||
+ android:orientation="vertical"
|
||||
+ android:visibility="gone" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_content"
|
||||
diff --git a/components/feed/core/shared_prefs/pref_names.cc b/components/feed/core/shared_prefs/pref_names.cc
|
||||
index e239b42b31ef3..21c7aab6bedd0 100644
|
||||
--- a/components/feed/core/shared_prefs/pref_names.cc
|
||||
+++ b/components/feed/core/shared_prefs/pref_names.cc
|
||||
@@ -1,4 +1,4 @@
|
||||
-// Copyright 2020 The Chromium Authors
|
||||
+// Copyright 2020 The Chromium Authors, Alex313031 and gz83
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
@@ -21,7 +21,7 @@ const char kVideoPreviewsType[] = "ntp_snippets.video_previews_type";
|
||||
|
||||
void RegisterFeedSharedProfilePrefs(PrefRegistrySimple* registry) {
|
||||
registry->RegisterBooleanPref(kEnableSnippets, true);
|
||||
- registry->RegisterBooleanPref(kArticlesListVisible, true);
|
||||
+ registry->RegisterBooleanPref(kArticlesListVisible, false);
|
||||
registry->RegisterIntegerPref(kVideoPreviewsType, 1);
|
||||
}
|
||||
|
||||
--
|
||||
2.39.1.windows.1
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2020 The Chromium Authors, Alex313031 and gz83
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file.
|
||||
-->
|
||||
|
||||
<org.chromium.chrome.browser.feed.sections.SectionHeaderView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/snippets_article_header_height"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layoutDirection="locale"
|
||||
android:visibility="gone" >
|
||||
|
||||
<RelativeLayout
|
||||
tools:ignore="RelativeOverlap"
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/ntp_header_lateral_paddings_v2" >
|
||||
<!-- Note: Setting textDirection to "locale" makes sure that a non-translated English word in
|
||||
the title text view is aligned based on the device locale and not the text content.
|
||||
-->
|
||||
<TextView
|
||||
android:id="@+id/header_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:textAppearance="@style/TextAppearance.HeaderTitle"
|
||||
android:textDirection="locale" />
|
||||
|
||||
<org.chromium.components.browser_ui.widget.listmenu.ListMenuButton
|
||||
android:id="@+id/header_menu"
|
||||
android:layout_width="@dimen/feed_v2_header_menu_width"
|
||||
android:layout_height="@dimen/snippets_article_header_menu_size"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_settings_gear_24dp"
|
||||
android:contentDescription="@string/accessibility_ntp_feed_menu_button"
|
||||
app:menuMaxWidth="@dimen/feed_header_menu_max_width"
|
||||
app:tint="@null" />
|
||||
</RelativeLayout>
|
||||
</org.chromium.chrome.browser.feed.sections.SectionHeaderView>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 The Chromium Authors, Alex313031 and gz83
|
||||
Use of this source code is governed by a BSD-style license that can be
|
||||
found in the LICENSE file.
|
||||
-->
|
||||
|
||||
<org.chromium.chrome.browser.feed.sections.SectionHeaderView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/snippets_article_header_height"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:layoutDirection="locale"
|
||||
android:paddingHorizontal="@dimen/ntp_header_lateral_paddings_v2" >
|
||||
|
||||
<!-- Null content description for now because UX in flux. -->
|
||||
<ImageView
|
||||
android:id="@+id/section_status_indicator"
|
||||
android:layout_width="@dimen/feed_header_icon_size"
|
||||
android:layout_height="@dimen/feed_header_icon_size"
|
||||
android:src="@drawable/ic_visibility_off_black"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="invisible"
|
||||
android:layout_marginEnd="@dimen/feed_header_icon_margin"
|
||||
app:tint="@color/default_icon_color_disabled"
|
||||
tools:ignore="contentDescription" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_list_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/feed_header_tab_layout_height"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
style="@style/NtpHeaderTabLayoutStyle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:textAppearance="@style/TextAppearance.HeaderTitle"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
<org.chromium.components.browser_ui.widget.listmenu.ListMenuButton
|
||||
android:id="@+id/header_menu"
|
||||
android:layout_width="@dimen/feed_header_icon_size"
|
||||
android:layout_height="@dimen/snippets_article_header_menu_size"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_marginStart="@dimen/feed_header_icon_margin"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_settings_gear_24dp"
|
||||
android:contentDescription="@string/accessibility_ntp_feed_menu_button"
|
||||
app:menuMaxWidth="@dimen/feed_header_menu_max_width"
|
||||
app:tint="@null" />
|
||||
</LinearLayout>
|
||||
</org.chromium.chrome.browser.feed.sections.SectionHeaderView>
|
31
src/components/feed/core/shared_prefs/pref_names.cc
Normal file
31
src/components/feed/core/shared_prefs/pref_names.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2020 The Chromium Authors, Alex313031 and gz83
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_
|
||||
#define COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_
|
||||
|
||||
#include "components/feed/core/shared_prefs/pref_names.h"
|
||||
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
|
||||
namespace feed {
|
||||
namespace prefs {
|
||||
|
||||
const char kEnableSnippets[] = "ntp_snippets.enable";
|
||||
// A boolean pref set to true if Feed articles are visible.
|
||||
// FEED_ARTICLES_LIST_VISIBLE in ChromePreferenceKeys.java is a pre-native cache
|
||||
// and should be consistent with this pref.
|
||||
const char kArticlesListVisible[] = "ntp_snippets.list_visible";
|
||||
const char kVideoPreviewsType[] = "ntp_snippets.video_previews_type";
|
||||
|
||||
void RegisterFeedSharedProfilePrefs(PrefRegistrySimple* registry) {
|
||||
registry->RegisterBooleanPref(kEnableSnippets, true);
|
||||
registry->RegisterBooleanPref(kArticlesListVisible, false);
|
||||
registry->RegisterIntegerPref(kVideoPreviewsType, 1);
|
||||
}
|
||||
|
||||
} // namespace prefs
|
||||
} // namespace feed
|
||||
|
||||
#endif // COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_
|
Loading…
Reference in a new issue