The No-Longer Persistent Counter



The No-Longer Persistent Counter

   In the explore tab of Github I came across an interesting project that looked rather simple! It was no longer being undated, which if fine. Maybe with the simplicity of the project id learn something. 
The project was a counter where you could set a number and increment up or down. 


Its actually a very nice looking app, Made with fragments for ui (yay! have to learn anyway). Where I saw a challenge where I may be of help was in someone posting an Issue.



So I started with what Im not the greatest at layouts. I just want to make a functional layout so I can just see if i can get the buttons and health to work.

While it doesn't look nearly as good, it's functional. Moving to another machine I got a Error! oh no! I downloaded the original files and tried again but still didn't work.  As expected StackOverflow came to save me!



 Once I created the Symbolic links I was able to work on the project.  What it did was by redirecting the folder to another with the same structure / tools it tricked the tool so It could still build.

Lets Get to Code!

I started by examining all the instances where player data was and started making copies including buttons of course!


Now since im trying to have 2 players I need the buttons to specify what health total is going down or up onClick
Once I starting coding i realized this wasn't really built to do 2 counters as per the use of SortedMap and SharedPreference. Which I didn't learn about till nearing the end of my attempt. As I need to still keep a 1 counter layout functional as its not mine I had to add 2 radio buttons and a mode on a lot of functions. Radio buttons were attached to the menu to choose from 1 or 2 players


If the 2nd player option is checked my layout will be displayed instead of the one original one

I then ran into issues where double counters wouldn't be saved and upon launch the first counter isn't initialized. To fix persistence issues id have to rewrite a lot of the way the app stores the data. I did attempt but just started breaking more things in the process. For now its a functional MTG life total. This semi responds to the request placed in the issue. I would like to come back and fix the persistence issue it just involves restructuring a lot of code . 




Comments

Popular posts from this blog

Image-Steganography-Library-Android

Release 0.3

Adding Simple Radios Ends in Bot Madness