Example usage for android.view.animation AnimationUtils loadAnimation

List of usage examples for android.view.animation AnimationUtils loadAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadAnimation.

Prototype

public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException 

Source Link

Document

Loads an Animation object from a resource

Usage

From source file:com.equinox.prodriver.Activities.RegisterDriverActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register_driver);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from  w  ww .ja va2s  .com*/
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    context = this;
    appBarLayout = (AppBarLayout) findViewById(R.id.app_bar);
    appBarLayout.setExpanded(false, true);
    mainScrollView = (NestedScrollView) findViewById(R.id.content_register_driver);
    mainScrollView.setSmoothScrollingEnabled(true);
    selectorsLayouts = new ArrayList<>();

    editDriver = new Driver();
    preferredPlace = new PrologixPlace();
    if (currentDriver == null) {
        getSupportActionBar().setTitle(getString(R.string.title_activity_register_driver));
        if (savedInstanceState != null && savedInstanceState.getBoolean("EDITING")) {
            editDriver = tempDriver;
            if (editDriver == null)
                editDriver = new Driver();
        }
        vehiclesList = new ArrayList<>();
    } else {
        getSupportActionBar().setTitle(getString(R.string.title_activity_update_driver));
        editDriver = currentDriver.clone();
        if (editDriver.getPreferredAddress() != null) {
            preferredPlace.setAddress(
                    driverGson.fromJson(driverGson.toJson(editDriver.getPreferredAddress()), GeoAddress.class));
            preferredPlace.setLocation(
                    driverGson.fromJson(driverGson.toJson(editDriver.getPreferredLocation()), LatLng.class));
        }
    }

    storagePermission = new PermissionManager(this);
    if (!storagePermission.checkReadStoragePermission())
        storagePermission.getReadStoragePermission();
    registerEmailHeaderFragment = RegisterEmailHeaderFragment.newInstance(editDriver);

    vehicleIndicator = (ImageView) findViewById(R.id.driver_vehicle_indicator);
    if (editDriver.getVehicles() == null)
        editDriver.setVehicles(new ArrayList<Vehicle>());
    vehicleRecyclerAdapter = new VehicleRecyclerAdapter(context, editDriver.getVehicles(), false);
    if (!editDriver.getVehicles().isEmpty())
        setIndicator(context, vehicleIndicator, true);
    if (!editDriver.getVehicles().contains(createVehicle)) {
        editDriver.getVehicles().add(new Vehicle());
        //TODO remove this.. just for testing only
        /*String vehicleId = "SA-3184VLB";
        DriverTask driverTask = new DriverTask(vehicleFetcher, "en");
        driverTask.getVehicle.execute(vehicleId);*/
    }
    vehicleListView = (RecyclerView) findViewById(R.id.vehicle_list_view);
    vehicleListView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    vehicleListView.setHasFixedSize(true);
    vehicleListView.setAdapter(vehicleRecyclerAdapter);
    vehicleListView.setNestedScrollingEnabled(false);

    licenseIndicator = (ImageView) findViewById(R.id.license_info_indicator);
    licenseValueNumber = (TextView) findViewById(R.id.license_info_number);
    licenseValueExpiry = (TextView) findViewById(R.id.license_info_expiry);
    licenseImage = (ImageView) findViewById(R.id.license_image);
    licenseImageLoaded = (NetworkImageView) findViewById(R.id.license_image_loaded);
    licenseInfoLayout = (RelativeLayout) findViewById(R.id.license_info_layout);
    if (editDriver.getLicenseNumber() != null) {
        setIndicator(context, licenseIndicator, true);
        licenseValueNumber.setText(editDriver.getLicenseNumber());
        licenseValueExpiry.setText(StringManipulation.getFormattedDate(editDriver.getLicenseExpiry()));
        if (editDriver.getLicenseImage() != null)
            licenseImageLoaded.setImageUrl(editDriver.getLicenseImage(),
                    DataHolder.getInstance().getImageLoader());
    }
    if (photo1 != null)
        licenseImage.setImageBitmap(photo1);
    licenseInfoLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent scanIdIntent = new Intent(context, CameraVisionActivity.class);
            scanIdIntent.putExtra("source", REQUEST_DRIVER_LICENSE);
            startActivity(scanIdIntent);
        }
    });

    residenceIndicator = (ImageView) findViewById(R.id.residence_info_indicator);
    residenceValueNumber = (TextView) findViewById(R.id.residence_info_number);
    residenceValueExpiry = (TextView) findViewById(R.id.residence_info_expiry);
    residenceValueLegalName = (TextView) findViewById(R.id.residence_info_legal_name);
    residenceImage = (ImageView) findViewById(R.id.residence_image);
    residenceImageLoaded = (NetworkImageView) findViewById(R.id.residence_image_loaded);
    residenceInfoLayout = (RelativeLayout) findViewById(R.id.residence_info_layout);
    if (editDriver.getResidenceNumber() != null) {
        setIndicator(context, residenceIndicator, true);
        residenceValueNumber.setText(editDriver.getResidenceNumber());
        residenceValueLegalName.setText(editDriver.getLegalName());
        if (editDriver.getResidenceImage() != null)
            residenceImageLoaded.setImageUrl(editDriver.getResidenceImage(),
                    DataHolder.getInstance().getImageLoader());
    }
    if (photo2 != null)
        residenceImage.setImageBitmap(photo2);
    residenceInfoLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent scanIdIntent = new Intent(context, CameraVisionActivity.class);
            scanIdIntent.putExtra(SOURCE, REQUEST_RESIDENCE_ID);
            startActivity(scanIdIntent);
        }
    });

    nationalityIndicator = (ImageView) findViewById(R.id.nationality_indicator);
    nationalityValue = (TextView) findViewById(R.id.nationality_value);
    nationalityLayout = (RelativeLayout) findViewById(R.id.nationality_layout);
    nationalityProgressLayout = (LinearLayout) findViewById(R.id.nationality_progress_layout);
    final RelativeLayout nationalitySelector = (RelativeLayout) findViewById(R.id.nationality_selector);
    selectorsLayouts.add(nationalitySelector);
    nationalitySelectorContent = (LinearLayout) findViewById(R.id.nationality_selector_content);
    countryTask = new CountryTask(countryListHandler, "en");
    countryTask.getCountryList.execute("en");
    if (editDriver.getNationality() != null) {
        setIndicator(context, nationalityIndicator, true);
        nationalityValue.setText(editDriver.getNationality().getCountryName());
    }
    nationalityAuto = (InstantAutoComplete) findViewById(R.id.nationality_auto);
    nationalityLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideKeyboard(context);
            if (nationalitySelector.getVisibility() == View.GONE) {
                closeInactiveLayouts(appBarLayout, selectorsLayouts, nationalitySelector);
                mainScrollView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mainScrollView.smoothScrollTo(0, nationalityLayout.getTop());
                        nationalityAuto.showDropDown();
                    }
                }, 1000);
            }
            if (countryTask.getCountryList.getStatus().equals(AsyncTask.Status.RUNNING)) {
                nationalityProgressLayout.setVisibility(View.VISIBLE);
                nationalitySelectorContent.setVisibility(View.GONE);
            }
            LinearLayout okayButton = (LinearLayout) findViewById(R.id.nationality_okay_button);
            okayButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (editDriver.getNationality() != null) {
                        setIndicator(context, nationalityIndicator, true);
                        nationalityValue.setText(editDriver.getNationality().getCountryName());
                        addressLayout.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                addressLayout.performClick();
                            }
                        }, 1000);
                    } else {
                        setIndicator(context, nationalityIndicator, false);
                        nationalitySelector.setVisibility(View.GONE);
                    }
                }
            });
            LinearLayout cancelButton = (LinearLayout) findViewById(R.id.nationality_cancel_button);
            cancelButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    nationalitySelector.setVisibility(View.GONE);
                }
            });
        }
    });

    addressIndicator = (ImageView) findViewById(R.id.preferred_address_indicator);
    addressValue = (TextView) findViewById(R.id.preferred_address_value);
    addressLayout = (RelativeLayout) findViewById(R.id.preferred_address_layout);
    if (editDriver.getPreferredAddress() != null) {
        setIndicator(context, addressIndicator, true);
        preferredPlace.setAddress(transform(editDriver.getPreferredAddress()));
        preferredPlace.setLocation(transform(editDriver.getPreferredLocation()));
        addressValue.setText(preferredPlace.getAddress().getFullAddress());
    }
    addressChooser = (FrameLayout) findViewById(R.id.preferred_address_chooser);
    selectorsLayouts.add(addressChooser);
    addressLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideKeyboard(context);
            try {
                if (addressChooser.getVisibility() == View.GONE) {
                    closeInactiveLayouts(appBarLayout, selectorsLayouts, addressChooser);
                    getSupportFragmentManager().beginTransaction()
                            .replace(R.id.preferred_address_chooser,
                                    PlaceChooserFragment.newInstance(preferredPlace, placeChooseHandler))
                            .commit();
                    mainScrollView.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mainScrollView.smoothScrollTo(0, addressLayout.getTop());
                        }
                    }, 1500);
                } else {
                    addressChooser.setVisibility(View.GONE);
                    getSupportFragmentManager().popBackStack();
                }
            } catch (Resources.NotFoundException | OutOfMemoryError ignored) {
            }
        }
    });

    final ImageView phoneIndicator = (ImageView) findViewById(R.id.driver_phone_indicator);
    final TextView phoneValue = (TextView) findViewById(R.id.driver_phone_value);
    if (editDriver.getPhoneNumber() != null) {
        setIndicator(context, phoneIndicator, true);
        phoneValue.setText(editDriver.getPhoneNumber().replace(currentCountry.getPhoneCode(), ""));
    }
    final LinearLayout phoneSelector = (LinearLayout) findViewById(R.id.driver_phone_selector);
    selectorsLayouts.add(phoneSelector);
    phoneLayout = (RelativeLayout) findViewById(R.id.driver_phone_layout);
    phoneLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideKeyboard(context);
            if (phoneSelector.getVisibility() == View.GONE) {
                closeInactiveLayouts(appBarLayout, selectorsLayouts, phoneSelector);
                mainScrollView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mainScrollView.smoothScrollTo(0, phoneLayout.getTop());
                    }
                }, 1000);
            }
            final EditText input = (EditText) findViewById(R.id.phone_number);
            if (editDriver.getPhoneNumber() != null)
                input.setText(editDriver.getPhoneNumber().replace(currentCountry.getPhoneCode(), ""));
            TextView phoneCode = (TextView) findViewById(R.id.country_code);
            phoneCode.setText(currentCountry.getPhoneCode());
            NetworkImageView countryFlag = (NetworkImageView) findViewById(R.id.country_flag);
            countryFlag.setImageUrl(currentCountry.getFlag(), DataHolder.getInstance().getImageLoader());
            LinearLayout okayButton = (LinearLayout) findViewById(R.id.driver_phone_okay_button);
            okayButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (!input.getText().toString().isEmpty()) {
                        String phoneNumberEdit = currentCountry.getPhoneCode()
                                + input.getText().toString().replaceAll(" ", "");
                        editDriver.setPhoneNumber(phoneNumberEdit);
                        phoneValue.setText(phoneNumberEdit);
                        setIndicator(context, phoneIndicator, true);
                        mainScrollView.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                mainScrollView.smoothScrollTo(0, dobLayout.getTop());
                            }
                        }, 1000);
                    } else {
                        phoneValue.setText(getString(R.string.driver_phone_hint));
                        setIndicator(context, phoneIndicator, false);
                    }
                    phoneSelector.setVisibility(View.GONE);
                }
            });
            LinearLayout cancelButton = (LinearLayout) findViewById(R.id.driver_phone_cancel_button);
            cancelButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    phoneSelector.setVisibility(View.GONE);
                }
            });
        }
    });

    dobValue = (TextView) findViewById(R.id.driver_dob_value);
    if (editDriver.getDob() != null)
        dobValue.setText(StringManipulation.getFormattedDate(editDriver.getDob()));
    dobLayout = (RelativeLayout) findViewById(R.id.driver_dob_layout);
    dobLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final Calendar calendar = Calendar.getInstance();
            if (editDriver.getDob() != null) {
                dobValue.setText(StringManipulation.getFormattedDate(editDriver.getDob()));
                calendar.setTimeInMillis(editDriver.getDob());
            }
            DatePickerDialog datePickerDialog = DatePickerDialog
                    .newInstance(new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePickerDialog view, int year, int monthOfYear,
                                int dayOfMonth) {
                            calendar.set(Calendar.YEAR, year);
                            calendar.set(Calendar.MONTH, monthOfYear);
                            calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                            editDriver.setDob(calendar.getTimeInMillis());
                            dobValue.setText(StringManipulation.getFormattedDate(editDriver.getDob()));
                        }
                    }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                            calendar.get(Calendar.DAY_OF_MONTH));
            datePickerDialog.show(getFragmentManager(), "Datepickerdialog");
        }
    });

    final TextView genderValue = (TextView) findViewById(R.id.driver_gender_value);
    if (editDriver.getGender() != null)
        genderValue.setText(
                editDriver.getGender() ? getString(R.string.male_option) : getString(R.string.female_option));
    final LinearLayout genderSelector = (LinearLayout) findViewById(R.id.driver_gender_selector);
    selectorsLayouts.add(genderSelector);
    final RelativeLayout genderLayout = (RelativeLayout) findViewById(R.id.driver_gender_layout);
    genderLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            hideKeyboard(context);
            if (genderSelector.getVisibility() == View.GONE) {
                closeInactiveLayouts(appBarLayout, selectorsLayouts, genderSelector);
                mainScrollView.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mainScrollView.smoothScrollTo(0, genderLayout.getTop());
                    }
                }, 1000);
            } else
                genderSelector.setVisibility(View.GONE);
            final int checkedPos = editDriver.getGender() == null ? -1
                    : (editDriver.getGender() ? R.id.driver_gender_male : R.id.driver_gender_female);
            final RadioGroup insuranceRadioGroup = (RadioGroup) findViewById(R.id.driver_gender_radio_group);
            if (checkedPos != -1)
                insuranceRadioGroup.check(checkedPos);
            LinearLayout okayButton = (LinearLayout) findViewById(R.id.driver_gender_okay_button);
            okayButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    switch (insuranceRadioGroup.getCheckedRadioButtonId()) {
                    case R.id.driver_gender_male:
                        editDriver.setGender(true);
                        genderValue.setText(getString(R.string.male_option));
                        break;
                    case R.id.driver_gender_female:
                        editDriver.setGender(false);
                        genderValue.setText(getString(R.string.female_option));
                        break;
                    default:
                        break;
                    }
                    mainScrollView.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mainScrollView.smoothScrollTo(0, 0);
                        }
                    }, 500);
                    appBarLayout.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            appBarLayout.setExpanded(true, true);
                        }
                    }, 1500);
                }
            });
            LinearLayout cancelButton = (LinearLayout) findViewById(R.id.driver_gender_cancel_button);
            cancelButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    genderSelector.setVisibility(View.GONE);
                }
            });
        }
    });

    //TODO image analyis on IDs (license) and cross check with profile photo1, or maybe selfie

    uploadCount = new AtomicInteger(0);
    saveDriverAction = (FloatingActionButton) findViewById(R.id.fab_save_id);
    saveDriverAction.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            boolean error = false;
            hideKeyboard(context);
            if (editDriver.getVehicles().size() == 1) {
                setIndicator(context, vehicleIndicator, false);
                error = true;
            }
            if (licenseImage.getDrawable() == null || editDriver.getLicenseExpiry() == null
                    || editDriver.getLicenseNumber() == null) {
                setIndicator(context, licenseIndicator, false);
                error = true;
            }
            if (residenceImage.getDrawable() == null || editDriver.getResidenceNumber() == null) {
                setIndicator(context, residenceIndicator, false);
                error = true;
            }
            if (editDriver.getNationality() == null) {
                setIndicator(context, nationalityIndicator, false);
                error = true;
            }
            if (editDriver.getPreferredAddress() == null) {
                setIndicator(context, addressIndicator, false);
                error = true;
            }
            if (editDriver.getPhoneNumber() == null || editDriver.getPhoneNumber().isEmpty()) {
                setIndicator(context, phoneIndicator, false);
                error = true;
            }
            if (user == null && !registerEmailHeaderFragment.setCustomerValues())
                error = true;
            if (error)
                Snackbar.make(view, getString(R.string.incorrect_driver_data_message), Snackbar.LENGTH_LONG)
                        .show();
            else if (user != null) {
                signUpAnalytics(user.getProviderId());
                editDriver.getVehicles().remove(editDriver.getVehicles().size() - 1);
                uploadImage("driver_license_snapshot",
                        "image_" + editDriver.getPhoneNumber().replace(currentCountry.getPhoneCode(), "") + "_"
                                + editDriver.getLicenseNumber() + ".jpg",
                        ((BitmapDrawable) licenseImage.getDrawable()).getBitmap(), REQUEST_DRIVER_LICENSE);
                uploadImage("driver_residence_snapshot",
                        "image_" + editDriver.getPhoneNumber().replace(currentCountry.getPhoneCode(), "") + "_"
                                + editDriver.getResidenceNumber() + ".jpg",
                        ((BitmapDrawable) residenceImage.getDrawable()).getBitmap(), REQUEST_RESIDENCE_ID);
                crossFade(context, findViewById(R.id.driver_progress_layout),
                        findViewById(R.id.driver_main_layout), null);
                //TODO verify registration details for duplicate, correctness, etc
            }
        }
    });

    imageUploadStatus = (TextSwitcher) findViewById(R.id.image_upload_status);
    imageUploadStatus.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            TextView switcherTextView = new TextView(getApplicationContext());
            switcherTextView.setTextSize(16);
            switcherTextView.setTypeface(null, Typeface.BOLD);
            switcherTextView.setText(getString(R.string.uploading_images));
            switcherTextView.setTextColor(getResources().getColor(R.color.colorAccent));
            return switcherTextView;
        }
    });
    Animation animationOut = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right);
    Animation animationIn = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left);
    imageUploadStatus.setOutAnimation(animationOut);
    imageUploadStatus.setInAnimation(animationIn);
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private Animation getAnimationInFromTopToDown() {
    return AnimationUtils.loadAnimation(mView.getContext(), R.anim.top_in);
}

