|
22 | 22 | import org.mozilla.geckoview.StorageController; |
23 | 23 | import org.mozilla.vrbrowser.R; |
24 | 24 | import org.mozilla.vrbrowser.browser.SettingsStore; |
25 | | -import org.mozilla.vrbrowser.browser.engine.SessionState; |
26 | 25 | import org.mozilla.vrbrowser.browser.engine.SessionStore; |
27 | 26 | import org.mozilla.vrbrowser.databinding.OptionsPrivacyBinding; |
28 | | -import org.mozilla.vrbrowser.db.SitePermission; |
29 | 27 | import org.mozilla.vrbrowser.ui.views.settings.RadioGroupSetting; |
30 | 28 | import org.mozilla.vrbrowser.ui.views.settings.SwitchSetting; |
31 | 29 | import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate; |
@@ -132,6 +130,9 @@ protected void updateUI() { |
132 | 130 | mBinding.restoreTabsSwitch.setOnCheckedChangeListener(mRestoreTabsListener); |
133 | 131 | setRestoreTabs(SettingsStore.getInstance(getContext()).isRestoreTabsEnabled(), false); |
134 | 132 |
|
| 133 | + mBinding.autocompleteSwitch.setOnCheckedChangeListener(mAutocompleteListener); |
| 134 | + setAutocomplete(SettingsStore.getInstance(getContext()).isAutocompleteEnabled(), false); |
| 135 | + |
135 | 136 | mBinding.webxrSwitch.setOnCheckedChangeListener(mWebXRListener); |
136 | 137 | setWebXR(SettingsStore.getInstance(getContext()).isWebXREnabled(), false); |
137 | 138 | mBinding.webxrExceptionsButton.setOnClickListener(v -> mDelegate.showView(SettingViewType.WEBXR_EXCEPTIONS)); |
@@ -202,6 +203,10 @@ public void reject() { |
202 | 203 | setRestoreTabs(value, doApply); |
203 | 204 | }; |
204 | 205 |
|
| 206 | + private SwitchSetting.OnCheckedChangeListener mAutocompleteListener = (compoundButton, value, doApply) -> { |
| 207 | + setAutocomplete(value, doApply); |
| 208 | + }; |
| 209 | + |
205 | 210 | private SwitchSetting.OnCheckedChangeListener mWebXRListener = (compoundButton, value, doApply) -> { |
206 | 211 | setWebXR(value, doApply); |
207 | 212 | }; |
@@ -243,6 +248,10 @@ private void resetOptions() { |
243 | 248 | setRestoreTabs(SettingsStore.RESTORE_TABS_ENABLED, true); |
244 | 249 | } |
245 | 250 |
|
| 251 | + if (mBinding.autocompleteSwitch.isChecked() != SettingsStore.AUTOCOMPLETE_ENABLED) { |
| 252 | + setAutocomplete(SettingsStore.AUTOCOMPLETE_ENABLED, true); |
| 253 | + } |
| 254 | + |
246 | 255 | if (mBinding.webxrSwitch.isChecked() != SettingsStore.WEBXR_ENABLED_DEFAULT) { |
247 | 256 | setWebXR(SettingsStore.WEBXR_ENABLED_DEFAULT, true); |
248 | 257 | } |
@@ -332,6 +341,16 @@ private void setRestoreTabs(boolean value, boolean doApply) { |
332 | 341 | } |
333 | 342 | } |
334 | 343 |
|
| 344 | + private void setAutocomplete(boolean value, boolean doApply) { |
| 345 | + mBinding.autocompleteSwitch.setOnCheckedChangeListener(null); |
| 346 | + mBinding.autocompleteSwitch.setValue(value, false); |
| 347 | + mBinding.autocompleteSwitch.setOnCheckedChangeListener(mAutocompleteListener); |
| 348 | + |
| 349 | + if (doApply) { |
| 350 | + SettingsStore.getInstance(getContext()).setAutocompleteEnabled(value); |
| 351 | + } |
| 352 | + } |
| 353 | + |
335 | 354 | private void setWebXR(boolean value, boolean doApply) { |
336 | 355 | mBinding.webxrSwitch.setOnCheckedChangeListener(null); |
337 | 356 | mBinding.webxrSwitch.setValue(value, false); |
|
0 commit comments