Example usage for android.os LocaleList equals

List of usage examples for android.os LocaleList equals

Introduction

In this page you can find the example usage for android.os LocaleList equals.

Prototype

@Override
    public boolean equals(Object other) 

Source Link

Usage

From source file:com.android.settings.localepicker.LocaleDragAndDropAdapter.java

public void updateLocalesWhenAnimationStops(final LocaleList localeList) {
    if (localeList.equals(mLocalesToSetNext)) {
        return;//  w  ww . j  a  v  a 2s.  com
    }

    // This will only update the Settings application to make things feel more responsive,
    // the system will be updated later, when animation stopped.
    LocaleList.setDefault(localeList);

    mLocalesToSetNext = localeList;
    final RecyclerView.ItemAnimator itemAnimator = mParentView.getItemAnimator();
    itemAnimator.isRunning(new RecyclerView.ItemAnimator.ItemAnimatorFinishedListener() {
        @Override
        public void onAnimationsFinished() {
            if (mLocalesToSetNext == null || mLocalesToSetNext.equals(mLocalesSetLast)) {
                // All animations finished, but the locale list did not change
                return;
            }

            LocalePicker.updateLocales(mLocalesToSetNext);
            mLocalesSetLast = mLocalesToSetNext;
            mLocalesToSetNext = null;

            mNumberFormatter = NumberFormat.getNumberInstance(Locale.getDefault());
        }
    });
}