com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor Java Examples

The following examples show how to use com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PullToRefreshAdapterViewBase.java    From ONE-Unofficial with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #2
Source File: PullToRefreshAdapterViewBase.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #3
Source File: PullToRefreshAdapterViewBase.java    From effective_android_sample with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #4
Source File: PullToRefreshAdapterViewBase.java    From zen4android with MIT License 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #5
Source File: PullToRefreshAdapterViewBase.java    From handmarkPulltorefreshLibrary with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView
 *            - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent
				&& newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView
				.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView)
				.setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #6
Source File: PullToRefreshAdapterViewBase.java    From PullToRefresh-PinnedSection-ListView with MIT License 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #7
Source File: PullToRefreshAdapterViewBase.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #8
Source File: PullToRefreshAdapterViewBase.java    From bmob-android-demo-paging with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #9
Source File: PullToRefreshAdapterViewBase.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public final void setEmptyView(View view)
{
    FrameLayout framelayout = getRefreshableViewWrapper();
    if (view != null)
    {
        view.setClickable(true);
        android.view.ViewParent viewparent = view.getParent();
        if (viewparent != null && (viewparent instanceof ViewGroup))
        {
            ((ViewGroup)viewparent).removeView(view);
        }
        android.widget.FrameLayout.LayoutParams layoutparams = a(view.getLayoutParams());
        if (layoutparams != null)
        {
            framelayout.addView(view, layoutparams);
        } else
        {
            framelayout.addView(view);
        }
    }
    if (l instanceof EmptyViewMethodAccessor)
    {
        ((EmptyViewMethodAccessor)l).setEmptyViewInternal(view);
    } else
    {
        ((AbsListView)l).setEmptyView(view);
    }
    p = view;
}
 
Example #10
Source File: PullToRefreshAdapterViewBase.java    From Social with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #11
Source File: PullToRefreshAdapterViewBase.java    From SweetMusicPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #12
Source File: PullToRefreshAdapterViewBase.java    From PullToRefreshLibrary with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #13
Source File: PullToRefreshAdapterViewBase.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #14
Source File: PullToRefreshAdapterViewBase.java    From LbaizxfPulltoRefresh with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #15
Source File: PullToRefreshAdapterViewBase.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #16
Source File: PullToRefreshAdapterViewBase.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 *
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView)
{
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

    if (null != newEmptyView)
    {
        // New view needs to be clickable so that Android recognizes it as a
        // target for Touch Events
        newEmptyView.setClickable(true);

        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup)
        {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }

        // We need to convert any LayoutParams so that it works in our
        // FrameLayout
        FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (null != lp)
        {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else
        {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }

    if (mRefreshableView instanceof EmptyViewMethodAccessor)
    {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else
    {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
 
Example #17
Source File: PullToRefreshAdapterViewBase.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
Example #18
Source File: PullToRefreshAdapterViewBase.java    From sctalk with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}