Skip to content

Commit

Permalink
Add ability to change ui scale
Browse files Browse the repository at this point in the history
this is related to #460
  • Loading branch information
MarmadileManteater committed Jan 9, 2025
1 parent 5909686 commit 2465536
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MainActivity : AppCompatActivity(), OnRequestPermissionsResultCallback {
setContentView(binding.root)
webView = binding.webView
webView.setBackgroundColor(Color.TRANSPARENT)
webView.setInitialScale(400)

// bind the back button to the web-view history
onBackPressedDispatcher.addCallback {
if (isInAPrompt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ fun WebView.consoleWarn(message: String) {

fun WebView.setScale(scale: Double) {
post {
setInitialScale((400 * scale).toInt())
setInitialScale((350 * scale).toInt())
}
}
3 changes: 2 additions & 1 deletion src/renderer/components/ThemeSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/>
</div>
</div>
<template v-if="usingElectron">
<template v-if="usingElectron || usingAndroid">
<FtFlexBox>
<FtSlider
:label="$t('Settings.Theme Settings.UI Scale')"
Expand Down Expand Up @@ -267,6 +267,7 @@ function updateUiScale(value) {
/** @type {boolean} */
const usingElectron = process.env.IS_ELECTRON
const usingAndroid = process.env.IS_ANDROID
const RESTART_PROMPT_VALUES = [
'restart',
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ const sideEffectHandlers = {
if (process.env.IS_ELECTRON) {
const { webFrame } = require('electron')
webFrame.setZoomFactor(value / 100)
} else if (process.env.IS_ANDROID) {
android.setScale(value)
}
}
}
Expand Down

0 comments on commit 2465536

Please sign in to comment.