Skip to content

Commit

Permalink
timob-10293: transition all event names to lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
pingwang2011 committed Aug 15, 2012
1 parent 76527b3 commit 03520ea
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 20 deletions.
Expand Up @@ -156,6 +156,8 @@ public void computeScroll()
location.put(TiC.PROPERTY_LATITUDE_DELTA, scaleFromGoogle(lastLatitudeSpan));
location.put(TiC.PROPERTY_LONGITUDE_DELTA, scaleFromGoogle(lastLongitudeSpan));
proxy.fireEvent(TiC.EVENT_REGION_CHANGED, location);
// TODO: Deprecate old event
proxy.fireEvent("regionChanged", location);
}
}

Expand Down
Expand Up @@ -521,6 +521,8 @@ private void firePlaybackState(int state)
KrollDict data = new KrollDict();
data.put(TiC.EVENT_PROPERTY_PLAYBACK_STATE, state);
fireEvent(TiC.EVENT_PLAYBACK_STATE, data);
// TODO: Deprecate old event
fireEvent("playbackState", data);
}

public void fireLoadState(int state)
Expand Down Expand Up @@ -554,6 +556,9 @@ public void onPlaybackReady(int duration)
setProperty(TiC.PROPERTY_INITIAL_PLAYBACK_TIME, 0);
}
fireEvent(TiC.EVENT_DURATION_AVAILABLE, data);
// TODO: Deprecate old event
fireEvent("durationAvailable", data);

fireEvent(TiC.EVENT_PRELOAD, null);
fireEvent(TiC.EVENT_LOAD, null); // No distinction between load and preload in our case.
fireLoadState(MediaModule.VIDEO_LOAD_STATE_PLAYABLE);
Expand Down
Expand Up @@ -216,7 +216,14 @@ public void fireDragEnd(int currentPage, TiViewProxy currentView) {
options.put("view", currentView);
options.put("currentPage", currentPage);
fireEvent(TiC.EVENT_DRAGEND, options);
}
}
// TODO: Deprecate old event
if (hasListeners("dragEnd")) {
KrollDict options = new KrollDict();
options.put("view", currentView);
options.put("currentPage", currentPage);
fireEvent("dragEnd", options);
}
}

public void fireScrollEnd(int currentPage, TiViewProxy currentView)
Expand All @@ -226,7 +233,14 @@ public void fireScrollEnd(int currentPage, TiViewProxy currentView)
options.put("view", currentView);
options.put("currentPage", currentPage);
fireEvent(TiC.EVENT_SCROLLEND, options);
}
}
// TODO: Deprecate old event
if (hasListeners("scrollEnd")) {
KrollDict options = new KrollDict();
options.put("view", currentView);
options.put("currentPage", currentPage);
fireEvent("scrollEnd", options);
}
}

public void fireScroll(int currentPage, float currentPageAsFloat, TiViewProxy currentView)
Expand Down
Expand Up @@ -100,6 +100,8 @@ public void setWindow(TiWindowProxy window)
this.win.setTabGroupProxy(tabGroupProxy);
//Send out a sync event to indicate window is added to tab
this.win.fireSyncEvent(TiC.EVENT_ADDED_TO_TAB, null);
// TODO: Deprecate old event
this.win.fireSyncEvent("addedToTab", null);
}

@Kroll.method @Kroll.getProperty
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void onPageScrollStateChanged(int scrollState)
// oldIndex will be -1 if the view has just
// been created and is setting currentPage
// to something other than 0. In that case we
// don't want a scrollEnd to fire.
// don't want a `scrollend` to fire.
((ScrollableViewProxy)proxy).fireScrollEnd(mCurIndex, mViews.get(mCurIndex));
}

