public
class
SplashRootLayout
extends
LinearLayout {
public
SplashRootLayout(Context context, AttributeSet attrs) {
super (context,
attrs);
}
public
SplashRootLayout(Context context) {
super (context);
}
@Override
protected
void
onDraw(Canvas canvas) {
super .onDraw(canvas);
postDelayed(splashRunnable,
3000 );
}
private
Runnable splashRunnable =
new
Runnable() {
@Override
public
void
run() {
ViewGroup
p = (ViewGroup) getParent();
if
(p !=
null )
{
p.removeView(SplashRootLayout. this );
}
if
(mSplashDismissListener !=
null )
{
mSplashDismissListener.onSplashDimiss(SplashRootLayout. this );
}
}
};
public
interface
OnSplashDismissListener {
public
void
onSplashDimiss(SplashRootLayout v);
}
private
OnSplashDismissListener mSplashDismissListener;
public
void
setOnSpalshDismissListener(OnSplashDismissListener l) {
mSplashDismissListener
= l;
}
}
|