Class SpinnerControl
java.lang.Object
com.samsung.android.sdk.samsungpay.v2.payment.sheet.SheetControl
com.samsung.android.sdk.samsungpay.v2.payment.sheet.SpinnerControl
- All Implemented Interfaces:
android.os.Parcelable
This class provides SpinnerControl on custom payment sheet.
SpinnerControl is used for displaying spinner option on custom payment sheet.
SpinnerControl is used for displaying spinner option on custom payment sheet.
- Since:
- API Level 1.6
-
Nested Class Summary
Nested classes/interfaces inherited from class com.samsung.android.sdk.samsungpay.v2.payment.sheet.SheetControl
SheetControl.Controltype
-
Field Summary
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionSpinnerControl
(String controlId, String title, SheetItemType sheetItemType) Constructor to create SpinnerControl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
API to add item in specific location.void
API to add item.boolean
API to check the item is existing or not.API to get the ID of selected item.getTitle()
API to get spinner title.void
removeItem
(String id) API to remove item.void
API to set selected item with ID.void
setSheetUpdatedListener
(SheetUpdatedListener sheetUpdatedListener) API to register a callback which is invoked when SpinnerControl is updated.
SheetUpdatedListener.onResult(String, CustomSheet)
is invoked when SpinnerControl is updated.void
API to set spinner title.void
updateItem
(String id, String text) API to update item text.Methods inherited from class com.samsung.android.sdk.samsungpay.v2.payment.sheet.SheetControl
getControlId, getControltype
-
Constructor Details
-
SpinnerControl
Constructor to create SpinnerControl.
// Construct SpinnerControl. SpinnerControl spinnerControl = new SpinnerControl("spinner", "Shipping method", SheetItemType .SHIPPING_METHOD_SPINNER); spinnerControl.addItem("id_item1", "item1 option"); spinnerControl.addItem("id_item2", "item2 option"); spinnerControl.setSelectedItemId("id_item1"); // Register {@link SheetUpdatedListener} to get result from Samsung Pay App. spinnerControl.setSheetUpdatedListener(new SheetUpdatedListener() { @Override public void onResult(String updatedControlId, CustomSheet sheet) { SpinnerControl spinnerControl = (SpinnerControl) sheet.getSheetControl(updatedControlId); Log.d(TAG, "SELECTED ID : " + spinnerControl.getSelectedItemId()); // Merchant can calculate total amount with selected option. sheet.updateControl(amountBoxControl); // Call updateSheet() API method with AmountBoxControl. This is mandatory. paymentManager.updateSheet(sheet); } }
- Parameters:
controlId
- Unique ID to represent the SpinnerControl. This ID is used to compare with other SheetControls.title
- Spinner title to display.sheetItemType
- sheetItemType to display.
The possible values are:
SheetItemType.SHIPPING_METHOD_SPINNER
SheetItemType.INSTALLMENT_SPINNER
- Throws:
NullPointerException
- Thrown if title is null.IllegalArgumentException
- Thrown if controlId is null or empty.
Thrown if sheetItemType is notSheetItemType.SHIPPING_METHOD_SPINNER
orSheetItemType.INSTALLMENT_SPINNER
.- Since:
- API Level 1.6
-
-
Method Details
-
setSheetUpdatedListener
API to register a callback which is invoked when SpinnerControl is updated.
SheetUpdatedListener.onResult(String, CustomSheet)
is invoked when SpinnerControl is updated.- Parameters:
sheetUpdatedListener
- The callback that will run.- Since:
- API Level 1.6
-
getTitle
API to get spinner title.- Returns:
- Title for SpinnerControl.
- Since:
- API Level 1.6
-
setTitle
API to set spinner title.- Parameters:
title
- Spinner title for SpinnerControl.- Throws:
NullPointerException
- Thrown if spinnerTitle is null.- Since:
- API Level 1.6
-
getSelectedItemId
API to get the ID of selected item.- Returns:
- Selected item ID.
- Since:
- API Level 1.6
-
setSelectedItemId
API to set selected item with ID.- Throws:
NullPointerException
- Thrown if the ID is null.IllegalArgumentException
- Thrown if there is no item associated with the ID.- Since:
- API Level 1.6
-
addItem
API to add item.- Parameters:
id
- Unique ID to be set.itemText
- String to be set.- Throws:
NullPointerException
- Thrown if the ID or value is null.IllegalArgumentException
- Thrown if the same ID is used in Items.- Since:
- API Level 1.6
-
addItem
API to add item in specific location.- Parameters:
id
- Unique ID to add.itemText
- String value to be set.- Throws:
NullPointerException
- Thrown if the ID or value is null.IllegalArgumentException
- Thrown if the location is abnormal.IllegalArgumentException
- Thrown if the same ID is used in Items.- Since:
- API Level 1.6
-
removeItem
API to remove item.- Parameters:
id
- ID to be removed.- Throws:
NullPointerException
- Thrown if the ID is null.IllegalArgumentException
- Thrown if there is no item associated with the ID.- Since:
- API Level 1.6
-
updateItem
API to update item text.- Parameters:
id
- ID to update.text
- Item String to update.- Throws:
NullPointerException
- Thrown if the ID is null.IllegalArgumentException
- Thrown if there is no item associated with the ID.- Since:
- API Level 1.6
-
existItem
API to check the item is existing or not.- Parameters:
id
- ID to be checked item.- Returns:
- True, if there is item.
- Throws:
NullPointerException
- Thrown if the ID is null.- Since:
- API Level 1.6
-
Samsung Electronics.
Samsung Pay SDK 2.19.00 - Jun 12 2024