From source file:android.support.v7.app.ActionBarImplCompatBase.java

public void doHide(boolean fromSystem) {
    mTopVisibilityView.clearAnimation();
    if (mTopVisibilityView.getVisibility() == View.GONE) {
        return;//from   w w  w.j  a  v  a2s  .  co m
    }

    final boolean animate = isShowHideAnimationEnabled() || fromSystem;

    if (animate) {
        Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_out_top);
        mTopVisibilityView.startAnimation(anim);
    }
    mTopVisibilityView.setVisibility(View.GONE);

    if (mSplitView != null && mSplitView.getVisibility() != View.GONE) {
        if (animate) {
            Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.abc_slide_out_bottom);
            mSplitView.startAnimation(anim);
        }
        mSplitView.setVisibility(View.GONE);
    }
}

From source file:android.support.v7.app.ActionBarImplBase.java

public void doHide(boolean fromSystem) {
    mTopVisibilityView.clearAnimation();
    if (mTopVisibilityView.getVisibility() == View.GONE) {
        return;/*  www  .j  av a 2s .co m*/
    }

    final boolean animate = isShowHideAnimationEnabled() || fromSystem;

    if (animate) {
        Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.slide_out_top);
        mTopVisibilityView.startAnimation(anim);
    }
    mTopVisibilityView.setVisibility(View.GONE);

    if (mSplitView != null && mSplitView.getVisibility() != View.GONE) {
        if (animate) {
            Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.slide_out_bottom);
            mSplitView.startAnimation(anim);
        }
        mSplitView.setVisibility(View.GONE);
    }
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private Animation getAnimationInFromBottomToTop() {
    return AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_in);
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private Animation getAnimationOutFromTopToDown() {
    return AnimationUtils.loadAnimation(mView.getContext(), R.anim.top_out);
}

