This commit is contained in:
Gabriel Calero 2018-07-02 19:44:48 -03:00
parent 11e47b8fe6
commit 21b089fa39
5 changed files with 19 additions and 11 deletions

View file

@ -11,7 +11,6 @@
package io.highfidelity.hifiinterface; package io.highfidelity.hifiinterface;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -273,7 +272,9 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW
case "WebView": case "WebView":
runOnUiThread(() -> { runOnUiThread(() -> {
webSlidingDrawer.setVisibility(View.VISIBLE); webSlidingDrawer.setVisibility(View.VISIBLE);
webSlidingDrawer.animateOpen(); if (!webSlidingDrawer.isOpened()) {
webSlidingDrawer.animateOpen();
}
if (args != null && args.containsKey(WebViewActivity.WEB_VIEW_ACTIVITY_EXTRA_URL)) { if (args != null && args.containsKey(WebViewActivity.WEB_VIEW_ACTIVITY_EXTRA_URL)) {
WebViewFragment webViewFragment = (WebViewFragment) getFragmentManager().findFragmentByTag("webViewFragment"); WebViewFragment webViewFragment = (WebViewFragment) getFragmentManager().findFragmentByTag("webViewFragment");
webViewFragment.loadUrl((String) args.get(WebViewActivity.WEB_VIEW_ACTIVITY_EXTRA_URL)); webViewFragment.loadUrl((String) args.get(WebViewActivity.WEB_VIEW_ACTIVITY_EXTRA_URL));

View file

@ -56,9 +56,14 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
public void loadUrl(String url) { public void loadUrl(String url) {
mUrl = url; mUrl = url;
myWebView.getSettings().setLoadWithOverviewMode(true); loadUrl(myWebView, url);
myWebView.getSettings().setUseWideViewPort(true); }
myWebView.loadUrl(mUrl);
private void loadUrl(WebView webView, String url) {
webView.setVisibility(View.GONE);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl(url);
} }
public void setToolbarVisible(boolean visible) { public void setToolbarVisible(boolean visible) {
@ -165,7 +170,6 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
webSettings.setBuiltInZoomControls(true); webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false); webSettings.setDisplayZoomControls(false);
// TODO: add a toolbar (close, ...)
mToolbar = rootView.findViewById(R.id.toolbar); mToolbar = rootView.findViewById(R.id.toolbar);
mToolbar.findViewById(R.id.viewFullScreen).setOnClickListener(view -> { mToolbar.findViewById(R.id.viewFullScreen).setOnClickListener(view -> {
openInFullScreen(); openInFullScreen();
@ -175,11 +179,9 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
mCloseAction.run(); mCloseAction.run();
} }
}); });
mToolbar.setVisibility(mToolbarVisible ? View.VISIBLE : View.GONE);
if (mUrl != null) { if (mUrl != null) {
myWebView.getSettings().setLoadWithOverviewMode(true); loadUrl(myWebView, mUrl);
myWebView.getSettings().setUseWideViewPort(true);
myWebView.loadUrl(mUrl);
} }
return rootView; return rootView;
} }
@ -227,6 +229,7 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
} }
} }
if (mListener != null) { if (mListener != null) {
myWebView.setVisibility(View.VISIBLE);
mListener.onWebLoaded(url, safenessLevel); mListener.onWebLoaded(url, safenessLevel);
} }
} }
@ -238,6 +241,7 @@ public class WebViewFragment extends Fragment implements GestureDetector.OnGestu
mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setProgress(0); mProgressBar.setProgress(0);
if (mListener != null) { if (mListener != null) {
myWebView.setVisibility(View.VISIBLE);
mListener.onWebLoaded(url, safenessLevel); mListener.onWebLoaded(url, safenessLevel);
} }
} }

View file

@ -10,11 +10,13 @@
android:name="path" android:name="path"
android:pathData="M 86.5 173 C 134.273 173 173 134.273 173 86.5 C 173 38.727 134.273 0 86.5 0 C 38.727 0 0 38.727 0 86.5 C 0 134.273 38.727 173 86.5 173 Z" android:pathData="M 86.5 173 C 134.273 173 173 134.273 173 86.5 C 173 38.727 134.273 0 86.5 0 C 38.727 0 0 38.727 0 86.5 C 0 134.273 38.727 173 86.5 173 Z"
android:fillColor="#181818" android:fillColor="#181818"
android:fillAlpha="0.6"
android:strokeWidth="1"/> android:strokeWidth="1"/>
<path <path
android:name="path_1" android:name="path_1"
android:pathData="M 53.3 53.3 L 119.7 119.7 M 53.3 119.7 L 119.7 53.3" android:pathData="M 53.3 53.3 L 119.7 119.7 M 53.3 119.7 L 119.7 53.3"
android:fillColor="#000" android:fillColor="#000"
android:fillAlpha="0.6"
android:strokeColor="#ffffff" android:strokeColor="#ffffff"
android:strokeWidth="13.5424" android:strokeWidth="13.5424"
android:strokeLineCap="round"/> android:strokeLineCap="round"/>

View file

@ -17,6 +17,7 @@
android:name="path" android:name="path"
android:pathData="M 86.5 173 C 134.273 173 173 134.273 173 86.5 C 173 38.727 134.273 0 86.5 0 C 38.727 0 0 38.727 0 86.5 C 0 134.273 38.727 173 86.5 173 Z" android:pathData="M 86.5 173 C 134.273 173 173 134.273 173 86.5 C 173 38.727 134.273 0 86.5 0 C 38.727 0 0 38.727 0 86.5 C 0 134.273 38.727 173 86.5 173 Z"
android:fillColor="#181818" android:fillColor="#181818"
android:fillAlpha="0.6"
android:strokeWidth="1"/> android:strokeWidth="1"/>
<path <path
android:name="path_2" android:name="path_2"

View file

@ -15,7 +15,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:visibility="visible"> android:visibility="gone">
<ImageView <ImageView
android:id="@+id/viewFullScreen" android:id="@+id/viewFullScreen"
android:layout_width="25dp" android:layout_width="25dp"