A Slider
creates a full screen or pop-up overlay (depending on platform) that a user can control. There are two main Slider
layouts, one with a static footer and one with a dynamic footer.
The slider will persist on the screen until the timeout has elapsed or the user dismisses the slider by selecting a position or canceling.
A slider popup with a static footer displays a single, optional, footer message below the slider UI.
//Create a slider Slider slider = new Slider(5, 1, "This is a Header"); List<String> footer = Collections.singletonList("Static Footer"); slider.setSliderFooter(footer); slider.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { SliderResponse sliderResponse = (SliderResponse) response; Log.i(TAG, "Slider Position Set: "+ sliderResponse.getSliderPosition()); } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); //Send Request sdlManager.sendRPC(slider);
This type of slider will have a different footer message displayed for each position of the slider. The footer is an optional paramater. The footer message displayed will be based off of the slider's current position. The footer array should be the same length as numTicks
because each footer must correspond to a tick value. Or, you can pass null
to have no footer at all.
//Create a slider Slider slider = new Slider(3, 1, "This is a Header"); // Each footer corresponds with the slider's position List<String> footer = Arrays.asList("Footer 1","Footer 2","Footer 3"); slider.setSliderFooter(footer); slider.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { SliderResponse sliderResponse = (SliderResponse) response; Log.i(TAG, "Slider Position Set: "+ sliderResponse.getSliderPosition()); } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); //Send Request sdlManager.sendRPC(slider);