Search in sources :

Example 1 with ScreenSizeQualifier

use of com.android.ide.common.resources.configuration.ScreenSizeQualifier in project platform_frameworks_base by android.

the class ConfigGenerator method getFolderConfig.

public FolderConfiguration getFolderConfig() {
    FolderConfiguration config = new FolderConfiguration();
    config.createDefault();
    config.setDensityQualifier(new DensityQualifier(mDensity));
    config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation));
    if (mScreenWidth > mScreenHeight) {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth, mScreenHeight));
    } else {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight, mScreenWidth));
    }
    config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio));
    config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize));
    config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard));
    config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen));
    config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState));
    config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation));
    config.updateScreenWidthAndHeight();
    // some default qualifiers.
    config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL));
    config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT));
    config.setCountryCodeQualifier(new CountryCodeQualifier());
    config.setLayoutDirectionQualifier(new LayoutDirectionQualifier());
    config.setNetworkCodeQualifier(new NetworkCodeQualifier());
    config.setLocaleQualifier(new LocaleQualifier());
    config.setVersionQualifier(new VersionQualifier());
    return config;
}
Also used : VersionQualifier(com.android.ide.common.resources.configuration.VersionQualifier) NavigationMethodQualifier(com.android.ide.common.resources.configuration.NavigationMethodQualifier) ScreenSizeQualifier(com.android.ide.common.resources.configuration.ScreenSizeQualifier) KeyboardStateQualifier(com.android.ide.common.resources.configuration.KeyboardStateQualifier) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) NightModeQualifier(com.android.ide.common.resources.configuration.NightModeQualifier) ScreenOrientationQualifier(com.android.ide.common.resources.configuration.ScreenOrientationQualifier) UiModeQualifier(com.android.ide.common.resources.configuration.UiModeQualifier) TouchScreenQualifier(com.android.ide.common.resources.configuration.TouchScreenQualifier) LayoutDirectionQualifier(com.android.ide.common.resources.configuration.LayoutDirectionQualifier) ScreenDimensionQualifier(com.android.ide.common.resources.configuration.ScreenDimensionQualifier) ScreenRatioQualifier(com.android.ide.common.resources.configuration.ScreenRatioQualifier) TextInputMethodQualifier(com.android.ide.common.resources.configuration.TextInputMethodQualifier) DensityQualifier(com.android.ide.common.resources.configuration.DensityQualifier) NetworkCodeQualifier(com.android.ide.common.resources.configuration.NetworkCodeQualifier) LocaleQualifier(com.android.ide.common.resources.configuration.LocaleQualifier) CountryCodeQualifier(com.android.ide.common.resources.configuration.CountryCodeQualifier)

Example 2 with ScreenSizeQualifier

use of com.android.ide.common.resources.configuration.ScreenSizeQualifier in project android_frameworks_base by ResurrectionRemix.

the class ConfigGenerator method getFolderConfig.

