Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mozilla.vrbrowser.search.suggestions;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;

Expand All @@ -17,6 +18,8 @@

public class SuggestionsProvider {

private static final String LOGTAG = SuggestionsProvider.class.getSimpleName();
Comment thread
keianhzo marked this conversation as resolved.

public class DefaultSuggestionsComparator implements Comparator {

public int compare(Object obj1, Object obj2) {
Expand Down Expand Up @@ -90,6 +93,11 @@ public CompletableFuture<List<SuggestionItem>> getBookmarkSuggestions(@NonNull L
items.sort(mComparator);
}
future.complete(items);

}).exceptionally(th -> {
Log.d(LOGTAG, "Error getting bookmarks suggestions: " + th.getLocalizedMessage());
future.complete(items);
return null;
});

return future;
Expand All @@ -111,6 +119,11 @@ public CompletableFuture<List<SuggestionItem>> getHistorySuggestions(@NonNull fi
items.sort(mComparator);
}
future.complete(items);

}).exceptionally(th -> {
Log.d(LOGTAG, "Error getting history suggestions: " + th.getLocalizedMessage());
future.complete(items);
return null;
});

return future;
Expand Down Expand Up @@ -152,6 +165,11 @@ public CompletableFuture<List<SuggestionItem>> getSearchEngineSuggestions(@NonNu
items.sort(mComparator);
}
future.complete(items);

}).exceptionally(th -> {
Log.d(LOGTAG, "Error getting search engine suggestions: " + th.getLocalizedMessage());
future.complete(items);
return null;
});

return future;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.MotionEvent;
Expand Down Expand Up @@ -52,6 +53,9 @@
import mozilla.components.ui.autocomplete.InlineAutocompleteEditText;

public class NavigationURLBar extends FrameLayout {

private static final String LOGTAG = NavigationURLBar.class.getSimpleName();

private InlineAutocompleteEditText mURL;
private UIButton mMicrophoneButton;
private UIButton mUAModeButton;
Expand Down Expand Up @@ -255,7 +259,10 @@ private void handleBookmarkClick() {
bookmarkStore.deleteBookmarkByURL(url);
setBookmarked(false);
}
}, mUIThreadExecutor);
}, mUIThreadExecutor).exceptionally(th -> {
Log.d(LOGTAG, "Error getting bookmarks: " + th.getLocalizedMessage());
return null;
});

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class NavigationBarWidget extends UIWidget implements GeckoSession.Naviga
SharedPreferences.OnSharedPreferenceChangeListener, SuggestionsWidget.URLBarPopupDelegate,
BookmarkListener, TrayListener {

private static final String LOGTAG = "VRB";
private static final String LOGTAG = NavigationBarWidget.class.getSimpleName();

private AudioEngine mAudio;
private UIButton mBackButton;
Expand Down Expand Up @@ -900,7 +900,10 @@ public void OnShowSearchPopup() {
mPopup.show(CLEAR_FOCUS);
}

}, new UIThreadExecutor());
}, new UIThreadExecutor()).exceptionally(th -> {
Log.d(LOGTAG, "Error getting suggestions: " + th.getLocalizedMessage());
return null;
});
}

@Override
Expand Down