blob: c726d55c3aaa505b159ab5f1e7c3731ba8fa3673 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0-google-v5) on Mon Oct 07 18:23:44 PDT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>AdapterViewProtocol (TestKit 1.0-SNAPSHOT API)</title>
<meta name="date" content="2013-10-07">
<link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AdapterViewProtocol (TestKit 1.0-SNAPSHOT API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AdapterViewProtocol.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterDataLoaderAction.html" title="class in com.google.android.apps.common.testing.ui.espresso.action"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../index.html?com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html" target="_top">Frames</a></li>
<li><a href="AdapterViewProtocol.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.google.android.apps.common.testing.ui.espresso.action</div>
<h2 title="Interface AdapterViewProtocol" class="title">Interface AdapterViewProtocol</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="strong">AdapterViewProtocol</span></pre>
<div class="block">A sadly necessary layer of indirection to interact with AdapterViews.
<p>
Generally any subclass should respect the contracts and behaviors of its superclass. Otherwise
it becomes impossible to work generically with objects that all claim to share a supertype - you
need special cases to perform the same operation 'owned' by the supertype for each sub-type. The
'is - a' relationship is broken.
</p>
<p>
Android breaks the Liskov substitution principal with ExpandableListView - you can't use
getAdapter(), getItemAtPosition(), and other methods common to AdapterViews on an
ExpandableListView because an ExpandableListView isn't an adapterView - they just share a lot of
code.
</p>
<p>
This interface exists to work around this wart (which sadly is copied in other projects too) and
lets the implementor translate Espresso's needs and manipulations of the AdapterView into calls
that make sense for the given subtype and context.
</p>
<p><i>
If you have to implement this to talk to widgets your own project defines - I'm sorry.
</i><p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Interface and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><strong><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a></strong></code>
<div class="block">A holder that associates a data object from an AdapterView with a token the
AdapterViewProtocol can use to force that data object to be rendered as a child or deeper
descendant of the adapter view.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html#getDataInAdapterView(android.widget.AdapterView)">getDataInAdapterView</a></strong>(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView)</code>
<div class="block">Returns all data this AdapterViewProtocol can find within the given AdapterView.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>com.google.common.base.Optional&lt;<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html#getDataRenderedByView(android.widget.AdapterView, android.view.View)">getDataRenderedByView</a></strong>(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
android.view.View&nbsp;descendantView)</code>
<div class="block">Returns the data object this particular view is rendering if possible.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html#isDataRenderedWithinAdapterView(android.widget.AdapterView, com.google.android.apps.common.testing.ui.espresso.action.AdapterViewProtocol.AdaptedData)">isDataRenderedWithinAdapterView</a></strong>(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&nbsp;adaptedData)</code>
<div class="block">Indicates whether or not there now exists a descendant view within adapterView that
is rendering this data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html#makeDataRenderedWithinAdapterView(android.widget.AdapterView, com.google.android.apps.common.testing.ui.espresso.action.AdapterViewProtocol.AdaptedData)">makeDataRenderedWithinAdapterView</a></strong>(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&nbsp;data)</code>
<div class="block">Requests that a particular piece of data held in this AdapterView is actually rendered by it.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getDataInAdapterView(android.widget.AdapterView)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDataInAdapterView</h4>
<pre><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a>&lt;<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&gt;&nbsp;getDataInAdapterView(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView)</pre>
<div class="block">Returns all data this AdapterViewProtocol can find within the given AdapterView.
<p>
Any AdaptedData returned by this method can be passed to makeDataRenderedWithinView and the
implementation should make the AdapterView bring that data item onto the screen.
</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adapterView</code> - the AdapterView we want to interrogate the contents of.</dd>
<dt><span class="strong">Returns:</span></dt><dd>an <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang"><code>Iterable</code></a> of AdaptedDatas representing all data the implementation sees in
this view</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the implementation doesn't know how to manipulate the given
adapter view.</dd></dl>
</li>
</ul>
<a name="getDataRenderedByView(android.widget.AdapterView, android.view.View)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDataRenderedByView</h4>
<pre>com.google.common.base.Optional&lt;<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&gt;&nbsp;getDataRenderedByView(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
android.view.View&nbsp;descendantView)</pre>
<div class="block">Returns the data object this particular view is rendering if possible.
<p>
Implementations are expected to create a relationship between the data in the AdapterView and
the descendant views of the AdapterView that obeys the following conditions:
</p>
<ul>
<li>For each descendant view there exists either 0 or 1 data objects it is rendering.</li>
<li>For each data object the AdapterView there exists either 0 or 1 descendant views which
claim to be rendering it.</li>
</ul>
<p> For example - if a PersonObject is rendered into: </p>
<code>
LinearLayout
ImageView picture
TextView firstName
TextView lastName
</code>
<p>
It would be expected that getDataRenderedByView(adapter, LinearLayout) would return the
PersonObject. If it were called instead with the TextView or ImageView it would return
Object.absent().
</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adapterView</code> - the adapterview hosting the data.</dd><dd><code>descendantView</code> - a view which is a child, grand-child, or deeper descendant of adapterView</dd>
<dt><span class="strong">Returns:</span></dt><dd>an optional data object the descendant view is rendering.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if this protocol cannot interrogate this class of adapterView</dd></dl>
</li>
</ul>
<a name="makeDataRenderedWithinAdapterView(android.widget.AdapterView, com.google.android.apps.common.testing.ui.espresso.action.AdapterViewProtocol.AdaptedData)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeDataRenderedWithinAdapterView</h4>
<pre>void&nbsp;makeDataRenderedWithinAdapterView(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&nbsp;data)</pre>
<div class="block">Requests that a particular piece of data held in this AdapterView is actually rendered by it.
<p>
After calling this method it expected that there will exist some descendant view of adapterView
for which calling getDataRenderedByView(adapterView, descView).get() == data.data is true.
<p>
</p>
Note: this need not happen immediately. EG: an implementor handling ListView may call
listView.smoothScrollToPosition(data.opaqueToken) - which kicks off an animated scroll over
the list to the given position. The animation may be in progress after this call returns. The
only guarantee is that eventually - with no further interaction necessary - this data item
will be rendered as a child or deeper descendant of this AdapterView.
</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adapterView</code> - the adapterView hosting the data.</dd><dd><code>data</code> - an AdaptedData instance retrieved by a prior call to getDataInAdapterView</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if this protocol cannot manipulate adapterView or if data is
not owned by this AdapterViewProtocol.</dd></dl>
</li>
</ul>
<a name="isDataRenderedWithinAdapterView(android.widget.AdapterView, com.google.android.apps.common.testing.ui.espresso.action.AdapterViewProtocol.AdaptedData)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isDataRenderedWithinAdapterView</h4>
<pre>boolean&nbsp;isDataRenderedWithinAdapterView(android.widget.AdapterView&lt;? extends android.widget.Adapter&gt;&nbsp;adapterView,
<a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action">AdapterViewProtocol.AdaptedData</a>&nbsp;adaptedData)</pre>
<div class="block">Indicates whether or not there now exists a descendant view within adapterView that
is rendering this data.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>adapterView</code> - the AdapterView hosting this data.</dd><dd><code>adaptedData</code> - the data we are checking the display state for.</dd>
<dt><span class="strong">Returns:</span></dt><dd>true if the data is rendered by a view in the adapterView, false otherwise.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AdapterViewProtocol.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterDataLoaderAction.html" title="class in com.google.android.apps.common.testing.ui.espresso.action"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../../../../com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.AdaptedData.html" title="class in com.google.android.apps.common.testing.ui.espresso.action"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../index.html?com/google/android/apps/common/testing/ui/espresso/action/AdapterViewProtocol.html" target="_top">Frames</a></li>
<li><a href="AdapterViewProtocol.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested_class_summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2013. All rights reserved.</small></p>
</body>
</html>