public FolderConfiguration getFolderConfig() {
    FolderConfiguration config = new FolderConfiguration();
    config.createDefault();
    config.setDensityQualifier(new DensityQualifier(mDensity));
    config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation));
    if (mScreenWidth > mScreenHeight) {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth, mScreenHeight));
    } else {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight, mScreenWidth));
    }
    config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio));
    config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize));
    config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard));
    config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen));
    config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState));
    config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation));
    config.updateScreenWidthAndHeight();
    // some default qualifiers.
    config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL));
    config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT));
    config.setCountryCodeQualifier(new CountryCodeQualifier());
    config.setLayoutDirectionQualifier(new LayoutDirectionQualifier());
    config.setNetworkCodeQualifier(new NetworkCodeQualifier());
    config.setLocaleQualifier(new LocaleQualifier());
    config.setVersionQualifier(new VersionQualifier());
    return config;
}
Also used : VersionQualifier(com.android.ide.common.resources.configuration.VersionQualifier) NavigationMethodQualifier(com.android.ide.common.resources.configuration.NavigationMethodQualifier) ScreenSizeQualifier(com.android.ide.common.resources.configuration.ScreenSizeQualifier) KeyboardStateQualifier(com.android.ide.common.resources.configuration.KeyboardStateQualifier) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) NightModeQualifier(com.android.ide.common.resources.configuration.NightModeQualifier) ScreenOrientationQualifier(com.android.ide.common.resources.configuration.ScreenOrientationQualifier) UiModeQualifier(com.android.ide.common.resources.configuration.UiModeQualifier) TouchScreenQualifier(com.android.ide.common.resources.configuration.TouchScreenQualifier) LayoutDirectionQualifier(com.android.ide.common.resources.configuration.LayoutDirectionQualifier) ScreenDimensionQualifier(com.android.ide.common.resources.configuration.ScreenDimensionQualifier) ScreenRatioQualifier(com.android.ide.common.resources.configuration.ScreenRatioQualifier) TextInputMethodQualifier(com.android.ide.common.resources.configuration.TextInputMethodQualifier) DensityQualifier(com.android.ide.common.resources.configuration.DensityQualifier) NetworkCodeQualifier(com.android.ide.common.resources.configuration.NetworkCodeQualifier) LocaleQualifier(com.android.ide.common.resources.configuration.LocaleQualifier) CountryCodeQualifier(com.android.ide.common.resources.configuration.CountryCodeQualifier)

Example 3 with ScreenSizeQualifier

use of com.android.ide.common.resources.configuration.ScreenSizeQualifier in project android by JetBrains.

the class ConfigurationMenuAction method createPopupActionGroup.

@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup("Configuration", true);
    Configuration configuration = mySurface.getConfiguration();
    if (configuration == null) {
        return group;
    }
    VirtualFile virtualFile = configuration.getFile();
    if (virtualFile != null) {
        Module module = configuration.getModule();
        if (module == null) {
            return group;
        }
        Project project = module.getProject();
        List<VirtualFile> variations = ResourceHelper.getResourceVariations(virtualFile, true);
        if (variations.size() > 1) {
            for (VirtualFile file : variations) {
                String title = String.format("Switch to %1$s", file.getParent().getName());
                group.add(new SwitchToVariationAction(title, project, file, virtualFile.equals(file)));
            }
            group.addSeparator();
        }
        ResourceFolderType folderType = ResourceHelper.getFolderType(configuration.getFile());
        if (folderType == ResourceFolderType.LAYOUT) {
            boolean haveLandscape = false;
            boolean haveLarge = false;
            for (VirtualFile file : variations) {
                String name = file.getParent().getName();
                if (name.startsWith(FD_RES_LAYOUT)) {
                    FolderConfiguration config = FolderConfiguration.getConfigForFolder(name);
                    if (config != null) {
                        ScreenOrientationQualifier orientation = config.getScreenOrientationQualifier();
                        if (orientation != null && orientation.getValue() == ScreenOrientation.LANDSCAPE) {
                            haveLandscape = true;
                            if (haveLarge) {
                                break;
                            }
                        }
                        ScreenSizeQualifier size = config.getScreenSizeQualifier();
                        if (size != null && size.getValue() == ScreenSize.XLARGE) {
                            haveLarge = true;
                            if (haveLandscape) {
                                break;
                            }
                        }
                    }
                }
            }
            // Do statistics on what is needed!
            if (!haveLandscape) {
                group.add(new CreateVariationAction(mySurface, "Create Landscape Variation", "layout-land"));
            }
            if (!haveLarge) {
                group.add(new CreateVariationAction(mySurface, "Create layout-xlarge Variation", "layout-xlarge"));
            //group.add(new CreateVariationAction(mySurface, "Create layout-sw600dp Variation...", "layout-sw600dp"));
            }
            group.add(new CreateVariationAction(mySurface, "Create Other...", null));
        } else {
            group.add(new CreateVariationAction(mySurface, "Create Alternative...", null));
        }
    /* TODO: Restore multi-configuration editing
      if (mySurface.supportsPreviews()) {
        addMultiConfigActions(group);
      }
      */
    }
    return group;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) ScreenSizeQualifier(com.android.ide.common.resources.configuration.ScreenSizeQualifier) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Project(com.intellij.openapi.project.Project) ScreenOrientationQualifier(com.android.ide.common.resources.configuration.ScreenOrientationQualifier) ResourceFolderType(com.android.resources.ResourceFolderType) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with ScreenSizeQualifier

