use of com.genonbeta.TrebleShot.object.NetworkDevice in project TrebleShot by genonbeta.
the class ShareActivity method onRequestReady.
protected void onRequestReady() {
if (getIntent().hasExtra(EXTRA_DEVICE_ID)) {
String deviceId = getIntent().getStringExtra(EXTRA_DEVICE_ID);
NetworkDevice chosenDevice = new NetworkDevice(deviceId);
try {
mDatabase.reconstruct(chosenDevice);
showChooserDialog(chosenDevice);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of com.genonbeta.TrebleShot.object.NetworkDevice in project TrebleShot by genonbeta.
the class NetworkDeviceListFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
final NetworkDevice device = (NetworkDevice) getAdapter().getItem(position);
if (mClickListener != null) {
if (device.versionNumber != -1 && device.versionNumber < AppConfig.SUPPORTED_MIN_VERSION)
createSnackbar(R.string.mesg_versionNotSupported).show();
else
mClickListener.onItemClick(l, v, position, id);
} else if (device instanceof NetworkDeviceListAdapter.HotspotNetwork) {
final NetworkDeviceListAdapter.HotspotNetwork hotspotNetwork = (NetworkDeviceListAdapter.HotspotNetwork) device;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(hotspotNetwork.nickname);
builder.setMessage(R.string.text_trebleshotHotspotDescription);
builder.setNegativeButton(R.string.butn_close, null);
builder.setPositiveButton(isConnectedToNetwork(hotspotNetwork) ? R.string.butn_disconnect : R.string.butn_connect, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
toggleConnection(hotspotNetwork);
}
});
builder.show();
} else if (device.brand != null && device.model != null)
new DeviceInfoDialog(getActivity(), getAdapter().getDatabase(), device).show();
}
Aggregations