Implement "show received files" preference item.
Add handler to send an intent to the Bluetooth OPP app to show the list of received files to the user. Bug: 3167219 Change-Id: I59e18559a0c35add7f1be56a5f040dae4dccc7f1
This commit is contained in:
@@ -18,7 +18,10 @@ package com.android.settings.bluetooth;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
|
import android.content.Intent;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceScreen;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -36,11 +39,16 @@ public class BluetoothSettings extends DeviceListPreferenceFragment
|
|||||||
private static final String KEY_BT_CHECKBOX = "bt_checkbox";
|
private static final String KEY_BT_CHECKBOX = "bt_checkbox";
|
||||||
private static final String KEY_BT_DISCOVERABLE = "bt_discoverable";
|
private static final String KEY_BT_DISCOVERABLE = "bt_discoverable";
|
||||||
private static final String KEY_BT_NAME = "bt_name";
|
private static final String KEY_BT_NAME = "bt_name";
|
||||||
|
private static final String KEY_BT_SHOW_RECEIVED = "bt_show_received_files";
|
||||||
|
|
||||||
private BluetoothEnabler mEnabler;
|
private BluetoothEnabler mEnabler;
|
||||||
private BluetoothDiscoverableEnabler mDiscoverableEnabler;
|
private BluetoothDiscoverableEnabler mDiscoverableEnabler;
|
||||||
private BluetoothNamePreference mNamePreference;
|
private BluetoothNamePreference mNamePreference;
|
||||||
|
|
||||||
|
/* Private intent to show the list of received files */
|
||||||
|
private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES =
|
||||||
|
"android.btopp.intent.action.OPEN_RECEIVED_FILES";
|
||||||
|
|
||||||
void addPreferencesForActivity(Activity activity) {
|
void addPreferencesForActivity(Activity activity) {
|
||||||
addPreferencesFromResource(R.xml.bluetooth_settings);
|
addPreferencesFromResource(R.xml.bluetooth_settings);
|
||||||
|
|
||||||
@@ -75,6 +83,18 @@ public class BluetoothSettings extends DeviceListPreferenceFragment
|
|||||||
mEnabler.pause();
|
mEnabler.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||||
|
Preference preference) {
|
||||||
|
if (KEY_BT_SHOW_RECEIVED.equals(preference.getKey())) {
|
||||||
|
Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES);
|
||||||
|
getActivity().sendBroadcast(intent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
|
}
|
||||||
|
|
||||||
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice,
|
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice,
|
||||||
int bondState) {
|
int bondState) {
|
||||||
if (bondState == BluetoothDevice.BOND_BONDED) {
|
if (bondState == BluetoothDevice.BOND_BONDED) {
|
||||||
|
Reference in New Issue
Block a user