Search in sources :

Example 6 with MediaDevice

use of com.android.settingslib.media.MediaDevice in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MediaOutputSlice method getSlice.

@Override
public Slice getSlice() {
    // Reload theme for switching dark mode on/off
    mContext.getTheme().applyStyle(R.style.Theme_Settings_Home, true);
    final ListBuilder listBuilder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY).setAccentColor(COLOR_NOT_TINTED);
    if (!isVisible()) {
        Log.d(TAG, "getSlice() is not visible");
        return listBuilder.build();
    }
    final List<MediaDevice> devices = getMediaDevices();
    final MediaDevice connectedDevice = getWorker().getCurrentConnectedMediaDevice();
    if (connectedDevice != null) {
        listBuilder.addRow(getActiveDeviceHeaderRow(connectedDevice));
    }
    for (MediaDevice device : devices) {
        if (connectedDevice == null || !TextUtils.equals(connectedDevice.getId(), device.getId())) {
            listBuilder.addRow(getMediaDeviceRow(device));
        }
    }
    return listBuilder.build();
}
Also used : ListBuilder(androidx.slice.builders.ListBuilder) MediaDevice(com.android.settingslib.media.MediaDevice)

Aggregations

MediaDevice (com.android.settingslib.media.MediaDevice)6 Test (org.junit.Test)4 Intent (android.content.Intent)2 Slice (androidx.slice.Slice)1 SliceMetadata (androidx.slice.SliceMetadata)1 ListBuilder (androidx.slice.builders.ListBuilder)1 SliceAction (androidx.slice.core.SliceAction)1 ArrayList (java.util.ArrayList)1