| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,8 @@ | |||
| 1 | 1 | import { Font } from "../styling/font"; | |
| 2 | 2 | import { | |
| 3 | 3 | SearchBarBase, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty, fontInternalProperty, | |
| 4 | - textProperty, hintProperty, textFieldHintColorProperty, textFieldBackgroundColorProperty, fontSizeProperty | ||
| 4 | + textProperty, hintProperty, textFieldHintColorProperty, textFieldBackgroundColorProperty, fontSizeProperty, | ||
| 5 | + isEnabledProperty, isUserInteractionEnabledProperty | ||
| 5 | 6 | } from "./search-bar-common"; | |
| 6 | 7 | import { ad } from "../../utils/utils"; | |
| 7 | 8 | ||
@@ -76,6 +77,33 @@ function initializeNativeClasses(): void { | |||
| 76 | 77 | CloseListener = CompatCloseListenerImpl; | |
| 77 | 78 | } | |
| 78 | 79 | ||
| 80 | + function enableSearchView(nativeView: any, value: boolean) { | ||
| 81 | + nativeView.setEnabled(value); | ||
| 82 | + | ||
| 83 | + if (!(nativeView instanceof android.view.ViewGroup)) { | ||
| 84 | + return; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + for (let i = 0; i < nativeView.getChildCount(); i++) { | ||
| 88 | + let child = nativeView.getChildAt(i); | ||
| 89 | + enableSearchView(child, value); | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + function enableUserInteractionSearchView(nativeView: any, value: boolean) { | ||
| 94 | + nativeView.setClickable(value); | ||
| 95 | + nativeView.setFocusable(value); | ||
| 96 | + | ||
| 97 | + if (!(nativeView instanceof android.view.ViewGroup)) { | ||
| 98 | + return; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + for (let i = 0; i < nativeView.getChildCount(); i++) { | ||
| 102 | + let child = nativeView.getChildAt(i); | ||
| 103 | + enableUserInteractionSearchView(child, value); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 79 | 107 | export class SearchBar extends SearchBarBase { | |
| 80 | 108 | nativeViewProtected: android.support.v7.widget.SearchView; | |
| 81 | 109 | private _searchTextView: android.widget.TextView; | |
@@ -122,6 +150,14 @@ export class SearchBar extends SearchBarBase { | |||
| 122 | 150 | super.disposeNativeView(); | |
| 123 | 151 | } | |
| 124 | 152 | ||
| 153 | + [isEnabledProperty.setNative](value: boolean) { | ||
| 154 | + enableSearchView(this.nativeViewProtected, value); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + [isUserInteractionEnabledProperty.setNative](value: boolean) { | ||
| 158 | + enableUserInteractionSearchView(this.nativeViewProtected, value); | ||
| 159 | + } | ||
| 160 | + | ||
| 125 | 161 | [backgroundColorProperty.getDefault](): number { | |
| 126 | 162 | // TODO: Why do we get DrawingCacheBackgroundColor but set backgroundColor????? | |
| 127 | 163 | const result = this.nativeViewProtected.getDrawingCacheBackgroundColor(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | import { Font } from "../styling/font"; | |
| 2 | 2 | import { | |
| 3 | 3 | SearchBarBase, Color, colorProperty, backgroundColorProperty, backgroundInternalProperty, fontInternalProperty, | |
| 4 | - textProperty, hintProperty, textFieldHintColorProperty, textFieldBackgroundColorProperty | ||
| 4 | + textProperty, hintProperty, textFieldHintColorProperty, textFieldBackgroundColorProperty, isEnabledProperty | ||
| 5 | 5 | } from "./search-bar-common"; | |
| 6 | 6 | import { ios as iosUtils } from "../../utils/utils"; | |
| 7 | 7 | ||
@@ -123,6 +123,18 @@ export class SearchBar extends SearchBarBase { | |||
| 123 | 123 | return this.__placeholderLabel; | |
| 124 | 124 | } | |
| 125 | 125 | ||
| 126 | + [isEnabledProperty.setNative](value: boolean) { | ||
| 127 | + const nativeView = this.nativeViewProtected; | ||
| 128 | + if (nativeView instanceof UIControl) { | ||
| 129 | + nativeView.enabled = value; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + const textField = this._textField; | ||
| 133 | + if (textField) { | ||
| 134 | + textField.enabled = value; | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + | ||
| 126 | 138 | [backgroundColorProperty.getDefault](): UIColor { | |
| 127 | 139 | return this.ios.barTintColor; | |
| 128 | 140 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments