homeeondemand/react-native-mapbox-navigation user location icon - react-native

https://github.com/homeeondemand/react-native-mapbox-navigation/blob/master/android/src/main/java/com/homee/mapboxnavigation/MapboxNavigationView.kt
below code is from MapboxNavigationView.kt
to display user location display like below
this.locationPuck = LocationPuck2D(
bearingImage = ContextCompat.getDrawable(
context,
R.drawable.mapbox_user_puck_icon
)
)
setLocationProvider(navigationLocationProvider)
enabled = true
}
how to modify this code to display custom image of car instead of above image

Related

File can not be attached to the Email when we try to send an email with Kotlin?

The following code is working while using Jetpack Kotlin.
But there is a little problem it can not attach pdf file.
When email button clicked opened view with Gmail and Drive icon at bottom shows
the pdf file name as test.pdf at top.
But when we choose gmail at bottom everything filled correctly except test.pdf.
It is not attached to the email form and then can not be emailed.
Button(onClick = {
val i = Intent(Intent.ACTION_SEND)
i.type = "vnd.android.cursor.dir/email"
val emailAddress = arrayOf("testEmailAddress#gmail.com")
i.putExtra(Intent.EXTRA_EMAIL,emailAddress)
val name = FileWorks().createFileName(context = cx, dirName = "calc", fileName = "test.pdf")
val contentUri = name.toURI()
i.putExtra(Intent.EXTRA_STREAM, Uri.parse(name.toString()))
i.putExtra(Intent.EXTRA_SUBJECT,"subject")
i.putExtra(Intent.EXTRA_TEXT,"body")
i.setType("message/rfc822")
ctx.startActivity(Intent.createChooser(i,"Choose an Email client : "))
}

Trying to get property 'path' of non-object

Hello I am having the above error in production but all works well in development. I am using the code bellow to get the path to the main image for the property but it defaults into the else despite the if not being false plus the else does not find the paths even when dump shows that the object has been returned
//check if there are hotels in the selected destination
if($hotels->isNotEmpty()){
//Loop through the hotels
foreach($hotels as $hotel){
//get hotels main image
$banner = Photo::where(['p_id'=>$hotel->id])->where(['is_main'=>1])->first();
$altbanner = Photo::where(['p_id'=>$hotel->id])->first();
$banner_path = "";
$altText = "";
if($banner!=null){
$banner_path = $banner->path;
$altText = $banner->alt_text;
}else{
$banner_path = $altbanner->path;
$altText = $altbanner->alt_text;
}
Have you checked your database if each hotel has an image? Based on your question and explanation, there is a part of the for each that returns null for the image hence the if part fails and the else return the error. If that is the case then you may want to check and sort it by uploading the image or modifying your checks to handle cases where no image is found.
I think the way you are using the where clause isn't right
foreach($hotels as $hotel){
//get hotels main image
$banner = Photo::where('p_id',$hotel->id)->where('is_main',1)->first();
$altbanner = Photo::where('p_id',$hotel->id)->first();
// .....
if($banner){
$banner_path = $banner->path;
// ......

How to show the custom PDF template while clicking the button

I want to show the PDF Template in new window while clicking the button in Sales Order. I created the button in sales order process using user event script. after that i'm unable to proceed it. It is possible to show the custom PDF template in new window while clicking the sales order?
My CODE:
USER EVENT SCRIPT:
// creating button in user event script before load event in view mode
unction userEventBeforeLoad(type, form, request){
if(type == 'view'){
var internalId = nlapiGetRecordId();
if (internalId != null) {
var createPdfUrl = nlapiResolveURL('SUITELET', 'customscript_back0rdered_itm_pdf', 'customdeploy_backord_itm_pdf_dep', false);
createPdfUrl += '&id=' + internalId;
//---add a button and call suitelet on click that button and it will open a new window
var addButton = form.addButton('custpage_printpdf', 'Print PDF', "window.open('" + createPdfUrl + "');");
}
else {
nlapiLogExecution('DEBUG', 'Error', 'Internaal id of the record is null');
}
}
}
SUITELET SCRIPT:
function suitelet(request, response){
var xml = "<?xml version=\"1.0\"?>\n<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n";
xml += "<pdf>";
xml += "<head><macrolist><macro id=\"myfooter\"><p align=\"center\"><pagenumber /></p></macro></macrolist></head>";
xml += "<body size= \"A4\" footer=\"myfooter\" footer-height=\"0.5in\">";
var record = request.getParameter('internalId');
xml +="record"; //Add values(in string format) what you want to show in pdf
xml += "</body></pdf>";
var file = nlapiXMLToPDF(xml);
response.setContentType('PDF', 'Print.pdf ', 'inline');
response.write(file.getValue());
}
thanks in advance
The way I did it recently:
User Event Adds the Button that calls a suitelet (window.open('suitelet URL'))
Suitelet Renders the custom template
You can do the rendering like this insise a Suitelet (params: request, response), the custscript_pdf_template points to an html file on the cabinet using the NetSuite Advanced HTML syntax
var template = nlapiGetContext().getSetting('SCRIPT', 'custscript_pdf_template');
var purchaseOrder = nlapiLoadRecord('purchaseorder', tranId);
var xmlTemplate = nlapiLoadFile(template);
var renderer = nlapiCreateTemplateRenderer();
var file;
xmlTemplate = xmlTemplate.getValue();
renderer.setTemplate(xmlTemplate);
renderer.addRecord('record', purchaseOrder);
xmlTemplate = renderer.renderToString();
file = nlapiXMLToPDF(xmlTemplate);
resObj = file.getValue();
response.setContentType('PDF', 'printOut.pdf', 'inline');
response.write(resObj)

Obj C - I can't find the user location via the Facebook Graph API

I'm building a iOS app with a Facebook login via the Facebook Graph API. So far the login works perfectly and I receive the users profile. I'm trying to display the location (place of residence, not his current location) of the user but can't seem to find it in the user data I get when the user is logging in.
This is the JSON I receive:
{
email = "";
"favorite_athletes" = (
{
id = 308994352528078;
name = "Belgian Falcon F16 Racing Team";
}
);
"first_name" = Bastiaan;
gender = male;
id = 10153090459134040;
"last_name" = Andriessen;
link = "https://www.facebook.com/app_scoped_user_id/10153090459134040/";
locale = "en_US";
name = "Bastiaan Andriessen";
timezone = 1;
"updated_time" = "2014-11-28T13:10:46+0000";
verified = 1;
}
The Facebook Docs says it does send the location with the profile but I as you can see I don't find it in the JSON:
https://developers.facebook.com/docs/reference/ios/current/protocol/FBGraphUser/
Does someone know how I could solve this?

losing image when form is not valid

I am quite stuck. I am saving image to a temporary folder. When the form doesn't validate on submit, why does the form lose the image name?
heres what I have:
if(CUploadedFile::getInstance($model, 'product_image') !==null)
{
$product_image=CUploadedFile::getInstance($model,'product_image');
$f_product_image = "{$impdate}{$random6}{$product_image}";
$model->product_image = $f_product_image;
if($session['image0']&&file_exists($thumb.'thumb_'.$session['image0'])){
$old_name = $session['image0'];
unlink($url.$old_name);
unlink($thumb.'thumb_'.$old_name);
}else $session['image0']=$f_product_image;
}
else $model->product_image = $session['image0'];