当前位置: 首页>>代码示例>>Java>>正文


Java Callout类代码示例

本文整理汇总了Java中org.commcare.suite.model.Callout的典型用法代码示例。如果您正苦于以下问题:Java Callout类的具体用法?Java Callout怎么用?Java Callout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Callout类属于org.commcare.suite.model包,在下文中一共展示了Callout类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDetailStructure

import org.commcare.suite.model.Callout; //导入依赖的package包/类
@Test
public void testDetailStructure() {
    // A suite detail can have a lookup block for performing an app callout
    Callout callout = 
        mApp.getSession().getPlatform().getDetail("m0_case_short").getCallout();

    // specifies the callout's intent type
    Assert.assertEquals(callout.getRawCalloutData().getType(), "text/plain");

    // If the detail block represents an entity list, then the 'lookup' can
    // have a detail field describing the UI for displaying callout result
    // data in the case list.
    DetailField lookupCalloutDetailField = callout.getResponseDetailField();

    // The header is the data's title
    Assert.assertTrue(lookupCalloutDetailField.getHeader() != null);

    // The template defines the key used to map an entity to the callout
    // result data.  callout result data is a mapping from keys to string
    // values, so each entity who's template evalutates to a key will have
    // the associated result data attached to it.
    Assert.assertTrue(lookupCalloutDetailField.getTemplate() instanceof Text);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:AppStructureTests.java

示例2: parse

import org.commcare.suite.model.Callout; //导入依赖的package包/类
public Callout parse() throws InvalidStructureException, IOException, XmlPullParserException {
    String actionName = parser.getAttributeValue(null, "action");
    String image = parser.getAttributeValue(null, "image");
    String displayName = parser.getAttributeValue(null, "name");
    String type = parser.getAttributeValue(null, "type");

    Hashtable<String, String> extras = new Hashtable<String, String>();
    Vector<String> responses = new Vector<String>();
    DetailField responseDetailField = null;

    while (nextTagInBlock("lookup")) {
        String tagName = parser.getName();
        if ("extra".equals(tagName)) {
            extras.put(parser.getAttributeValue(null, "key"), parser.getAttributeValue(null, "value"));
        } else if ("response".equals(tagName)) {
            responses.addElement(parser.getAttributeValue(null, "key"));
        } else if ("field".equals(tagName)) {
            responseDetailField = new DetailFieldParser(parser, null, "'lookup callout detail field'").parse();
        }
    }
    return new Callout(actionName, image, displayName, extras, responses, responseDetailField, type);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:CalloutParser.java

示例3: makeCalloutClickListener

import org.commcare.suite.model.Callout; //导入依赖的package包/类
/**
 * Build click listener from callout: set button's image, get intent action,
 * and copy extras into intent.
 *
 * @param callout contains intent action and extras, and sometimes button image
 * @return click listener that launches the callout's activity with the
 * associated callout extras
 */
public static View.OnClickListener makeCalloutClickListener(final Activity activity,
                                                            Callout callout, EvaluationContext ec) {
    final Intent i = buildCalloutIntent(callout, ec);
    return new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                activity.startActivityForResult(i, EntitySelectActivity.CALLOUT);
            } catch (ActivityNotFoundException anfe) {
                Toast.makeText(activity,
                        Localization.get("callout.missing", new String[]{i.getAction()}),
                        Toast.LENGTH_LONG).show();
            }
        }
    };
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:25,代码来源:EntitySelectCalloutSetup.java

示例4: parse

