Repository navigation
Conversation
…g off and on the screen
…g off and on the screen
…roid into us4_view_text_files Conflicts: src/com/owncloud/android/datamodel/OCFile.java src/com/owncloud/android/ui/activity/FileDisplayActivity.java
There was a problem hiding this comment.
You are overwriting this SETUP.md (from Oct 12) with an old version! Did you merge develop into your branch?
…to us4_view_text_files
|
This PR has a lot of conflicts because the branch is outdated. It should be necessary to updated with the last version of the develop branch. |
|
There is a bug when you rotate the device
CURRENT BEHAVIOR
@stoyicker could you take a look? thank you |
|
@purigarcia can't replicate on real Nexus 4, nor Nexus 5, Galaxy S3 and Galaxy S5 emulators (everything I've tried so far). Can you share the exact file you are able to trigger the issue with? |
|
I could replicate it with a nexus 5 emulator: Text file is 0.txt with only content "laptop". |
|
@stoyicker , I have updated the steps indicating the you should be seen the preview of the file. |
|
Are you testing this branch or text_file_preview_pr_707_with develop? |
|
I am testing text_file_preview_pr_707_with develop |
|
Maybe the bug is affected with new code, but we should fix it anyway. |
|
It has to be that. My attempts have been with us4_view_text_files and the bug is not there. |
|
I have fixed the bug. |
|
I have pushed the fix to text_file_preview_pr_707_with develop |
|
I think this one can be closed and therefore I open a PR for the new branch. |
|
Great, @tobiasKaminsky ! |
|
It's OK. History is kept, and a single PR for a single feature. Let's follow the work in #1095 . Thanks to everybody. |
|
I find another issue _rtf files are not been shown correctly_
@stoyicker ,@tobiasKaminsky could any of you take a look of it? Thanks |
|
RTF is a proprietary format by Microsoft that describes a file that contains information which is not plain text. I don't know if it is possible to properly read the file (the results would probably be something similar to what you get when you open a .docx file with LibreOffice), but even if it is, the effort and the likely overhead added to the app just for this is huge, and makes the feature completely infeasible in my opinion. The fact that the file attempts to be previewed is just because the interpretation of its type depends on its mime type, and this is defined by ownCloud, not in the PR. Note how the same problem occurs with non-text files. For example, take this PSD file and upload it to your server, then open the app and, when it's synced, download it. You'll see how it tries to show the preview, because of the recognized mime type, but is unable to do so because the format is not "understandable" and shows an error instead. In conclusion, this is a "problem" of the policy on how you identify file types, not preview text files itself. Furthermore, and since there is always the option of opening the file with an external app (Word or Photoshop for example in the described cases) I would not even identify it as a problem. Mime types are a more reliable way to identify a file type than extension parsing as extensions can easily be edited. |
|
Yeah. |
|
I would say that's inconsistent in practice. In the case that you want to reliably identify RTF files you would probably need to look for certain bytes that show that structure; otherwise you could be facing, for example, a plain text file that got its extension manually changed to .rtf, and although since it is a plain text file it should be previewable, the .rtf extension would filter it out. And, even if the filtering is applied, what happens then with .doc, .docx, .odt, etc? I say let's not touch it. |
|
According to http://www.sitepoint.com/web-foundations/mime-types-complete-list/ So this should work. Of course there is still the function mimetypeByName which should be dropped for the reason you mentioned. |
|
The point is it is precisely because of that it doesn't work. The filtering method implemented in OCFile only cares about the file being text, and not whether it is or not plain, which causes the issue here. |
|
Hmm. Maybe I am not understanding you correctly. |
|
In summary, I strongly want to keep the "corrupted" preview. I'll use an example to try to better explain why. Think of your suggestion: let's imagine that we decide that this functionality only applies to purely plain text files. This is already arguable by the fact that a user downloading, let's say, an HTML (text/html) file, probably expects to be able to see the contents, but instead the functionality would not support it. But even if we decide to go through all 99 text/something types and filter in those that are properly readable even if not typed as plain, like text/html, this is inconsistent with the current behaviour of the app. |
|
Ok. thanks for your very detailed explanation. This is fine for me. |
|
I'm sorry, @stoyicker, but I disagree. I love consistency in code, but it cannot be more important than providing the user with a right functionality. I cannot imagine a situation where rendering the non-printable characters of an RTF file is a nice result for a regular user. I agree that trying to render RTF correctly is too hard with our resources and current knowledge. Too much for this PR, that brings a very valuable functionality and doesn't need to increase its scope due to problems found in QA. Due to this, the best decision to take is not rendering the file. The user will be able to open it with other apps installed in the device, as for any other file that the OC app is not able to preview (that are a lot).
Sorry, but that's not the filtering method, it's a (helper) method about a property of the file. The filtering method is , that may be as complex as necessary. So, please, let's change this before merging. It's the last pending point, if I'm not wrong. Thanks. |
|
Sure, will get into it later. |
This PR adds support for previewing text files.
Depends on #661.