From source file:com.github.shareme.gwsmaterialuikit.library.material.widget.EditText.java

private void setLabelVisible(boolean visible, boolean animation) {
    if (!mLabelEnable || mLabelVisible == visible)
        return;//w w  w .  j  a  v  a 2s  . c o  m

    mLabelVisible = visible;

    if (animation) {
        if (mLabelVisible) {
            if (mLabelInAnimId != 0) {
                Animation anim = AnimationUtils.loadAnimation(getContext(), mLabelInAnimId);
                anim.setAnimationListener(new Animation.AnimationListener() {

                    @Override
                    public void onAnimationStart(Animation animation) {
                        mLabelView.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationRepeat(Animation animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animation animation) {
                    }
                });
                mLabelView.clearAnimation();
                mLabelView.startAnimation(anim);
            } else
                mLabelView.setVisibility(View.VISIBLE);
        } else {
            if (mLabelOutAnimId != 0) {
                Animation anim = AnimationUtils.loadAnimation(getContext(), mLabelOutAnimId);
                anim.setAnimationListener(new Animation.AnimationListener() {

                    @Override
                    public void onAnimationStart(Animation animation) {
                        mLabelView.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationRepeat(Animation animation) {
                    }

                    @Override
                    public void onAnimationEnd(Animation animation) {
                        mLabelView.setVisibility(View.INVISIBLE);
                    }

                });
                mLabelView.clearAnimation();
                mLabelView.startAnimation(anim);
            } else
                mLabelView.setVisibility(View.INVISIBLE);
        }
    } else
        mLabelView.setVisibility(mLabelVisible ? View.VISIBLE : View.INVISIBLE);
}

From source file:com.box.myview.MyTopSnackBar.TSnackbar.java

private Animation getAnimationOutFromBottomToTop() {
    return AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_out);
}

From source file:net.sourceforge.kalimbaradio.androidapp.activity.DownloadActivity.java

private void toggleFullscreenAlbumArt() {
    scrollToCurrent();//from  w ww . ja v  a2 s  .c  o  m
    if (playlistFlipper.getDisplayedChild() == 1) {
        playlistFlipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.push_down_in));
        playlistFlipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.push_down_out));
        playlistFlipper.setDisplayedChild(0);
        toggleListButton.setImageResource(R.drawable.media_toggle_list);
    } else {
        playlistFlipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.push_up_in));
        playlistFlipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.push_up_out));
        playlistFlipper.setDisplayedChild(1);
        DownloadService downloadService = getDownloadService();
        if (downloadService != null && downloadService.getCurrentPlaying() != null) {
            getImageLoader().loadImage(toggleListButton, downloadService.getCurrentPlaying().getSong(), false,
                    true);
        }
    }
    setControlsVisible(true);
}

