Use snackbar instead of progress dialog to find device.

This commit is contained in:
Daniele Gobbetti 2016-10-30 15:15:34 +01:00
parent a45f76d3bf
commit 8c769b15c3
1 changed files with 18 additions and 12 deletions

View File

@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.adapter;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -222,17 +221,24 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
@Override @Override
public void onClick(View v) { public void onClick(View v) {
GBApplication.deviceService().onFindDevice(true); GBApplication.deviceService().onFindDevice(true);
ProgressDialog.show( //TODO: extract string resource if we like this solution.
context, Snackbar.make(parent, R.string.control_center_find_lost_device, Snackbar.LENGTH_INDEFINITE).setAction("Found it!", new View.OnClickListener() {
context.getString(R.string.control_center_find_lost_device),
context.getString(R.string.control_center_cancel_to_stop_vibration),
true, true,
new DialogInterface.OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialog) { public void onClick(View v) {
GBApplication.deviceService().onFindDevice(false); GBApplication.deviceService().onFindDevice(false);
} }
}); }).show();
// ProgressDialog.show(
// context,
// context.getString(R.string.control_center_find_lost_device),
// context.getString(R.string.control_center_cancel_to_stop_vibration),
// true, true,
// new DialogInterface.OnCancelListener() {
// @Override
// public void onCancel(DialogInterface dialog) {
// GBApplication.deviceService().onFindDevice(false);
// }
// });
} }
} }