fusion44

Untitled

Nov 12th, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.34 KB | None | 0 0
  1.     public void onCreate(Bundle savedInstanceState) {
  2.         super.onCreate(savedInstanceState);
  3.  
  4.         mScaleInAnim = new ScaleAnimation(1, 1, 0, 1);
  5.         mScaleInAnim.setDuration(700);
  6.         mScaleInAnim.setAnimationListener(this);
  7.  
  8.         mScaleOutAnim = new ScaleAnimation(1, 1, 1, 0);
  9.         mScaleOutAnim.setDuration(700);
  10.         mScaleOutAnim.setAnimationListener(this);
  11.  
  12.         if (getArguments().containsKey(ARG_ITEM_ID)) {
  13.             // Load the dummy content specified by the fragment
  14.             // arguments. In a real-world scenario, use a Loader
  15.             // to load content from a content provider.
  16.             mTrip = TripContent.getSingleton().ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
  17.         }
  18.  
  19.     public void update(String TAG, int year, int month, int day) {
  20.         if(TAG == START_PICKER_TAG)
  21.         {
  22.             mTrip.setBegin(year, month, day);
  23.             mTripStartTextView.setText(mTrip.getBeginAsString(getActivity().getBaseContext()));
  24.  
  25.             long begin = mTrip.getBegin().getTimeInMillis();
  26.             long end = mTrip.getEnd().getTimeInMillis();
  27.  
  28.             if(begin < end)
  29.             {
  30.                 mErrorView.startAnimation(mScaleOutAnim);
  31.             }
  32.             else
  33.             {
  34.                 mErrorView.startAnimation(mScaleInAnim);
  35.             }
  36.         }
  37.         else if(TAG == END_PICKER_TAG)
  38.         {
  39.             mTrip.setEnd(year, month, day);
  40.             mTripEndTextView.setText(mTrip.getEndAsString(getActivity().getBaseContext()));
  41.  
  42.             long begin = mTrip.getBegin().getTimeInMillis();
  43.             long end = mTrip.getEnd().getTimeInMillis();
  44.  
  45.             if(begin < end)
  46.             {
  47.                 mErrorView.startAnimation(mScaleOutAnim);
  48.             }
  49.             else
  50.             {
  51.                 mErrorView.startAnimation(mScaleInAnim);
  52.             }
  53.         }
  54.     }
  55.  
  56.     @Override
  57.     public void onAnimationStart(Animation animation) {
  58.         if(animation == mScaleInAnim)
  59.         {
  60.             mErrorView.setVisibility(View.VISIBLE);
  61.         }
  62.     }
  63.  
  64.     @Override
  65.     public void onAnimationEnd(Animation animation) {
  66.         if(animation == mScaleOutAnim)
  67.         {
  68.             mErrorView.setVisibility(View.GONE);
  69.         }
  70.     }
  71.  
  72.     @Override
  73.     public void onAnimationRepeat(Animation animation) {
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment