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

Commit 0c9f13e

Browse files
MortimerGorobluemarvin
authored andcommitted
Fix visual glitches on the hint fading edge (#1933)
1 parent 7782c30 commit 0c9f13e

4 files changed

Lines changed: 92 additions & 1 deletion

File tree

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import android.view.inputmethod.EditorInfo;
2525
import android.widget.FrameLayout;
2626
import android.widget.ImageView;
27+
import android.widget.LinearLayout;
2728
import android.widget.RelativeLayout;
2829

2930
import androidx.annotation.NonNull;
@@ -234,6 +235,7 @@ public void setIsContentMode(boolean isContentMode) {
234235
}
235236
}
236237
syncViews();
238+
updateRightPadding();
237239
}
238240

239241
public boolean isInBookmarkMode() {
@@ -446,18 +448,35 @@ public void updateHintFading() {
446448

447449
private void updateRightPadding() {
448450
int padding = WidgetPlacement.convertDpToPixel(getContext(), 5);
451+
boolean anyButtonVisible = false;
449452
if (mMicrophoneButton.getVisibility() == View.VISIBLE) {
450453
padding += mMicrophoneButton.getLayoutParams().width;
454+
anyButtonVisible = true;
451455
}
452456
if (mUAModeButton.getVisibility() == View.VISIBLE) {
453457
padding += mUAModeButton.getLayoutParams().width;
458+
anyButtonVisible = true;
454459
}
455460
if (mBookmarkButton.getVisibility() == View.VISIBLE) {
456461
padding += mBookmarkButton.getLayoutParams().width;
462+
anyButtonVisible = true;
457463
}
458464
// Min padding of 20 if no icons are visible
459465
padding = Math.max(padding, WidgetPlacement.convertDpToPixel(getContext(), 20));
460466
mURL.setPadding(mURL.getPaddingLeft(), mURL.getPaddingTop(), padding, mURL.getPaddingBottom());
467+
468+
// Update hint fading
469+
int margin = 0;
470+
if (anyButtonVisible) {
471+
mHintFading.setBackgroundResource(mIsPrivateMode ? R.drawable.url_bar_hint_fading_edge_private : R.drawable.url_bar_hint_fading_edge);
472+
} else {
473+
mHintFading.setBackgroundResource(mIsPrivateMode ? R.drawable.url_bar_hint_fading_edge_end_private : R.drawable.url_bar_hint_fading_edge_end);
474+
margin = WidgetPlacement.convertDpToPixel(getContext(), 5);
475+
}
476+
477+
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)mHintFading.getLayoutParams();
478+
params.rightMargin = margin;
479+
mHintFading.setLayoutParams(params);
461480
}
462481

463482
private void syncViews() {
@@ -545,7 +564,7 @@ public void setPrivateMode(boolean isEnabled) {
545564
} else {
546565
mMicrophoneButton.setBackgroundResource(backgroundEnd);
547566
}
548-
567+
updateRightPadding();
549568
}
550569

551570
@Override
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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/void_color" />
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/asphalt" />
21+
</shape>
22+
</item>
23+
</selector>
24+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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>
23+
</selector>
24+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<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>
23+
</selector>
24+

0 commit comments

Comments
 (0)