use of com.android.ide.common.resources.configuration.ScreenSizeQualifier in project android_frameworks_base by crdroidandroid.

the class ConfigGenerator method getFolderConfig.

public FolderConfiguration getFolderConfig() {
    FolderConfiguration config = new FolderConfiguration();
    config.createDefault();
    config.setDensityQualifier(new DensityQualifier(mDensity));
    config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation));
    if (mScreenWidth > mScreenHeight) {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth, mScreenHeight));
    } else {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight, mScreenWidth));
    }
    config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio));
    config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize));
    config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard));
    config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen));
    config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState));
    config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation));
    config.updateScreenWidthAndHeight();
    // some default qualifiers.
    config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL));
    config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT));
    config.setCountryCodeQualifier(new CountryCodeQualifier());
    config.setLayoutDirectionQualifier(new LayoutDirectionQualifier());
    config.setNetworkCodeQualifier(new NetworkCodeQualifier());
    config.setLocaleQualifier(new LocaleQualifier());
    config.setVersionQualifier(new VersionQualifier());
    return config;
}
Also used : VersionQualifier(com.android.ide.common.resources.configuration.VersionQualifier) NavigationMethodQualifier(com.android.ide.common.resources.configuration.NavigationMethodQualifier) ScreenSizeQualifier(com.android.ide.common.resources.configuration.ScreenSizeQualifier) KeyboardStateQualifier(com.android.ide.common.resources.configuration.KeyboardStateQualifier) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) NightModeQualifier(com.android.ide.common.resources.configuration.NightModeQualifier) ScreenOrientationQualifier(com.android.ide.common.resources.configuration.ScreenOrientationQualifier) UiModeQualifier(com.android.ide.common.resources.configuration.UiModeQualifier) TouchScreenQualifier(com.android.ide.common.resources.configuration.TouchScreenQualifier) LayoutDirectionQualifier(com.android.ide.common.resources.configuration.LayoutDirectionQualifier) ScreenDimensionQualifier(com.android.ide.common.resources.configuration.ScreenDimensionQualifier) ScreenRatioQualifier(com.android.ide.common.resources.configuration.ScreenRatioQualifier) TextInputMethodQualifier(com.android.ide.common.resources.configuration.TextInputMethodQualifier) DensityQualifier(com.android.ide.common.resources.configuration.DensityQualifier) NetworkCodeQualifier(com.android.ide.common.resources.configuration.NetworkCodeQualifier) LocaleQualifier(com.android.ide.common.resources.configuration.LocaleQualifier) CountryCodeQualifier(com.android.ide.common.resources.configuration.CountryCodeQualifier)

Example 5 with ScreenSizeQualifier

use of com.android.ide.common.resources.configuration.ScreenSizeQualifier in project android_frameworks_base by AOSPA.

the class ConfigGenerator method getFolderConfig.

