-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for JVFloatLabeledTextView #1
- Loading branch information
Showing
83 changed files
with
971 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,36 @@ | ||
var flf = require('ts.floatlabelfield'); | ||
|
||
// open a single window | ||
var win = Ti.UI.createWindow({ | ||
backgroundColor:'white' | ||
backgroundColor:'white', | ||
layout: 'vertical' | ||
}); | ||
var floatlabelfield = require('ts.floatlabelfield').createView({ | ||
|
||
var floatlabelfield = flf.createTextFieldView({ | ||
height: Ti.UI.SIZE, | ||
width: Ti.UI.SIZE, | ||
top: 150, | ||
fontSize: '18dp', | ||
textColor: '#2c3e50', | ||
placeholderTextColor: '#bdc3c7', | ||
placeholderTextColor: '#8d8d8d', | ||
placeholderText: "short description", | ||
floatingLabelFontSize: '20dp', | ||
floatingLabelTextColor: "#2980b9" | ||
floatingLabelFontSize: '12dp', | ||
floatingLabelTextColor: "#2980b9", | ||
debug: false | ||
}); | ||
win.add(floatlabelfield); | ||
|
||
var floatlabelview = flf.createTextViewView({ | ||
height: 150, | ||
width: 150, | ||
top: 50, | ||
fontSize: '10dp', | ||
textColor: '#2c3e50', | ||
placeholderTextColor: '#bdc3c7', | ||
placeholderText: "short description", | ||
floatingLabelFontSize: '7dp', | ||
floatingLabelTextColor: "#2980b9", | ||
debug: false | ||
}); | ||
win.add(floatlabelview); | ||
win.open(); |
3 changes: 1 addition & 2 deletions
3
ios/Classes/TsFloatlabelfieldView.h → ios/Classes/TsFloatlabelfieldTextFieldView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
ios/Classes/TsFloatlabelfieldView.m → ios/Classes/TsFloatlabelfieldTextFieldView.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import "TiViewProxy.h" | ||
|
||
@interface TsFloatlabelfieldTextFieldViewProxy: TiViewProxy | ||
{ | ||
NSString *value; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#import "TsFloatlabelfieldTextFieldViewProxy.h" | ||
#import "TsFloatlabelfieldTextFieldView.h" | ||
@implementation TsFloatlabelfieldTextFieldViewProxy | ||
|
||
-(void)viewDidAttach | ||
{ | ||
ENSURE_UI_THREAD_0_ARGS; | ||
TsFloatlabelfieldTextFieldView * view = (TsFloatlabelfieldTextFieldView *)[self view]; | ||
} | ||
|
||
|
||
-(void)setValue:(id)text | ||
{ | ||
ENSURE_STRING(text); | ||
[(TsFloatlabelfieldTextFieldView*)[self view] performSelectorOnMainThread:@selector(setValue:) | ||
withObject:text waitUntilDone:NO]; | ||
} | ||
-(NSString *)value | ||
{ | ||
return [(TsFloatlabelfieldTextFieldView*)[self view] getValue]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#import "TiUIView.h" | ||
#import "JVFloatLabeledTextView.h" | ||
|
||
@interface TsFloatlabelfieldTextViewView : TiUIView<UITextViewDelegate> | ||
{ | ||
JVFloatLabeledTextView *fltf; | ||
NSNumber *debug; | ||
} | ||
|
||
-(void)setValue:(id)text; | ||
-(id)getValue; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
|
||
#import "TsFloatlabelfieldTextViewView.h" | ||
#import "TsFloatlabelfieldTextViewViewProxy.h" | ||
|
||
@implementation TsFloatlabelfieldTextViewView | ||
|
||
-(JVFloatLabeledTextView*)FLTF | ||
{ | ||
if (fltf==nil) | ||
{ | ||
fltf = [[JVFloatLabeledTextView alloc] initWithFrame:CGRectZero]; | ||
fltf.delegate = self; | ||
[self addSubview:fltf]; | ||
[self bringSubviewToFront:fltf]; | ||
fltf.translatesAutoresizingMaskIntoConstraints = NO; | ||
} | ||
return fltf; | ||
} | ||
|
||
-(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds | ||
{ | ||
if(debug) NSLog(@"[FLFV] frameSizeChanged frame %@ : %@ ", NSStringFromCGRect(frame), NSStringFromCGRect(fltf.frame)); | ||
// If using Ti.UI.SIZE, frameSizeChanged is called with size (0,0). TODO | ||
[TiUtils setView:fltf positionRect: bounds]; | ||
[super frameSizeChanged:frame bounds:bounds]; | ||
} | ||
|
||
- (void)textViewDidChange:(UITextView *)textView | ||
{ | ||
[[self proxy] fireEvent:@"change" withObject:[NSDictionary dictionaryWithObject:[(UITextView *)fltf text] forKey:@"value"]]; | ||
} | ||
|
||
- (void) dealloc | ||
{ | ||
fltf.delegate = nil; | ||
RELEASE_TO_NIL(fltf); | ||
[super dealloc]; | ||
} | ||
|
||
|
||
#pragma mark Public API | ||
|
||
-(void)setValue:(id)text | ||
{ | ||
if(debug) NSLog(@"[FLFV] setValue %@", text); | ||
[self FLTF].text = text; | ||
} | ||
-(id)getValue | ||
{ | ||
if(debug) NSLog(@"[FLFV] getValue"); | ||
return [self FLTF].text; | ||
} | ||
|
||
-(void)setValue_:(id)text | ||
{ | ||
ENSURE_SINGLE_ARG(text, NSString); | ||
[self setValue:text]; | ||
} | ||
|
||
-(void)setFontSize_:(id)size | ||
{ | ||
if(debug) NSLog(@"[FLFV] setFontSize_"); | ||
[self FLTF].font = [UIFont systemFontOfSize:[TiUtils floatValue:size def:20]]; | ||
} | ||
|
||
-(void)setTextColor_:(id)color | ||
{ | ||
ENSURE_SINGLE_ARG(color, NSString); | ||
if(debug) NSLog(@"[FLFV] setTextColor %@", color); | ||
|
||
[self FLTF].tintColor = [[TiUtils colorValue:color] _color]; | ||
[self FLTF].textColor = [[TiUtils colorValue:color] _color]; | ||
} | ||
|
||
-(void)setPlaceholderText_:(id)text | ||
{ | ||
ENSURE_SINGLE_ARG(text, NSString); | ||
if(debug) NSLog(@"[FLFV] setPlaceholderText"); | ||
[self FLTF].placeholder = text; | ||
} | ||
|
||
-(void)setPlaceholderTextColor_:(id)color | ||
{ | ||
ENSURE_SINGLE_ARG(color, NSString); | ||
if(debug) NSLog(@"[FLFV] setPlaceholderTextColor %@", color); | ||
[self FLTF].placeholderTextColor = [[TiUtils colorValue:color] _color]; | ||
} | ||
|
||
-(void)setFloatingLabelFontSize_:(id)size | ||
{ | ||
if(debug) NSLog(@"[FLFV] setFloatingLabelFontSize_"); | ||
[self FLTF].floatingLabelFont = [UIFont boldSystemFontOfSize:[TiUtils floatValue:size def:10]]; | ||
} | ||
|
||
-(void)setFloatingLabelTextColor_:(id)color | ||
{ | ||
if(debug) NSLog(@"[FLFV] setFloatingLabelTextColor_"); | ||
ENSURE_SINGLE_ARG(color, NSString); | ||
// Use the TiUtils methods to get the values from the arguments | ||
[self FLTF].floatingLabelTextColor = [[TiUtils colorValue:color] _color]; | ||
[self FLTF].floatingLabelActiveTextColor = [[TiUtils colorValue:color] _color]; | ||
} | ||
|
||
-(void)setDebug_:(id)yesno | ||
{ | ||
debug = [TiUtils boolValue:yesno]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import "TiViewProxy.h" | ||
|
||
@interface TsFloatlabelfieldTextViewViewProxy: TiViewProxy | ||
{ | ||
NSString *value; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#import "TsFloatlabelfieldTextViewViewProxy.h" | ||
#import "TsFloatlabelfieldTextViewView.h" | ||
@implementation TsFloatlabelfieldTextViewViewProxy | ||
|
||
-(void)viewDidAttach | ||
{ | ||
ENSURE_UI_THREAD_0_ARGS; | ||
TsFloatlabelfieldTextViewView * view = (TsFloatlabelfieldTextViewView *)[self view]; | ||
} | ||
|
||
|
||
-(void)setValue:(id)text | ||
{ | ||
ENSURE_STRING(text); | ||
[(TsFloatlabelfieldTextViewView*)[self view] performSelectorOnMainThread:@selector(setValue:) | ||
withObject:text waitUntilDone:NO]; | ||
} | ||
-(NSString *)value | ||
{ | ||
return [(TsFloatlabelfieldTextViewView*)[self view] getValue]; | ||
} | ||
|
||
@end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 4 additions & 2 deletions
6
...ase-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfield.LinkFileList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/JVFloatLabeledTextView.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldModule.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/NSString+TextDirectionality.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldViewProxy.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldView.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldTextFieldViewProxy.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldTextViewViewProxy.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldTextFieldView.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/JVFloatLabeledTextField.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldTextViewView.o | ||
/Users/pierre/TheSmiths/ts.floatlabelfield/ios/build/ts.floatlabelfield.build/Release-iphoneos/ts.floatlabelfield.build/Objects-normal/arm64/TsFloatlabelfieldModuleAssets.o |
Oops, something went wrong.