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

Commit 9f74488

Browse files
keianhzobluemarvin
authored andcommitted
URL bar polising (#2140)
* Fix the hint private mode and remove unused resources * Increased url bar left padding * Setup session before updating the URL So we have the right session available when setting the URL * Hide the insecure icon from the url bar when the url text is empty * Add some end padding to the loading animation
1 parent 8f26d45 commit 9f74488

File tree

6 files changed

+46
-81
lines changed

6 files changed

+46
-81
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/views/NavigationURLBar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ public void setURL(String aURL) {
326326
return;
327327

328328
} else if (aURL.startsWith("resource:") || mSession.isHomeUri(aURL)) {
329-
330329
aURL = "";
330+
331331
} else if (aURL.startsWith("data:") && mSession.isPrivateMode()) {
332332
aURL = "";
333333

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,15 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
425425
mAttachedWindow.addWindowListener(this);
426426
mAttachedWindow.setPopUpDelegate(mPopUpDelegate);
427427

428+
clearFocus();
429+
430+
if (getSession() != null) {
431+
setUpSession(getSession());
432+
}
433+
handleWindowResize();
434+
428435
if (mAttachedWindow != null) {
429436
mURLBar.setIsLibraryVisible(mAttachedWindow.isBookmarksVisible() || mAttachedWindow.isHistoryVisible());
430-
mURLBar.setURL("");
431437
if (mAttachedWindow.isBookmarksVisible()) {
432438
mURLBar.setHint(R.string.url_bookmarks_title);
433439
mURLBar.setIsLibraryVisible(true);
@@ -443,13 +449,6 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
443449
}
444450
mURLBar.setIsPopUpAvailable(mAttachedWindow.hasPendingPopUps());
445451
}
446-
447-
clearFocus();
448-
449-
if (getSession() != null) {
450-
setUpSession(getSession());
451-
}
452-
handleWindowResize();
453452
}
454453

455454
private Session getSession() {

app/src/main/res/drawable/url_bar_hint_fading_edge_end.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/src/main/res/drawable/url_bar_hint_fading_edge_end_private.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:state_enabled="true">
4-
<shape>
5-
<corners android:bottomRightRadius="20dp" android:topRightRadius="20dp" />
6-
<gradient
7-
android:type="linear"
8-
android:angle="0"
9-
android:startColor="#00000000"
10-
android:endColor="@color/blackberry" />
11-
</shape>
12-
</item>
13-
<item android:state_enabled="false">
14-
<shape>
15-
<corners android:bottomRightRadius="20dp" android:topRightRadius="20dp" />
16-
<gradient
17-
android:type="linear"
18-
android:angle="0"
19-
android:startColor="#00000000"
20-
android:endColor="@color/eggplant" />
21-
</shape>
22-
</item>
3+
<item android:state_focused="true">
4+
<layer-list>
5+
<item android:width="120dp">
6+
<shape>
7+
<gradient
8+
android:startColor="#00000000"
9+
android:endColor="@color/blackberry" />
10+
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
11+
</shape>
12+
</item>
13+
</layer-list>
14+
</item>
15+
<item android:state_focused="false">
16+
<layer-list>
17+
<item android:width="120dp">
18+
<shape>
19+
<gradient
20+
android:startColor="@android:color/transparent"
21+
android:endColor="@color/eggplant" />
22+
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
23+
</shape>
24+
</item>
25+
</layer-list>
26+
</item>
27+
<item>
28+
<shape>
29+
<gradient
30+
android:type="linear"
31+
android:angle="0"
32+
android:startColor="#00000000"
33+
android:endColor="@color/eggplant" />
34+
</shape>
35+
</item>
2336
</selector>
2437

app/src/main/res/layout/navigation_url.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
app:visibleGone="@{isPopUpAvailable}" />
140140

141141
<View
142-
android:layout_width="10dp"
142+
android:layout_width="15dp"
143143
android:layout_height="match_parent"
144144
app:visibleGone="@{!isPopUpAvailable}"/>
145145
</LinearLayout>
@@ -154,6 +154,7 @@
154154
android:id="@+id/loadingView"
155155
android:layout_width="24dp"
156156
android:layout_height="24dp"
157+
android:paddingEnd="5dp"
157158
android:contentDescription="Loading animation"
158159
android:src="@drawable/loading_shape"
159160
app:visibleGone="@{isLoading}" />
@@ -163,14 +164,14 @@
163164
android:layout_height="24dp"
164165
android:contentDescription="SSL icon"
165166
android:src="@drawable/ic_icon_security_state_insecure"
166-
app:visibleGone="@{isInsecure}" />
167+
app:visibleGone="@{isInsecure &amp;&amp; (urlEditText.length() != 0)}" />
167168
</LinearLayout>
168169

169170
</RelativeLayout>
170171

171172
<View
172173
android:id="@+id/padding"
173-
android:layout_width="10dp"
174+
android:layout_width="15dp"
174175
android:layout_height="match_parent"
175176
android:layout_toEndOf="@id/iconsLayout"
176177
app:visibleGone="@{isLibraryVisible}"/>
@@ -182,7 +183,7 @@
182183
android:paddingEnd="10dp"
183184
android:layout_toStartOf="@id/endButtonsLayout"
184185
android:layout_toEndOf="@id/padding"
185-
android:foreground="@{isUrlEmpty ? @drawable/url_bar_hint_fading_edge : null}"
186+
android:foreground="@{isUrlEmpty ? (isPrivateMode ? @drawable/url_bar_hint_fading_edge_private : @drawable/url_bar_hint_fading_edge) : null}"
186187
android:foregroundGravity="fill_vertical|right"
187188
android:ems="10"
188189
android:fadingEdgeLength="40dp"

0 commit comments

Comments
 (0)