Accordion/Carousel Dojo can't load Android (Cordova) - android

I'm using Dojo 1.10 and i try to solve all the problemas with undescore files (_blabla). related here: https://code.google.com/p/android/issues/detail?id=5343
building/minimizing dojo for specific webkit:
http://dojotoolkig.org/reference-guide/1.10/build/webkit-mobile.html#build-webkit-mobile and everything works fine excepts Carousel and Accordion, this elements loads fine on local webserver.
I try to debug with weinre and this "classes" Carousel, Accordion doesn't exists (object dojox.mobile doesn't contain this)
Anyone can provide me with a glimmers of hope
iOS and webbrowsers works fine, I'm using Cordova 4.0 (only JS, CSS, HTML)
Tested on Physical and virtual devices

Should not have the _ problems, All the widgets you need, including Carousel are compiled into the layer files..(Carousel is inside of mobile-ui-layer.js)
In your www folder there should be either mobile-ui-layer.js and core-web-layer.js
files in either the layers or dojo subdirectory.
and your wlCommonInit has to be referencing these files depending on where they are in your project:
function wlCommonInit() {
require([ "layers/core-web-layer", "layers/mobile-ui-layer" ], dojoInit);
}
Edit, sorry just noticed that you are saying you are using straight cordova and not worklight.
They easiest say to deal with this is to use the dojo build, to condense the dojo files into a layer file.
Download -src.zip package from dojo website
extract new dojo
navigate to /js/dojo-src/util/buildscripts/profiles
use one of the existing profiles as template. insert something like i have below as a layer.
run ./build.sh -p ./profiles/.profile.js
Add Layer file to project and reference it.
Sample Mobile Layer:
layers: {
"dojo/mobile-ui-layer":{
include: ["dojox/mobile",
"dojox/mobile/_base",
"dojox/mobile/_ComboBoxMenu",
"dojox/mobile/_ContentPaneMixin",
"dojox/mobile/_css3",
"dojox/mobile/_DataListMixin",
"dojox/mobile/_DataMixin",
"dojox/mobile/_DatePickerMixin",
"dojox/mobile/_EditableIconMixin",
"dojox/mobile/_EditableListMixin",
"dojox/mobile/_ExecScriptMixin",
"dojox/mobile/_IconItemPane",
"dojox/mobile/_ItemBase",
"dojox/mobile/_ListTouchMixin",
"dojox/mobile/_maskUtils",
"dojox/mobile/_PickerBase",
"dojox/mobile/_PickerChooser",
"dojox/mobile/_ScrollableMixin",
"dojox/mobile/_StoreListMixin",
"dojox/mobile/_StoreMixin",
"dojox/mobile/_TimePickerMixin",
"dojox/mobile/Accordion",
"dojox/mobile/Audio",
"dojox/mobile/Badge",
"dojox/mobile/bookmarkable",
"dojox/mobile/Button",
"dojox/mobile/Carousel",
"dojox/mobile/CarouselItem",
"dojox/mobile/CheckBox",
"dojox/mobile/ComboBox", // experimental
"dojox/mobile/common",
"dojox/mobile/compat",
"dojox/mobile/Container",
"dojox/mobile/ContentPane",
"dojox/mobile/DataCarousel",
"dojox/mobile/DatePicker",
"dojox/mobile/EdgeToEdgeCategory",
"dojox/mobile/EdgeToEdgeDataList",
"dojox/mobile/EdgeToEdgeList",
"dojox/mobile/EdgeToEdgeStoreList",
"dojox/mobile/ExpandingTextArea",
"dojox/mobile/FilteredListMixin",
"dojox/mobile/FixedSplitter",
"dojox/mobile/FixedSplitterPane",
"dojox/mobile/FormLayout",
"dojox/mobile/GridLayout",
"dojox/mobile/Heading",
"dojox/mobile/i18n",
"dojox/mobile/Icon",
"dojox/mobile/IconContainer",
"dojox/mobile/IconItem",
"dojox/mobile/IconMenu",
"dojox/mobile/IconMenuItem",
"dojox/mobile/iconUtils",
"dojox/mobile/lazyLoadUtils",
"dojox/mobile/ListItem",
"dojox/mobile/LongListMixin",
"dojox/mobile/Opener",
"dojox/mobile/Overlay",
"dojox/mobile/PageIndicator",
"dojox/mobile/pageTurningUtils",
"dojox/mobile/Pane",
//"dojox/mobile/parser",
"dojox/mobile/ProgressBar",
"dojox/mobile/ProgressIndicator",
"dojox/mobile/RadioButton",
"dojox/mobile/Rating",
"dojox/mobile/RoundRect",
"dojox/mobile/RoundRectCategory",
"dojox/mobile/RoundRectDataList",
"dojox/mobile/RoundRectList",
"dojox/mobile/RoundRectStoreList",
"dojox/mobile/ScreenSizeAware", // experimental
"dojox/mobile/scrollable",
"dojox/mobile/ScrollablePane",
"dojox/mobile/ScrollableView",
"dojox/mobile/SearchBox",
"dojox/mobile/SimpleDialog",
"dojox/mobile/Slider",
"dojox/mobile/sniff",
"dojox/mobile/SpinWheel",
"dojox/mobile/SpinWheelDatePicker",
"dojox/mobile/SpinWheelSlot",
"dojox/mobile/SpinWheelTimePicker",
"dojox/mobile/StoreCarousel",
"dojox/mobile/SwapView",
"dojox/mobile/Switch",
"dojox/mobile/TabBar",
"dojox/mobile/TabBarButton",
"dojox/mobile/TextArea",
"dojox/mobile/TextBox",
"dojox/mobile/TimePicker",
"dojox/mobile/ToggleButton",
"dojox/mobile/ToolBarButton",
"dojox/mobile/Tooltip",
"dojox/mobile/transition",
"dojox/mobile/TransitionEvent",
"dojox/mobile/TreeView", // experimental
"dojox/mobile/uacss",
"dojox/mobile/ValuePicker",
"dojox/mobile/ValuePickerDatePicker",
"dojox/mobile/ValuePickerSlot",
"dojox/mobile/ValuePickerTimePicker",
"dojox/mobile/Video",
"dojox/mobile/View",
"dojox/mobile/ViewController",
"dojox/mobile/viewRegistry",
"dojox/mobile/dh/ContentTypeMap",
"dojox/mobile/dh/DataHandler",
"dojox/mobile/dh/HtmlContentHandler",
"dojox/mobile/dh/HtmlScriptContentHandler",
"dojox/mobile/dh/JsonContentHandler",
"dojox/mobile/dh/PatternFileTypeMap",
"dojox/mobile/dh/StringDataSource",
"dojox/mobile/dh/SuffixFileTypeMap",
"dojox/mobile/dh/UrlDataSource"],
exclude: [
"dojox/mobile/bidi/_ComboBoxMenu",
"dojox/mobile/bidi/_ItemBase",
"dojox/mobile/bidi/_StoreListMixin",
"dojox/mobile/bidi/Accordion",
"dojox/mobile/bidi/Badge",
"dojox/mobile/bidi/Button",
"dojox/mobile/bidi/Carousel",
"dojox/mobile/bidi/CarouselItem",
"dojox/mobile/bidi/common",
"dojox/mobile/bidi/Heading",
"dojox/mobile/bidi/IconItem",
"dojox/mobile/bidi/IconMenu",
"dojox/mobile/bidi/ListItem",
"dojox/mobile/bidi/RoundRectCategory",
"dojox/mobile/bidi/SpinWheelSlot",
"dojox/mobile/bidi/Switch",
"dojox/mobile/bidi/TabBar",
"dojox/mobile/bidi/TabBarButton",
"dojox/mobile/bidi/TextBox",
"dojox/mobile/bidi/ToolBarButton",
"dojox/mobile/bidi/Tooltip",
"dojox/mobile/bidi/TreeView",
"dojox/mobile/bidi/ValuePickerSlot"
]
}

Related

Loading glb model in react native three using expo-three component not working on android device. The model appears on the web version though

I'm trying to create a react-native apps with three js using expo-gl, expo-three frameworks.
Following is the list of imports..
import { ExpoWebGLRenderingContext, GLView } from 'expo-gl';
import ExpoTHREE, { Renderer, TextureLoader } from 'expo-three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import * as React from 'react';
import {
AmbientLight,
HemisphereLight,
BoxBufferGeometry,
Fog,
GridHelper,
Mesh,
MeshStandardMaterial,
PerspectiveCamera,
PointLight,
Scene,
SpotLight,
Camera,
InstancedMesh,
} from 'three';
import OrbitControlsView from 'expo-three-orbit-controls';
Apart from the basic scene, camera and light setup I'm trying to load a glb model using the ExpoTHREE.loadAsync method as below...
const loadGlb = async ()=>{
const obj = await ExpoTHREE.loadAsync(
[require('./assets/suzanne.glb')],
null,
null}).
then((e)=>{
scene.add(e.scene);
e.scene.traverse((f)=>{if(f.isMesh){f.material = new THREE.MeshNormalMaterial();}});
})
.catch((err)=>{console.log(err)});
}
loadGlb();
Using the ref: https://www.npmjs.com/package/expo-three
The model loads when I run the code on the desktop browser but not on my android phone using expo app. Please let me know what am I doing wrong.
You can access the app here https://expo.io/#praful124/expo3
I had the same problem and ended up running into the fact that it does not support textures inside the glb file. But if you find a solution, I will be very happy if you share them.

How can I use `asset://` for non-APK file(s) on Android in a mapbox-gl Style?

I've been using Mapbox GL Native (specifically react-native-mapbox-gl). I'm generating my own vector tiles on a server, and I'd like to have the user download them onto their device from the mobile app. Then I want Mapbox GL to use the local tiles, specified via a TileJSON file referenced in the Mapbox GL Style file.
I've got it working on iOS (at least in the simulator). My style.json looks like the following:
{
"version":8,
"name":"Bright",
"sources":{
"mapbox":{
"type":"vector",
"url": "asset:///absolute/path/map/tile.json"
}
},
"sprite":"asset:///absolute/path/map/sprites/mysprite",
"glyphs":"asset:///absolute/path/map/glyphs/{fontstack}/{range}.pbf",
"metadata":{...},
"layers":[...]
}
with the tile.json looking like:
{
"tiles":[
"asset:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"
],
"tilejson":"2.0.0",
// plus lots of other stuff
}
On Android this doesn't work. It appears that asset:// only works on files bundled inside the APK, not on the filesystem.
Is there something I can do on the Android platform to let Mapbox GL load my downloaded tiles from off the device?
Have you tried using the file:/// path? This usually loads from your app's file directory, eg.
"file:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"

How do I load an image to an apk in delphi XE8