From source file:com.dvn.vindecoder.ui.seller.GetAllVehicalSellerDetails.java

private void setScrollContent() {

    collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout);
    final RelativeLayout img_container1 = (RelativeLayout) findViewById(R.id.img_container1);
    // load the animation
    final Animation animFadein = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fadein);
    // start the animation
    // set animation listener
    animFadein.setAnimationListener(new Animation.AnimationListener() {
        @Override/*from w ww  .  j  a v  a2 s.  co  m*/
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            /* if(img_container1.getVisibility() == View.VISIBLE)
             {
                 img_container1.setVisibility(View.GONE);
             }*/
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
        boolean isShow = false;
        int scrollRange = -1;

        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
            if (scrollRange == -1) {
                scrollRange = appBarLayout.getTotalScrollRange();
                // Log.e("val","-1  choti imge ko hide kerna h");
                img_container1.setVisibility(View.GONE);
            }
            if (scrollRange + verticalOffset == 0) {
                //  collapsingToolbarLayout.setTitle("Title");
                // Log.e("val","0 choti imge ko show kerna h");
                img_container1.setVisibility(View.VISIBLE);
                img_container1.startAnimation(animFadein);
                isShow = true;
            } else if (isShow) {
                // collapsingToolbarLayout.setTitle(" ");//carefull there should a space between double quote otherwise it wont work
                //Log.e("val","Showing choti imge ko hide kerna h");
                img_container1.setVisibility(View.GONE);

                isShow = false;
            }
        }
    });
}