It is currently Fri Jun 23, 2017 6:55 am



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: How to keep ressources when GW is used ?
Unread postPosted: Mon Nov 28, 2016 7:45 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 859
Location: France
Hello Nicolas,

i tried to make an APK of my last project that use inlude GW.bas + 2 little PNG files used by a GW command.

BASIC! Compiler create the right directory and copy the 3 files
- jquery.mobile-1.4.5.min.css
- jquery.mobile-1.4.5.min.js
- jquery-2.1.1.min.js

but not my 2 PNG files that are however at the same place (and well selected as ressources in BASIC! Compiler) !?

If I copy them manually they are well used by the APK...

Cheers

Gilles

PS: I believed that ressources (including jquery* files) were hidden ( asset package ) ?

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
 Post subject: Re: How to keep ressources when GW is used ?
Unread postPosted: Tue Nov 29, 2016 1:13 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
Hello Gilles,

Yes, when you compile GW projects with the BASIC! Compiler you need to manually copy all resource files that are used in GW commands, such as: image, font, icon, video, loading image.

There is a dedicated function specially made for this, it copies the resource from the APK assets to sdcard:
Code:
MAKE_SURE_IS_ON_SD(resource_name$)

You have to call this function for all your resources (and of course embed your resources inside your APK in the Compiler, as you correctly did).

The internal files used by the GW lib: theme files (*.js, *.css), color picker files, lock pattern files, spinner files, and gallery files are all handled by the GW lib: if you call the corresponding GW function (for example GW_LOAD_THEME()) and the needed files are not on sdcard, but they are in assets, they will be automatically copied to sdcard.

Cassiope34 wrote:
PS: I believed that ressources (including jquery* files) were hidden ( asset package ) ?

That is true generally for resources except in HTML mode.
HTML mode uses the sdcard/<my-app>/data as the base folder. It cannot use the assets as a base folder.
So it means any .js or .css used in HTML mode (or any image etc.) needs to be present on sdcard to be used and rendered.

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: How to keep ressources when GW is used ?
Unread postPosted: Tue Nov 29, 2016 1:18 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
See this post which deals with the same issue: resources-in-inside-subdirectories-t4521.html

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: How to keep ressources when GW is used ?
Unread postPosted: Wed Nov 30, 2016 4:06 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 859
Location: France
Sorry Nicolas

I'afraid I don't understand very well where I must use the function MAKE_SURE_IS_ON_SD(resource_name$) in my code ?

Cheers

Gilles

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
 Post subject: Re: How to keep ressources when GW is used ?
Unread postPosted: Wed Nov 30, 2016 4:49 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5537
Location: Paris, France
At the beginning of your program, for example just after the INCLUDE "GW.bas":
Code:
INCLUDE "GW.bas"
IF IS_APK() % we have put all app resources in our apk
  MAKE_SURE_IS_ON_SD("logo.gif") % make sure they're on sd to be displayed correctly
  MAKE_SURE_IS_ON_SD("small.avi")
END IF

p = GW_NEW_PAGE()
GW_ADD_IMAGE(p, "logo.gif")
GW_ADD_TEXT(p, "Here is a nice video:")
GW_ADD_VIDEO(p, "small.avi")
GW_ADD_TEXT(p, "Hit the back key to exit")

GW_RENDER(p)
DO
  r$ = GW_WAIT_ACTION$()
UNTIL r$ = "BACK"
EXIT

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: How to keep ressources when GW is used ?
Unread postPosted: Wed Nov 30, 2016 7:28 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 859
Location: France
Thanks Nicolas
i'll try when i'll make DataPass.apk (for now I have some problems with GW_AMODIFY () about the array of a SELECTBOX )

Gilles

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred