Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
8caf7fb1
Commit
8caf7fb1
authored
Aug 16, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated TextField accessibility settings and Material version to 2.9.4 for next release
parent
862927ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
29 deletions
+44
-29
Sources/Info.plist
+1
-1
Sources/iOS/SearchBarController.swift
+18
-3
Sources/iOS/TextField.swift
+25
-25
No files found.
Sources/Info.plist
View file @
8caf7fb1
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
2.9.
3
<
/string
>
<
string
>
2.9.
4
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
Sources/iOS/SearchBarController.swift
View file @
8caf7fb1
...
@@ -30,6 +30,12 @@
...
@@ -30,6 +30,12 @@
import
UIKit
import
UIKit
@objc(SearchBarAlignment)
public
enum
SearchBarAlignment
:
Int
{
case
top
case
bottom
}
public
extension
UIViewController
{
public
extension
UIViewController
{
/**
/**
A convenience property that provides access to the SearchBarController.
A convenience property that provides access to the SearchBarController.
...
@@ -46,6 +52,13 @@ open class SearchBarController: StatusBarController {
...
@@ -46,6 +52,13 @@ open class SearchBarController: StatusBarController {
@IBInspectable
@IBInspectable
open
let
searchBar
=
SearchBar
()
open
let
searchBar
=
SearchBar
()
/// The searchBar alignment.
open
var
searchBarAlignment
=
SearchBarAlignment
.
top
{
didSet
{
layoutSubviews
()
}
}
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
...
@@ -56,6 +69,8 @@ open class SearchBarController: StatusBarController {
...
@@ -56,6 +69,8 @@ open class SearchBarController: StatusBarController {
switch
displayStyle
{
switch
displayStyle
{
case
.
partial
:
case
.
partial
:
let
h
=
y
+
searchBar
.
height
let
h
=
y
+
searchBar
.
height
container
.
y
=
h
container
.
y
=
h
container
.
height
=
view
.
height
-
h
container
.
height
=
view
.
height
-
h
...
@@ -75,14 +90,14 @@ open class SearchBarController: StatusBarController {
...
@@ -75,14 +90,14 @@ open class SearchBarController: StatusBarController {
}
}
}
}
extension
SearchBarController
{
fileprivate
extension
SearchBarController
{
/// Prepares the statusBar.
/// Prepares the statusBar.
f
ileprivate
f
unc
prepareStatusBar
()
{
func
prepareStatusBar
()
{
shouldHideStatusBarOnRotation
=
false
shouldHideStatusBarOnRotation
=
false
}
}
/// Prepares the searchBar.
/// Prepares the searchBar.
f
ileprivate
f
unc
prepareSearchBar
()
{
func
prepareSearchBar
()
{
searchBar
.
depthPreset
=
.
depth1
searchBar
.
depthPreset
=
.
depth1
searchBar
.
zPosition
=
1000
searchBar
.
zPosition
=
1000
view
.
addSubview
(
searchBar
)
view
.
addSubview
(
searchBar
)
...
...
Sources/iOS/TextField.swift
View file @
8caf7fb1
...
@@ -283,7 +283,7 @@ open class TextField: UITextField {
...
@@ -283,7 +283,7 @@ open class TextField: UITextField {
clearButtonMode
=
.
never
clearButtonMode
=
.
never
rightViewMode
=
.
whileEditing
rightViewMode
=
.
whileEditing
rightView
=
clearIconButton
rightView
=
clearIconButton
isClearIconButtonAutoHandled
=
isClearIconButtonAutoHandled
?
true
:
false
isClearIconButtonAutoHandled
=
{
isClearIconButtonAutoHandled
}()
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -330,7 +330,7 @@ open class TextField: UITextField {
...
@@ -330,7 +330,7 @@ open class TextField: UITextField {
clearButtonMode
=
.
never
clearButtonMode
=
.
never
rightViewMode
=
.
whileEditing
rightViewMode
=
.
whileEditing
rightView
=
visibilityIconButton
rightView
=
visibilityIconButton
isVisibilityIconButtonAutoHandled
=
isVisibilityIconButtonAutoHandled
?
true
:
false
isVisibilityIconButtonAutoHandled
=
{
isVisibilityIconButtonAutoHandled
}()
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -338,7 +338,7 @@ open class TextField: UITextField {
...
@@ -338,7 +338,7 @@ open class TextField: UITextField {
/// Enables the automatic handling of the visibilityIconButton.
/// Enables the automatic handling of the visibilityIconButton.
@IBInspectable
@IBInspectable
open
var
isVisibilityIconButtonAutoHandled
:
Bool
=
true
{
open
var
isVisibilityIconButtonAutoHandled
=
true
{
didSet
{
didSet
{
visibilityIconButton
?
.
removeTarget
(
self
,
action
:
#selector(
handleVisibilityIconButton
)
,
for
:
.
touchUpInside
)
visibilityIconButton
?
.
removeTarget
(
self
,
action
:
#selector(
handleVisibilityIconButton
)
,
for
:
.
touchUpInside
)
...
@@ -428,21 +428,21 @@ open class TextField: UITextField {
...
@@ -428,21 +428,21 @@ open class TextField: UITextField {
}
}
}
}
extension
TextField
{
fileprivate
extension
TextField
{
/// Prepares the divider.
/// Prepares the divider.
f
ileprivate
f
unc
prepareDivider
()
{
func
prepareDivider
()
{
dividerColor
=
dividerNormalColor
dividerColor
=
dividerNormalColor
}
}
/// Prepares the placeholderLabel.
/// Prepares the placeholderLabel.
f
ileprivate
f
unc
preparePlaceholderLabel
()
{
func
preparePlaceholderLabel
()
{
placeholderNormalColor
=
Color
.
darkText
.
others
placeholderNormalColor
=
Color
.
darkText
.
others
placeholderLabel
.
backgroundColor
=
.
clear
placeholderLabel
.
backgroundColor
=
.
clear
addSubview
(
placeholderLabel
)
addSubview
(
placeholderLabel
)
}
}
/// Prepares the detailLabel.
/// Prepares the detailLabel.
f
ileprivate
f
unc
prepareDetailLabel
()
{
func
prepareDetailLabel
()
{
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
numberOfLines
=
0
detailLabel
.
numberOfLines
=
0
detailColor
=
Color
.
darkText
.
others
detailColor
=
Color
.
darkText
.
others
...
@@ -450,46 +450,46 @@ extension TextField {
...
@@ -450,46 +450,46 @@ extension TextField {
}
}
/// Prepares the leftView.
/// Prepares the leftView.
f
ileprivate
f
unc
prepareLeftView
()
{
func
prepareLeftView
()
{
leftView
?
.
contentMode
=
.
left
leftView
?
.
contentMode
=
.
left
leftViewMode
=
.
always
leftViewMode
=
.
always
updateLeftViewColor
()
updateLeftViewColor
()
}
}
/// Prepares the target handlers.
/// Prepares the target handlers.
f
ileprivate
f
unc
prepareTargetHandlers
()
{
func
prepareTargetHandlers
()
{
addTarget
(
self
,
action
:
#selector(
handleEditingDidBegin
)
,
for
:
.
editingDidBegin
)
addTarget
(
self
,
action
:
#selector(
handleEditingDidBegin
)
,
for
:
.
editingDidBegin
)
addTarget
(
self
,
action
:
#selector(
handleEditingChanged
)
,
for
:
.
editingChanged
)
addTarget
(
self
,
action
:
#selector(
handleEditingChanged
)
,
for
:
.
editingChanged
)
addTarget
(
self
,
action
:
#selector(
handleEditingDidEnd
)
,
for
:
.
editingDidEnd
)
addTarget
(
self
,
action
:
#selector(
handleEditingDidEnd
)
,
for
:
.
editingDidEnd
)
}
}
/// Prepares the textAlignment.
/// Prepares the textAlignment.
f
ileprivate
f
unc
prepareTextAlignment
()
{
func
prepareTextAlignment
()
{
textAlignment
=
.
rightToLeft
==
Application
.
userInterfaceLayoutDirection
?
.
right
:
.
left
textAlignment
=
.
rightToLeft
==
Application
.
userInterfaceLayoutDirection
?
.
right
:
.
left
}
}
}
}
extension
TextField
{
fileprivate
extension
TextField
{
/// Updates the leftView tint color.
/// Updates the leftView tint color.
f
ileprivate
f
unc
updateLeftViewColor
()
{
func
updateLeftViewColor
()
{
leftView
?
.
tintColor
=
isEditing
?
leftViewActiveColor
:
leftViewNormalColor
leftView
?
.
tintColor
=
isEditing
?
leftViewActiveColor
:
leftViewNormalColor
}
}
/// Updates the placeholderLabel text color.
/// Updates the placeholderLabel text color.
f
ileprivate
f
unc
updatePlaceholderLabelColor
()
{
func
updatePlaceholderLabelColor
()
{
tintColor
=
placeholderActiveColor
tintColor
=
placeholderActiveColor
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
}
}
/// Updates the detailLabel text color.
/// Updates the detailLabel text color.
f
ileprivate
f
unc
updateDetailLabelColor
()
{
func
updateDetailLabelColor
()
{
detailLabel
.
textColor
=
detailColor
detailLabel
.
textColor
=
detailColor
}
}
}
}
extension
TextField
{
fileprivate
extension
TextField
{
/// Layout the placeholderLabel.
/// Layout the placeholderLabel.
f
ileprivate
f
unc
layoutPlaceholderLabel
()
{
func
layoutPlaceholderLabel
()
{
let
w
=
leftViewWidth
+
textInset
let
w
=
leftViewWidth
+
textInset
let
h
=
0
==
height
?
intrinsicContentSize
.
height
:
height
let
h
=
0
==
height
?
intrinsicContentSize
.
height
:
height
...
@@ -515,7 +515,7 @@ extension TextField {
...
@@ -515,7 +515,7 @@ extension TextField {
}
}
/// Layout the detailLabel.
/// Layout the detailLabel.
f
ileprivate
f
unc
layoutDetailLabel
()
{
func
layoutDetailLabel
()
{
let
c
=
dividerContentEdgeInsets
let
c
=
dividerContentEdgeInsets
detailLabel
.
height
=
detailLabel
.
sizeThatFits
(
CGSize
(
width
:
width
,
height
:
.
greatestFiniteMagnitude
))
.
height
detailLabel
.
height
=
detailLabel
.
sizeThatFits
(
CGSize
(
width
:
width
,
height
:
.
greatestFiniteMagnitude
))
.
height
detailLabel
.
x
=
c
.
left
detailLabel
.
x
=
c
.
left
...
@@ -524,12 +524,12 @@ extension TextField {
...
@@ -524,12 +524,12 @@ extension TextField {
}
}
/// Layout the a button.
/// Layout the a button.
f
ileprivate
f
unc
layoutButton
(
button
:
UIButton
?)
{
func
layoutButton
(
button
:
UIButton
?)
{
button
?
.
frame
=
CGRect
(
x
:
width
-
height
,
y
:
0
,
width
:
height
,
height
:
height
)
button
?
.
frame
=
CGRect
(
x
:
width
-
height
,
y
:
0
,
width
:
height
,
height
:
height
)
}
}
/// Layout the leftView.
/// Layout the leftView.
f
ileprivate
f
unc
layoutLeftView
()
{
func
layoutLeftView
()
{
guard
let
v
=
leftView
else
{
guard
let
v
=
leftView
else
{
return
return
}
}
...
@@ -540,10 +540,10 @@ extension TextField {
...
@@ -540,10 +540,10 @@ extension TextField {
}
}
}
}
extension
TextField
{
fileprivate
extension
TextField
{
/// Handles the text editing did begin state.
/// Handles the text editing did begin state.
@objc
@objc
f
ileprivate
f
unc
handleEditingDidBegin
()
{
func
handleEditingDidBegin
()
{
leftViewEditingBeginAnimation
()
leftViewEditingBeginAnimation
()
placeholderEditingDidBeginAnimation
()
placeholderEditingDidBeginAnimation
()
dividerEditingDidBeginAnimation
()
dividerEditingDidBeginAnimation
()
...
@@ -551,13 +551,13 @@ extension TextField {
...
@@ -551,13 +551,13 @@ extension TextField {
// Live updates the textField text.
// Live updates the textField text.
@objc
@objc
f
ileprivate
f
unc
handleEditingChanged
(
textField
:
UITextField
)
{
func
handleEditingChanged
(
textField
:
UITextField
)
{
(
delegate
as?
TextFieldDelegate
)?
.
textField
?(
textField
:
self
,
didChange
:
textField
.
text
)
(
delegate
as?
TextFieldDelegate
)?
.
textField
?(
textField
:
self
,
didChange
:
textField
.
text
)
}
}
/// Handles the text editing did end state.
/// Handles the text editing did end state.
@objc
@objc
f
ileprivate
f
unc
handleEditingDidEnd
()
{
func
handleEditingDidEnd
()
{
leftViewEditingEndAnimation
()
leftViewEditingEndAnimation
()
placeholderEditingDidEndAnimation
()
placeholderEditingDidEndAnimation
()
dividerEditingDidEndAnimation
()
dividerEditingDidEndAnimation
()
...
@@ -565,7 +565,7 @@ extension TextField {
...
@@ -565,7 +565,7 @@ extension TextField {
/// Handles the clearIconButton TouchUpInside event.
/// Handles the clearIconButton TouchUpInside event.
@objc
@objc
f
ileprivate
f
unc
handleClearIconButton
()
{
func
handleClearIconButton
()
{
guard
nil
==
delegate
?
.
textFieldShouldClear
||
true
==
delegate
?
.
textFieldShouldClear
?(
self
)
else
{
guard
nil
==
delegate
?
.
textFieldShouldClear
||
true
==
delegate
?
.
textFieldShouldClear
?(
self
)
else
{
return
return
}
}
...
@@ -581,7 +581,7 @@ extension TextField {
...
@@ -581,7 +581,7 @@ extension TextField {
/// Handles the visibilityIconButton TouchUpInside event.
/// Handles the visibilityIconButton TouchUpInside event.
@objc
@objc
f
ileprivate
f
unc
handleVisibilityIconButton
()
{
func
handleVisibilityIconButton
()
{
isSecureTextEntry
=
!
isSecureTextEntry
isSecureTextEntry
=
!
isSecureTextEntry
if
!
isSecureTextEntry
{
if
!
isSecureTextEntry
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment