Loading android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java +9 −0 Original line number Diff line number Diff line Loading @@ -1219,6 +1219,15 @@ public class BluetoothProxy { return true; } public boolean hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) { if (bluetoothHapClient == null) return false; int groupId = bluetoothLeAudio.getGroupId(device); bluetoothHapClient.selectPresetForGroup(groupId, preset_index); return true; } public boolean hapChangePresetName(BluetoothDevice device, int preset_index, String name) { if (bluetoothHapClient == null) return false; Loading android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/LeAudioRecycleViewAdapter.java +20 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,8 @@ public class LeAudioRecycleViewAdapter void onSetActivePresetClicked(BluetoothDevice device, int preset_index); void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index); void onNextDevicePresetClicked(BluetoothDevice device); void onPreviousDevicePresetClicked(BluetoothDevice device); Loading Loading @@ -947,6 +949,7 @@ public class LeAudioRecycleViewAdapter private Spinner leAudioHapPresetsSpinner; private Button leAudioHapChangePresetNameButton; private Button leAudioHapSetActivePresetButton; private Button leAudioHapSetActivePresetForGroupButton; private Button leAudioHapReadPresetInfoButton; private Button leAudioHapNextDevicePresetButton; private Button leAudioHapPreviousDevicePresetButton; Loading Loading @@ -1041,6 +1044,8 @@ public class LeAudioRecycleViewAdapter itemView.findViewById(R.id.hap_change_preset_name_button); leAudioHapSetActivePresetButton = itemView.findViewById(R.id.hap_set_active_preset_button); leAudioHapSetActivePresetForGroupButton = itemView.findViewById(R.id.hap_set_active_preset_for_group_button); leAudioHapReadPresetInfoButton = itemView.findViewById(R.id.hap_read_preset_info_button); leAudioHapNextDevicePresetButton = Loading Loading @@ -1110,6 +1115,21 @@ public class LeAudioRecycleViewAdapter } }); leAudioHapSetActivePresetForGroupButton.setOnClickListener(view -> { if (hapInteractionListener != null) { if (leAudioHapPresetsSpinner.getSelectedItem() == null) { Toast.makeText(view.getContext(), "No known preset, please reconnect.", Toast.LENGTH_SHORT).show(); return; } Integer index = Integer.valueOf( leAudioHapPresetsSpinner.getSelectedItem().toString().split("\\s")[0]); hapInteractionListener.onSetActivePresetForGroupClicked( devices.get(ViewHolder.this.getAdapterPosition()).device, index); } }); leAudioHapReadPresetInfoButton.setOnClickListener(view -> { if (hapInteractionListener != null) { if (leAudioHapPresetsSpinner.getSelectedItem() == null) { Loading android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/LeAudioViewModel.java +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public class LeAudioViewModel extends AndroidViewModel { bluetoothProxy.hapSetActivePreset(device, preset_index); } public void hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) { bluetoothProxy.hapSetActivePresetForGroup(device, preset_index); } public void hapChangePresetName(BluetoothDevice device, int preset_index, String name) { bluetoothProxy.hapChangePresetName(device, preset_index, name); } Loading android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/MainActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,11 @@ public class MainActivity extends AppCompatActivity { leAudioViewModel.hapSetActivePreset(device, preset_index); } @Override public void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index) { leAudioViewModel.hapSetActivePresetForGroup(device, preset_index); } @Override public void onChangePresetNameClicked(BluetoothDevice device, int preset_index, String name) { Loading android/leaudio/app/src/main/res/layout/hap_layout.xml +8 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Precious group preset" /> android:text="Previous group preset" /> <Button android:id="@+id/hap_next_group_preset_button" Loading @@ -168,5 +168,12 @@ android:layout_weight="1" android:text="Next group preset" /> <Button android:id="@+id/hap_set_active_preset_for_group_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Set group active" /> </LinearLayout> </LinearLayout> No newline at end of file Loading
android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/BluetoothProxy.java +9 −0 Original line number Diff line number Diff line Loading @@ -1219,6 +1219,15 @@ public class BluetoothProxy { return true; } public boolean hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) { if (bluetoothHapClient == null) return false; int groupId = bluetoothLeAudio.getGroupId(device); bluetoothHapClient.selectPresetForGroup(groupId, preset_index); return true; } public boolean hapChangePresetName(BluetoothDevice device, int preset_index, String name) { if (bluetoothHapClient == null) return false; Loading
android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/LeAudioRecycleViewAdapter.java +20 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,8 @@ public class LeAudioRecycleViewAdapter void onSetActivePresetClicked(BluetoothDevice device, int preset_index); void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index); void onNextDevicePresetClicked(BluetoothDevice device); void onPreviousDevicePresetClicked(BluetoothDevice device); Loading Loading @@ -947,6 +949,7 @@ public class LeAudioRecycleViewAdapter private Spinner leAudioHapPresetsSpinner; private Button leAudioHapChangePresetNameButton; private Button leAudioHapSetActivePresetButton; private Button leAudioHapSetActivePresetForGroupButton; private Button leAudioHapReadPresetInfoButton; private Button leAudioHapNextDevicePresetButton; private Button leAudioHapPreviousDevicePresetButton; Loading Loading @@ -1041,6 +1044,8 @@ public class LeAudioRecycleViewAdapter itemView.findViewById(R.id.hap_change_preset_name_button); leAudioHapSetActivePresetButton = itemView.findViewById(R.id.hap_set_active_preset_button); leAudioHapSetActivePresetForGroupButton = itemView.findViewById(R.id.hap_set_active_preset_for_group_button); leAudioHapReadPresetInfoButton = itemView.findViewById(R.id.hap_read_preset_info_button); leAudioHapNextDevicePresetButton = Loading Loading @@ -1110,6 +1115,21 @@ public class LeAudioRecycleViewAdapter } }); leAudioHapSetActivePresetForGroupButton.setOnClickListener(view -> { if (hapInteractionListener != null) { if (leAudioHapPresetsSpinner.getSelectedItem() == null) { Toast.makeText(view.getContext(), "No known preset, please reconnect.", Toast.LENGTH_SHORT).show(); return; } Integer index = Integer.valueOf( leAudioHapPresetsSpinner.getSelectedItem().toString().split("\\s")[0]); hapInteractionListener.onSetActivePresetForGroupClicked( devices.get(ViewHolder.this.getAdapterPosition()).device, index); } }); leAudioHapReadPresetInfoButton.setOnClickListener(view -> { if (hapInteractionListener != null) { if (leAudioHapPresetsSpinner.getSelectedItem() == null) { Loading
android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/LeAudioViewModel.java +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public class LeAudioViewModel extends AndroidViewModel { bluetoothProxy.hapSetActivePreset(device, preset_index); } public void hapSetActivePresetForGroup(BluetoothDevice device, int preset_index) { bluetoothProxy.hapSetActivePresetForGroup(device, preset_index); } public void hapChangePresetName(BluetoothDevice device, int preset_index, String name) { bluetoothProxy.hapChangePresetName(device, preset_index, name); } Loading
android/leaudio/app/src/main/java/com/android/bluetooth/leaudio/MainActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,11 @@ public class MainActivity extends AppCompatActivity { leAudioViewModel.hapSetActivePreset(device, preset_index); } @Override public void onSetActivePresetForGroupClicked(BluetoothDevice device, int preset_index) { leAudioViewModel.hapSetActivePresetForGroup(device, preset_index); } @Override public void onChangePresetNameClicked(BluetoothDevice device, int preset_index, String name) { Loading
android/leaudio/app/src/main/res/layout/hap_layout.xml +8 −1 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Precious group preset" /> android:text="Previous group preset" /> <Button android:id="@+id/hap_next_group_preset_button" Loading @@ -168,5 +168,12 @@ android:layout_weight="1" android:text="Next group preset" /> <Button android:id="@+id/hap_set_active_preset_for_group_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Set group active" /> </LinearLayout> </LinearLayout> No newline at end of file