Start a new topic

Draw a custom view on Wikitude CameraView [GoogleGlass]

Draw a custom view on Wikitude CameraView [GoogleGlass]


Hi,

I am loading POIs using Wikitude SDK. On TAP of google glass i am requesting new POIs locations and when received i delete old ones and draw new ones. However while drawing new POIs on CameraView, it takes a little time. What i want to do is to show an image or a text or something while it draws the new ones. That way the user will understand that he TAPPED glass and needs to wait a little. Is there any way to achieve that?

Hi there!

Note that the "ArchitectView" is managed like an advanced ViewGroup in your layout.xml
Feel free to pu other native UI components on top of it.
That way you can e.g. center a "Requesting new POIs" box on top of the AR-View which is shown for around 2 seconds when user presses the refresh button.

Alternatively but a bit more advanced you could also style a loading-div in your AR-View's index.html and tell your JavaScript environment via arView.callJavaScript (compare retrieving POI data from application model sample) to call e.g. arView.callJavaScript("World.onRefreshTriggered()") and handle all the div-hiding + refresh POI stuff in JS environment.

Hope that helps.
Kind regards,
Andreas

 

PS.: Unfortunately there is no "onDestroyed" or "onDrawn" callback available for AR.Objects so please just define your loading animation for a period that looks suitable.

When you say on top, you mean inside ArchitectVIew or outside it.
Tried:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<RelativeLayout
android:visibility="gone"
android:id="@+id/architetViewRefreshing"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:text="@string/msg_refresh"
android:layout_height="wrap_content" />

</RelativeLayout>

<com.wikitude.architect.ArchitectView
android:id="@+id/architectView"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</com.wikitude.architect.ArchitectView>
</RelativeLayout>

 

With no success (It does not show the TextView).

If i also try to put it inside ArchitectView, it crashes.

 

Hi there!

Use a FrameLayout, put ARchitectView and your loadingView as childs in it and ensure loadingView sits on top.
That should do the job for you.


Though architectView is a ViewGroup itself, it is private and does not allow any additional children-layouts.
 

Kind regards,
Andreas

Tried:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<RelativeLayout
android:gravity="center_horizontal"
android:visibility="visible"
android:id="@+id/architetViewRefreshing"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:textColor="@color/red_full"
android:layout_width="wrap_content"
android:text="@string/msg_refresh"
android:layout_height="wrap_content" />

</RelativeLayout>

<com.wikitude.architect.ArchitectView
android:id="@+id/architectView"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</com.wikitude.architect.ArchitectView>
</FrameLayout>

But it is not showing TextView
 

please have a closer look at the functionality of a FrameLayout - e.g. run through this sample.

My wild guess would be: Please change the order of the XML elements so the AR-View is not in the foreground.

Kind regards

Adding it programatically worked. Thanx dude

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="horizontal">

   

   <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/framelayout" >

   <com.wikitude.architect.ArchitectView

        android:id="@+id/architectView"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent" />

           <TextView

            android:id="@+id/title"

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:text="prestige kew gardens"

            android:textColor="#000000"

            android:textSize="16dp"

            android:gravity="bottom"

            android:textStyle="bold"

            android:layout_gravity="bottom" />

</FrameLayout>

</LinearLayout>

 

this is working for me.....

 
Login or Signup to post a comment