-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create New Tab page and add an option to set New Tab page as homepage #1574
base: main
Are you sure you want to change the base?
Conversation
@felipeerias @svillar (and other maintainers) This is a very draft initial implementation. Currently I just added a Homepage option that shows Bookmarks panel like this: https://drive.google.com/file/d/1feSPqru-LJJOmQ3kwPKKuEXal9dirkbr/view?usp=sharing I'm thinking of creating a specific New Tab page that shows bookmarks (and maybe other things too?). Do you have any ideas on how that New Tab page should look like? Is there any existing layout that I can use for this page? |
I think we should be consistent with what others do. See Desktop Firefox, Chrome, or Edge for inspiration |
64fb0d9
to
218b7b8
Compare
bf3f824
to
8ffd64b
Compare
01ac05b
to
96768a2
Compare
@felipeerias @svillar (and other maintainers) There's bug in the New Tab page that I'm not having any clues to debug. Basically, the hovering point is not exactly as it's showing. For example: The reverse is true too: when I actually hover in the item, the page doesn't recognize that and doesn't show the trash icon: Could you help me to debug this? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is great work 🙂
In addition to these suggestions, we also need to add the New Page to the WindowViewModel
so other elements in the UI are updated correctly.
See WindowViewModel.setIsLibraryVisible()
and WindowViewModel.getIsLibraryVisible()
for reference.
app/src/common/shared/com/igalia/wolvic/ui/adapters/Bookmark.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/adapters/NewTabAdapter.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/views/library/BookmarksView.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java
Outdated
Show resolved
Hide resolved
app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/DisplayOptionsView.java
Outdated
Show resolved
Hide resolved
@felipeerias I have simplified the initial UI of the New Tab page like you suggested (the more complete UI is stored here as references for next PRs: https://github.com/haanhvu/wolvic/tree/issue1318-skeleton) I have also enabled going back to New Tab from another page or library panel. I'll wait for #1644 to be merged first to continue on it. Basically if #1644 works for library panel it would work for New Tab too |
b5206ba
to
4d02e46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felipeerias I have applied your suggestions and fixed the remaining bugs. Think we can undraft this now. Please review and see whether there are any other bugs. Thanks!
I'll add notes for some changes that don't seem very apparent:
isNativeContentVisible = new MediatorLiveData<>(); | ||
isNativeContentVisible.addSource(currentContentType, contentType -> | ||
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT)) | ||
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT && contentType != Windows.ContentType.NEW_TAB)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I excluded New Tab here. Because as I see there're many places we're dealing with library content only, but there're no places where we deal with library and new tab content together. Do you agree? If yes should we change the name to isLibraryContentVisible
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNativeContentVisible
indicates that Android UI is being shown, so it should also include New Tab.
This property is mainly used to address the different requirements of Web content and Android UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this to the review. Simply restore the previous lines:
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT))
@@ -239,9 +249,12 @@ public void onChanged(ObservableBoolean o) { | |||
@Override | |||
public void onChanged(Spannable aUrl) { | |||
String url = aUrl.toString(); | |||
if (isNativeContentVisible.getValue().get()) { | |||
if (isNativeContentVisible.getValue().get() && currentContentType.getValue() != Windows.ContentType.NEW_TAB) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though isNativeContentVisible
does not include New Tab now, there are currently still some lines like this, because I want to remember these are where we check for library content only. Once we agree what isNativeContentVisible
include I'll clean up these lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned above, isNativeContentVisible
should include New Tab so this line can stay as is.
if (switchSurface && mRestoreFirstPaint != null) { | ||
mRestoreFirstPaint.run(); | ||
mRestoreFirstPaint = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L591-594 already existed in hidePanel(boolean switchSurface)
. I actually added these lines to hideNewTab(boolean switchSurface)
. But somehow Github shows that I added to hidePanel()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Thank you for the clarification.
public boolean isLibraryContent() { | ||
return (this.URL == UrlUtils.ABOUT_BOOKMARKS || | ||
this.URL == UrlUtils.ABOUT_WEBAPPS || | ||
this.URL == UrlUtils.ABOUT_HISTORY || | ||
this.URL == UrlUtils.ABOUT_DOWNLOADS || | ||
this.URL == UrlUtils.ABOUT_ADDONS); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we agree isNativeContenVisible
does not include New Tab, then this function is probably not needed. I'll clean up later once we agree what isNativeContenVisible
includes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this method is a good idea.
However. it is using ==
to compare Strings, which might lead to trouble in Java. This is one possible way to rewrite it:
public boolean isLibraryContent() {
switch (this) {
case BOOKMARKS:
case WEB_APPS:
case HISTORY:
case DOWNLOADS:
case ADDONS:
return true;
default:
return false;
}
@@ -188,7 +188,7 @@ | |||
android:id="@+id/bookmarksButton" | |||
style="@style/trayButtonMiddleTheme" | |||
android:src="@drawable/ic_icon_bookmark" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.BOOKMARKS ? @string/close_library_tooltip : @string/open_library_tooltip}" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.BOOKMARKS ? @string/close_library_tooltip : @string/open_bookmarks_tooltip}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and L204 are not in the scope of this PR. But I think these are correct fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, these were fixed in #1655
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. These were fixed, no need to include this particular change in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much, this is a great job. I have a few comments pointing some things that need to be changed.
Additionally:
In TrayWidget.java
mCurrentContentTypeObserver
(line 608) we need to change this line:
if (contentType == Windows.ContentType.WEB_CONTENT) {
into this one:
if (contentType == Windows.ContentType.WEB_CONTENT || contentType == Windows.ContentType.NEW_TAB) {
otherwise there is a small glitch in the Bookmarks icon in the tray.
public boolean isLibraryContent() { | ||
return (this.URL == UrlUtils.ABOUT_BOOKMARKS || | ||
this.URL == UrlUtils.ABOUT_WEBAPPS || | ||
this.URL == UrlUtils.ABOUT_HISTORY || | ||
this.URL == UrlUtils.ABOUT_DOWNLOADS || | ||
this.URL == UrlUtils.ABOUT_ADDONS); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this method is a good idea.
However. it is using ==
to compare Strings, which might lead to trouble in Java. This is one possible way to rewrite it:
public boolean isLibraryContent() {
switch (this) {
case BOOKMARKS:
case WEB_APPS:
case HISTORY:
case DOWNLOADS:
case ADDONS:
return true;
default:
return false;
}
isNativeContentVisible = new MediatorLiveData<>(); | ||
isNativeContentVisible.addSource(currentContentType, contentType -> | ||
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT)) | ||
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT && contentType != Windows.ContentType.NEW_TAB)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this to the review. Simply restore the previous lines:
isNativeContentVisible.setValue(new ObservableBoolean(contentType != Windows.ContentType.WEB_CONTENT))
@@ -188,7 +188,7 @@ | |||
android:id="@+id/bookmarksButton" | |||
style="@style/trayButtonMiddleTheme" | |||
android:src="@drawable/ic_icon_bookmark" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.BOOKMARKS ? @string/close_library_tooltip : @string/open_library_tooltip}" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.BOOKMARKS ? @string/close_library_tooltip : @string/open_bookmarks_tooltip}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. These were fixed, no need to include this particular change in this PR.
@@ -201,7 +201,7 @@ | |||
<com.igalia.wolvic.ui.views.UIButton | |||
android:id="@+id/downloadsButton" | |||
style="@style/trayButtonMiddleTheme" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.DOWNLOADS ? @string/close_library_tooltip : @string/open_library_tooltip}" | |||
android:tooltipText="@{viewmodel.currentContentType == ContentType.DOWNLOADS ? @string/close_library_tooltip : @string/open_downloads_tooltip}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, already fixed.
private MediatorLiveData<ObservableBoolean> isNativeContentVisible; | ||
private MutableLiveData<ObservableBoolean> backToNewTabEnabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you had to add new attributes in the WindowViewModel
to keep track of the current state, specially when the user browses back and forward, shows and hides the library, etc. Perhaps not all of these are needed and we can use the current URL to select the appropriate UI and content type (but maybe that is just wishful thinking on my part :-) ).
One question that comes to mind is whether these need to be part of the WindowViewModel
instead of being internal properties of WindowWidget
, for example. The view model is specially useful to listen to changes in particular values and to update XML layouts automatically.
Another observation is that this code tries to manipulate how the Back and Forward navigation works, and the result can be a bit confusing sometimes. This happens specially when we combine back/forward with the Home button.
In this case, I think it is better to leave that behaviour as something internal to the Web engine (Gecko or Chromium). Personally, I often use desktop Firefox as the reference when trying to understand how this navigation should work,
First step for #1318: Create initial New Tab page that has Wolvic logo and add an option in Display Settings to set New Tab page as homepage
This should be released when all the steps have been done and #1318 is closed.