Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Added support for em-dash and backslash (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Sep 26, 2018
1 parent b63b15b commit 104871e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.SettingsStore;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class SearchEngine implements GeolocationTask.GeolocationTaskDelegate {

private static final String LOGTAG = "VRB";
Expand Down Expand Up @@ -87,6 +90,12 @@ private SearchEngine(@NonNull Context aContext) {
}

public String getSearchURL(String aQuery) {
try {
aQuery = URLEncoder.encode(aQuery, "UTF-8");

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return mEngine.getSearchQuery(mContext, aQuery);
}
public String getURLResource() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import org.mozilla.vrbrowser.search.SearchEngine;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
import java.util.regex.Pattern;

public class NavigationURLBar extends FrameLayout {
Expand Down Expand Up @@ -120,6 +122,12 @@ public void setURL(String aURL) {

int index = -1;
if (aURL != null) {
try {
aURL = URLDecoder.decode(aURL, "UTF-8");

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
if (aURL.startsWith("jar:"))
return;
else if (aURL.startsWith("resource:") || SessionStore.get().isHomeUri(aURL))
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/keyboard_symbols.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</Row>

<Row>
<Key android:codes="45" android:keyLabel="-" android:keyEdgeFlags="left" android:horizontalGap="@dimen/keyboard_left_margin"/>
<Key android:codes="45" android:keyLabel="-" android:popupCharacters="-—" android:popupKeyboard="@xml/keyboard_popup" android:keyEdgeFlags="left" android:horizontalGap="@dimen/keyboard_left_margin"/>
<Key android:codes="39" android:keyLabel="\'"/>
<Key android:codes="58" android:keyLabel=":"/>
<Key android:codes="59" android:keyLabel=";"/>
Expand All @@ -41,7 +41,7 @@
<Key android:codes="96" android:keyLabel="`"/>
<Key android:codes="63" android:keyLabel="\?"/>
<Key android:codes="46" android:keyLabel="."/>
<Key android:codes="47" android:keyLabel="/" />
<Key android:codes="92" android:keyLabel="\\" />
<Key android:codes="-10" android:keyLabel="#+" android:keyEdgeFlags="right"/>
</Row>

Expand Down

0 comments on commit 104871e

Please sign in to comment.