Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19802

Android: CardView should use standard property names

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: Release 5.1.0
    • Fix Version/s: Release 5.1.2
    • Component/s: Android
    • Labels:
      None
    • Environment:

      SDK 5.1.0.v20151026164636

    • Story Points:
      3
    • Sprint:
      2015 Sprint 24 SDK

      Description

      The following sample shows that both backgroundColor and cardBackgroundColor work, but the one with backgroundColor doesn't show a border/corner radius. Because of TIMOB-19801 I cannot verify, but I guess when I would set both I would see a rectangle without radius behind one that has?

      Is there an actual use case to have both (working, if we resolve TIMOB-19801)? If so, then we need to document the difference. If not, then I'd say we rename cardBackgroundColor to backgroundColor.

      var win = Ti.UI.createWindow({
      	layout: 'vertical'
      });
       
      var card1 = Ti.UI.Android.createCardView({
      	top: 20,
      	left: 20,
      	right: 20,
      	contentPadding: 20,
       
      	cardBackgroundColor: '#F00'
      });
       
      card1.add(Ti.UI.createLabel({
      	text: 'cardBackgroundColor',
      	color: '#000'
      }));
       
      win.add(card1);
       
      var card2 = Ti.UI.Android.createCardView({
      	top: 20,
      	left: 20,
      	right: 20,
      	contentPadding: 20,
       
      	backgroundColor: '#F00'
      });
       
      card2.add(Ti.UI.createLabel({
      	text: 'backgroundColor',
      	color: '#000'
      }));
       
      win.add(card2);
       
      win.open();
      

      UPDATE: I'm not convinced deviating from standard properties like backgroundColor, borderRadius, elevation and *Padding.

      • Pro: Easier to translate what you read in the Android reference to your Titanium app.
      • Con: Titanium developers are used to our naming conventions throughout what is after all a cross-platform SDK, even for platform-specific components.

      Given my experience that most Titanium developers do not read the target platform references but rely on our docs and - lazy as developers are - the predictability of our API I think we should:

      • Remove the card prefix from the CardView specific properties.
      • Rename (card)CornerRadius to borderRadius.
      • Remove the content prefix from the contentPadding* properties.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                msamah Ashraf Abu (Inactive)
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Srikanth Sombhatla (Inactive)
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code