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

Commit c093f07

Browse files
authored
Fix private notification url bar button style (#3516)
1 parent 7e5bc69 commit c093f07

6 files changed

Lines changed: 31 additions & 13 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/ChinesePinyinKeyboard.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import android.database.sqlite.SQLiteDatabase;
66
import android.util.Log;
77

8+
import androidx.annotation.NonNull;
9+
import androidx.annotation.Nullable;
10+
811
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
912

1013
import org.mozilla.vrbrowser.R;
@@ -13,16 +16,12 @@
1316
import org.mozilla.vrbrowser.utils.SystemUtils;
1417

1518
import java.util.ArrayList;
16-
import java.util.Arrays;
1719
import java.util.Collections;
1820
import java.util.HashMap;
1921
import java.util.List;
2022
import java.util.Locale;
2123
import java.util.regex.Pattern;
2224

23-
import androidx.annotation.NonNull;
24-
import androidx.annotation.Nullable;
25-
2625
import jp.co.omronsoft.openwnn.ComposingText;
2726
import jp.co.omronsoft.openwnn.SymbolList;
2827
import jp.co.omronsoft.openwnn.WnnWord;

app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/ChineseZhuyinKeyboard.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
import android.content.Context;
44
import android.database.Cursor;
55
import android.database.sqlite.SQLiteDatabase;
6-
import android.util.Log;
76
import android.inputmethodservice.Keyboard.Key;
7+
import android.util.Log;
8+
9+
import androidx.annotation.NonNull;
10+
import androidx.annotation.Nullable;
811

912
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
1013

@@ -21,9 +24,6 @@
2124
import java.util.Map;
2225
import java.util.regex.Pattern;
2326

24-
import androidx.annotation.NonNull;
25-
import androidx.annotation.Nullable;
26-
2727
import jp.co.omronsoft.openwnn.ComposingText;
2828
import jp.co.omronsoft.openwnn.SymbolList;
2929
import jp.co.omronsoft.openwnn.WnnWord;
@@ -229,7 +229,7 @@ private List<Words> getDisplays(String aKey) {
229229
// Allow completion of uppercase/lowercase letters numbers, and symbols
230230
// aKey.length() > 1 only happens when switching from other keyboard.
231231
if (aKey.matches(nonZhuyinReg) ||
232-
(aKey.length() > 1 && mKeymaps.size() == 0)) {
232+
(aKey.length() > 1 && mKeymaps.size() == 0)) {
233233
return Collections.singletonList(new Words(1, aKey, aKey));
234234
}
235235

@@ -248,9 +248,9 @@ private List<Words> getDisplays(String aKey) {
248248
final String lastChar = "" + aKey.charAt(aKey.length()-1);
249249
if (map != null && lastChar.matches(nonZhuyinReg))
250250
{
251-
Words word = map.displays.get(0);
252-
return Collections.singletonList(new Words(1,
253-
word.code + lastChar, word.value + lastChar));
251+
Words word = map.displays.get(0);
252+
return Collections.singletonList(new Words(1,
253+
word.code + lastChar, word.value + lastChar));
254254
}
255255
return map.displays;
256256
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class UIButton extends AppCompatImageButton implements CustomUIButton {
4646
private @IdRes int mPrivateModeTintColorListRes;
4747
private @IdRes int mActiveModeTintColorListRes;
4848
private @IdRes int mNotificationModeTintColorListRes;
49+
private @IdRes int mPrivateNotificationModeTintColorListRes;
4950
private TooltipWidget mTooltipView;
5051
private String mTooltipText;
5152
private int mTooltipDelay;
@@ -76,6 +77,7 @@ public UIButton(Context context, AttributeSet attrs, int defStyleAttr) {
7677
mPrivateModeTintColorListRes = attributes.getResourceId(R.styleable.UIButton_privateModeTintColorList, 0);
7778
mActiveModeTintColorListRes = attributes.getResourceId(R.styleable.UIButton_activeModeTintColorList, 0);
7879
mNotificationModeTintColorListRes = attributes.getResourceId(R.styleable.UIButton_notificationModeTintColorList, 0);
80+
mPrivateNotificationModeTintColorListRes = attributes.getResourceId(R.styleable.UIButton_privateNotificationModeTintColorList, 0);
7981
mTooltipDelay = attributes.getInt(R.styleable.UIButton_tooltipDelay, getResources().getInteger(R.integer.tooltip_delay));
8082
mTooltipPosition = ViewUtils.TooltipPosition.fromId(attributes.getInt(R.styleable.UIButton_tooltipPosition, ViewUtils.TooltipPosition.BOTTOM.ordinal()));
8183
TypedValue densityValue = new TypedValue();
@@ -263,7 +265,10 @@ private void setActive() {
263265
}
264266

265267
private void setNotification() {
266-
if (mActiveModeTintColorListRes != 0) {
268+
if (mIsPrivate && mPrivateNotificationModeTintColorListRes != 0) {
269+
setTintColorList(mPrivateNotificationModeTintColorListRes);
270+
271+
} else if (mNotificationModeTintColorListRes != 0) {
267272
setTintColorList(mNotificationModeTintColorListRes);
268273
}
269274
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
2+
<item android:state_enabled="false"
3+
android:color="@color/blackberry"/>
4+
<item android:state_pressed="true"
5+
android:color="@color/azure"/>
6+
<item android:state_hovered="true"
7+
android:color="@color/eggplant"/>
8+
<item android:color="@color/azure"/>
9+
</selector>

app/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<attr name="privateModeTintColorList" format="reference|color" />
2323
<attr name="activeModeTintColorList" format="reference|color" />
2424
<attr name="notificationModeTintColorList" format="reference|color" />
25+
<attr name="privateNotificationModeTintColorList" format="reference|color" />
2526
<attr name="privateModeBackground" format="integer" />
2627
<attr name="activeModeBackground" format="integer" />
2728
<attr name="regularModeBackground" format="integer" />

app/src/main/res/values/styles.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<item name="privateModeTintColorList">@drawable/main_button_icon_color_private</item>
5959
<item name="activeModeTintColorList">@drawable/main_button_icon_color_active</item>
6060
<item name="notificationModeTintColorList">@drawable/main_button_icon_color_notification</item>
61+
<item name="privateNotificationModeTintColorList">@drawable/main_button_icon_color_notification_private</item>
6162
<item name="clipColor">@color/azure</item>
6263
</style>
6364

@@ -184,6 +185,7 @@
184185
<item name="privateModeTintColorList">@drawable/main_button_icon_color_private</item>
185186
<item name="activeModeTintColorList">@drawable/main_button_icon_color_active</item>
186187
<item name="notificationModeTintColorList">@drawable/main_button_icon_color_notification</item>
188+
<item name="privateNotificationModeTintColorList">@drawable/main_button_icon_color_notification_private</item>
187189
</style>
188190

189191
<style name="urlBarIconThemeStart">
@@ -197,6 +199,7 @@
197199
<item name="privateModeTintColorList">@drawable/main_button_icon_color_private</item>
198200
<item name="activeModeTintColorList">@drawable/main_button_icon_color_active</item>
199201
<item name="notificationModeTintColorList">@drawable/main_button_icon_color_notification</item>
202+
<item name="privateNotificationModeTintColorList">@drawable/main_button_icon_color_notification_private</item>
200203
</style>
201204

202205
<style name="urlBarIconThemeEnd">
@@ -210,6 +213,7 @@
210213
<item name="privateModeTintColorList">@drawable/main_button_icon_color_private</item>
211214
<item name="activeModeTintColorList">@drawable/main_button_icon_color_active</item>
212215
<item name="notificationModeTintColorList">@drawable/main_button_icon_color_notification</item>
216+
<item name="privateNotificationModeTintColorList">@drawable/main_button_icon_color_notification_private</item>
213217
</style>
214218

215219
<style name="scrollbar">

0 commit comments

Comments
 (0)