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

Added backslash symbol and en-dash #577

Merged
merged 1 commit into from
Sep 26, 2018
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
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"/>
Copy link
Contributor

@cvan cvan Nov 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you toggle this? I can't tell how to get the en-dash () to show up instead of the hyphen (-).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you long press the hyphen and a popup should show with both symbols to choose. I guess the confusion comes because the hyphen and underscore are not easy to differentiate when not hovered. We might need to add the popup to both of them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, okay - I'm going to fiddle with this some more. I'll likely file some follow-up issues for the keyboard.

thanks for adding these, btw! 👍

<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