ScrollView and onFling and onLongPress oh my! - Android Software Development

Got a great program going..things have been going smoothly.
onFling implemented to slide screens back and forth, onLongPress has some functionality. Menus operations fine, calls to view images work great.
Life is good.
Then we find a need to go longer on some screens in portrait mode. No problemo, toss in a ScrollView in the xml and we're good to go....NOT.
Seems ScrollView has it's on little onTouch implementation and "eats" all of my gesture events so my onFling and onLongPress do not work.
Life is not good.
Spent the better part of today Googling for this and read at least 100 articles and just can't find a resolution that fits.
Any hints or pointers appreciated.
tia,
Roots
<edit> Alternatively, a hint or pointer on how I can get rid of the xml ScrollView and just use my overrided onTouch methods to simulate a vertical scroll or swipe. I can handle the gesture movements, just not sure what or how to "redraw" the lower portion of the screen.
</edit>

Fixed. To save future searchers any grief on this, I found the code snippet. Hell, I probably passed over it 5 times in my searches! LOL
Code:
@Override
public boolean dispatchTouchEvent(MotionEvent ev){
// Let ScrollView handle it
super.dispatchTouchEvent(ev);
// Otherwise, I'll handle it
return myGestureDetector.onTouchEvent(ev);
}

Tossed a thanks your way as I'm sure someone will find this in a google search some day and be glad you posted back your answer

Related

Scroll bar control, accessing, WM_HSCROLL