Expand All @@ -132,8 +132,8 @@ public void onPageScrollStateChanged(int scrollState)
} else if (scrollState == ViewPager.SCROLL_STATE_SETTLING) {
((ScrollableViewProxy)proxy).fireDragEnd(mCurIndex, mViews.get(mCurIndex));

// Note that we just fired a dragEnd so the `onPageSelected`
// handler below doesn't fire a `scrollEnd`. Read below comment.
// Note that we just fired a `dragend` so the `onPageSelected`
// handler below doesn't fire a `scrollend`. Read below comment.
justFiredDragEnd = true;
}
}
Expand All @@ -142,7 +142,7 @@ public void onPageScrollStateChanged(int scrollState)
public void onPageSelected(int page)
{

// If we didn't just fire a `dragEnd` event then this is the case
// If we didn't just fire a `dragend` event then this is the case
// where a user drags the view and settles it on a different view.
// Since the OS settling logic is never run, the
// `onPageScrollStateChanged` handler is never run, and therefore
Expand Down Expand Up @@ -184,7 +184,7 @@ public void onPageScrolled(int positionRoundedDown, float positionOffset, int po
mCurIndex = (int) Math.floor(positionFloat + 0.5);
((ScrollableViewProxy)proxy).fireScroll(mCurIndex, positionFloat, mViews.get(mCurIndex));

// Note that we didn't just fire a dragEnd. See the above comment
// Note that we didn't just fire a `dragend`. See the above comment
// in `onPageSelected`.
justFiredDragEnd = false;
}
Expand Down
Expand Up @@ -280,6 +280,8 @@ public void onScrollStateChanged(AbsListView view, int scrollState)
size.put("width", TiTableView.this.getWidth());
size.put("height", TiTableView.this.getHeight());
eventArgs.put("size", size);
fProxy.fireEvent(TiC.EVENT_SCROLLEND, eventArgs);
// TODO: Deprecate old event
fProxy.fireEvent("scrollEnd", eventArgs);
}
else if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
Expand Down
Expand Up @@ -544,6 +544,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:back")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:back", null);
}
handled = true;
}

break;
}
Expand All @@ -554,6 +561,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:camera")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:camera", null);
}
handled = true;
}

break;
}
Expand All @@ -564,6 +578,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:focus")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:focus", null);
}
handled = true;
}

break;
}
Expand All @@ -574,6 +595,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:search")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:search", null);
}
handled = true;
}

break;
}
Expand All @@ -584,6 +612,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:volup")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:volup", null);
}
handled = true;
}

break;
}
Expand All @@ -594,6 +629,13 @@ public boolean dispatchKeyEvent(KeyEvent event)
}
handled = true;
}
// TODO: Deprecate old event
if (window.hasListeners("android:voldown")) {
if (event.getAction() == KeyEvent.ACTION_UP) {
window.fireEvent("android:voldown", null);
}
handled = true;
}

break;
}
Expand Down Expand Up @@ -662,6 +704,8 @@ protected void onNewIntent(Intent intent)
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_INTENT, ip);
activityProxy.fireSyncEvent(TiC.EVENT_NEW_INTENT, data);
// TODO: Deprecate old event
activityProxy.fireSyncEvent("newIntent", data);
}
}

Expand Down
26 changes: 13 additions & 13 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Expand Up @@ -21,37 +21,37 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_ADDED_TO_TAB = "addedToTab";
public static final String EVENT_ADDED_TO_TAB = "addedtotab";

/**
* @module.api
*/
public static final String EVENT_ANDROID_BACK = "android:back";
public static final String EVENT_ANDROID_BACK = "androidback";

/**
* @module.api
*/
public static final String EVENT_ANDROID_CAMERA = "android:camera";
public static final String EVENT_ANDROID_CAMERA = "androidcamera";

/**
* @module.api
*/
public static final String EVENT_ANDROID_FOCUS = "android:focus";
public static final String EVENT_ANDROID_FOCUS = "androidfocus";

/**
* @module.api
*/
public static final String EVENT_ANDROID_SEARCH = "android:search";
public static final String EVENT_ANDROID_SEARCH = "androidsearch";

/**
* @module.api
*/
public static final String EVENT_ANDROID_VOLDOWN = "android:voldown";
public static final String EVENT_ANDROID_VOLDOWN = "androidvoldown";

/**
* @module.api
*/
public static final String EVENT_ANDROID_VOLUP = "android:volup";
public static final String EVENT_ANDROID_VOLUP = "androidvolup";

/**
* @module.api
Expand Down Expand Up @@ -116,7 +116,7 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_DURATION_AVAILABLE = "durationAvailable";
public static final String EVENT_DURATION_AVAILABLE = "durationavailable";

/**
* @module.api
Expand Down Expand Up @@ -171,7 +171,7 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_NEW_INTENT = "newIntent";
public static final String EVENT_NEW_INTENT = "newintent";

/**
* @module.api
Expand All @@ -191,7 +191,7 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_PLAYBACK_STATE = "playbackState";
public static final String EVENT_PLAYBACK_STATE = "playbackstate";

/**
* @module.api
Expand Down Expand Up @@ -361,7 +361,7 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_REGION_CHANGED = "regionChanged";
public static final String EVENT_REGION_CHANGED = "regionchanged";

/**
* @module.api
Expand All @@ -381,12 +381,12 @@ public class TiC
/**
* @module.api
*/
public static final String EVENT_SCROLLEND = "scrollEnd";
public static final String EVENT_SCROLLEND = "scrollend";

/**
* @module.api
*/
public static final String EVENT_DRAGEND = "dragEnd";
public static final String EVENT_DRAGEND = "dragend";

/**
* @module.api
Expand Down

0 comments on commit 03520ea

Please sign in to comment.