use of android.animation.Animator.AnimatorListener in project platform_frameworks_base by android.
the class SettingsButton method startAccelSpin.
protected void startAccelSpin() {
cancelAnimation();
mAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, 360);
mAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.accelerate_quad));
mAnimator.setDuration(ACCEL_LENGTH);
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
startContinuousSpin();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
mAnimator.start();
}
use of android.animation.Animator.AnimatorListener in project platform_frameworks_base by android.
the class QSDetail method handleShowingDetail.
private void handleShowingDetail(final QSTile.DetailAdapter adapter, int x, int y) {
final boolean showingDetail = adapter != null;
setClickable(showingDetail);
if (showingDetail) {
mQsDetailHeaderTitle.setText(adapter.getTitle());
final Boolean toggleState = adapter.getToggleState();
if (toggleState == null) {
mQsDetailHeaderSwitch.setVisibility(INVISIBLE);
mQsDetailHeader.setClickable(false);
} else {
mQsDetailHeaderSwitch.setVisibility(VISIBLE);
handleToggleStateChanged(toggleState, adapter.getToggleEnabled());
mQsDetailHeader.setClickable(true);
mQsDetailHeader.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !mQsDetailHeaderSwitch.isChecked();
mQsDetailHeaderSwitch.setChecked(checked);
adapter.setToggleState(checked);
}
});
}
if (!mFullyExpanded) {
mTriggeredExpand = true;
mHost.animateToggleQSExpansion();
} else {
mTriggeredExpand = false;
}
mOpenX = x;
mOpenY = y;
} else {
// Ensure we collapse into the same point we opened from.
x = mOpenX;
y = mOpenY;
if (mTriggeredExpand) {
mHost.animateToggleQSExpansion();
mTriggeredExpand = false;
}
}
boolean visibleDiff = (mDetailAdapter != null) != (adapter != null);
// already in right state
if (!visibleDiff && mDetailAdapter == adapter)
return;
AnimatorListener listener = null;
if (adapter != null) {
int viewCacheIndex = adapter.getMetricsCategory();
View detailView = adapter.createDetailView(mContext, mDetailViews.get(viewCacheIndex), mDetailContent);
if (detailView == null)
throw new IllegalStateException("Must return detail view");
final Intent settingsIntent = adapter.getSettingsIntent();
mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
mDetailSettingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mHost.startActivityDismissingKeyguard(settingsIntent);
}
});
mDetailContent.removeAllViews();
mDetailContent.addView(detailView);
mDetailViews.put(viewCacheIndex, detailView);
MetricsLogger.visible(mContext, adapter.getMetricsCategory());
announceForAccessibility(mContext.getString(R.string.accessibility_quick_settings_detail, adapter.getTitle()));
mDetailAdapter = adapter;
listener = mHideGridContentWhenDone;
setVisibility(View.VISIBLE);
} else {
if (mDetailAdapter != null) {
MetricsLogger.hidden(mContext, mDetailAdapter.getMetricsCategory());
}
mClosingDetail = true;
mDetailAdapter = null;
listener = mTeardownDetailWhenDone;
mHeader.setVisibility(View.VISIBLE);
mQsPanel.setGridContentVisibility(true);
mQsPanelCallback.onScanStateChanged(false);
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
if (visibleDiff) {
mAnimatingOpen = adapter != null;
if (mFullyExpanded || mDetailAdapter != null) {
setAlpha(1);
mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
} else {
animate().alpha(0).setDuration(FADE_DURATION).setListener(listener).start();
}
}
}
use of android.animation.Animator.AnimatorListener in project android_frameworks_base by DirtyUnicorns.
the class QSDetail method handleShowingDetail.
private void handleShowingDetail(final QSTile.DetailAdapter adapter, int x, int y) {
final boolean showingDetail = adapter != null;
setClickable(showingDetail);
if (showingDetail) {
mQsDetailHeaderTitle.setText(adapter.getTitle());
final Boolean toggleState = adapter.getToggleState();
if (toggleState == null) {
mQsDetailHeaderSwitch.setVisibility(INVISIBLE);
mQsDetailHeader.setClickable(false);
} else {
mQsDetailHeaderSwitch.setVisibility(VISIBLE);
handleToggleStateChanged(toggleState, adapter.getToggleEnabled());
mQsDetailHeader.setClickable(true);
mQsDetailHeader.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !mQsDetailHeaderSwitch.isChecked();
mQsDetailHeaderSwitch.setChecked(checked);
adapter.setToggleState(checked);
}
});
}
if (!mFullyExpanded) {
mTriggeredExpand = true;
mHost.animateToggleQSExpansion();
} else {
mTriggeredExpand = false;
}
mOpenX = x;
mOpenY = y;
} else {
// Ensure we collapse into the same point we opened from.
x = mOpenX;
y = mOpenY;
if (mTriggeredExpand) {
mHost.animateToggleQSExpansion();
mTriggeredExpand = false;
}
}
boolean visibleDiff = (mDetailAdapter != null) != (adapter != null);
// already in right state
if (!visibleDiff && mDetailAdapter == adapter)
return;
AnimatorListener listener = null;
if (adapter != null) {
int viewCacheIndex = adapter.getMetricsCategory();
View detailView = adapter.createDetailView(mContext, mDetailViews.get(viewCacheIndex), mDetailContent);
if (detailView == null)
throw new IllegalStateException("Must return detail view");
final Intent settingsIntent = adapter.getSettingsIntent();
mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
mDetailSettingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mHost.startActivityDismissingKeyguard(settingsIntent);
}
});
mDetailContent.removeAllViews();
mDetailContent.addView(detailView);
mDetailViews.put(viewCacheIndex, detailView);
MetricsLogger.visible(mContext, adapter.getMetricsCategory());
announceForAccessibility(mContext.getString(R.string.accessibility_quick_settings_detail, adapter.getTitle()));
mDetailAdapter = adapter;
listener = mHideGridContentWhenDone;
setVisibility(View.VISIBLE);
} else {
if (mDetailAdapter != null) {
MetricsLogger.hidden(mContext, mDetailAdapter.getMetricsCategory());
}
mClosingDetail = true;
mDetailAdapter = null;
listener = mTeardownDetailWhenDone;
mHeader.setVisibility(View.VISIBLE);
mQsPanel.setGridContentVisibility(true);
mQsPanelCallback.onScanStateChanged(false);
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
if (visibleDiff) {
mAnimatingOpen = adapter != null;
if (mFullyExpanded || mDetailAdapter != null) {
setAlpha(1);
mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
} else {
animate().alpha(0).setDuration(FADE_DURATION).setListener(listener).start();
}
}
}
use of android.animation.Animator.AnimatorListener in project android_frameworks_base by crdroidandroid.
the class SettingsButton method startAccelSpin.
protected void startAccelSpin() {
cancelAnimation();
mAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, 360);
mAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.accelerate_quad));
mAnimator.setDuration(ACCEL_LENGTH);
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
startContinuousSpin();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
mAnimator.start();
}
use of android.animation.Animator.AnimatorListener in project android_frameworks_base by crdroidandroid.
the class QSDetail method handleShowingDetail.
private void handleShowingDetail(final QSTile.DetailAdapter adapter, int x, int y) {
final boolean showingDetail = adapter != null;
setClickable(showingDetail);
if (showingDetail) {
mQsDetailHeaderTitle.setText(adapter.getTitle());
final Boolean toggleState = adapter.getToggleState();
if (toggleState == null) {
mQsDetailHeaderSwitch.setVisibility(INVISIBLE);
mQsDetailHeader.setClickable(false);
} else {
mQsDetailHeaderSwitch.setVisibility(VISIBLE);
handleToggleStateChanged(toggleState, adapter.getToggleEnabled());
mQsDetailHeader.setClickable(true);
mQsDetailHeader.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
boolean checked = !mQsDetailHeaderSwitch.isChecked();
mQsDetailHeaderSwitch.setChecked(checked);
adapter.setToggleState(checked);
}
});
}
if (!mFullyExpanded) {
mTriggeredExpand = true;
mHost.animateToggleQSExpansion();
} else {
mTriggeredExpand = false;
}
mOpenX = x;
mOpenY = y;
} else {
// Ensure we collapse into the same point we opened from.
x = mOpenX;
y = mOpenY;
if (mTriggeredExpand) {
mHost.animateToggleQSExpansion();
mTriggeredExpand = false;
}
}
boolean visibleDiff = (mDetailAdapter != null) != (adapter != null);
// already in right state
if (!visibleDiff && mDetailAdapter == adapter)
return;
AnimatorListener listener = null;
if (adapter != null) {
int viewCacheIndex = adapter.getMetricsCategory();
View detailView = adapter.createDetailView(mContext, mDetailViews.get(viewCacheIndex), mDetailContent);
if (detailView == null)
throw new IllegalStateException("Must return detail view");
final Intent settingsIntent = adapter.getSettingsIntent();
mDetailSettingsButton.setVisibility(settingsIntent != null ? VISIBLE : GONE);
mDetailSettingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mHost.startActivityDismissingKeyguard(settingsIntent);
}
});
mDetailContent.removeAllViews();
mDetailContent.addView(detailView);
mDetailViews.put(viewCacheIndex, detailView);
MetricsLogger.visible(mContext, adapter.getMetricsCategory());
announceForAccessibility(mContext.getString(R.string.accessibility_quick_settings_detail, adapter.getTitle()));
mDetailAdapter = adapter;
listener = mHideGridContentWhenDone;
setVisibility(View.VISIBLE);
} else {
if (mDetailAdapter != null) {
MetricsLogger.hidden(mContext, mDetailAdapter.getMetricsCategory());
}
mClosingDetail = true;
mDetailAdapter = null;
listener = mTeardownDetailWhenDone;
mHeader.setVisibility(View.VISIBLE);
mQsPanel.setGridContentVisibility(true);
mQsPanelCallback.onScanStateChanged(false);
}
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
if (visibleDiff) {
mAnimatingOpen = adapter != null;
if (mFullyExpanded || mDetailAdapter != null) {
setAlpha(1);
mClipper.animateCircularClip(x, y, mDetailAdapter != null, listener);
} else {
animate().alpha(0).setDuration(FADE_DURATION).setListener(listener).start();
}
}
}
Aggregations