Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mScaleInAnim = new ScaleAnimation(1, 1, 0, 1);
- mScaleInAnim.setDuration(700);
- mScaleInAnim.setAnimationListener(this);
- mScaleOutAnim = new ScaleAnimation(1, 1, 1, 0);
- mScaleOutAnim.setDuration(700);
- mScaleOutAnim.setAnimationListener(this);
- if (getArguments().containsKey(ARG_ITEM_ID)) {
- // Load the dummy content specified by the fragment
- // arguments. In a real-world scenario, use a Loader
- // to load content from a content provider.
- mTrip = TripContent.getSingleton().ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
- }
- public void update(String TAG, int year, int month, int day) {
- if(TAG == START_PICKER_TAG)
- {
- mTrip.setBegin(year, month, day);
- mTripStartTextView.setText(mTrip.getBeginAsString(getActivity().getBaseContext()));
- long begin = mTrip.getBegin().getTimeInMillis();
- long end = mTrip.getEnd().getTimeInMillis();
- if(begin < end)
- {
- mErrorView.startAnimation(mScaleOutAnim);
- }
- else
- {
- mErrorView.startAnimation(mScaleInAnim);
- }
- }
- else if(TAG == END_PICKER_TAG)
- {
- mTrip.setEnd(year, month, day);
- mTripEndTextView.setText(mTrip.getEndAsString(getActivity().getBaseContext()));
- long begin = mTrip.getBegin().getTimeInMillis();
- long end = mTrip.getEnd().getTimeInMillis();
- if(begin < end)
- {
- mErrorView.startAnimation(mScaleOutAnim);
- }
- else
- {
- mErrorView.startAnimation(mScaleInAnim);
- }
- }
- }
- @Override
- public void onAnimationStart(Animation animation) {
- if(animation == mScaleInAnim)
- {
- mErrorView.setVisibility(View.VISIBLE);
- }
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- if(animation == mScaleOutAnim)
- {
- mErrorView.setVisibility(View.GONE);
- }
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
Advertisement
Add Comment
Please, Sign In to add comment