Skip to content
Draft
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 @@ -136,7 +136,6 @@ public void onReceive(Context context, Intent intent) {
}
};


@Override
public void onConfigurationChanged(Configuration newConfig) {
int currentNightMode = newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK;
Expand Down Expand Up @@ -171,6 +170,8 @@ public void setDarkTheme(boolean isDark) {
}
}

private int currentZoom;

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -226,7 +227,33 @@ protected void onCreate(Bundle savedInstanceState) {

// vw.setWebContentsDebuggingEnabled(true); // enable remote debugging in chrome://inspect/#devices

vw.setWebViewClient(new BitBoxWebViewClient(BASE_URL, getAssets(), getApplication()));
// Retrieve the current text zoom setting to adjust the base font size in the WebView.
currentZoom = vw.getSettings().getTextZoom();

vw.setWebViewClient(new BitBoxWebViewClient(BASE_URL, getAssets(), getApplication()) {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);

// Calculate the base font size for html as a percentage.
// This percentage dynamically adjusts to ensure 1rem = 10px, scaled according to the current zoom level.
double baseFontSizePercentage = 62.5 * ((double) currentZoom / 100.0);

// The default body font size in rem, which is independent of the zoom level.
// This size does not scale dynamically with zoom adjustments and is fixed at 1.6rem.
double defaultFontSizeREM = 1.6;

// Reset the WebView's text zoom to 100% to ensure that the scaling is controlled via CSS
// and not by the WebView's default scaling behavior.
view.getSettings().setTextZoom(100);

String cssSetup = "document.documentElement.style.fontSize='" + baseFontSizePercentage + "%';" +
"document.body.style.fontSize='" + defaultFontSizeREM + "rem';";

// Execute the CSS setup in the WebView.
view.evaluateJavascript(cssSetup, null);
}
});

ActivityResultLauncher<String> fileChooser = registerForActivityResult(new ActivityResultContracts.GetContent(), uri -> webChrome.onFilePickerResult(uri));
BitBoxWebChromeClient.CameraPermissionDelegate cameraPermissionDelegate = () -> ActivityCompat.requestPermissions(
Expand Down Expand Up @@ -321,7 +348,6 @@ public void noAuthConfigured() {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
}));

}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.container {
--size-default: 14px;
--size-default: min(1.4rem, 24px);
align-items: center;
background-color: var(--background-secondary);
border: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
.txPrefix,
.txUnit {
color: var(--color-secondary);
font-size: 14px;
font-size: 1.4rem;
line-height: 1.285714;
white-space: nowrap;
}

.txConversionAmount .txUnit {
font-size: 12px;
font-size: 1.2rem;
flex-shrink: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/components/aopp/aopp.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
}
@media (min-width: 1200px) {
.message {
--size-default: 18px;
--size-default: 1.8rem;
}
}
4 changes: 2 additions & 2 deletions frontends/web/src/components/badge/badge.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}

.badgeIcon {
max-width: 10px;
max-width: 1rem;
}

.withChildren .badgeIcon {
Expand All @@ -28,7 +28,7 @@

@media (max-width: 382px) {
.badge {
font-size: 10px;
font-size: 1rem;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
align-items: center;
color: var(--color-text);
display: flex;
font-size: 12px;
font-size: min(1.2rem, 20px);
flex-direction: column;
gap: 4px;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

.progressInfo {
display: flex;
font-size: 16px;
font-size: 1.6rem;
justify-content: space-between;
margin: 0 0 var(--space-default);
}

.additionalUpgrade {
font-size: 16px;
font-size: 1.6rem;
margin: 0;
margin-top: var(--space-eight);
}
Expand All @@ -23,7 +23,7 @@
.content,
.additionalUpgrade
{
font-size: 14px;
font-size: 1.4rem;
}
}

4 changes: 2 additions & 2 deletions frontends/web/src/components/dialog/dialog.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
/* guard dialog and wait-dialog from view styles */
@media (min-width: 1200px) {
.header .title {
--size-subheader: 16px;
--size-subheader: 1.6rem;
}
.modal {
margin-left: var(--sidebar-width-large);
}
.modal .contentContainer p {
--size-default: 14px;
--size-default: 1.4rem;
}
}

Expand Down
4 changes: 3 additions & 1 deletion frontends/web/src/components/dropdown/dropdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@

.select :global(.react-select__control) {
background-color: var(--background-secondary);
border-radius: 2px;
border-radius: 0.2rem;
border-width: var(--border-width);
min-height: var(--input-height);
padding: var(--space-quarter) var(--space-eight);
}

Expand Down
5 changes: 2 additions & 3 deletions frontends/web/src/components/forms/button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
border-color: transparent;
border-radius: 2px;
border-style: solid;
border-width: 1px;
border-width: var(--border-width);
cursor: default;
display: inline-flex;
flex-direction: row;
font-family: var(--font-family);
font-size: var(--size-default);
font-weight: 400;
justify-content: center;
min-height: var(--button-height);
min-width: 100px;
height: 50px;
outline: none;
padding: 0 var(--space-default);
position: relative;
Expand Down Expand Up @@ -87,7 +87,6 @@
border-color: transparent;
color: var(--color-blue);
display: inline-block;
height: 50px;
min-width: 0;
}

Expand Down
14 changes: 7 additions & 7 deletions frontends/web/src/components/forms/checkbox.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.checkbox input + label {
display: inline-block;
max-width: 100%;
padding-left: 2em;
padding-left: 2rem;
position: relative;
}

Expand All @@ -27,7 +27,7 @@
}

.checkbox input + label::before {
border: 1px solid var(--background-tertiary);
border: var(--border-width) solid var(--background-tertiary);
border-radius: 2px;
top: 2px;
}
Expand All @@ -37,22 +37,22 @@
}
.warning input + label::before {
border-color: var(--background-secondary);
outline: 1px solid var(--color-warning);
outline: var(--border-width) solid var(--color-warning);
}
.info input + label::before {
border-color: var(--background-secondary);
outline: 1px solid var(--color-info);
outline: var(--border-width) solid var(--color-info);
}

.checkbox input + label::after {
background: transparent;
border: solid var(--background-secondary);
border-width: 0px 2px 2px 0;
border-width: 0 2px 2px 0;
width: 0.35em;
height: 0.55em;
position: absolute;
top: 6px;
left: 6px;
top: min(0.6rem, 9px);
left: 0.6rem;
margin-left: -1px;
margin-top: -2px;
opacity: 0;
Expand Down
4 changes: 2 additions & 2 deletions frontends/web/src/components/forms/input.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
border-color: var(--background-quaternary);
border-radius: 2px;
border-style: solid;
border-width: 1px;
border-width: var(--border-width);
font-family: var(--font-family);
font-size: var(--size-default);
font-weight: 400;
height: 52px;
height: var(--input-height);
padding: 0 var(--space-half);
width: 100%;
transition: border-color .2s ease-out;
Expand Down
20 changes: 10 additions & 10 deletions frontends/web/src/components/forms/radio.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.radio {
--size-default: 14px;
--size-default: 1.4rem;
line-height: 1.5;
}

Expand All @@ -13,7 +13,7 @@
flex-direction: column;
font-size: var(--size-default);
margin-right: var(--space-half);
padding-left: calc(var(--space-half) + var(--space-quarter));
padding-left: calc(1.6rem + var(--space-quarter));
position: relative;
}

Expand All @@ -22,27 +22,27 @@
background: var(--background-secondary);
content: '';
display: inline-block;
width: 12px;
height: 12px;
width: 1.2rem;
height: 1.2rem;
position: absolute;
top: 4px;
top: .4rem;
left: 0;
transition: all 100ms ease;
}

.radio input + label::before {
border: 1px solid var(--background-tertiary);
border: var(--border-width) solid var(--background-tertiary);
border-radius: 1em;
}

.radio input + label::after {
background: var(--color-blue);
border-radius: 1em;
width: 10px;
height: 10px;
width: 1rem;
height: 1rem;
position: absolute;
top: 6px;
left: 2px;
top: .6rem;
left: .2rem;
opacity: 0;
transform: scale(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}

.balanceSingleValue {
margin-left: var(--space-quarter);
margin-right: var(--space-quarter);
}

Expand All @@ -26,12 +27,13 @@
}

.select {
font-size: min(var(--size-default), 24px);
margin-bottom: var(--space-half);
}

.select :global(.react-select__group-heading) {
color: var(--color-default);
font-size: var(--size-default);
font-size: min(var(--size-default), 24px);
margin: 0;
padding-right: var(--space-quarter);
text-transform: unset;
Expand Down Expand Up @@ -72,6 +74,7 @@

.select :global(.react-select__control) {
background-color: var(--background-secondary);
min-height: var(--input-height);
padding: var(--space-quarter) var(--space-eight);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ const SelectSingleValue = (props: SingleValueProps<TOption>) => {
{coinCode ? <Logo coinCode={coinCode} alt={coinCode} /> : null}
<span className={styles.selectLabelText}>{label}</span>
{insured && <InsuredShield/>}
{coinCode && balance && <span className={styles.balanceSingleValue}>{hideAmounts ? `*** ${coinCode}` : balance}</span>}
{coinCode && balance && (
<span className={styles.balanceSingleValue}>
{hideAmounts ? `*** ${coinCode}` : balance}
</span>
)}
</div>
</components.SingleValue>
</div>
Expand Down
Loading