-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Implement opening GWC files from local storage and other apps #40
Conversation
Can one of the admins verify this patch? |
Can I set up my build somehow so that I get a APK from github directly, or do I need to setup an AndroidStudio? |
@jakedot but first after you are allowd to submit |
@Lineflyer can you do it ? (I don't know how) |
OK to test @bekuno This trigger sentence should do the trick |
Build finished. |
I can't install the built apks. Hope it's not my changes responsible 😳 Do I need to do something else first perhaps? |
@jakedot which kind of error did you get? I suspect it's a problem of apk signature which is different from the one coming from GPlay. Did you tried to uninstall your current version before installing the one from PR builds? |
That did the trick, thanks. |
Unfortunately, my changes did not properly implement the desired functionality. Will see if I can look into it later this week. |
Maybe the same workaround as in cgeo would help |
retest this please was the trigger for a rebuild right? |
Build finished. |
hm, doesn't change anything as far as i can see. But opening the cartridges from the wherigo.com website must do something different, we're storing the credentials and so opening the link must have some code setting up authentication? I guess it will not work with file links immediately. |
according to my comment in biylda/WhereYouGo#36 (comment) |
Seems to me that GWZ isn't supported so far at all, but it should be possible to support it as well, e.g. webwigo.net can open both GWC and GWZ - and GWZ is about the same as GWC after the decompilation stage I'd guess... |
retest this please |
In the near future I won't have time to look into the code mentioned by @SimonHeimberg - so I'm closing this PR in the meantime. Thanks for your help so far! |
I set the label "WIP" because you only reopend your work. |
d99664d
to
c11fb54
Compare
This is just a preview of how it could look like. Actually storing cartridges is not yet finished. @bekuno I would appreciate an early review if you have time for it. |
This would be the old behaviour, though? It should start the "Downloading" activity, as it is based on the unchanged http URI.
That is strange. You mean, that WhereYouGo is just not selectable for opening the download with? Maybe Firefox sets some strange mimetype / filename combination, I'll have a look locally.
Probably the same as above...
The standard file manager in the emulator did work as well. The standard file manager from Samsung too. I will test with TotalCommander as well.
I will try to find out why this is the case. Maybe I need to add a mimetype intent-filter too. Unfortunately the GWC files don't have a registered mimetype we could filter on reliably - it's none at all, |
rebased on current master with #83. |
Will start to look for described problems and continue development now. |
OpenLocalActivity: implement saving the cartridge from a local source (like a content: or file: URI) into the app files directory.
Here is an overview of what got changed by this pull request: Issues
======
- Added 9
Complexity increasing per file
==============================
- src/main/java/menion/android/whereyougo/network/activity/OpenLocalActivity.java 5
See the complete overview on Codacy |
public class Progress { | ||
final DownloadCartridgeTask.State state; | ||
long total; | ||
long completed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
public class Progress { | ||
final DownloadCartridgeTask.State state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> { | ||
final ProgressDialog progressDialog; | ||
final String name; | ||
final Long size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
public class Progress { | ||
final DownloadCartridgeTask.State state; | ||
long total; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final DownloadCartridgeTask.State state; | ||
long total; | ||
long completed; | ||
String message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tvName.setText(R.string.import_cartridge); | ||
|
||
TextView tvDescription = (TextView) findViewById(R.id.layoutDetailsTextViewDescription); | ||
TextView tvState = (TextView) findViewById(R.id.layoutDetailsTextViewState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: Avoid unused local variables such as 'tvState'.
} | ||
|
||
class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> { | ||
final ProgressDialog progressDialog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
class ImportTask extends AsyncTask<Uri, ImportTask.Progress, Boolean> { | ||
final ProgressDialog progressDialog; | ||
final String name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return true; | ||
} | ||
}); | ||
Button buttonDownload = (Button) findViewById(R.id.button_positive); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @moving-bits found in cgeo#7663, distinguishing files by name/extension properly isn't possible with the Android Intent-Filter system. So, this PR will probably be useful in a revisited form. I'll close it until I have time to look into it properly. |
Maybe a simple addition to cgeo/cgeo#8180 can resolve that problem: We already have a check for file content there, and this can be extended by a check for map files and routing the user to WhereYouGo. But let's tests the c:geo side first (which is scheduled for after the next release). |
@jakedot Seeing this issue being closed without a merge, I'm not sure about the current state of WhereYouGo being able to read gwc files or not - can you enlighten me? If it is not yet able to work with gwc files - do you plan to implement it? Thanks. |
As far as i know, the current WherYouGo code does not have the capability to read from gwc files. My OpenLocalActivity in this PR did implement it, but I don't know how/if it can work with newer Android versions, I guess it would be better to start fresh. I don't know how to implement a Intent for sending a file from another app, I guess we would need to declare and use a new mimetype like application/gwc? |
has anything changed regarding this functionality in WhereYouGo? |
I don't think so - there's nearly no dev activity around WhereYouGo lately, the two most pressing blocker being missing "storage access framework" support (to open file stored locally) and support for newer Mapsforge versions (or even VTM). Both is not happening to WhereYouGo anymore, very likely. |
I unfortunately don't know if this is enough to work instantly but this is what I guess needs to be changed.
Attempt to fix #39