I am working on an app in Delphi XE8.
When I run the program on my phone, it gives me an error:
Loading bitmap failed(image.png)
My code works as follows:
if ListBox1.ItemIndex = 0 then
begin
img.bitmap.LoadFromFile('Image.png');
iMin:= Round(iNumber * 1);
iMax:= Round(iNumber *13.24);
iAvg:= Round(iNumber * 2.59);
label7.Text:= inttostr(iMin);
label5.Text:= inttostr(iAvg);
label6.Text:= inttostr(iMax);
label2.Text:= 'Minimum';
label3.Text:= 'Average';
label4.Text:= 'Maximum';
end
else
...
Please note the image is saved in the same folder as my program.
Don't use relative paths. Always use absolute paths.
You need to use the Deployment Manager to deploy the image file to an appropriate folder on the phone, and then use the System.IOUtils.TPath class to locate that folder at runtime:
Standard RTL Path Functions across the Supported Target Platforms
On Android, deploy the image file to the ./assets/internal folder, and then use the TPath.GetDocumentsPath() method at runtime, as documented on this blog:
Deploying and accessing local files on iOS and Android
What the EDN documentation and blog both fail to mention is that you also need to add the System.StartupCopy unit to your app's uses clause.
uses
..., System.IOUtils, System.StartupCopy;
...
img.bitmap.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'Image.png'));

Using Cordova, is there a way to reference native icons?

I'm using Cordova 3.5 to build an app which contains a menu with pretty standard items in the list (home, contacts, etc.), and I want to use the native menu icons whenever possible. I believe those icons are already on the device as part of the OS, but I don't know if Cordova gives me a way to reference them.
I suppose I'd need to write a Javascript function to choose the right file name based on the platform, e.g.:
// this is pseudocode
var icon = '';
if (platform === 'android') {
icon = 'some/path/home.png';
} else {
icon = 'other/path/icon.home.png';
// or maybe a function such as the following exists:
// icon = cordova.getNativeIcon('icon.home.png');
}
$('.selector').css('background-image', icon);
Alternatively, I may be able to make do by referencing the files in CSS, e.g.:
.android .home-icon {
background-image: url('some/path/home.png');
}
.ios .home-icon {
background-image: url('other/path/icon.home.png');
}
So, how do folks handle this sort of thing in Cordova? Is there a function I can use to access native icons? Are folks just copying them into their projects? What's the best practice?
If you're working with Cordova, then you'll be working inside a web view provided by the host OS and you won't have direct access to any artwork. I've found that using icon fonts and CSS "themes" to work well enough, but that approach will replicate artwork already provided. There's extra work involved with theming for iOS 6 vs iOS 7 or 8, for example, but it's not as bad as it sounds.
IBM does have an article on partitioning your view between native and web controls, but it sounds a bit cumbersome. More details here: https://www.ibm.com/developerworks/community/blogs/worklight/entry/ios_combining_native_and_web_controls_in_cordova_based_applications

locales/en-US/translation.json loads in Eclipse but fail in iphone

I am currently developing a cross platform mobile app using phonegap 2.5. When app starts it loads a json file for setting the app's language. It works perfectly in android but in ios it gets me that error: failed loading: locales/el-GR/translation.json. I tried to change the relative path for locales folder or move the current folder to other scope but neither seems to work.
WWW subfolder path
_www/
__index.html
__js/
___some js files like as main.js, cordova.js,jqmobi.min.js, i18next-1.7.1.min.js e.t.c.
__locales/
___en-US/
____translation.json
And the function i call in main.js:
i18n.init(
{
lng: AppSettings.Language.get(),
fallbackLng: 'en-US',
/* Where __lng__/__ns__.json = en-US/translation.json */
resGetPath : '/locales/__lng__/__ns__.json',
resPostPath: '/locales/__lng__/__ns__.json',
debug: true
},
function(){
}
);
In main.js i give the relative url path for loading translation.json (locales/en-US/translation.json). This works fine in android but in ios it doesn't seem to load it.
So, if you can, i could need some help.
Does iphone understand differently the relative paths of a phonegap mobile app?
What path should i give so that the app loads the translation.json?
If you need more info tell me.
Ty in advance.

Categories

Resources