[go: nahoru, domu]

Added API to get primary action SliceItem from RowView

Test: manual - verified slices in viewer app, no UI change

Relnote: Added getter of primary action SliceItem from RowView in order to fire action on it from subclasses.
Change-Id: Id088dca22322d7bfe9f24e64902050b5fcfa5674
diff --git a/slices/view/api/current.txt b/slices/view/api/current.txt
index 8f4ab1c..00623eb 100644
--- a/slices/view/api/current.txt
+++ b/slices/view/api/current.txt
@@ -124,6 +124,7 @@
   @RequiresApi(19) public class RowView extends androidx.slice.widget.SliceChildView implements android.widget.AdapterView.OnItemSelectedListener android.view.View.OnClickListener {
     ctor public RowView(android.content.Context);
     method protected java.util.List<java.lang.String!> getEndItemKeys();
+    method protected androidx.slice.SliceItem? getPrimaryActionItem();
     method protected String? getPrimaryActionKey();
     method public void onClick(android.view.View);
     method public void onItemSelected(android.widget.AdapterView<?>, android.view.View, int, long);
diff --git a/slices/view/api/public_plus_experimental_current.txt b/slices/view/api/public_plus_experimental_current.txt
index 8f4ab1c..00623eb 100644
--- a/slices/view/api/public_plus_experimental_current.txt
+++ b/slices/view/api/public_plus_experimental_current.txt
@@ -124,6 +124,7 @@
   @RequiresApi(19) public class RowView extends androidx.slice.widget.SliceChildView implements android.widget.AdapterView.OnItemSelectedListener android.view.View.OnClickListener {
     ctor public RowView(android.content.Context);
     method protected java.util.List<java.lang.String!> getEndItemKeys();
+    method protected androidx.slice.SliceItem? getPrimaryActionItem();
     method protected String? getPrimaryActionKey();
     method public void onClick(android.view.View);
     method public void onItemSelected(android.widget.AdapterView<?>, android.view.View, int, long);
diff --git a/slices/view/api/restricted_current.txt b/slices/view/api/restricted_current.txt
index 490f80e..960fa08 100644
--- a/slices/view/api/restricted_current.txt
+++ b/slices/view/api/restricted_current.txt
@@ -204,6 +204,7 @@
   @RequiresApi(19) public class RowView extends androidx.slice.widget.SliceChildView implements android.widget.AdapterView.OnItemSelectedListener android.view.View.OnClickListener {
     ctor public RowView(android.content.Context);
     method protected java.util.List<java.lang.String!> getEndItemKeys();
+    method protected androidx.slice.SliceItem? getPrimaryActionItem();
     method protected String? getPrimaryActionKey();
     method public void onClick(android.view.View);
     method public void onItemSelected(android.widget.AdapterView<?>, android.view.View, int, long);
diff --git a/slices/view/src/main/java/androidx/slice/widget/RowView.java b/slices/view/src/main/java/androidx/slice/widget/RowView.java
index 08cf037..f094431 100644
--- a/slices/view/src/main/java/androidx/slice/widget/RowView.java
+++ b/slices/view/src/main/java/androidx/slice/widget/RowView.java
@@ -324,6 +324,14 @@
     }
 
     /**
+     * Allows subclasses to access the SliceItem that can be used to fire an action.
+     */
+    @Nullable
+    protected SliceItem getPrimaryActionItem() {
+        return (mRowContent != null) ? mRowContent.getPrimaryAction() : null;
+    }
+
+    /**
      * Allows subclasses to access the key associated with the primary action of the row.
      */
     @Nullable