am 78a4b799: Merge "Making folders open/close smoothly" into jb-dev
* commit '78a4b7993b95d0f0270a0bb0ce58355fe5963e97': Making folders open/close smoothly
This commit is contained in:
@@ -106,6 +106,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
|
|
||||||
private static String sDefaultFolderName;
|
private static String sDefaultFolderName;
|
||||||
private static String sHintText;
|
private static String sHintText;
|
||||||
|
private ObjectAnimator mOpenCloseAnimator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to inflate the Workspace from XML.
|
* Used to inflate the Workspace from XML.
|
||||||
@@ -417,7 +418,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1);
|
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1);
|
||||||
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
|
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
|
||||||
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
|
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
|
||||||
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
|
final ObjectAnimator oa = mOpenCloseAnimator =
|
||||||
|
ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
|
||||||
|
|
||||||
oa.addListener(new AnimatorListenerAdapter() {
|
oa.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -430,7 +432,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
mState = STATE_OPEN;
|
mState = STATE_OPEN;
|
||||||
|
setLayerType(LAYER_TYPE_NONE, null);
|
||||||
Cling cling = mLauncher.showFirstRunFoldersCling();
|
Cling cling = mLauncher.showFirstRunFoldersCling();
|
||||||
if (cling != null) {
|
if (cling != null) {
|
||||||
cling.bringToFront();
|
cling.bringToFront();
|
||||||
@@ -439,7 +441,16 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
oa.setDuration(mExpandDuration);
|
oa.setDuration(mExpandDuration);
|
||||||
oa.start();
|
setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||||
|
buildLayer();
|
||||||
|
post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// Check if the animator changed in the meantime
|
||||||
|
if (oa != mOpenCloseAnimator)
|
||||||
|
return;
|
||||||
|
oa.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCustomAccessibilityEvent(int type, String text) {
|
private void sendCustomAccessibilityEvent(int type, String text) {
|
||||||
@@ -465,12 +476,14 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
|
PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
|
||||||
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f);
|
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f);
|
||||||
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
|
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
|
||||||
ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
|
final ObjectAnimator oa = mOpenCloseAnimator =
|
||||||
|
ObjectAnimator.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
|
||||||
|
|
||||||
oa.addListener(new AnimatorListenerAdapter() {
|
oa.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
onCloseComplete();
|
onCloseComplete();
|
||||||
|
setLayerType(LAYER_TYPE_NONE, null);
|
||||||
mState = STATE_SMALL;
|
mState = STATE_SMALL;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -481,7 +494,16 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
oa.setDuration(mExpandDuration);
|
oa.setDuration(mExpandDuration);
|
||||||
oa.start();
|
setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||||
|
buildLayer();
|
||||||
|
post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// Check if the animator changed in the meantime
|
||||||
|
if (oa != mOpenCloseAnimator)
|
||||||
|
return;
|
||||||
|
oa.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyDataSetChanged() {
|
void notifyDataSetChanged() {
|
||||||
|
|||||||
Reference in New Issue
Block a user