下面列出了android.content.pm.ActivityInfo#CONFIG_FONT_SCALE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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();
}
}
}
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();
}
}
}
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();
}
}
}
/** @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();
}
/**
* Determines if a new resource needs to be loaded from the bit set of
* configuration changes returned by {@link #updateFrom(Configuration)}.
*
* @param configChanges the mask of changes configurations as returned by
* {@link #updateFrom(Configuration)}
* @param interestingChanges the configuration changes that the resource
* can handle as given in
* {@link android.util.TypedValue#changingConfigurations}
* @return {@code true} if the resource needs to be loaded, {@code false}
* otherwise
*/
public static boolean needNewResources(@Config int configChanges,
@Config int interestingChanges) {
// CONFIG_ASSETS_PATHS and CONFIG_FONT_SCALE are higher level configuration changes that
// all resources are subject to change with.
interestingChanges = interestingChanges | ActivityInfo.CONFIG_ASSETS_PATHS
| ActivityInfo.CONFIG_FONT_SCALE;
return (configChanges & interestingChanges) != 0;
}