Android Open Source - ExpandAnimator Expand Animator Manager






From Project

Back to project page ExpandAnimator.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...

If you think the Android project ExpandAnimator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Created by sys1yagi on 12/02/10/*w  w  w. j ava2 s.c  o  m*/
 * Copyright (C) 2012 sys1yagi
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jp.dip.sys1.yagi.android.expandanimator;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
 * ExpandAnimator????????????????????????HashMap<String, ExpandAnimator>?????????????????????????????????
 * @author sys1yagi
 *
 */
public class ExpandAnimatorManager {

  /**
   * ExpandAnimator?????????????HashMap?
   */
  private Map<String, ExpandAnimator> mAnimators = new HashMap<String, ExpandAnimator>();

  /**
   * ?????????????????????????????
   */
  public ExpandAnimatorManager() {

  }

  /**
   * ExpandAnimator????????key??????????????????????????
   * @param key ExpandAnimator???????????????? 
   * @param anim ExpandAnimator 
   */
  public void put(String key, ExpandAnimator anim) {
    mAnimators.put(key, anim);
  }
  /**
   * ???????????ExpandAnimator????????????????????????
   * @param key ExpandAnimator?????????
   * @return ExpandAnimator????????????ExpandAnimator??????????????null????? 
   */
  public ExpandAnimator get(String key){
    return mAnimators.get(key);
  }

  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#expand()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void expand(String key) {
    if(mAnimators.containsKey(key)){
      mAnimators.get(key).expand();
    }
  }

  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#unexpand()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void unexpand(String key) {
    if(mAnimators.containsKey(key)){
      mAnimators.get(key).unexpand();
    }
  }

  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#expand()}?????????????
   * ????????ExpandAnimatorManager????????ExpandAnimator???{@link ExpandAnimator#unexpand()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void exclusiveExpand(String key) {
    Set<String> keys = mAnimators.keySet();
    for (String k : keys) {
      if (k.equals(key)) {
        expand(k);
      } else {
        unexpand(k);
      }
    }
  }

  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#unexpand()}?????????????
   * ????????ExpandAnimatorManager????????ExpandAnimator???{@link ExpandAnimator#expand()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void exclusiveUnexpand(String key) {
    Set<String> keys = mAnimators.keySet();
    for (String k : keys) {
      if (!k.equals(key)) {
        expand(k);
      } else {
        unexpand(k);
      }
    }
  }

  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#adjustSize()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void adjustSize(String key){
    ExpandAnimator anim = mAnimators.get(key);
    if(anim != null){
      anim.adjustSize();
    }
  }
  /**
   * ???????????ExpandAnimator???{@link ExpandAnimator#adjustSizeImmediately()}?????????????
   * @param key ExpandAnimator?????????
   */
  public void adjustSizeImmediately(String key){
    ExpandAnimator anim = mAnimators.get(key);
    if(anim != null){
      anim.adjustSizeImmediately();
    }
  }
}




Java Source Code List

jp.dip.sys1.yagi.android.expandanimator.ExpandAnimatorManager.java
jp.dip.sys1.yagi.android.expandanimator.ExpandAnimator.java
jp.dip.sys1.yagi.android.expandanimator.sample.ExpandAnimatorSampleActivity.java