Search in sources :

Example 11 with IntValueProperty

use of com.android.tools.idea.ui.properties.core.IntValueProperty in project android by JetBrains.

the class DeveloperServiceCreator method createContext.

@NotNull
private static ServiceContext createContext(@NotNull Module module) {
    String buildSystemId = getBuildSystemOperations(module.getProject()).getBuildSystemId();
    ServiceContext context = new ServiceContext(buildSystemId);
    String packageName = MergedManifest.get(module).getPackage();
    if (packageName != null) {
        context.putValue("packageName", new StringValueProperty(packageName));
    }
    AndroidPlatform platform = AndroidPlatform.getInstance(module);
    if (platform != null) {
        // Add the compileSdkVersion (or buildApiVersion) such that compatible dependencies are chosen
        AndroidVersion version = platform.getApiVersion();
        context.putValue(ATTR_BUILD_API, new IntValueProperty(version.getFeatureLevel()));
        context.putValue(ATTR_BUILD_API_STRING, new StringValueProperty(getBuildApiString(version)));
    }
    return context;
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) StringValueProperty(com.android.tools.idea.ui.properties.core.StringValueProperty) AndroidPlatform(org.jetbrains.android.sdk.AndroidPlatform) TemplateMetadata.getBuildApiString(com.android.tools.idea.templates.TemplateMetadata.getBuildApiString) AndroidVersion(com.android.sdklib.AndroidVersion) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with IntValueProperty

use of com.android.tools.idea.ui.properties.core.IntValueProperty in project android by JetBrains.

the class IntExpressionsTest method testLessThanEqualValueExpression.

@Test
public void testLessThanEqualValueExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThanEqualTo(10));
    assertThat(result.get()).isTrue();
    lhs.set(10);
    assertThat(result.get()).isTrue();
    lhs.set(20);
    assertThat(result.get()).isFalse();
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 13 with IntValueProperty

use of com.android.tools.idea.ui.properties.core.IntValueProperty in project android by JetBrains.

the class IntExpressionsTest method testLessThanEqualExpression.

@Test
public void testLessThanEqualExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    IntValueProperty rhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThanEqualTo(rhs));
    assertThat(result.get()).isTrue();
    lhs.set(10);
    assertThat(result.get()).isFalse();
    rhs.set(10);
    assertThat(result.get()).isTrue();
    rhs.set(20);
    assertThat(result.get()).isTrue();
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 14 with IntValueProperty

use of com.android.tools.idea.ui.properties.core.IntValueProperty in project android by JetBrains.

the class IntExpressionsTest method testLessThanExpression.

@Test
public void testLessThanExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    IntValueProperty rhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThan(rhs));
    assertThat(result.get()).isFalse();
    rhs.set(10);
    assertThat(result.get()).isTrue();
    lhs.set(10);
    assertThat(result.get()).isFalse();
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 15 with IntValueProperty

use of com.android.tools.idea.ui.properties.core.IntValueProperty in project android by JetBrains.

the class IntExpressionsTest method testGreaterThanExpression.

@Test
public void testGreaterThanExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    IntValueProperty rhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isGreaterThan(rhs));
    assertThat(result.get()).isFalse();
    lhs.set(10);
    assertThat(result.get()).isTrue();
    rhs.set(10);
    assertThat(result.get()).isFalse();
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Aggregations

IntValueProperty (com.android.tools.idea.ui.properties.core.IntValueProperty)23 Test (org.junit.Test)22 BoolValueProperty (com.android.tools.idea.ui.properties.core.BoolValueProperty)13 BindingsManager (com.android.tools.idea.ui.properties.BindingsManager)12 StringValueProperty (com.android.tools.idea.ui.properties.core.StringValueProperty)3 IntProperty (com.android.tools.idea.ui.properties.core.IntProperty)2 AndroidVersion (com.android.sdklib.AndroidVersion)1 TemplateMetadata.getBuildApiString (com.android.tools.idea.templates.TemplateMetadata.getBuildApiString)1 StringExpression (com.android.tools.idea.ui.properties.expressions.string.StringExpression)1 AndroidPlatform (org.jetbrains.android.sdk.AndroidPlatform)1 NotNull (org.jetbrains.annotations.NotNull)1