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

Commit

Permalink
URL bar polising (#2140)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keianhzo authored and bluemarvin committed Nov 4, 2019
1 parent 8f26d45 commit 9f74488
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ public void setURL(String aURL) {
return;

} else if (aURL.startsWith("resource:") || mSession.isHomeUri(aURL)) {

aURL = "";

} else if (aURL.startsWith("data:") && mSession.isPrivateMode()) {
aURL = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,15 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
mAttachedWindow.addWindowListener(this);
mAttachedWindow.setPopUpDelegate(mPopUpDelegate);

clearFocus();

if (getSession() != null) {
setUpSession(getSession());
}
handleWindowResize();

if (mAttachedWindow != null) {
mURLBar.setIsLibraryVisible(mAttachedWindow.isBookmarksVisible() || mAttachedWindow.isHistoryVisible());
mURLBar.setURL("");
if (mAttachedWindow.isBookmarksVisible()) {
mURLBar.setHint(R.string.url_bookmarks_title);
mURLBar.setIsLibraryVisible(true);
Expand All @@ -443,13 +449,6 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
}
mURLBar.setIsPopUpAvailable(mAttachedWindow.hasPendingPopUps());
}

clearFocus();

if (getSession() != null) {
setUpSession(getSession());
}
handleWindowResize();
}

private Session getSession() {
Expand Down
24 changes: 0 additions & 24 deletions app/src/main/res/drawable/url_bar_hint_fading_edge_end.xml

This file was deleted.

24 changes: 0 additions & 24 deletions app/src/main/res/drawable/url_bar_hint_fading_edge_end_private.xml

This file was deleted.

53 changes: 33 additions & 20 deletions app/src/main/res/drawable/url_bar_hint_fading_edge_private.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<shape>
<corners android:bottomRightRadius="20dp" android:topRightRadius="20dp" />
<gradient
android:type="linear"
android:angle="0"
android:startColor="#00000000"
android:endColor="@color/blackberry" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<corners android:bottomRightRadius="20dp" android:topRightRadius="20dp" />
<gradient
android:type="linear"
android:angle="0"
android:startColor="#00000000"
android:endColor="@color/eggplant" />
</shape>
</item>
<item android:state_focused="true">
<layer-list>
<item android:width="120dp">
<shape>
<gradient
android:startColor="#00000000"
android:endColor="@color/blackberry" />
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_focused="false">
<layer-list>
<item android:width="120dp">
<shape>
<gradient
android:startColor="@android:color/transparent"
android:endColor="@color/eggplant" />
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
</shape>
</item>
</layer-list>
</item>
<item>
<shape>
<gradient
android:type="linear"
android:angle="0"
android:startColor="#00000000"
android:endColor="@color/eggplant" />
</shape>
</item>
</selector>

9 changes: 5 additions & 4 deletions app/src/main/res/layout/navigation_url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
app:visibleGone="@{isPopUpAvailable}" />

<View
android:layout_width="10dp"
android:layout_width="15dp"
android:layout_height="match_parent"
app:visibleGone="@{!isPopUpAvailable}"/>
</LinearLayout>
Expand All @@ -154,6 +154,7 @@
android:id="@+id/loadingView"
android:layout_width="24dp"
android:layout_height="24dp"
android:paddingEnd="5dp"
android:contentDescription="Loading animation"
android:src="@drawable/loading_shape"
app:visibleGone="@{isLoading}" />
Expand All @@ -163,14 +164,14 @@
android:layout_height="24dp"
android:contentDescription="SSL icon"
android:src="@drawable/ic_icon_security_state_insecure"
app:visibleGone="@{isInsecure}" />
app:visibleGone="@{isInsecure &amp;&amp; (urlEditText.length() != 0)}" />
</LinearLayout>

</RelativeLayout>

<View
android:id="@+id/padding"
android:layout_width="10dp"
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_toEndOf="@id/iconsLayout"
app:visibleGone="@{isLibraryVisible}"/>
Expand All @@ -182,7 +183,7 @@
android:paddingEnd="10dp"
android:layout_toStartOf="@id/endButtonsLayout"
android:layout_toEndOf="@id/padding"
android:foreground="@{isUrlEmpty ? @drawable/url_bar_hint_fading_edge : null}"
android:foreground="@{isUrlEmpty ? (isPrivateMode ? @drawable/url_bar_hint_fading_edge_private : @drawable/url_bar_hint_fading_edge) : null}"
android:foregroundGravity="fill_vertical|right"
android:ems="10"
android:fadingEdgeLength="40dp"
Expand Down

0 comments on commit 9f74488

Please sign in to comment.