xyzz / openmw-android

OpenMW for Android
https://omw.xyz.is/
GNU General Public License v3.0
325 stars 88 forks source link

Added app shortcut to instantly launch game #24

Open rozPierog opened 5 years ago

rozPierog commented 5 years ago

Hi @xyzz great work on android version of OpenMW. I've wanted to help and resolve https://github.com/xyzz/openmw-android/issues/21 It goes without saying that its more of a POC and not a final implementation, would love some pointers from you about, naming, code and shortcut appearance.

licaon-kter commented 5 years ago

Are those "imports" useless and needed to be removed?

rozPierog commented 5 years ago

@licaon-kter Yeah, Android Studio removed them automatically, so I guess that they are not needed anymore.

xyzz commented 5 years ago

Is there a reason this is a dynamic shortcut instead of a static one? It seems the same functionality could be implemented with a static shortcut, as in https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#static

rozPierog commented 5 years ago

I totally forgot about static shortcuts. I'll rewrite this later today. Thanks

rozPierog commented 5 years ago

@xyzz I've changed it to static. Sadly I couldn't find reliable method of getting application_id inside .xml file so I decided to make shortcut release type only, because of different application_id in debug mode. I can bypass it by creating alternate shortcut for debug mode or adding application id to strings.xml let me know which way you prefer.

xyzz commented 5 years ago

The shortcut working in debug would be nice to have but not overly important. However, the current implementation won't work for is.xyz.omw_nightly, which is a separate build flavor. Should probably do it similar to https://stackoverflow.com/a/51518675

rozPierog commented 5 years ago

@xyzz While adding shortcuts to nightly I've decided to add them to debug as well. Sorry for a long delay on this PR 😉

xyzz commented 5 years ago

Hmm, I've tried it out again, and a problem it introduces is that if you run the game, then minimize and run again through the shortcut, it is restarted instead of resumed. I suspect this shouldn't be how it's supposed to work, can you confirm?