Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25374] Android: borderColor not visible on Android tiSDK 6.2.2 #9510

Merged
merged 9 commits into from Nov 13, 2017

Conversation

ypbnv
Copy link
Contributor

@ypbnv ypbnv commented Oct 9, 2017

JIRA: https://jira.appcelerator.org/browse/TIMOB-25374

Description:
Set default border width of 1 unit. Change in documentation.

#9507 needs to be merged first for this change to have a point.

Test case:

var win = Ti.UI.createWindow();
var view = Ti.UI.createView({width: 200, height: 200, backgroundColor: 'white', borderColor: 'red'});
win.add(view);
win.open();

@ypbnv ypbnv added this to the 7.0.0 milestone Oct 9, 2017
@ypbnv ypbnv requested a review from garymathews October 9, 2017 10:48
@@ -1427,14 +1427,18 @@ private void initializeBorder(KrollDict d, Integer bgColor)
borderView.setColor(TiConvert.toColor(d, TiC.PROPERTY_BORDER_COLOR));
}

//Have a default border width of 1
Object borderWidth = "1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've confirmed that Titanium for iOS defaults the borderWidth to "1dp" (Apple's framework takes UI measurements in points/dips by default). This can be seen in the [TiUIView setBorderColor] method here...
https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUIView.m#L483

So, I recommend that you change "1" to "1dp" here to match iOS' behavior.

Copy link
Contributor Author

@ypbnv ypbnv Oct 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jquick-axway I set it as a String with value '1' to use the ti.ui.defaultunit that is set in tiapp.xml. I think iOS does the same here:
https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiDimension.m#L103

@@ -1223,7 +1223,7 @@ properties:
- name: borderWidth
summary: Border width of the view.
type: Number
default: 0
default: 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure here. It is 0 by default, but 1 if any related border is set. So if no border-related properties are set, I think it does not set 1 on iOS (cc @jquick-axway).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hansemannn Fair enough. Maybe adding as a description that we set default width to 1 if any border related property is set?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it only gets set to 1 when borderColor is set? It is not set to 1 when borderRadius is set on either platforms.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, sorry for the confusion. Quite simple implementation on iOS:

- (void)setBorderColor_:(id)color
{
  TiColor *ticolor = [TiUtils colorValue:color];
  self.layer.borderWidth = MAX(self.layer.borderWidth, 1);
  self.layer.borderColor = [ticolor _color].CGColor;
}

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@build
Copy link
Contributor

build commented Oct 25, 2017

Fails
🚫

Tests have failed, see below for more information.

Tests:

Classname Name Time Error
ios.Titanium.UI.View border with only borderColor set 5.002 file:///Users/build/Libra

Generated by 🚫 dangerJS

@lokeshchdhry
Copy link
Contributor

FR Passed.

If no borderWidth is set & borderColor is specified then borderwidth will automatically be 1.

Studio Ver: 4.10.0.201709271713
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.10
Appc CLI: 6.3.0
Ti CLI Ver: 5.0.14
Alloy Ver: 1.10.7
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 6P --- Android 8.0.0
⇨ google Nexus 5 --- Android 6.0.1

@eric34 eric34 merged commit d82c621 into tidev:master Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants