本文整理匯總了Java中android.graphics.drawable.TransitionDrawable.reverseTransition方法的典型用法代碼示例。如果您正苦於以下問題:Java TransitionDrawable.reverseTransition方法的具體用法?Java TransitionDrawable.reverseTransition怎麽用?Java TransitionDrawable.reverseTransition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.TransitionDrawable
的用法示例。
在下文中一共展示了TransitionDrawable.reverseTransition方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_result);
final TextView search_result_back = (TextView) findViewById(R.id.search_result_back);
final ListView search_result_list = (ListView) findViewById(R.id.search_result_list);
img = (ImageView) findViewById(R.id.imageView3);
ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, Item.searchList);
search_result_list.setAdapter(adapter);
TransitionDrawable animation = (TransitionDrawable)img.getDrawable();
animation.startTransition(3000);
animation.reverseTransition(3000);
// img.setBackgroundResource(R.drawable.trans);
// AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
// frameAnimation.start();
search_result_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Item.searchList.clear();
goToSearch();
}
});
}
示例2: repeatTransition
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
void repeatTransition(final TransitionDrawable trans, final int timeInterval) {
r = new Runnable() {
@Override
public void run() {
if (flag) {
// Log.d("tagg", "straight");
trans.startTransition(timeInterval);
flag = false;
} else {
// Log.d("tagg", "reverse");
trans.reverseTransition(timeInterval);
flag = true;
}
hand.postDelayed(this, (2*timeInterval));
}
};
hand.post(r);
}
示例3: onCreate
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
//For creating a full-screen activity.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
image = (ImageView) findViewById(R.id.image);
Resources res = this.getResources();
trans = (TransitionDrawable) res.getDrawable(R.drawable.transition);
image.setImageDrawable(trans);
trans.reverseTransition(3000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
finish();
}
}, SPLASH_TIME_OUT);
}
示例4: onUrlFocusChange
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
public void onUrlFocusChange(final boolean hasFocus) {
super.onUrlFocusChange(hasFocus);
triggerUrlFocusAnimation(hasFocus);
TransitionDrawable shadowDrawable = (TransitionDrawable) mToolbarShadow.getDrawable();
if (hasFocus) {
dismissTabSwitcherCallout();
shadowDrawable.startTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
} else {
shadowDrawable.reverseTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
}
}
示例5: handleFindToolbarStateChange
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
protected void handleFindToolbarStateChange(boolean showing) {
setVisibility(showing ? View.GONE : View.VISIBLE);
TransitionDrawable shadowDrawable = (TransitionDrawable) mToolbarShadow.getDrawable();
if (showing) {
shadowDrawable.startTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
} else {
shadowDrawable.reverseTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
}
}
示例6: onDestroyActionMode
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
public void onDestroyActionMode(ActionMode mode) {
// show fab
mListener.setFabVisible(true);
// show all tabs
TabLayout tabLayout = mListener.getTabLayout();
if (tabLayout.getChildAt(0) instanceof ViewGroup) {
ViewGroup tabLayoutChild0 = (ViewGroup) tabLayout.getChildAt(0);
if (tabLayoutChild0.getChildCount() == tabLayout.getTabCount()) {
for (int i = 0; i < tabLayoutChild0.getChildCount(); i++) {
if (i == tabLayout.getSelectedTabPosition())
continue;
View child = tabLayoutChild0.getChildAt(i);
child.animate().setDuration(300).alpha(1);
}
}
}
// restore tabLayout background
TransitionDrawable transitionDrawable = (TransitionDrawable) mListener.getTabLayout().getBackground();
transitionDrawable.reverseTransition(300);
// enable paging
mListener.getViewPager().setPagingEnabled(true);
// restore statusBar color
if (Build.VERSION.SDK_INT >= 21) {
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), R.color.colorPrimaryDark));
}
mAdapter.deselectAllItems();
mActionMode = null;
}
示例7: onUrlFocusChange
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
public void onUrlFocusChange(final boolean hasFocus) {
super.onUrlFocusChange(hasFocus);
triggerUrlFocusAnimation(hasFocus);
TransitionDrawable shadowDrawable = (TransitionDrawable) mToolbarShadow.getDrawable();
if (hasFocus) {
shadowDrawable.startTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
} else {
shadowDrawable.reverseTransition(URL_FOCUS_CHANGE_ANIMATION_DURATION_MS);
}
}
示例8: onTouch
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
public boolean onTouch(View view_, MotionEvent motionEvent_) {
TransitionDrawable dr = (TransitionDrawable) view_.getBackground();
switch (motionEvent_.getAction()) {
case MotionEvent.ACTION_DOWN:
dr.startTransition(500);
return true;
case MotionEvent.ACTION_UP:
dr.reverseTransition(500);
break;
}
return false;
}
示例9: hideOverlayView
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
@Override
public void hideOverlayView(boolean animated) {
if (overlayVisible) {
TransitionDrawable drawable = (TransitionDrawable) overlayView.getBackground();
int duration = OVERLAY_TRANSITION_DURATION;
if (!animated) duration = 0;
drawable.reverseTransition(duration);
overlayView.setClickable(false);
overlayVisible = false;
}
}
示例10: closeActivity
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
void closeActivity()
{
if (isClosing) return;
if (enableAnimations)
{
ViewGroup container = (ViewGroup) findViewById(R.id.container);
TransitionDrawable transitionDrawable = (TransitionDrawable) container.getBackground();
transitionDrawable.reverseTransition(ANIMATION_OUT_DURATION);
int maxChildId = container.getChildCount()-1;
for (int i=maxChildId; i >= 0 ; i--)
{
int j = maxChildId-i;
View child = container.getChildAt(i);
animateCardOut(child, calcualteCardOriginY(j), new Runnable()
{
@Override
public void run()
{
finish();
}
});
}
}
else finish();
isClosing=true;
}
示例11: updateBackground
import android.graphics.drawable.TransitionDrawable; //導入方法依賴的package包/類
private void updateBackground(View view) {
int checked = mLayoutSelector.getSelected();
int unchecked = mLayoutSelector.getUnselected();
//Set text color
ColorStateList colorStateList = new ColorStateList(new int[][]{
{-android.R.attr.state_checked},
{android.R.attr.state_checked}},
new int[]{mTintColor, mCheckedTextColor});
((Button) view).setTextColor(colorStateList);
//Redraw with tint color
Drawable checkedDrawable = resources.getDrawable(checked).mutate();
Drawable uncheckedDrawable = resources.getDrawable(unchecked).mutate();
((GradientDrawable) checkedDrawable).setColor(mTintColor);
((GradientDrawable) checkedDrawable).setStroke(mMarginDp, mTintColor);
((GradientDrawable) uncheckedDrawable).setStroke(mMarginDp, mTintColor);
((GradientDrawable) uncheckedDrawable).setColor(mUnCheckedTintColor);
//Set proper radius
((GradientDrawable) checkedDrawable).setCornerRadii(mLayoutSelector.getChildRadii(view));
((GradientDrawable) uncheckedDrawable).setCornerRadii(mLayoutSelector.getChildRadii(view));
GradientDrawable maskDrawable = (GradientDrawable) resources.getDrawable(unchecked).mutate();
maskDrawable.setStroke(mMarginDp, mTintColor);
maskDrawable.setColor(mUnCheckedTintColor);
maskDrawable.setCornerRadii(mLayoutSelector.getChildRadii(view));
int maskColor = Color.argb(50, Color.red(mTintColor), Color.green(mTintColor), Color.blue(mTintColor));
maskDrawable.setColor(maskColor);
LayerDrawable pressedDrawable = new LayerDrawable(new Drawable[] {uncheckedDrawable, maskDrawable});
Drawable[] drawables = {uncheckedDrawable, checkedDrawable};
TransitionDrawable transitionDrawable = new TransitionDrawable(drawables);
if (((RadioButton) view).isChecked()) {
transitionDrawable.reverseTransition(0);
}
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[] {-android.R.attr.state_checked, android.R.attr.state_pressed}, pressedDrawable);
stateListDrawable.addState(StateSet.WILD_CARD, transitionDrawable);
mDrawableMap.put(view.getId(), transitionDrawable);
//Set button background
if (Build.VERSION.SDK_INT >= 16) {
view.setBackground(stateListDrawable);
} else {
view.setBackgroundDrawable(stateListDrawable);
}
super.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
TransitionDrawable current = mDrawableMap.get(checkedId);
current.reverseTransition(200);
if (mLastCheckId != 0) {
TransitionDrawable last = mDrawableMap.get(mLastCheckId);
if (last != null) last.reverseTransition(200);
}
mLastCheckId = checkedId;
if (mCheckedChangeListener != null) {
mCheckedChangeListener.onCheckedChanged(group, checkedId);
}
}
});
}