本文整理汇总了Java中android.widget.Adapter.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Adapter.isEmpty方法的具体用法?Java Adapter.isEmpty怎么用?Java Adapter.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.Adapter
的用法示例。
在下文中一共展示了Adapter.isEmpty方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isFirstItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isFirstItemVisible. Empty View.");
}
return true;
} else {
/**
* This check should really just be:
* mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView
* internally use a HeaderView which messes the positions up. For
* now we'll just add one to account for it and rely on the inner
* condition which checks getTop().
*/
if (mRefreshableView.getFirstVisiblePosition() <= 1) {
final View firstVisibleChild = mRefreshableView.getChildAt(0);
if (firstVisibleChild != null) {
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
}
}
}
return false;
}
示例2: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible() {
Adapter adapter = ((AbsListView) this.mRefreshableView).getAdapter();
if (adapter == null || adapter.isEmpty()) {
return true;
}
int lastItemPosition = ((AbsListView) this.mRefreshableView).getCount() - 1;
int lastVisiblePosition = ((AbsListView) this.mRefreshableView).getLastVisiblePosition();
if (lastVisiblePosition >= lastItemPosition - 1) {
View lastVisibleChild = ((AbsListView) this.mRefreshableView).getChildAt
(lastVisiblePosition - ((AbsListView) this.mRefreshableView)
.getFirstVisiblePosition());
if (lastVisibleChild != null) {
return lastVisibleChild.getBottom() <= ((AbsListView) this.mRefreshableView)
.getBottom();
}
}
return false;
}
示例3: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
/**
* 判断第一个child是否完全显示出来
*
* @return true完全显示出来,否则false
*/
private boolean isFirstItemVisible() {
final Adapter adapter = mListView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
return true;
}
if (mListView.getChildCount() > 0
&& mListView.getFirstVisiblePosition() == 0
&& mListView.getChildAt(0).getTop() >= mListView
.getPaddingTop()) {
return true;
}
return false;
}
示例4: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Empty View.");
}
return true;
} else {
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " + lastItemPosition + " Last Visible Pos: "
+ lastVisiblePosition);
}
/**
* This check should really just be: lastVisiblePosition ==
* lastItemPosition, but PtRListView internally uses a FooterView
* which messes the positions up. For me we'll just subtract one to
* account for it and rely on the inner condition which checks
* getBottom().
*/
if (lastVisiblePosition >= lastItemPosition - 1) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if (lastVisibleChild != null) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}
示例5: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isFirstItemVisible() {
Adapter adapter = ((ExpandableListView) this.mRootView).getAdapter();
if (adapter == null || adapter.isEmpty()) {
return true;
}
if (((ExpandableListView) this.mRootView).getFirstVisiblePosition() <= 1) {
View firstVisibleChild = ((ExpandableListView) this.mRootView).getChildAt(0);
if (firstVisibleChild != null) {
return firstVisibleChild.getTop() >= ((ExpandableListView) this.mRootView).getTop();
}
}
return false;
}
示例6: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isFirstItemVisible() {
Adapter adapter = ((AbsListView) this.mRefreshableView).getAdapter();
if (adapter == null || adapter.isEmpty()) {
return true;
}
if (((AbsListView) this.mRefreshableView).getFirstVisiblePosition() <= 1) {
View firstVisibleChild = ((AbsListView) this.mRefreshableView).getChildAt(0);
if (firstVisibleChild != null) {
return firstVisibleChild.getTop() >= ((AbsListView) this.mRefreshableView).getTop();
}
}
return false;
}
示例7: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isFirstItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isFirstItemVisible. Empty View.");
}
return true;
} else {
/**
* This check should really just be:
* mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView
* internally use a HeaderView which messes the positions up. For
* now we'll just add one to account for it and rely on the inner
* condition which checks getTop().
*/
if (mRefreshableView.getFirstVisiblePosition() <= 1) {
final View firstVisibleChild = mRefreshableView.getChildAt(0);
if (firstVisibleChild != null) {
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
}
}
}
return false;
}
示例8: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Empty View.");
}
return true;
} else {
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
// if (DEBUG) {
// Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " +
// lastItemPosition + " Last Visible Pos: "
// + lastVisiblePosition);
// }
/**
* This check should really just be: lastVisiblePosition ==
* lastItemPosition, but PtRListView internally uses a FooterView
* which messes the positions up. For me we'll just subtract one to
* account for it and rely on the inner condition which checks
* getBottom().
*/
if (lastVisiblePosition >= lastItemPosition - 1) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if (lastVisibleChild != null) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}
示例9: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Empty View.");
}
return true;
} else {
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " + lastItemPosition + " Last Visible Pos: "
+ lastVisiblePosition);
}
/**
* This check should really just be: lastVisiblePosition ==
* lastItemPosition, but PtRListView internally uses a FooterView
* which messes the positions up. For me we'll just subtract one to
* account for it and rely on the inner condition which checks
* getBottom().
*/
//if (lastVisiblePosition >= lastItemPosition - 1) {
if ((null == mIndicatorIvBottom && lastVisiblePosition == lastItemPosition) ||
(null != mIndicatorIvBottom && lastVisiblePosition >= lastItemPosition - 1)) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
//if (lastVisibleChild != null) {
if (lastVisibleChild != null && lastVisibleChild != mIndicatorIvBottom) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}
示例10: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Empty View.");
}
return true;
} else {
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
if (DEBUG) {
Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " + lastItemPosition + " Last Visible Pos: "
+ lastVisiblePosition);
}
/**
* This check should really just be: lastVisiblePosition ==
* lastItemPosition, but PtRListView internally uses a FooterView
* which messes the positions up. For me we'll just subtract one to
* account for it and rely on the inner condition which checks
* getBottom().
*/
if (lastVisiblePosition >= lastItemPosition - 1) {
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if (lastVisibleChild != null) {
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}
示例11: isFirstItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isFirstItemVisible() {
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty()) {
if (DEBUG) {
Log.d(LOG_TAG, "isFirstItemVisible. Empty View.");
}
return true;
} else {
/**
* This check should really just be:
* mRefreshableView.getFirstVisiblePosition() == 0, but PtRListView
* internally use a HeaderView which messes the positions up. For
* now we'll just add one to account for it and rely on the inner
* condition which checks getTop().
*/
//if (mRefreshableView.getFirstVisiblePosition() <= 1) {
if ((null == mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() == 0) ||
(null != mIndicatorIvTop && mRefreshableView.getFirstVisiblePosition() <= 1)) {
final View firstVisibleChild = mRefreshableView.getChildAt(0);
//if (firstVisibleChild != null) {
if (firstVisibleChild != null && firstVisibleChild != mIndicatorIvTop) {
return firstVisibleChild.getTop() >= mRefreshableView.getTop();
}
}
}
return false;
}
示例12: setEmptyView
import android.widget.Adapter; //导入方法依赖的package包/类
public void setEmptyView(View paramView) {
this.mEmptyView = paramView;
Adapter localAdapter = getAdapter();
boolean bool = (localAdapter == null) || (localAdapter.isEmpty());
updateEmptyStatus(bool);
}
示例13: isLastItemVisible
import android.widget.Adapter; //导入方法依赖的package包/类
private boolean isLastItemVisible()
{
final Adapter adapter = mRefreshableView.getAdapter();
if (null == adapter || adapter.isEmpty())
{
if (DEBUG)
{
Log.d(LOG_TAG, "isLastItemVisible. Empty View.");
}
return true;
} else
{
final int lastItemPosition = mRefreshableView.getCount() - 1;
final int lastVisiblePosition = mRefreshableView.getLastVisiblePosition();
if (DEBUG)
{
Log.d(LOG_TAG, "isLastItemVisible. Last Item Position: " + lastItemPosition + " Last Visible Pos: "
+ lastVisiblePosition);
}
/**
* This check should really just be: lastVisiblePosition ==
* lastItemPosition, but PtRListView internally uses a FooterView
* which messes the positions up. For me we'll just subtract one to
* account for it and rely on the inner condition which checks
* getBottom().
*/
if (lastVisiblePosition >= lastItemPosition - 1)
{
final int childIndex = lastVisiblePosition - mRefreshableView.getFirstVisiblePosition();
final View lastVisibleChild = mRefreshableView.getChildAt(childIndex);
if (lastVisibleChild != null)
{
return lastVisibleChild.getBottom() <= mRefreshableView.getBottom();
}
}
}
return false;
}