import org.commcare.suite.model.Callout; //导入依赖的package包/类
@Override
public Callout parse() throws InvalidStructureException, IOException, XmlPullParserException {
    String actionName = parser.getAttributeValue(null, "action");
    String image = parser.getAttributeValue(null, "image");
    String displayName = parser.getAttributeValue(null, "name");
    String type = parser.getAttributeValue(null, "type");
    boolean isAutoLaunching = "true".equals(parser.getAttributeValue(null, "auto_launch"));

    Hashtable<String, String> extras = new Hashtable<>();
    Vector<String> responses = new Vector<>();
    DetailField responseDetailField = null;

    while (nextTagInBlock("lookup")) {
        String tagName = parser.getName();
        if ("extra".equals(tagName)) {
            extras.put(parser.getAttributeValue(null, "key"), parser.getAttributeValue(null, "value"));
        } else if ("response".equals(tagName)) {
            responses.addElement(parser.getAttributeValue(null, "key"));
        } else if ("field".equals(tagName)) {
            responseDetailField = new DetailFieldParser(parser, null, "'lookup callout detail field'").parse();
        }
    }
    return new Callout(actionName, image, displayName, extras, responses, responseDetailField, type, isAutoLaunching);
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:25,代码来源:CalloutParser.java

示例5: testDetailStructure

import org.commcare.suite.model.Callout; //导入依赖的package包/类
@Test
public void testDetailStructure() {
    // A suite detail can have a lookup block for performing an app callout
    Callout callout = 
        mApp.getSession().getPlatform().getDetail("m0_case_short").getCallout();

    // specifies the callout's intent type
    assertEquals(callout.evaluate(mApp.getSession().getEvaluationContext()).getType(), "text/plain");

    // If the detail block represents an entity list, then the 'lookup' can
    // have a detail field describing the UI for displaying callout result
    // data in the case list.
    DetailField lookupCalloutDetailField = callout.getResponseDetailField();

    // The header is the data's title
    Assert.assertTrue(lookupCalloutDetailField.getHeader() != null);

    // The template defines the key used to map an entity to the callout
    // result data.  callout result data is a mapping from keys to string
    // values, so each entity who's template evalutates to a key will have
    // the associated result data attached to it.
    Assert.assertTrue(lookupCalloutDetailField.getTemplate() instanceof Text);
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:24,代码来源:AppStructureTests.java

示例6: initCustomCallout

import org.commcare.suite.model.Callout; //导入依赖的package包/类
private Callout initCustomCallout() {
    Callout customCallout = shortSelect.getCallout();
    if (customCallout != null && customCallout.isSimprintsCallout()
            && Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If this device can't support the simprints library, don't create the callout
        return null;
    }
    if (customCallout != null && ICDS_DOMAIN_NAME.equals(ReportingUtils.getDomain())) {
        customCallout.setAssumePlainTextValues();
    }
    return customCallout;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:13,代码来源:EntitySelectActivity.java

示例7: setupPreHoneycombFooter

import org.commcare.suite.model.Callout; //导入依赖的package包/类
protected void setupPreHoneycombFooter(View.OnClickListener barcodeScanOnClickListener, Callout callout) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        TextView preHoneycombSearchLabel =
                (TextView)activity.findViewById(R.id.screen_entity_select_search_label);
        //use the old method here because some Android versions don't like Spannables for titles
        preHoneycombSearchLabel.setText(Localization.get("select.search.label"));
        preHoneycombSearchLabel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // get the focus on the edittext by performing click
                preHoneycombSearchBox.performClick();
                // then force the keyboard up since performClick() apparently isn't enough on some devices
                InputMethodManager inputMethodManager =
                        (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
                // only will trigger it if no physical keyboard is open
                inputMethodManager.showSoftInput(preHoneycombSearchBox, InputMethodManager.SHOW_IMPLICIT);
            }
        });

        preHoneycombSearchBox = (EditText)activity.findViewById(R.id.searchbox);
        preHoneycombSearchBox.setMaxLines(3);
        preHoneycombSearchBox.setHorizontallyScrolling(false);
        preHoneycombSearchBox.addTextChangedListener(this);
        preHoneycombSearchBox.requestFocus();
        preHoneycombSearchBox.setText(activity.getLastQueryString());

        ImageButton preHoneycombBarcodeButton = (ImageButton)activity.findViewById(R.id.barcodeButton);
        preHoneycombBarcodeButton.setOnClickListener(barcodeScanOnClickListener);
        if (callout != null && callout.getImage() != null) {
            EntitySelectCalloutSetup.setupImageLayout(activity, preHoneycombBarcodeButton, callout.getImage());
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:34,代码来源:EntitySelectSearchUI.java

示例8: buildCalloutIntent

import org.commcare.suite.model.Callout; //导入依赖的package包/类
public static Intent buildCalloutIntent(Callout callout, EvaluationContext ec) {
    final CalloutData calloutData = callout.evaluate(ec);
    Intent i = new Intent(calloutData.getActionName());
    for (Map.Entry<String, String> keyValue : calloutData.getExtras().entrySet()) {
        i.putExtra(keyValue.getKey(), keyValue.getValue());
    }
    if (calloutData.getType() != null && !"".equals(calloutData.getType())) {
        i.setType(calloutData.getType());
    }
    return i;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:12,代码来源:EntitySelectCalloutSetup.java

示例9: performFingerprintCallout

import org.commcare.suite.model.Callout; //导入依赖的package包/类
private void performFingerprintCallout() {
    // make entity list callout to 'fingerprint identification'
    entitySelectActivity.barcodeScanOnClickListener.onClick(null);

    // receive the (faked) callout result
    Callout identificationScanCallout = getEntitySelectCallout();
    Intent calloutIntent = EntitySelectCalloutSetup.buildCalloutIntent(
            identificationScanCallout,
            entitySelectActivity.evalContext());
    Intent responseIntent = buildIdentificationResultIntent();
    ShadowActivity shadowEntitySelect = Shadows.shadowOf(entitySelectActivity);
    shadowEntitySelect.receiveResult(calloutIntent, Activity.RESULT_OK, responseIntent);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:14,代码来源:EntityListCalloutDataTest.java

示例10: getEntitySelectCallout

import org.commcare.suite.model.Callout; //导入依赖的package包/类
private static Callout getEntitySelectCallout() {
    AndroidSessionWrapper sessionWrapper =
            CommCareApplication.instance().getCurrentSessionWrapper();
    CommCareSession session = sessionWrapper.getSession();
    EntityDatum selectDatum = (EntityDatum)session.getNeededDatum();
    Detail shortSelect = session.getDetail(selectDatum.getShortDetail());
    return shortSelect.getCallout();
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:9,代码来源:EntityListCalloutDataTest.java

示例11: setupActionImage

import org.commcare.suite.model.Callout; //导入依赖的package包/类
public void setupActionImage(Callout callout) {
    if (callout != null && callout.getImage() != null) {
        // Replace the barcode scan callout with our custom callout
        EntitySelectCalloutSetup.setupImageLayout(activity, barcodeMenuItem, callout.getImage());
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:7,代码来源:EntitySelectSearchUI.java


注:本文中的org.commcare.suite.model.Callout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。