WebView mWebView;
private ProgressBar progressBar;

@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_PROGRESS); // 프로그레스   
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mWebView.setWebChromeClient(new FullscreenableChromeClient(this));



 progressBar = (ProgressBar)findViewById(R.id.loaderProgressBar);
    progressBar.setProgressDrawable (getResources().getDrawable(R.drawable.main_loading_progress));
    progressBar.setProgress(0);
  
    mWebView.setWebChromeClient(new WebChromeClient(){
    @Override
    public void onProgressChanged(WebView view, int progress) {
    progressBar.setVisibility(View.VISIBLE);
    progressBar.setProgress(progress);
   
    if(progress >= 100){
    progressBar.setVisibility(View.GONE);
    }
    }
    });

인터넷에서 검색으로 웹뷰를 이용해 어플 만들고 있는데
유튜브등 동영상 전체화면과 프로그래스바를 둘 다 적용하면
프로그래스바가 잘 작동하면 전체화면시 어플이 멈추고,
전체화면이 잘 되면 프로그래스바가 작동하지 않아요.

배운적이 없어서 어떻게든 짜집기는 하겠는데 오류 해결은 못하겠네요.

아래는 전체화면때 쓰이는 클래스입니다.


package com.example.ttest;

import android.annotation.SuppressLint;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.webkit.*;
import android.widget.*;

@SuppressLint("NewApi")
public class FullscreenableChromeClient extends WebChromeClient {
    protected Activity mActivity = null;
 
    private View mCustomView;
    private WebChromeClient.CustomViewCallback mCustomViewCallback;
    private int mOriginalOrientation;
 
    private FrameLayout mContentView;
    private FrameLayout mFullscreenContainer;
 
    private static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
 
    public FullscreenableChromeClient(Activity activity) {
        this.mActivity = activity;
    }
 
    @Override
    public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            if (mCustomView != null) {
                callback.onCustomViewHidden();
                return;
            }
 
            mOriginalOrientation = mActivity.getRequestedOrientation();
            FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
            mFullscreenContainer = new FullscreenHolder(mActivity);
            mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
            decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
            mCustomView = view;
            setFullscreen(true);
            mCustomViewCallback = callback;
            mActivity.setRequestedOrientation(requestedOrientation);
        }
 
        super.onShowCustomView(view, requestedOrientation, callback);
    }
 
    @Override
    public void onHideCustomView() {
        if (mCustomView == null) {
            return;
        }
 
        setFullscreen(false);
        FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
        decor.removeView(mFullscreenContainer);
        mFullscreenContainer = null;
        mCustomView = null;
        mCustomViewCallback.onCustomViewHidden();
        mActivity.setRequestedOrientation(mOriginalOrientation);
    }
 
    private void setFullscreen(boolean enabled) {
        Window win = mActivity.getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        if (enabled) {
            winParams.flags |= bits;
        } else {
            winParams.flags &= ~bits;
            if (mCustomView != null) {
                mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
            } else {
                mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
            }
        }
        win.setAttributes(winParams);
    }
 
    private static class FullscreenHolder extends FrameLayout {
        public FullscreenHolder(Context ctx) {
            super(ctx);
            setBackgroundColor(ctx.getResources().getColor(android.R.color.black));
        }
 
        @Override
        public boolean onTouchEvent(MotionEvent evt) {
            return true;
        }
    }
}