mirror of
https://github.com/lubosz/overte.git
synced 2025-04-06 14:22:30 +02:00
Keep the domain connection while WebView is expanded
This commit is contained in:
parent
05267a7100
commit
9675328f1e
4 changed files with 21 additions and 8 deletions
|
@ -24,10 +24,8 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.SlidingDrawer;
|
||||
|
@ -173,6 +171,7 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
super.onResume();
|
||||
nativeEnterForeground();
|
||||
surfacesWorkaround();
|
||||
keepInterfaceRunning = false;
|
||||
//gvrApi.resumeTracking();
|
||||
}
|
||||
|
||||
|
@ -337,4 +336,9 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
|
|||
|
||||
@Override
|
||||
public void onTitleReceived(String title) { }
|
||||
|
||||
@Override
|
||||
public void onExpand() {
|
||||
keepInterfaceRunning = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,4 +128,7 @@ public class WebViewActivity extends Activity implements WebViewFragment.OnWebVi
|
|||
mActionBar.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpand() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.view.MotionEvent;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceError;
|
||||
|
@ -183,7 +182,7 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
|
|||
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent motionEvent) {
|
||||
openInFullScreen();
|
||||
expand();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -203,7 +202,7 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
|
|||
|
||||
mToolbar = rootView.findViewById(R.id.toolbar);
|
||||
mToolbar.findViewById(R.id.viewFullScreen).setOnClickListener(view -> {
|
||||
openInFullScreen();
|
||||
expand();
|
||||
});
|
||||
mToolbar.findViewById(R.id.close).setOnClickListener(view -> {
|
||||
if (mCloseAction != null) {
|
||||
|
@ -216,7 +215,10 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
|
|||
return rootView;
|
||||
}
|
||||
|
||||
private void openInFullScreen() {
|
||||
private void expand() {
|
||||
if (mListener != null) {
|
||||
mListener.onExpand();
|
||||
}
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra(WebViewActivity.WEB_VIEW_ACTIVITY_EXTRA_URL, intentUrlOrWebUrl());
|
||||
getActivity().startActivity(intent);
|
||||
|
@ -243,6 +245,7 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
|
|||
void processURL(String url);
|
||||
void onWebLoaded(String url, SafenessLevel safenessLevel);
|
||||
void onTitleReceived(String title);
|
||||
void onExpand();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ public class QtActivity extends Activity {
|
|||
private QtActivityLoader m_loader = new QtActivityLoader(this);
|
||||
|
||||
public boolean isLoading;
|
||||
public boolean keepInterfaceRunning;
|
||||
|
||||
public QtActivity() {
|
||||
}
|
||||
|
@ -503,7 +504,7 @@ public class QtActivity extends Activity {
|
|||
super.onPause();
|
||||
// GC: this trick allow us to show a splash activity until Qt app finishes
|
||||
// loading
|
||||
if (!isLoading) {
|
||||
if (!isLoading && !keepInterfaceRunning) {
|
||||
QtApplication.invokeDelegate();
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +645,9 @@ public class QtActivity extends Activity {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
QtApplication.invokeDelegate();
|
||||
if (!keepInterfaceRunning) {
|
||||
QtApplication.invokeDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue