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-10535: Android: Deprecate updateLayout, startLayout, finishLayout #2801

Merged
merged 4 commits into from
Aug 27, 2012
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public abstract class TiViewProxy extends KrollProxy implements Handler.Callback
protected Object pendingAnimationLock;
protected TiAnimationBuilder pendingAnimation;
private boolean isDecorView = false;
private AtomicBoolean layoutStarted = new AtomicBoolean();

// TODO: Deprecated since Release 2.2.0
@Deprecated private AtomicBoolean layoutStarted = new AtomicBoolean();

/**
* Constructs a new TiViewProxy instance.
Expand Down Expand Up @@ -975,15 +977,21 @@ public KrollDict convertPointToView(KrollDict point, TiViewProxy dest)
return destPoint;
}

@Kroll.method
// TODO: Deprecated since Release 2.2.0
@Kroll.method @Deprecated
public void startLayout()
{
Log.w(TAG, "startLayout() is deprecated.", Log.DEBUG_MODE);

layoutStarted.set(true);
}

@Kroll.method
// TODO: Deprecated since Release 2.2.0
@Kroll.method @Deprecated
public void finishLayout()
{
Log.w(TAG, "finishLayout() is deprecated.", Log.DEBUG_MODE);

// Don't force a layout if startLayout() was never called
if (!isLayoutStarted()) {
return;
Expand All @@ -996,9 +1004,12 @@ public void finishLayout()
layoutStarted.set(false);
}

@Kroll.method
// TODO: Deprecated since Release 2.2.0
@Kroll.method @Deprecated
public void updateLayout(Object params)
{
Log.w(TAG, "updateLayout() is deprecated.", Log.DEBUG_MODE);

HashMap<String, Object> paramsMap;

if (!(params instanceof HashMap)) {
Expand Down Expand Up @@ -1034,8 +1045,10 @@ private void handleUpdateLayout(HashMap<String, Object> params)
handleFinishLayout();
}

// TODO: Deprecated since Release 2.2.0
// This is used to check if the user has called startLayout(). We mainly use this to perform a check before running
// deprecated behavior. (i.e. performing layout when a property has changed, and the user didn't call startLayout)
@Deprecated
public boolean isLayoutStarted()
{
return layoutStarted.get();
Expand Down
3 changes: 3 additions & 0 deletions apidoc/Titanium/UI/View.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ methods:

- name: finishLayout
since: "2.0.0"
deprecated: {since: "2.2.0"}
Copy link
Contributor

Choose a reason for hiding this comment

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

We are adding support for a new key here, "notes:" Please use it to refer to the alternative API.

deprecated: 
    since: "2.2.0"
    notes: Use the [applyProperties](Titanium.Proxy.applyProperties) method to batch-update layout properties.

(You can also use the deprecated: { since: "...", notes: "..." } form, but I think this is a little easier to read when you're including text.)

summary: |
Finishes a batch update of the View's layout properties and schedules a layout pass of the
view tree.
Expand Down Expand Up @@ -509,6 +510,7 @@ methods:

On Mobile Web, this method is included for parity only, and thus has no effect.
since: "2.0.0"
deprecated: {since: "2.2.0"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same.


- name: toImage
summary: Returns an image of the rendered view, as a Blob.
Expand Down Expand Up @@ -558,6 +560,7 @@ methods:

On Mobile Web, this method is included for parity only, and thus has no effect.
since: "2.0.0"
deprecated: {since: "2.2.0"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

parameters:
- name: params
summary: Layout properties to be updated.
Expand Down