pozorvlak: (Default)
pozorvlak ([personal profile] pozorvlak) wrote2010-11-02 02:25 pm

PeCoWriMo day 2

Today's hack is up. It's to the flashlight app again; now the UI stays in portrait orientation no matter how you rotate the phone. This prevents the pause/resume/create cycle that was killing my Activity and causing the light to go out. Most of yesterday's code is no longer needed and has been taken out again, but that's a good thing, right? :-)

Sideload the app (if you care - HTC Sense has such a thing built-in) from here.

Anyway, the way you do this is by adding the attribute android:screenOrientation="portrait" to the activity element in your manifest. This tip came from this StackOverflow post: I tried the more complicated "add a configChanges attribute and override onConfigurationChanged" approach described there, but that resulted in the LED wedging in whatever state it was in when you rotated the phone and not accepting any further changes. God knows what was going on there.

By the way, does anyone use git add -p much? I tried the "edit this hunk" feature a couple of times, but it told me that it my patch wouldn't apply cleanly, and then rejected the whole thing. Also, I'm having trouble uploading files to GitHub's "download" section.

Edit: and I've had a documentation patch accepted into Idris. Go me!

Re: I use add -p all the time...

[identity profile] pozorvlak.livejournal.com 2010-11-03 07:27 pm (UTC)(link)
Do you need to muck about with the context line at the top?

Re: I use add -p all the time...

[identity profile] aaroncrane.livejournal.com 2010-11-03 07:49 pm (UTC)(link)

You mean, the hunk header with the @@ and the line numbers? If so, then no, but then I use Emacs’s diff-editing mode, which automatically keeps hunk headers correct as you edit. However, I’ve just tried env EDITOR=vim git add -p, and edited a patch in a way that changes the number of lines added and removed, and Git seems to have handled it fine.

(Sorry to nitpick the terminology, but I think that’s what you mean, and for diffs, “context” usually means the space-prefixed lines that show surrounding unchanged code, and that can be used to apply patches even when the line numbers match only fuzzily.)

Re: I use add -p all the time...

[identity profile] pozorvlak.livejournal.com 2010-11-03 08:11 pm (UTC)(link)
Yes, that's the thing I meant: I didn't know the name for it. Thanks!