Show or Hide Panel layout on SurfaceView such as MediaController layout
// NOTE: You have to simple layout that
// LinearLayout_MyPanel(layout_width="fill_parent", layout_height="50dp", ...) or whatever
// in order to applying below code.
// Show Panel layout on SurfaceView
private boolean ShowMyPanel(boolean isRunnable) {
Log.d( "FUNC", "ShowMyPanel()" );
boolean ret = true;
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE ) {
if( isRunnable )
return false;
rl.setVisibility( 0 );
ret = true;
Log.d( "LOG", "Show" );
}
else {
rl.setVisibility( 4 );
ret = false;
Log.d( "LOG", "Hidden" );
}
//rl.invalidate();
return ret;
}
// SurfaceView Touch Event
// Show or Hide the Panel layout on SurfaceView after 3 seconds
View.OnClickListener surfaceViewListener = new View.OnClickListener() {
Handler handlerMyPanel = null;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Toast.makeText( myClass.this, "SurfaceView...", Toast.LENGTH_LONG ).show();
Log.d( "LOG", "SurfaceView Touch Event" );
/*
android.widget.LinearLayout rl = (android.widget.LinearLayout)findViewById( R.id.LinearLayout_MyPanel );
if( rl.getVisibility() != rl.VISIBLE )
rl.setVisibility( 0 );
else
rl.setVisibility( 4 );
//rl.invalidate();
*/
if( !ShowMyPanel(false) )
return;
if( handlerMyPanel != null ) {
Log.d( "LOG", "handlerMyPanel != null" );
handlerMyPanel.removeCallbacksAndMessages( null );
handlerMyPanel = null;
}
handlerMyPanel = new Handler();
handlerMyPanel.postDelayed( new Runnable() {
public void run() {
Log.d( "RUNNABLE", "MyPanel start" );
ShowMyPanel(true);
Log.d( "THREAD", "MyPanel finish" );
}
}, 3000
);
}
};
m_SurfaceView.setOnClickListener( surfaceViewListener );
-----
Cheers,
June
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기