Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #679 updated realpath util method #697

Merged
merged 7 commits into from Apr 14, 2019

Conversation

jddeep
Copy link
Contributor

@jddeep jddeep commented Apr 11, 2019

Description

updated realpath util method.

Fixes #679

Type of change

Just put an x in the [] which are valid.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • ./gradlew assembleDebug assembleRelease
  • ./gradlew checkstyle

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@codeclimate
Copy link

codeclimate bot commented Apr 11, 2019

Code Climate has analyzed commit 1a893e4 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 11, 2019

@Swati4star Please review.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 11, 2019

@Swati4star If you still are facing any error to load the files, please log the actual uri's of the files.And please let me know. Cause I have another way with which I can update it if this does'nt work out. This works fine for my devices and hence I made the PR.

@Swati4star
Copy link
Owner

Swati4star commented Apr 11, 2019

@vyankatesh24 @sidhuparas Can you test it locally once?

Copy link
Contributor

@vyankatesh24 vyankatesh24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jddeep

Not working for following

image

@jddeep
Copy link
Contributor Author

jddeep commented Apr 12, 2019

@vyankatesh24 Can you log the full URI of the file. I mean just log the mUri and let me know about it.

@vyankatesh24
Copy link
Contributor

content://com.mi.android.globalFileexplorer.myprovider/external_files/1.xlsx

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

@vyankatesh24 Please review now.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

And @vyankatesh24 Just to be sure your external_files from the uri path is a folder?

@vyankatesh24
Copy link
Contributor

And @vyankatesh24 Just to be sure your external_files from the uri path is a folder?

No!

Copy link
Contributor

@vyankatesh24 vyankatesh24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Working for
content://com.mi.android.globalFileexplorer.myprovider/external_files/1.xlsx
and this as well
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3Dencoded%3DcGBWpakb4wu5i6GbZrp0QEmsFGGaaRcJBGQCYEk6rDHhD35AT%2Fx9kWnYnq%2BKyFpg

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

content://com.mi.android.globalFileexplorer.myprovider/external_files/1.xlsx

@vyankatesh24 Then what does this mean? Does this mean there is 1.xlsx in your base root directory?

@vyankatesh24
Copy link
Contributor

content://com.mi.android.globalFileexplorer.myprovider/external_files/1.xlsx

@vyankatesh24 Then what does this mean? Does this mean there is 1.xlsx in your base root directory?

yes!

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

@vyankatesh24 Please check again.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

@vyankatesh24 Also can you please log your mRealPath and tell me what do you actually get there?

@vyankatesh24
Copy link
Contributor

@vyankatesh24 Also can you please log your mRealPath and tell me what do you actually get there?

/storage/emulated/0/external_files/1.xlsx

@jddeep
Copy link
Contributor Author

jddeep commented Apr 13, 2019

@vyankatesh24 Please confirm if my last commit/push work? If not I will be pushing a new change.

@vyankatesh24
Copy link
Contributor

@vyankatesh24 Please confirm if my last commit/push work? If not I will be pushing a new change.

No

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@vyankatesh24 Made some changes. Please check.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@vyankatesh24 If this doesn't work too, please let me know about the exact uri/path you used to test the PPT feature.

@vyankatesh24
Copy link
Contributor

vyankatesh24 commented Apr 14, 2019

@jddeep
Conversion working for content://com.mi.android.globalFileexplorer.myprovider/external_files/1.xlsx 👍
but not for content://com.google.android.apps.docs.storage.legacy/enc%3Dixdcs7oqHCZwyMukpyuhnbcvnSWsXQMyrmxbfmkc2Z5R_kHLkQ1haWfePHtDkaueDo4i-mhZKKzi%0AXO9hOzjFB0LrtzrrQxdgequn2XJIEJK-kPVd3krPDj9xNDIESFImnoNwSQ%3D%3D%0A
App crashes with this URI

@vyankatesh24
Copy link
Contributor

Also not working for this
URI: content://com.mi.android.globalFileexplorer.myprovider/external_files/Download/CounterFoil_260418.xls

Output: /storage/emulated/0/Download

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

Also not working for this
URI: content://com.mi.android.globalFileexplorer.myprovider/external_files/Download/CounterFoil_260418.xls

Output: /storage/emulated/0/Download

@vyankatesh24 Now this time this should work for all.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@vyankatesh24 Please review.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@Swati4star Done. Please review.

Copy link
Contributor

@vyankatesh24 vyankatesh24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jddeep
Now Conversion is working for such URIs 👍
content://com.mi.android.globalFileexplorer.myprovider/external_files/Download/CounterFoil_260418.xls

But app still crashes for following URIs
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3Dencoded%3DcGBWpakb4wu5i6GbZrp0QEmsFGGaaRcJBGQCYEk6rDHhD35AT%2Fx9kWnYnq%2BKyFpg

The error log is as follows

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: swati4star.createpdf, PID: 27910
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65536, result=-1, data=Intent { dat=content://com.google.android.apps.docs.storage/document/acc=1;doc=encoded=cGBWpakb4wu5i6GbZrp0QEmsFGGaaRcJBGQCYEk6rDHhD35AT/x9kWnYnq+KyFpg flg=0x1 }} to activity {swati4star.createpdf/swati4star.createpdf.activity.MainActivity}: java.lang.NullPointerException: println needs a message
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4179)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4222)
        at android.app.ActivityThread.-wrap20(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:163)
        at android.app.ActivityThread.main(ActivityThread.java:6238)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
     Caused by: java.lang.NullPointerException: println needs a message
        at android.util.Log.println_native(Native Method)
        at android.util.Log.d(Log.java:143)
        at swati4star.createpdf.fragment.ExceltoPdfFragment.onActivityResult(ExceltoPdfFragment.java:145)
        at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:160)
        at android.app.Activity.dispatchActivityResult(Activity.java:7121)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4175

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@vyankatesh24 I think we cannot upload drive files as of now. We need some more support for that. But Now Any kind of file uploads from the device locally can be feasible as you rightly mentioned, 👍

@vyankatesh24
Copy link
Contributor

@vyankatesh24 I think we cannot upload drive files as of now. We need some more support for that. But Now Any kind of file uploads from the device locally can be feasible as you rightly mentioned,

Then handle the exception for such URIs. The app should not crash.

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

Then handle the exception for such URIs. The app should not crash.

Alright, that can be done. 👍

@jddeep
Copy link
Contributor Author

jddeep commented Apr 14, 2019

@vyankatesh24 Done! Please review.

@vyankatesh24
Copy link
Contributor

Well done 👍 @jddeep

@vyankatesh24 vyankatesh24 merged commit 7c19b57 into Swati4star:master Apr 14, 2019
@worm69
Copy link

worm69 commented Apr 16, 2019

Hi app can handle this type uri? from sdcard with following android emulator
image

image

@jddeep
Copy link
Contributor Author

jddeep commented Apr 16, 2019

Yes @worm69 the App can handle most types of URI's. But some specific drive file uri's are not handled at this moment and the user is directed accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Occurred while creating pdf from excel.
4 participants