public FolderConfiguration getFolderConfig() {
    FolderConfiguration config = new FolderConfiguration();
    config.createDefault();
    config.setDensityQualifier(new DensityQualifier(mDensity));
    config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation));
    if (mScreenWidth > mScreenHeight) {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth, mScreenHeight));
    } else {
        config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight, mScreenWidth));
    }
    config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio));
    config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize));
    config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard));
    config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen));
    config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState));
    config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation));
    config.updateScreenWidthAndHeight();
    // some default qualifiers.
    config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL));
    config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT));
    config.setCountryCodeQualifier(new CountryCodeQualifier());
    config.setLayoutDirectionQualifier(new LayoutDirectionQualifier());
    config.setNetworkCodeQualifier(new NetworkCodeQualifier());
    config.setLocaleQualifier(new LocaleQualifier());
    config.setVersionQualifier(new VersionQualifier());
    return config;
}
Also used : VersionQualifier(com.android.ide.common.resources.configuration.VersionQualifier) NavigationMethodQualifier(com.android.ide.common.resources.configuration.NavigationMethodQualifier) ScreenSizeQualifier(com.android.ide.common.resources.configuration.ScreenSizeQualifier) KeyboardStateQualifier(com.android.ide.common.resources.configuration.KeyboardStateQualifier) FolderConfiguration(com.android.ide.common.resources.configuration.FolderConfiguration) NightModeQualifier(com.android.ide.common.resources.configuration.NightModeQualifier) ScreenOrientationQualifier(com.android.ide.common.resources.configuration.ScreenOrientationQualifier) UiModeQualifier(com.android.ide.common.resources.configuration.UiModeQualifier) TouchScreenQualifier(com.android.ide.common.resources.configuration.TouchScreenQualifier) LayoutDirectionQualifier(com.android.ide.common.resources.configuration.LayoutDirectionQualifier) ScreenDimensionQualifier(com.android.ide.common.resources.configuration.ScreenDimensionQualifier) ScreenRatioQualifier(com.android.ide.common.resources.configuration.ScreenRatioQualifier) TextInputMethodQualifier(com.android.ide.common.resources.configuration.TextInputMethodQualifier) DensityQualifier(com.android.ide.common.resources.configuration.DensityQualifier) NetworkCodeQualifier(com.android.ide.common.resources.configuration.NetworkCodeQualifier) LocaleQualifier(com.android.ide.common.resources.configuration.LocaleQualifier) CountryCodeQualifier(com.android.ide.common.resources.configuration.CountryCodeQualifier)

Aggregations

FolderConfiguration (com.android.ide.common.resources.configuration.FolderConfiguration)6 ScreenOrientationQualifier (com.android.ide.common.resources.configuration.ScreenOrientationQualifier)6 ScreenSizeQualifier (com.android.ide.common.resources.configuration.ScreenSizeQualifier)6 CountryCodeQualifier (com.android.ide.common.resources.configuration.CountryCodeQualifier)5 DensityQualifier (com.android.ide.common.resources.configuration.DensityQualifier)5 KeyboardStateQualifier (com.android.ide.common.resources.configuration.KeyboardStateQualifier)5 LayoutDirectionQualifier (com.android.ide.common.resources.configuration.LayoutDirectionQualifier)5 LocaleQualifier (com.android.ide.common.resources.configuration.LocaleQualifier)5 NavigationMethodQualifier (com.android.ide.common.resources.configuration.NavigationMethodQualifier)5 NetworkCodeQualifier (com.android.ide.common.resources.configuration.NetworkCodeQualifier)5 NightModeQualifier (com.android.ide.common.resources.configuration.NightModeQualifier)5 ScreenDimensionQualifier (com.android.ide.common.resources.configuration.ScreenDimensionQualifier)5 ScreenRatioQualifier (com.android.ide.common.resources.configuration.ScreenRatioQualifier)5 TextInputMethodQualifier (com.android.ide.common.resources.configuration.TextInputMethodQualifier)5 TouchScreenQualifier (com.android.ide.common.resources.configuration.TouchScreenQualifier)5 UiModeQualifier (com.android.ide.common.resources.configuration.UiModeQualifier)5 VersionQualifier (com.android.ide.common.resources.configuration.VersionQualifier)5 ResourceFolderType (com.android.resources.ResourceFolderType)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 Module (com.intellij.openapi.module.Module)1