- Posts: 6
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Development and suggestions about third part tool integration.
Cordova, Xamarin, Basic4Android topics are listed here.
Cordova, Xamarin, Basic4Android topics are listed here.
Question about cordova plugin
9 years 4 months ago #11384
by eastxing
Question about cordova plugin was created by eastxing
How to know the user has back from radaee pdf reader view and the file has been modified?
Hello,
I add cordova plugin into a cordova app, I want to use it like this:
1. show a pdf files list to user;
2. user click one file then download it from server;
3. after file download, open it by radaee pdf reader;
4. user add some annotation and click back button, a dialog popup prompt user to save the modification;
5. user click "ok" button, save the pdf;
6. back to the first pdf files list view;
7. upload the modified pdf file to server;
I have implemented all steps except step 7, because I don't know when the user back from radaee pdf reader view and the file has been modified or not.
Thank you.
Hello,
I add cordova plugin into a cordova app, I want to use it like this:
1. show a pdf files list to user;
2. user click one file then download it from server;
3. after file download, open it by radaee pdf reader;
4. user add some annotation and click back button, a dialog popup prompt user to save the modification;
5. user click "ok" button, save the pdf;
6. back to the first pdf files list view;
7. upload the modified pdf file to server;
I have implemented all steps except step 7, because I don't know when the user back from radaee pdf reader view and the file has been modified or not.
Thank you.
9 years 4 months ago #11385
by support
Replied by support on topic Question about cordova plugin
Are you using the radaee pdf reader plugin within your Cordova application?
Is that's the case, we might introduce a new js command to retrive such an information.
I should ask you to be patient while waiting for our update.
Is that's the case, we might introduce a new js command to retrive such an information.
I should ask you to be patient while waiting for our update.
9 years 4 months ago #11387
by eastxing
Replied by eastxing on topic Question about cordova plugin
Yes, I using radaee pdf reader plugin in my cordova app.
Looking forward to your update.
Thank you.
Looking forward to your update.
Thank you.
9 years 4 months ago #11410
by nermeen
Replied by nermeen on topic Question about cordova plugin
We have updated our
Cordova plugin
..
We have added a new js interface (getFileState) that can be used to get the state of the last opened file (not modified, modified but not saved, modified and saved)...
The plugin is now aligned with the latest Android version.
We have added a new js interface (getFileState) that can be used to get the state of the last opened file (not modified, modified but not saved, modified and saved)...
Code:
RadaeePDFPlugin.getFileState(
{ },
function(message) {
console.log("Success: " + message);
},
function(err){
console.log("Failure: " + err);
});
9 years 4 months ago #11430
by eastxing
Replied by eastxing on topic Question about cordova plugin
Thanks for your update.
But it is not my need. I still do not know when the user back from the PDF view to my app view (by pressed back button).
At last I implemented it myself by modify the cordova plugin source code.
To put it simply,
1. Modify file RadaeePDFPlugin.java;
comment:
change:
to:
and add:
2. Modify file PDFViewAct.java;
change function 'onBackPressed' to:
Now when user back from PDF view, I can get file state and do my process.
But it is not my need. I still do not know when the user back from the PDF view to my app view (by pressed back button).
At last I implemented it myself by modify the cordova plugin source code.
To put it simply,
1. Modify file RadaeePDFPlugin.java;
comment:
Code:
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
change:
Code:
mContext.startActivity(intent);
to:
Code:
this.cordova.startActivityForResult((CordovaPlugin)this, intent, 0);
and add:
Code:
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
if(requestCode == 0) {
if(resultCode == cordova.getActivity().RESULT_OK) {
Bundle extras = data.getExtras();// Get data sent by the Intent
String information = extras.getString("fileState"); // data parameter will be send from the other activity.
PluginResult resultado = new PluginResult(PluginResult.Status.OK, information);
resultado.setKeepCallback(true);
PUBLIC_CALLBACKS.sendPluginResult(resultado);
return;
}
else if(resultCode == cordova.getActivity().RESULT_CANCELED) {
PluginResult resultado = new PluginResult(PluginResult.Status.OK, "canceled action, process this in javascript");
resultado.setKeepCallback(true);
PUBLIC_CALLBACKS.sendPluginResult(resultado);
return;
}
}
// Handle other results if exists.
super.onActivityResult(requestCode, resultCode, data);
}
2. Modify file PDFViewAct.java;
change function 'onBackPressed' to:
Code:
@Override
public void onBackPressed()
{
if(m_controller == null || m_controller.OnBackPressed())
{
if(m_modified) {
TextView txtView = new TextView(this);
txtView.setText("Document modified\r\nDo you want save it?");
new AlertDialog.Builder(this).setTitle("Exiting").setView(
txtView).setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
m_doc.Save();
Intent mIntent = new Intent();
mIntent.putExtra("fileState", "modifiedAndSaved");
PDFViewAct.this.setResult(RESULT_OK, mIntent);
PDFViewAct.super.onBackPressed();
}
}).setNegativeButton("No", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
Intent mIntent = new Intent();
mIntent.putExtra("fileState", "modifiedAndNotSaved");
PDFViewAct.this.setResult(RESULT_OK, mIntent);
PDFViewAct.super.onBackPressed();
}
}).show();
}
else {
Intent mIntent = new Intent();
mIntent.putExtra("fileState", "notModified");
setResult(RESULT_OK, mIntent);
super.onBackPressed();
}
}
}
Now when user back from PDF view, I can get file state and do my process.
9 years 4 months ago #11433
by nermeen
Replied by nermeen on topic Question about cordova plugin
Thanks for the feedback,
But unfortunately, we cannot add such implementation in the standard version distribution; as it's oriented to apps specific needs and implementations.
But unfortunately, we cannot add such implementation in the standard version distribution; as it's oriented to apps specific needs and implementations.
Time to create page: 0.416 seconds