Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Oct 22, 2024
1 parent ec74612 commit b9de8a1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,8 @@ public void loadHome() {

} else {
if (mSession.getHomeUri() == "") {
Log.e(LOGTAG, "Empty home URI in WindowWidget => Show bookmarks");
showPanel(Windows.BOOKMARKS);
} else {
Log.e(LOGTAG, "Non-empty home URI in WindowWidget => Load homepage");
mSession.loadUri(SettingsStore.getInstance(getContext()).getHomepage());
}
}
Expand Down Expand Up @@ -531,16 +529,13 @@ public void showPanel(@Windows.PanelType int panelType) {

public void showPanel(@Windows.PanelType int panelType, boolean switchSurface) {
if (mLibrary != null) {
Log.e(LOGTAG, "mLibrary is not null => Function USED");
if (mView == null) {
Log.e(LOGTAG, "mView is null => First case");
setView(mLibrary, switchSurface);
mLibrary.selectPanel(panelType);
mLibrary.onShow();
mViewModel.setIsFindInPage(false);
mViewModel.setIsPanelVisible(true);
//if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null) && (mSurface != null)) {
Log.e(LOGTAG, "if is executed");
final Runnable firstDrawCallback = mFirstDrawCallback;
onFirstContentfulPaint(mSession.getWSession());
mRestoreFirstPaint = () -> {
Expand All @@ -550,18 +545,10 @@ public void showPanel(@Windows.PanelType int panelType, boolean switchSurface) {
mWidgetManager.updateWidget(WindowWidget.this);
}
};
//} else {
//Log.e(LOGTAG, "if is not executed");
//}

} else if (mView == mLibrary) {
Log.e(LOGTAG, "mView == mLibrary => Second case");
mLibrary.selectPanel(panelType);
} else {
Log.e(LOGTAG, "mView is other case => Function NOT USED");
}
} else {
Log.e(LOGTAG, "mLibrary is null => Function NOT USED");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1520,10 +1520,8 @@ public void addTab(@NonNull WindowWidget targetWindow, @Nullable String aUri) {
targetWindow.setSession(session, WindowWidget.DEACTIVATE_CURRENT_SESSION);
if (aUri == null || aUri.isEmpty()) {
if (session.getHomeUri() == "") {
Log.e(LOGTAG, "Empty home URI in Windows => Show bookmarks");
targetWindow.showPanel(Windows.BOOKMARKS);
} else {
Log.e(LOGTAG, "Non-empty home URI in Windows => Load homepage");
session.loadHomePage();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ private void setHomepage(int checkedId, boolean doApply) {
private int getHomepageId() {
String homepage = SettingsStore.getInstance(getContext()).getHomepage();

if (homepage == mDefaultHomepageUrl) {
if (homepage == getContext().getString(R.string.HOMEPAGE_URL)) {
return 0;
} else if (homepage == "New Tab") {
} else if (homepage == "") {
return 1;
} else {
return 2;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@

<string name="developer_options_homepage_wolvic">Wolvic</string>

<string name="developer_options_homepage_new_tab">New tab</string>
<string name="developer_options_homepage_new_tab">Bookmarks</string>

<string name="developer_options_homepage_other">Other</string>

Expand Down

0 comments on commit b9de8a1

Please sign in to comment.