Code example for ImageButton

Methods: setVisibility

0
    protected void addFullScreenButton(){ 
        btnFullScreen=getFullScreenButton();
        btnFullScreen.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                updateFullscreenStatus(true); 
                btnFullScreen.setVisibility(View.GONE);
            } 
        }); 
    } 
 
    protected void updateFullscreenStatus(){ 
        if(!m_FullScreen)return ;
        updateFullscreenStatus(true); 
    } 
 
    protected void toggleFullscreenStatus(){ 
        updateFullscreenStatus(!m_CurrentFullScreen);
    } 
 
    private Boolean m_CurrentFullScreen=false;
    protected Boolean getCurrentFullScreen(){
        return m_CurrentFullScreen;
    } 
     
    private Window getWindow(){
        return m_WebViewContainer.getWindow();
    } 
     
    private com.actionbarsherlock.app.ActionBar getSupportActionBar(){ 
         return m_WebViewContainer.getSupportActionBar();
    } 
 
    public void onPrepareOptionsMenu(){ 
        if(!m_FullScreen)return;
        updateFullscreenStatus(false); 
    } 
 
    protected void updateFullscreenStatus(Boolean useFullscreen) {
        if (useFullscreen) {
            if(getSupportActionBar()!=null) 
                getSupportActionBar().hide(); 
 
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        } else { 
            if(getSupportActionBar()!=null) 
                getSupportActionBar().show(); 
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            if(m_FullScreen)
                btnFullScreen.setVisibility(View.VISIBLE);
        } 
        m_CurrentFullScreen=useFullscreen;
    } 
 
    public void setWebViewSettings() {