use of butter.droid.base.manager.internal.beaming.BeamManager in project butter-android by butterproject.
the class BeamDeviceSelectorDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder;
if (!beamManager.isConnected()) {
adapter = new BeamDeviceAdapter(getActivity(), beamManager);
builder = new AlertDialog.Builder(getActivity()).setSingleChoiceItems(adapter, -1, (dialog, position) -> {
ConnectableDevice device = adapter.getItem(position);
beamManager.connect(device);
dismiss();
}).setTitle(R.string.select_beaming).setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
return builder.create();
} else if (beamManager.getConnectedDevice() != null) {
builder = new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.connected_to) + " " + beamManager.getConnectedDevice().getFriendlyName()).setNeutralButton(R.string.disconnect, (dialog, which) -> beamManager.disconnect());
return builder.create();
} else {
return super.onCreateDialog(savedInstanceState);
}
}
Aggregations