Example usage for android.content.pm ActivityInfo CONFIG_LAYOUT_DIRECTION

List of usage examples for android.content.pm ActivityInfo CONFIG_LAYOUT_DIRECTION

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo CONFIG_LAYOUT_DIRECTION.

Prototype

int CONFIG_LAYOUT_DIRECTION

To view the source code for android.content.pm ActivityInfo CONFIG_LAYOUT_DIRECTION.

Click Source Link

Document

Bit in #configChanges that indicates that the activity can itself handle the change to layout direction.

Usage

From source file:com.appsimobile.appsii.Appsi.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    int diff = mLastConfiguration.diff(newConfig);

    // handle layout-direction change

    boolean directionChanged = (diff
            & ActivityInfo.CONFIG_LAYOUT_DIRECTION) == ActivityInfo.CONFIG_LAYOUT_DIRECTION;
    boolean localeChanged = (diff & ActivityInfo.CONFIG_LOCALE) == ActivityInfo.CONFIG_LOCALE;
    boolean orientationChanged = newConfig.orientation != mLastConfiguration.orientation;

    mLastConfiguration = new Configuration(newConfig);

    if (directionChanged || localeChanged) {
        Log.i("Appsi", "restarting because of direction or locale change");
        restartAppsiService();/*from   ww  w  .ja  va2 s. c  o m*/
        return;
    }

    if (orientationChanged) {
        mHotspotHelper.onOrientationChanged();
    }
}