Merge "Revert "Revert "Update to match now slice APIs"""
This commit is contained in:
committed by
Android (Google) Code Review
commit
aaa5643d86
@@ -35,6 +35,7 @@ import java.util.WeakHashMap;
|
||||
|
||||
import androidx.app.slice.Slice;
|
||||
import androidx.app.slice.SliceProvider;
|
||||
import androidx.app.slice.builders.SliceAction;
|
||||
import androidx.app.slice.builders.ListBuilder;
|
||||
|
||||
/**
|
||||
@@ -173,8 +174,9 @@ public class SettingsSliceProvider extends SliceProvider {
|
||||
.setTitle(getContext().getString(R.string.wifi_settings))
|
||||
.setTitleItem(Icon.createWithResource(getContext(), R.drawable.wifi_signal))
|
||||
.setSubtitle(state)
|
||||
.addToggle(getBroadcastIntent(ACTION_WIFI_CHANGED), finalWifiEnabled)
|
||||
.setContentIntent(getIntent(Intent.ACTION_MAIN)))
|
||||
.addEndItem(new SliceAction(getBroadcastIntent(ACTION_WIFI_CHANGED),
|
||||
null, finalWifiEnabled))
|
||||
.setPrimaryAction(new SliceAction(getIntent(Intent.ACTION_MAIN), null, null)))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import androidx.app.slice.Slice;
|
||||
import androidx.app.slice.builders.SliceAction;
|
||||
import androidx.app.slice.builders.ListBuilder;
|
||||
import androidx.app.slice.builders.ListBuilder.RowBuilder;
|
||||
|
||||
@@ -62,7 +63,7 @@ public class SliceBuilderUtils {
|
||||
.setTitle(sliceData.getTitle())
|
||||
.setTitleItem(icon)
|
||||
.setSubtitle(subtitleText)
|
||||
.setContentIntent(contentIntent);
|
||||
.setPrimaryAction(new SliceAction(contentIntent, null, null));
|
||||
|
||||
// TODO (b/71640747) Respect setting availability.
|
||||
|
||||
@@ -112,7 +113,7 @@ public class SliceBuilderUtils {
|
||||
String key) {
|
||||
PendingIntent actionIntent = getActionIntent(context,
|
||||
SettingsSliceProvider.ACTION_TOGGLE_CHANGED, key);
|
||||
builder.addToggle(actionIntent, isChecked);
|
||||
builder.addEndItem(new SliceAction(actionIntent, null, isChecked));
|
||||
}
|
||||
|
||||
private static PendingIntent getActionIntent(Context context, String action, String key) {
|
||||
|
Reference in New Issue
Block a user