Skip to content
Snippets Groups Projects
Commit c1a60055 authored by Xavier Gibert's avatar Xavier Gibert
Browse files

Slider HUD panel

parent 75e8617d
No related branches found
No related tags found
No related merge requests found
......@@ -4,14 +4,14 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/panel_limit"
android:gravity="bottom"
android:gravity="top"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/commentsLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/grey2"
android:background="@color/black"
android:orientation="vertical" >
</LinearLayout>
......@@ -37,6 +37,7 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_border"
android:orientation="vertical" >
<TextView
......
......@@ -58,7 +58,7 @@ public final class SphereFragment extends Fragment {
public ModelSimulation sim;
XWalkView browser;
LinearLayout commentsLayout;
LinearLayout commentsLayout, slider_content;
@SuppressWarnings("deprecation")
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled", "NewApi" })
......@@ -72,7 +72,8 @@ public final class SphereFragment extends Fragment {
drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
public void onDrawerOpened() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(browser.getLayoutParams());
layoutParams.height = browser.getLayoutParams().height/2;
layoutParams.height = browser.getHeight()-slider_content.getHeight();
layoutParams.width = LayoutParams.MATCH_PARENT;
browser.setLayoutParams(layoutParams);
}
});
......@@ -81,11 +82,12 @@ public final class SphereFragment extends Fragment {
public void onDrawerClosed() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(browser.getLayoutParams());
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.width = LayoutParams.MATCH_PARENT;
browser.setLayoutParams(layoutParams);
}
});
//XWalkView browser = (XWalkView) rootView.findViewById(R.id.xbrowser);
slider_content = (LinearLayout) rootView.findViewById(R.id.content);
browser = new XWalkView(this.getActivity().getApplicationContext(), this.getActivity());
XWalkSettings browserSettings = browser.getSettings();
......@@ -101,19 +103,20 @@ public final class SphereFragment extends Fragment {
browser.clearCache(true);
/*browser.setXWalkWebChromeClient(new org.xwalk.core.client.XWalkDefaultWebChromeClient(rootView.getContext(), browser) {
public void onProgressChanged(WebView view, int progress) {
browser.setXWalkWebChromeClient(new org.xwalk.core.client.XWalkDefaultWebChromeClient(rootView.getContext(), browser) {
@Override
public void onProgressChanged(XWalkView view, int progress) {
// Activities and WebViews measure progress with different scales.
// The progress meter will automatically disappear when we reach 100%
getActivity().setProgress(progress * 100);
}
});
browser.setXWalkClient(new org.xwalk.core.client.XWalkDefaultClient(rootView.getContext(), browser) {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
public void onReceivedError(XWalkView view, int errorCode, String description, String failingUrl) {
Toast.makeText(getActivity(), "Oh no! " + description, Toast.LENGTH_LONG).show();
}
});
*/
browser.addJavascriptInterface(new webclient.UAJscriptHandler(null), "unlockingandroid");
browser.addJavascriptInterface(new UANOOP() {}, "unlockingandroid");
browser.addJavascriptInterface(null, "unlockingandroid");
......@@ -121,6 +124,7 @@ public final class SphereFragment extends Fragment {
sim = (ModelSimulation) getArguments().getSerializable(ARG_SIM_OBJ);
sim.setCurrentView(rootView);
browser.addJavascriptInterface(new WebAppInterface(getActivity(), sim), "Android");
commentsLayout=(LinearLayout)rootView.findViewById(R.id.commentsLayout);
commentsLayout.addView(browser);
......
......@@ -9,6 +9,7 @@ import android.os.Handler;
import android.widget.Toast;
import org.chromium.content.browser.JavascriptInterface;
//XGGDEBUG:WAITING use ( org.xwalk.core.JavascriptInterface ) when the code is merged in: https://github.com/crosswalk-project/crosswalk/pull/1876/files
//import android.webkit.JavascriptInterface; Used for WebView not XWalkView
public class WebAppInterface {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment