Battleships interactive table (android studio) - Design, Prototyping, UI, Graphics

Hello!
I'm doing an Android studio project called Android Battleships from scratch. I ran into a problem. When designing player ship arranging activity I need a table with clickable cells that should return it's row and col number or at least it's ID. I tried doing this with 64 (8x8table) ImageButtons but that doesn't seem like a good solution considering I have to initialize all of them and set onClick listener cases for all of them. Also there should be switches that determine how many cells I can choose for the current ship. Any ideas? Or any better solutions? Maybe inputing coordinates and the image view elements in table show ships (different colored cells). I hit a wall. Any help welcome! Thanks!

Related

[APP][ALPHA] G Force Logger for Vehicle Performance (no, not gPC)

Hi, my name is Eric. I've been working with WinCE for a long time (since WinCE 2.0 haha) and I've regained interest in PPC programming. Working with few things here and there, mostly experimenting.
In anycase, I've got an idea to record g forces on a vehicle while it's being tested to its limits (AutoX, drag race).
Now, I know there's already a piece of software out there, gPC, but it isn't completely refined (indepth calibration, angle corrections) or completely free (by donation).
The goal of the project is to create something similar to a device called gTech which goes upwards of $300 for the basic model.
Key features will include:
- a reset function + algorithms to compensate for device orientation
- graphs of resulting logged data
- logging of calibrated data and raw data
- Driving aids
- Flashing screen to indicate reaching of new peak G (separate indicators for forward and lateral)
- a screen showing realtime overlapping graphed data for all axis
- a 2d grid with a cursor indicating current forward and lateral g
- on the same 2d graph, a drawn boundary indicating limits of g achieved (this will eventually look like an egg after working the car hard)
- and finally, real time telemetry transmission via edge/3g to a receiving computer
The ultimate goal of this project is to provide reliable data for motor enthusiasts whether they would like to see if their shifting is smooth, or if they're braking, or powering on in the right places or if their car mods have had any effect (this last one is pretty useful to quantify). In addition, provide some rudimentary tools to assist in competitions and spirited driving in the form of g limit warnings (flashing screen, large indicators of current g). In the case of spirited driving on a mountain road, the device can warn when approaching loss of traction (after collecting limit data) to prevent going off a cliff.
Venues of use:
Auto Cross
Track Days
Drag Strip
Skidpad
Of course, I have to insert here, that this device can't save your bacon if you do something idiotic and by no means do I condone dangerous driving.
With that said, all the above is what I hope to achieve and any of your comments is well appreciated.
Current Release:
v0.1
Alpha stage, rudimentary raw data output via numbers and a line (indicating X and Y recorded g) and a circle (indicating Z g). The numbers shown are the raw numbers recorded from the accelerometer and not converted to m/s^2. Although, you can probably do that math on your own if you're smart enough (simple scaling). What I've discovered is that each accelerometer is different, and even going from a negative axis (eg, device upside down) to positive axis (device right side up) will give different numbers. In addition, if you run the program, you'll notice a lot of jitteriness. I hope it doesn't affect the accuracy once I smooth them out with a segmented average.
Executable is packaged in a zip. It contains an EXE which can be straight run with Dot NET CF v2.0 (basically, all WM 6.1 devices)
Hi Canagan,
Great idea, I will certainly be testing this out.
I would like to ask, would it be possible to be able to include 1/4 mile time, and 0-60 etc so we can work out HP of the car. There is a similar app for the Iphone called Dynolicious http://gizmodo.com/5030749/iphone-apps-we-like-dynolicious-car-performance-meter
Thanks.
Whoooaaa sound a really good app ! Will test it this weekend ! Thanks
PooleyUK said:
I would like to ask, would it be possible to be able to include 1/4 mile time, and 0-60 etc so we can work out HP of the car. There is a similar app for the Iphone called Dynolicious http://gizmodo.com/5030749/iphone-apps-we-like-dynolicious-car-performance-meter
Click to expand...
Click to collapse
Yes, I can do that if there's more of a demand for it. Calculating horsepower is fairly simple, however, I may put 1/4 mile times and 0-60 towards the end of development as they require tieing into the GPS.
Great idea.. I will test it also
It seemt to be working on my Touch HD. But are the meaning of all these numbers??
CanaganD said:
Yes, I can do that if there's more of a demand for it. Calculating horsepower is fairly simple, however, I may put 1/4 mile times and 0-60 towards the end of development as they require tieing into the GPS.
Click to expand...
Click to collapse
Cool, looking forward to seeing this develop.
So far the accelerator test seems to be working fine.
would be need ive i could see how many hp mycar has

Programatically update today screen image

Hi all,
First a little background into what I'm attempting...
On my PC, I have a self created program which swaps the desktop image to one selected at random from a predetermined directory. There's lots of nifty features, such as image resizing to fit desktop, support for different images on different monitors in a multi monitor setup. etc.
But enough about that, as it's not really windows mobile related. What is related is the fact i'm trying to implement something similar on my Xperia X1.
Obviously I want it so I can have different images for the today screen when it's in landscape and portrait mode - like the built in themes do. I have to admit i'm fairly miffed that this feature isn't supported nativly in a nice easy non-theme related way. it's nigh-on impossible to find an image that looks good in both aspects.
Anyway, I did have something working. A small program which creates a stwater_480_800.bmp and stwater_800_480.bmp by selecting a random image from one of two predetermined directories, and then plonking said images in the windows directory. (Replacing the two bmp images put there by the theme i was using) No resizing of images or anything fancy, just a straight file copy.
This line of code:
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 242, 0)
forces the today screen to update to the lovely new images after the files have been replaced.
All was well until I installed gtrab's excellent pure windows mobile 6.5 update (http://forum.xda-developers.com/showthread.php?t=588882). And although the app still works for the main part, i.e. it picks an image, and changes the background for the today screen, i have encountered a bug.
The image behind the updated start menu doesn't get refreshed - it stays as whatever the image was when the phone was last reset (Think it's specifically a hard reset? i.e. holding power button down the rebooting with sony ericsson logo etc).
Here's the code i'm currently using (Apologies for lack of comments, despite being employed as a vb.net programmer, i'm self taught and not commenting is a bad habit i've never gotten out of.)
Code:
Public Shared Sub SwitchBG()
Randomize()
Dim curdir As New IO.DirectoryInfo(SharedVars.LandscapeDir)
Dim imagefiles As IO.FileInfo() = curdir.GetFiles("*.bmp")
If imagefiles.Length > 0 Then
IO.File.Delete("Windows\stwater_800_480.bmp")
IO.File.Copy(imagefiles(Math.Floor(Rnd() * imagefiles.Length)).FullName, "Windows\stwater_800_480.bmp")
Else
MessageBox.Show("No Landscape Images!", "BGSwitcherPPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End If
curdir = New IO.DirectoryInfo(SharedVars.PortraitDir)
imagefiles = curdir.GetFiles("*.bmp")
If imagefiles.Length > 0 Then
IO.File.Delete("Windows\stwater_480_800.bmp")
IO.File.Copy(imagefiles(Math.Floor(Rnd() * imagefiles.Length)).FullName, "Windows\stwater_480_800.bmp")
Else
MessageBox.Show("No Portrait Images!", "BGSwitcherPPC", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
End If
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 242, 0)
End Sub
I'd love to know what I have to do to force the start menu image to refresh. I've googled for a while with no joys.
Incidentally, I did discover that i can use .jpgs for the background (makes sense really). Not sure if that will have any bearing, but i'll be changing the code to accept both bmp, jpgs, and probably gifs. Can't see that it will affect my specific problem, but thought it would be worth mentioning.
Once i've got this sorted, i'll be ready to tackle the next stage, which is implementing some form of schedule so i can wake up to a new today screen image every day.
Thanks in advance to anyone with any pointers.
Matt.
Sorry, just realised I should have posted this in the windows specific forum.
Still, any help much appreciated!
Okay, I've managed to do this. Via a hacky work-around.
Basically, I realised after a bit of playing, that if you set a "normal" wallpaper, all it does is create a registry key. But, rather handily, the start menu and lock screens (lock was also affected by this bug) would see this change, and update their pic.
Also, rather handily, if you set the registry to an image that doesn't exist, the image then defaults back to the appropriate stwater
so the workaround is as follows...
Every time i run the switch code, I write an incrementing value to the HKCU\software\windows\today\wall registy value. This can be anything, providing it's not a "real image"
when you next open the start menu, it looks for this "new" image, can't find it, so loads the appropriate stwater image.
I'm gona stick the program in an Xperia forum for some feedback/suggestions.
edit: link to app: http://forum.xda-developers.com/showthread.php?t=594763

[Q] recognize letters in my app

hello,
I'm programming a WP7-App, i have a letter (for example the "A").
How can i recognize the input and match the correct character ?
sorry for my bad english
You can cast chars to ints.
see: http://www.asciitable.com/
In the table in that link, note that 'A' corresponds to a decimal number 65. When you cast your char 'A' to an int, it will turn into 65.
Similarly, (int)'a' is 97. And 'a' - ch, where ch = 'b', is equal to -1. Doing subtraction of chars automatically converts to integers. Casting the whole string to lowercase and then checking (currentChar - 'a' < 26) is a great way to check if you're looking at an alphabetic character (a through z).
Thanks for the answer...
the "A" is only an example caracter.
in the real world example i use japanese caracters.
the user shall be paint the correct caracter in my app, like this on the picture...
CB.NET said:
Thanks for the answer...
the "A" is only an example caracter.
in the real world example i use japanese caracters.
the user shall be paint the correct caracter in my app, like this on the picture...
Click to expand...
Click to collapse
That will be an insanely difficult task. Actually this in general takes years of study in order to accomplish
Handwriting recognition is one of the hardest things to accomplish.
If you do want to give it a shot, my suggestion:
Crop and rescale the images, and than determine patterns for each letter, thus an A can be build from 3 linear formules, check if the drawing matches this structure. You can than compute the derivatives of the drawings and from those derivatives cross check them with a database to determine which letter it is.
But this is extremely difficult, we tried to read digits in a sudoku puzzle which was already quite a difficult task to accomplish (and we tried to reference it against a database with images, as well as checking several characteristic points in a figure etc) this went OK with printed letters, but with handwritten it was a disaster. Not trying to discourage you, maybe there are libraries out there which you can use, but I would reconsider what you are trying to accomplish and determine an approach for yourself.
CB.NET said:
Thanks for the answer...
the "A" is only an example caracter.
in the real world example i use japanese caracters.
the user shall be paint the correct caracter in my app, like this on the picture...
Click to expand...
Click to collapse
I highly recommend making a class of "Cases" this way if it detects "A" it uses the "A" case select opposed to making a ton of "if" and "else" statements.
Better yet... You always could use an if/else statement or have an array of listed recognized items...
Here is something that might help: http://joshsmithonwpf.wordpress.com/2007/06/12/searching-for-items-in-a-listbox.

Aviation Heads Up Display (HUD)

Hey guys! I was paging through the forums and had what could be an awesome idea. I'm by no means a aerospace engineer nor a computer scientist, but I was trying to figure out how hard it would be to take a standalone Attitude and Heading Reference System (AHRS) system like the iLevil 3 Sport, and display it on something like the EPSON BT-300. Im sure it would have to be a simplified display, but in theory couldn't we get something like a fighter jet HUD directly in front of your face?!
The reason I have chosen these two pieces of hardware (iLevil 3 Sport and EPSON BT-300) is to try and simplify the problem at hand. Through programs like ixGyro, AHRS Utility by iLevil, and Xavion, to name a few (all of which are compatible with the iLevel, and available to download directly to any Android system), you already have all of the information in tablet form.
The AHRS device has all of the hardware required and outputs the information via WiFi. These programs have already proven that this information can be successfully displayed. It seems as through that the only problem now is the GUI. I don't have either of these two products so I can't say for certain, but I'm willing to bet that the BT-300, running Android 5.1, can display this information almost the exact same as on your phone or tablet! I propose that we simply delete the background so you have a true augmented reality while you fly!

Best Mounting / Project Box for Pi Zero 'Window to Scotland'

So I'm working on a multimedia project for a friend at work. He loves watching webcams of Scotland and so I designed a simple Pi Zero W setup where a python script loads a series of live streams of Scottish points of interest and one can use a potentiometer to "change the channel" to different cams. The goal is to hook this up to an old monitor we have (a 19-inch Dell, but we could find another) and hang it on the wall so he can always look at it.
So I've got the old monitor and the Pi and the potentiometer and I've got a python script that uses OMXplayer to make it work, although I'm not sure I want to stick with a potentiometer because it's hard to tell how far you've advanced and there's a 10 second pause where the screen goes black when changing cam feeds (if anyone knows how to fix that, please let me know). But my main issue is how I physically mount the pi and all the associated pieces (the MCP3008 ADC chip, the potentiometer) to the screen or at least to a neat box that I can hang on the wall, just below the screen.
Is there a good project box that has holes for the Pi Zero? Should I use a protoboard to attach the dial and the ADC chip? Any advice appreciated.

Categories

Resources