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

The following examples show how to use android.content.pm.ActivityInfo#CONFIG_ORIENTATION .
Example 1
Project: android_9.0.0_r45   File: AttributeCache.java    License: Apache License 2.0 5 votes vote down vote up
public void updateConfiguration(Configuration config) {
    synchronized (this) {
        int changes = mConfiguration.updateFrom(config);
        if ((changes & ~(ActivityInfo.CONFIG_FONT_SCALE |
                ActivityInfo.CONFIG_KEYBOARD_HIDDEN |
                ActivityInfo.CONFIG_ORIENTATION)) != 0) {
            // The configurations being masked out are ones that commonly
            // change so we don't want flushing the cache... all others
            // will flush the cache.
            mPackages.evictAll();
        }
    }
}
 
Example 2
Project: container   File: AttributeCache.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void updateConfiguration(Configuration config) {
	synchronized (this) {
		int changes = mConfiguration.updateFrom(config);
		if ((changes & ~(ActivityInfo.CONFIG_FONT_SCALE | ActivityInfo.CONFIG_KEYBOARD_HIDDEN
				| ActivityInfo.CONFIG_ORIENTATION)) != 0) {
			// The configurations being masked out are ones that commonly
			// change so we don't want flushing the cache... all others
			// will flush the cache.
			mPackages.clear();
		}
	}
}
 
Example 3
Project: DroidPlugin   File: AttributeCache.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public void updateConfiguration(Configuration config) {
    synchronized (this) {
        int changes = mConfiguration.updateFrom(config);
        if ((changes & ~(ActivityInfo.CONFIG_FONT_SCALE |
                ActivityInfo.CONFIG_KEYBOARD_HIDDEN |
                ActivityInfo.CONFIG_ORIENTATION)) != 0) {
            // The configurations being masked out are ones that commonly
            // change so we don't want flushing the cache... all others
            // will flush the cache.
            mPackages.clear();
        }
    }
}
 
Example 4
Project: connectivity-samples   File: JUIHelper.java    License: Apache License 2.0 4 votes vote down vote up
public PopupWindow createPopupWindow(final NativeActivity act) {
    // Check manifest settings if the activity wouldn't be destroyed when
    // the device orientation changes
    try {
        ActivityInfo info = act.getPackageManager().getActivityInfo(
                act.getComponentName(), 0);
        if ((info.configChanges & ActivityInfo.CONFIG_ORIENTATION) == 0
                || (info.configChanges & ActivityInfo.CONFIG_SCREEN_SIZE) == 0) {
            Log.i("NDKHelper",
                    "Activity does not have android:configChanges='orientation|screenSize' attributes in AndroidManifest.xml.");
        }
    } catch (NameNotFoundException e) {
      Log.e("NDKHelper", "Failed to find ActivityName");
    }

    activity_ = act;
    // activity.setTheme(android.R.style.Theme_DeviceDefault);

    final PopupWindow popupWindow = new PopupWindow(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    activity_.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Window window = activity_.getWindow();
            if( window != null )
            {
                View decorView = window.getDecorView();
                if( decorView == null )
                {
                    // Put dummy layout to NativeActivity
                    LinearLayout mainLayout = new LinearLayout(activity_);
                    MarginLayoutParams params = new MarginLayoutParams(
                            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                    params.setMargins(0, 0, 0, 0);
                    activity_.setContentView(mainLayout, params);
                    decorView = mainLayout;
                }

                // Setup relative layout
                JUIRelativeLayout_ = new RelativeLayout(activity_);
                popupWindow.setContentView(JUIRelativeLayout_);

                // Show our UI over NativeActivity window
                popupWindow.showAtLocation(decorView, Gravity.TOP
                        | Gravity.START, 0, 0);
                popupWindow.setTouchable(false);
                popupWindow.update();
            }
        }
    });
    return popupWindow;
}
 
Example 5
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();
}