Update Bluetooth toggle UI to UX spec - settings
Change-Id: I171d3e55e8a480d304e4dc4e0debbd2f3ab27651
This commit is contained in:
@@ -20,12 +20,17 @@ import android.app.Activity;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.app.AlertActivity;
|
||||
import com.android.internal.app.AlertController;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.util.CharSequences;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
@@ -45,8 +50,13 @@ public class RequestPermissionHelperActivity extends AlertActivity implements
|
||||
public static final String ACTION_INTERNAL_REQUEST_BT_OFF =
|
||||
"com.android.settings.bluetooth.ACTION_INTERNAL_REQUEST_BT_OFF";
|
||||
|
||||
public static final String EXTRA_APP_LABEL =
|
||||
"com.android.settings.bluetooth.extra.APP_LABEL";
|
||||
|
||||
private LocalBluetoothAdapter mLocalAdapter;
|
||||
|
||||
private CharSequence mAppLabel;
|
||||
|
||||
private int mTimeout = -1;
|
||||
|
||||
private int mRequest;
|
||||
@@ -78,18 +88,29 @@ public class RequestPermissionHelperActivity extends AlertActivity implements
|
||||
switch (mRequest) {
|
||||
case RequestPermissionActivity.REQUEST_ENABLE: {
|
||||
if (mTimeout < 0) {
|
||||
p.mMessage = getString(R.string.bluetooth_ask_enablement);
|
||||
p.mMessage = mAppLabel != null
|
||||
? getString(R.string.bluetooth_ask_enablement, mAppLabel)
|
||||
: getString(R.string.bluetooth_ask_enablement_no_name);
|
||||
} else if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) {
|
||||
p.mMessage = getString(
|
||||
R.string.bluetooth_ask_enablement_and_lasting_discovery);
|
||||
p.mMessage = mAppLabel != null
|
||||
? getString(
|
||||
R.string.bluetooth_ask_enablement_and_lasting_discovery,
|
||||
mAppLabel)
|
||||
: getString(
|
||||
R.string.bluetooth_ask_enablement_and_lasting_discovery_no_name);
|
||||
} else {
|
||||
p.mMessage = getString(
|
||||
R.string.bluetooth_ask_enablement_and_discovery, mTimeout);
|
||||
p.mMessage = mAppLabel != null
|
||||
? getString(R.string.bluetooth_ask_enablement_and_discovery,
|
||||
mAppLabel, mTimeout)
|
||||
: getString(R.string.bluetooth_ask_enablement_and_discovery_no_name,
|
||||
mTimeout);
|
||||
}
|
||||
} break;
|
||||
|
||||
case RequestPermissionActivity.REQUEST_DISABLE: {
|
||||
p.mMessage = getString(R.string.bluetooth_ask_disablement);
|
||||
p.mMessage = mAppLabel != null
|
||||
? getString(R.string.bluetooth_ask_disablement, mAppLabel)
|
||||
: getString(R.string.bluetooth_ask_disablement_no_name);
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -145,6 +166,8 @@ public class RequestPermissionHelperActivity extends AlertActivity implements
|
||||
return false;
|
||||
}
|
||||
|
||||
mAppLabel = getIntent().getCharSequenceExtra(EXTRA_APP_LABEL);
|
||||
|
||||
mLocalAdapter = manager.getBluetoothAdapter();
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user