Android Viewer and Desktop Downloader/Viewer for PA Stats

Discussion in 'Mod Discussions' started by infuscoletum, August 28, 2013.

  1. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    First off, the Android version just for a more mobile friendly version of the PA Stats website:

    Step 1: Make sure you have "Unknown sources" checked under settings/security. If you don't you won't be able to install this, since it's not an official on-the-play-store app.

    2: Download the zip and load up the apk file it contains to your Android device. Next, using your file viewer, navigate to where you put the apk, and open it. If you have more than one package installer present (I really don't know why I do, so don't ask...) you might get a window like the one below. Choose the package installer shown (it's the default android one)

    2013-08-28-12-45-05.png

    3: Install. The reason for the network permission should be self explanatory, but just in case: THE APP NEEDS IT, AND ONLY USES IT, TO ACCESS COLA_COLIN'S PA STATS SITE. Specifically, the game list JSON (/report/games), and the game graphs (/chart?gameId=...)

    2013-08-28-12-47-06.png

    4: Open it!

    2013-08-28-12-48-39.png

    5: This is where you search for game numbers, the names of reporting players, and open the game graphs:

    2013-08-28-12-50-56.png

    6: The menu (show's up at the bottom on my phone, I think it's in the title bar for the app on Nexus devices) launches whatever browser you use and opens the PA Stats thread, or this thread for the app:

    2013-08-28-13-54-22.png

    7: The graph display! It's not anything more than a javascript enabled webview that auto scrolls down after its loads. Unfortunately the graphs "zoom" bar doesn't really work. You can touch where you want the points to be, but I found it rather clumsy, so I enabled native zooming so you can pinch zoom like a boss.

    2013-08-28-12-52-34.png


    Enjoy!:D

    ** This should work/use the native look and feel all the way from Android 2.1 thru 4.3. I haven't tracked it's memory usage, but it seems to work fine on the 2.3.3 virtual device I have set with 1/2 a gig of ram. **

    EDITS: added info about in app menu, uploaded new version with proper "about" link functionality, and thumbnails instead of huge phone screens everywhere :eek::oops::D

    Version 1.2 adds in a spinning thing and a progress bar to the graph view as it loads the page.

    Version 1.3 adds a refresh menu to reload live game pages. used a menu so that there was still the full screen for the actual page.

    Attached Files:

    Last edited: September 1, 2013
    Gorbles likes this.
  2. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Steps/usage for desktop java based version:

    1: download the zip at the end of this post, extract it somewhere. You only really need the jar file if you're really tech savvy, but the empty replay folder and pics are there for convenience and to add some prettyness.

    2: Double click the cmd file. It's just the line "javaw -jar PAStatsGraph.jar" which is all you need to know to run this on other systems, or even in the command prompt of windows. Just open up a terminal in mac/linux or cmd.exe in windows, navigate to where you have the jar stored, and type that in. It should work on any system with java installed on it. You might even be able to rename the cmd file to a .sh?

    3: Window pops up with a smaller one that says (hopefully):

    01 Game List Download.png

    This means that you have got the json with all the game ID and reporting player data.

    4: Next it will prompt you to open a json file from replays (if you extracted it), but it's blank so you can just hit cancel if you want.

    5: Your best bet would be to go thru the File>PAStats Games menu list and click one to download it, or open the search popup (which doesn't lock focus btw) and after searching, click one of the buttons to download the json data for that game. It defaults to "game[gameID].json" and when you hit save a popup should appear like for the game list data, but this time for the file you choose. Open new should let you select and open it, and the names of the reporting players will appear after "Players:" in the menubar. From there you can select what stat you want to add to the graphs, whether you want the data to be additive over time or not, and what color you want it to be. Mousing over the window changes the info displayed in the top left for each item. Items are also listed under "Currently Displayed Data". Clear graph does exactly that, allowing you do view different stats from a blank slate. You can also change the zero value line and back ground color of the graph under the file menu, refresh the games list data file, or exit.

    02 Main Window.png

    Well, that's it for that one. I still have a few things I want to add, like ranges on the side, and a few values calculated from the base ones, and even have some like "timepoint" not show up in the menu, which are of no use to display as a graph line.

    As with the Android one, enjoy! :D

    Attached Files:

    Last edited: August 29, 2013
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    looks nice, I dont have a device like that though.
    One thing about the webservice call to get all games you use currently: It's slow. Like super slow. Like call it once and than cache it's result slow. It will be much much faster once I've reorganized a few things. Which will hopefully be done around the end of the weekend. But that's just my wishful thinking, I dont have an ETA
  4. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Actually, getting the json data AND parsing it takes like 3 seconds on my Note. Not too shabby.

    Anyways, version 1.1's only change is to redirect the "About this App" menu to this thread, not both launching the PA Stats one:oops:
  5. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    it IS slow, the query that collects the data runs for 1 to 2 seconds. It should take less than 100ms if done right.
    I am pretty sure you can kill the server by calling the webservice method in a full speed loop. Better don't try it ^^
  6. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Here's the source files if you wanna check em out. You can check out the parser in java\fusco\leetum\pastatsmobile\GameListActivity.java

    basically refreshGameList calls an async object GetGameList, which when finished downloading the JSON to a string, sends it back to the activity via gameListParse, which makes a JSONArray from it then traverses/searches.

    A little different than just being able to download the file in desktop java! Thank god Android Studio and even Eclipse have such a good ui builder where it's easy to make something (in)visible so you can make sure stuff stays where it should!

    Attached Files:

  7. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    ah, so far it's okay. I am just saying: please dont really too much on that call to be fast for now.
  8. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Alright, added the desktop one to post #2. And here's the source, including external librarys, if anyone's interested. It's more commented than the android code....... but not fully.

    I am a bad programmer :eek::oops:

    Attached Files:

  9. Gorbles

    Gorbles Post Master General

    Messages:
    1,832
    Likes Received:
    1,421
    Seems to run pretty smoothly/fast on my Samsung S3, nice work. Cached memory usage is about 50MB after calling the list of all matches and loading up one of them in graph form (and exploring the graph a bit).

    One thing I'd suggest is some kind of loading bar while rendering the graph page. The current implementation gives the impression the app is hanging (page force-rotates and displays a white page for several seconds).
    infuscoletum likes this.
  10. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    I could put a giant generic spinner over top that goes invisible when the page is loaded. Should be possible alongside the force scroll down code. When I have more time to spend on it, I'll look into it further :)

    50 MB is actually a lot less that what I figured it would be! :cool:
  11. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    @Gorbles Added code so a progress bar appears at the top, and a spinning thing is in the center of the screen. Which is basically a progress bar without an orientation :eek:
    It does seem a lot more user friendly than before :oops::cool::D
  12. Gorbles

    Gorbles Post Master General

    Messages:
    1,832
    Likes Received:
    1,421
    Much nicer, thanks for that! Don't have any other complaints, hah :D
    infuscoletum likes this.
  13. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    Holy **** man! next up people tweeting on their smartphone about how a gamer was "off the charts" played brilliantly. Sweet.
    infuscoletum likes this.
  14. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Android now @ v1.3: hitting menu button brings up a refresh option for when viewing live game pages, since the auto refresh on the page (?) doesn't seem to trigger on my device.

    EDIT: LOL apparently it DOES refresh the graph over time :oops::D:cool: Anyways........
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    the auto refresh is a javascript function that calls itself in window.setTimeout again and again and again...
    no idea how that works on android.
  16. infuscoletum

    infuscoletum Active Member

    Messages:
    606
    Likes Received:
    37
    Apparently it does work just fine as is. Don't even know......:oops: Either way, it's just a menu option :D

Share This Page