Java Code Examples for android.content.pm.ActivityInfo#CONFIG_SCREEN_LAYOUT

The following examples show how to use android.content.pm.ActivityInfo#CONFIG_SCREEN_LAYOUT .
Example 1
Project: PowerFileExplorer   File: InterestingConfigChange.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check for any config change between various callbacks to this method.
 * Make sure to recycle after done
 * @param resources
 * @return
 */
public static boolean isConfigChanged(Resources resources) {
    int changedFieldsMask = lastConfiguration.updateFrom(resources.getConfiguration());
    boolean densityChanged = lastDensity!=resources.getDisplayMetrics().densityDpi;

    if (densityChanged || (changedFieldsMask &
            (ActivityInfo.CONFIG_SCREEN_LAYOUT | ActivityInfo.CONFIG_UI_MODE | ActivityInfo.CONFIG_LOCALE)) != 0) {
        // we have density changed from last time we came here
        return true;
    }

    return false;
}
 
Example 2
Project: V.FlyoutTest   File: LoaderCustomSupport.java    License: MIT License 5 votes vote down vote up
boolean applyNewConfig(Resources res) {
    int configChanges = mLastConfiguration.updateFrom(res.getConfiguration());
    boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
    if (densityChanged || (configChanges&(ActivityInfo.CONFIG_LOCALE
            |ActivityInfoCompat.CONFIG_UI_MODE|ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) {
        mLastDensity = res.getDisplayMetrics().densityDpi;
        return true;
    }
    return false;
}
 
Example 3
Project: AppOpsXposed   File: AppOpsCategory.java    License: GNU General Public License v3.0 5 votes vote down vote up
boolean applyNewConfig(Resources res) {
    int configChanges = mLastConfiguration.updateFrom(res.getConfiguration());
    boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
    if (densityChanged || (configChanges&(ActivityInfo.CONFIG_LOCALE
            |ActivityInfo.CONFIG_UI_MODE|ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) {
        mLastDensity = res.getDisplayMetrics().densityDpi;
        return true;
    }
    return false;
}
 
Example 4
Project: codeexamples-android   File: LoaderCustom.java    License: Eclipse Public License 1.0 5 votes vote down vote up
boolean applyNewConfig(Resources res) {
    int configChanges = mLastConfiguration.updateFrom(res.getConfiguration());
    boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
    if (densityChanged || (configChanges&(ActivityInfo.CONFIG_LOCALE
            |ActivityInfo.CONFIG_UI_MODE|ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) {
        mLastDensity = res.getDisplayMetrics().densityDpi;
        return true;
    }
    return false;
}
 
Example 5
Project: tup.dota2recipe   File: InterestingConfigChanges.java    License: Apache License 2.0 5 votes vote down vote up
public boolean applyNewConfig(Resources res) {
    int configChanges = mLastConfiguration.updateFrom(res.getConfiguration());
    boolean densityChanged = mLastDensity != res.getDisplayMetrics().densityDpi;
    if (densityChanged
            || (configChanges & (ActivityInfo.CONFIG_LOCALE | ActivityInfo.CONFIG_UI_MODE | ActivityInfo.CONFIG_SCREEN_LAYOUT)) != 0) {
        mLastDensity = res.getDisplayMetrics().densityDpi;
        return true;
    }
    return false;
}
 
Example 6
Project: android_9.0.0_r45   File: Configuration.java    License: Apache License 2.0 4 votes vote down vote up
/** @hide */
public static String configurationDiffToString(int diff) {
    ArrayList<String> list = new ArrayList<>();
    if ((diff & ActivityInfo.CONFIG_MCC) != 0) {
        list.add("CONFIG_MCC");
    }
    if ((diff & ActivityInfo.CONFIG_MNC) != 0) {
        list.add("CONFIG_MNC");
    }
    if ((diff & ActivityInfo.CONFIG_LOCALE) != 0) {
        list.add("CONFIG_LOCALE");
    }
    if ((diff & ActivityInfo.CONFIG_TOUCHSCREEN) != 0) {
        list.add("CONFIG_TOUCHSCREEN");
    }
    if ((diff & ActivityInfo.CONFIG_KEYBOARD) != 0) {
        list.add("CONFIG_KEYBOARD");
    }
    if ((diff & ActivityInfo.CONFIG_KEYBOARD_HIDDEN) != 0) {
        list.add("CONFIG_KEYBOARD_HIDDEN");
    }
    if ((diff & ActivityInfo.CONFIG_NAVIGATION) != 0) {
        list.add("CONFIG_NAVIGATION");
    }
    if ((diff & ActivityInfo.CONFIG_ORIENTATION) != 0) {
        list.add("CONFIG_ORIENTATION");
    }
    if ((diff & ActivityInfo.CONFIG_SCREEN_LAYOUT) != 0) {
        list.add("CONFIG_SCREEN_LAYOUT");
    }
    if ((diff & ActivityInfo.CONFIG_COLOR_MODE) != 0) {
        list.add("CONFIG_COLOR_MODE");
    }
    if ((diff & ActivityInfo.CONFIG_UI_MODE) != 0) {
        list.add("CONFIG_UI_MODE");
    }
    if ((diff & ActivityInfo.CONFIG_SCREEN_SIZE) != 0) {
        list.add("CONFIG_SCREEN_SIZE");
    }
    if ((diff & ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) != 0) {
        list.add("CONFIG_SMALLEST_SCREEN_SIZE");
    }
    if ((diff & ActivityInfo.CONFIG_LAYOUT_DIRECTION) != 0) {
        list.add("CONFIG_LAYOUT_DIRECTION");
    }
    if ((diff & ActivityInfo.CONFIG_FONT_SCALE) != 0) {
        list.add("CONFIG_FONT_SCALE");
    }
    if ((diff & ActivityInfo.CONFIG_ASSETS_PATHS) != 0) {
        list.add("CONFIG_ASSETS_PATHS");
    }
    StringBuilder builder = new StringBuilder("{");
    for (int i = 0, n = list.size(); i < n; i++) {
        builder.append(list.get(i));
        if (i != n - 1) {
            builder.append(", ");
        }
    }
    builder.append("}");
    return builder.toString();
}