Hi all (and no worries vijay555.... I'm new to forums and my Axim x51v... hope I'm doing this right... and thank you for your assistance!!!)
Keystrokes as code?
Specifically Excel Mobile keyboard shortcut Alt-PgUp/Dn (scrolls one screen width left/right)
I've created several Keystroke "routines" to minimize stylus use in Excel Mobile. I've mapped to hardware buttons, and they all work great... except Alt-PgUp(and PgDn). In Excel, these key combos will scroll one screen left or right, respectively. Other similarly-coded "routines" work as expected.
I've worked around this for now by recording screentaps in Excel's horizontal scrollbar. Unfortunately, the location of that s/b depends on whether SIP is active. If it is, the vertical co-ordinates of the screentaps become irrelevant and/or potentially destructive to my intended result. I prefer to avoid "position dependent" commands whenever possible for obvious reasons.
I have several other programs at my disposal to effect the Alt-PgUp/Dn shortcut(s).... IF I knew how to define the values(?) of Alt-PgUp/Dn in a script.
(MortScript, PHMkeys, Pen Commander, Spb FullScreenKb, PDA MediaKb)
I've been all over the web, and I think I understand keystroke scan-codes and values... and how they work together. Is there something akin to an ASCII "value" for this key combination? (099/0A1; 073/081; 153/161)?
Any ideas are appreciated. I've no aversion to research or work, but can't figure out what to ask or where to look further.
(I just really need a more direct/reliable functionality to scroll entire screen at a time left/right.)
Thanks in advance if anyone can help.
Dell Axim x51v WM5 (if it matters)
p.s. Thanks to Vijay555 for "permitting" this post here, and for putting me on the track of WM_HSCROLL (which I haven't had a chance to study yet).
Guys, just to say, there's never any reason to ask me for permission to post. As far as I'm concerned, post whatever you want using your own good sense!
pro-fit2:
Try something like this, as we discussed in the other thread:
Code:
//get current foreground window
HWND CurrentForegroundWindow_hwnd;
CurrentForegroundWindow_hwnd=GetForegroundWindow();
SendMessage (CurrentForegroundWindow_hwnd, WM_VSCROLL, SB_PAGEDOWN, 0);
V

Circle TouchFlo 3d or 2d like launcher

I had idea and i had try find out how send object when scroll display with finger and c# but didn't understant so if someone wants to do something
whit this idea or wants to help me to do more.
I put here screenshots so you get the point.
19.2.2008 Finally yesterday and today i did something.
Here is start.
-Nothing added exept clock in homescreen.
-Visio is launcher like picktures downside.
-Still need help because i wanna remove buttons and replace them with finger slide.
BUT IT IS STILL START! IT IS TO VGA MACHINES......
.......THIS PROJECT IS STOPPED BECAUSE I HAVE MADE IT WITH VISUAL STUDIO AND MY FREE 3 MONTHS ARE END...
..NOW I HAVE ANYMORE TOOL CONTINUE!
what's the point of this menu? i think there won't be enough space then for the important things
I am a very starter programmer i think so i don't know is there any opportunity make this kind of menu.
Hey, I kinda like it.. wish i could contribute in some way.
Its nice to look at but not very functional and seems like it would waste up screen space. Only thing if you can add a hide button would it be decent. M2D is very functional as it stands though.
Anyone know how i send command in c# when i slide screen wint finger (left to right) or (right to left)?
Is there any easy way like button_click command.
Example...
private void button1_Click(object sender, EventArgs e)
{
button2.Show();
}
....Thanks

Subclassing the Start Button

Hi All,
I cracked open Remote Spy++ and started figuring out how I could go about writing a Honeycomb start menu replacement for WM5-6.1 (seen the XP Start Replacement? Same idea). Having written something similar on desktop Windows I thought it would be easy. The app is in C#/CF.
So the window hierarchy is:
Code:
- Desktop
- HHTaskBar
- (nothing !!!)
And messages of interest (in order):
Code:
WM_LBUTTONDOWN (0x201)
WM_PAINT (0xF)
WM_INITMENUPOPUP (0x117)
Okay, so forgetting about the fact that the window is opaque (I will delve into this later on), I went ahead and subclassed it to catch the WM_LBUTTONDOWN message (the others didn't stop the original from showing up). That falls over (the debugger doesn't even break into code and the device needs a hard reset). I am investigating this - although my MessageBox shows up just before it dies.
Update: Using BeginInvoke with a worker method fixes the above issue. E.g:
Code:
public IntPtr NewWndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
if (msg == WM_LBUTTONDOWN)
{
this.BeginInvoke(new Action(DoWork));
return IntPtr.Zero;
}
return CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);;
}
private void DoWork()
{
Form2 two = new Form2();
two.Show();
}
So my question: the HHTaskBar is opaque, it has no child controls. Obviously, I don't want to subclass the battery/close/etc. buttons, and ideas on how to reliably retrieve the rect for the start button?
Or is the whole thing a hack? I suspect there is a way to do this without all this subclassing hackery. Google and forum search didn't turn up anything.
Thanks guys.
Source code
Usage: (not recommended on real device - use an emulator!) Click on button1 then click anywhere on the taskbar. Now reboot
I'd start with Quickmenu:
http://forum.xda-developers.com/showthread.php?t=471292
This app is the best start menu replacement I ever saw...
I'd only add a mixture of WKTASK's taskbar management and the ability to choose a icon for the start menu.
Thanks
twolf said:
I'd start with Quickmenu:
http://forum.xda-developers.com/showthread.php?t=471292
This app is the best start menu replacement I ever saw...
I'd only add a mixture of WKTASK's taskbar management and the ability to choose a icon for the start menu.
Click to expand...
Click to collapse
Thanks, it doesn't look like he has any source code available though. Looks like I will have to investigate more... I am not going for the drop down style (but as you said, it is really cool), I am trying to make a Honeycomb (WM 6.5) style menu.
I tried the wm6.5 honeycomb start menu... was not impressed, but maybe it had some extra something i didnt noticed... :/
I still haven't flashed my device with 6.5, but I reckon a FOSS honeycomb menu could be cool...
I think you'r on to something here. The start menu as it is in WM6.1 is pretty much useless. I would much rather have the start menu show me a application shortcut page like the one in WM6.5. Although to be honest I don't really like the honeycomb look. What's wrong with a plain old columns and rows type of thing. With the added physics scrolling/swiping stuff of course
frepe383 said:
I think you'r on to something here. The start menu as it is in WM6.1 is pretty much useless. I would much rather have the start menu show me a application shortcut page like the one in WM6.5.
Click to expand...
Click to collapse
Exactly! I am also hoping to replace that shoddy settings menu.
frepe383 said:
Although to be honest I don't really like the honeycomb look. What's wrong with a plain old columns and rows type of thing. With the added physics scrolling/swiping stuff of course
Click to expand...
Click to collapse
I think something with tabs (like Manila 2D) such as 'Programs', 'Running Programs', 'Settings' would be pretty useful. Skinning is a given, and honeycomb would be one (for the fanatics).
Update
I decided to call the tool Mead (as in the beer that contains honey ).
I was having problems with the default message pump and the hook (well, subclassed event). I am not sure which message was crashing my program, but if I use Application.Run() a native exception occurs in mscoree3_5.dll. The workaround is to create the form in the handler for the hook and show that one (it wasn't a UI thread being called from a worker, I am aware of that). So I think it must be a CF message pump bug. In any case, it works great now.
Quitting isn't all the way there yet, still some bugs (the type that will need a soft reset).
On to the UI stuff.
clickety
Excellent idea mate, but is it worth doing? the Beta 2 of 6.5 is already out and i am guessing its not long until the final version
Any news on this?
Nope
Nothing new. Just haven't had time between my job.
For now I am pinning it as the native call-in issue that the .Net CF suffers from (a documented limitation). Something isn't quite right.
I will continue to experiment, but push comes to shove, I will probably land up creating an interop library for it.
Instead of subclassing, you can just create a childwindow of HHTaskbar that is located over the start button.
Alternatively, you could suPerclass the "Explore" window class just to replace the Programs menu. Beware, that superclassing may be a bit dangerous
Interesting Idea
That is an interesting idea. When I get time I will start messing around with it.
That said I do expect some problems: again the interop call-in to .NET CF, but this may prove to work as a work-around .

[Q] Confused with coding for layout.

Hi there, long time lurker first time poster here!
Slowly getting into android but i really cant get my head around the layouts. I would love to be able to use the AbsoluteLayouts but that isn't a good idea anymore.
Basically after some work i have managed to get a gallery working at the top of the screen. I want my app to look like this in essence: Ok can't post outside links at the moment, fair enough. Think of the android market. Icons to the left and a bit of information for each app next to it and a buy button on the right.
However i have no idea where to start off. Since i have the gallery already i have no idea how i can add things underneath it without screwing anything up.
Can anyone help? Thanks in advance!
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
RED_ said:
Sorry to bump but the issue has changed, I have built an app but would like like the text to be besides the icon. Any chance someone can help? Using a linear layout.
http://img263.imageshack.us/i/sellscreen.jpg/
Click to expand...
Click to collapse
Are you using a List View? Looks like one.
How do you build up your content for the list?
In my view the best solution for your problem would be:
- Use a ListView
- Build your own ListAdapter (drived from BaseAdapter for example)
The Adapter builds the view for each item (or recycles an already built up view, the ListView handles that).
The view for each item would be a horizontal oriented LinearLayout with two items (the image and the text) and the adapter fills the layout with the information of the current item.
For better layout handling I would define the layout for the items in an extra xml file and use the LayoutInflater-Service inside the Adapter (if a view has to be built).
Hope this helps and points into a helpful direction
Devmil
Thanks for replying, managed to find a solution in the end without using ListView. Thought about moving to a RelativeLayout as its more effcient but as my app is very small anyway in the end i've just gone and used nested LinearLayouts with a textview and imageview in each one.
Ridiculously simple when you look back on it.
I was actually going to use this tutorial which does what you explained i think: http://www.anddev.org/iconified_textlist_-_the_making_of-t97.html but it left me with a force close error so that went out the window.

[Q] ListView without scrolling

Is it possible to create a ListView that only displays all of it's content and does not try to be scrollable ?
I need ListViews, because it's the most convenient solution for my app. I have 3 types of content and each has it's own layout style, own context menus and some of them have on click listeners in one case and context menus in other cases. I have a pretty elegant and sexy solution for this, but it only works with ListViews.
The problem is that I want to have all 3 types of content on one screen that will scroll as ONE, but with multiple list views it scrolls as a whole and all lists scroll independently, which makes my app an unusable piece of ****e.
Please only suggest solutions that use list views.
One that I could think of is to create 3 different screens with flip view or maybe some kind of tab view. Or maybe both and let the user choose. What do you think ?
2 things (as I know you're a good programmer, but still kind of "new") LOL
1. Maybe you can @Override the onTouch methods and disable the scroll
2. Don't EVER get so stuck on an interface (or a method, or a piece of code) that you get into a mindset of "It HAS to be this way". Many hours/days I have wasted with this kind of thinking and sometimes, you just have to give-up and start over.
I know you're in a time constraint, but I also find if I leave a problem for a day or two and come back to it, a solution presents itself.
I already put it aside a few days ago, but I'll have to deal with it soon. Actually I just came up with the tab view idea while writing this post and it seems like a good solution (even better than the original with all 3 lists on one screen).
SOLVED
I implemented a tab layout. Like a BAWSSS.

Categories

Resources