<item name="android:navigationBarColor">#00000000</item>
</style>
- <style name="Theme.BluetoothPermission" parent="@android:style/Theme.Material.Light.Dialog.Alert">
+ <style name="Theme.BluetoothPermission" parent="@style/Theme.AlertDialog">
<item name="android:windowNoTitle">true</item>
</style>
import android.text.TextUtils;
import android.util.Log;
+import androidx.appcompat.app.AlertDialog;
+
import com.android.settings.R;
import com.android.settingslib.bluetooth.BluetoothDiscoverableTimeoutReceiver;
-import androidx.appcompat.app.AlertDialog;
-
/**
* RequestPermissionActivity asks the user whether to enable discovery. This is
* usually started by an application wanted to start bluetooth and or discovery
*/
public class RequestPermissionActivity extends Activity implements
- DialogInterface.OnClickListener {
+ DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
// Command line to test this
// adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
// adb shell am start -a android.bluetooth.adapter.action.REQUEST_DISCOVERABLE
builder.setNegativeButton(getString(R.string.deny), this);
}
+ builder.setOnDismissListener(this);
mDialog = builder.create();
mDialog.show();
}
break;
case DialogInterface.BUTTON_NEGATIVE:
- setResult(RESULT_CANCELED);
- finish();
+ cancelAndFinish();
break;
}
}
+ @Override
+ public void onDismiss(final DialogInterface dialog) {
+ cancelAndFinish();
+ }
+
private void proceedAndFinish() {
int returnCode;