Monday, August 1, 2011

Tinkering with the layout and other random fixes



I wanted to check what I call "Panera mode", where your device is connected to the network, but only locally, so you can't get at the license server. For that, I'll take it out of airplane mode.

Ok, well, the local licence check module apparently treats a timeout the same way it treats non-licensed mode - it disallows it.

Well, I just will update the error message to a "network or license validation error - please make sure you reach the internet with your browser".

Ok, there are about 3 things I want to do

1) Get a return in bootstrap from the start activity, so if I exit the app using the up arrow, it doesn't end up a black limbo.
2) Change the wording to "Quiz - SRS" and "Quiz - Browse"
3) Add a line between the question and the first answer on the question display
4) Get through a day of testing without finding any bugs. Or at least an hour or 2.

Ok, as far as getting the return, I think it was something like when you launch an intent, you can launch it with a return. I did that with the Answer display before I happily eliminated that.

From SO,

Intent i = new Intent(this,CameraActivity.class);
startActivityForResult(i, STATIC_INTEGER_VALUE);

Wait - I'm calling it from ValidateLicense, which isn't even an activity.

What happens if I just call "finish()" from BootStrap after launching the validation?

Ah, that seems to work. Ok, and how about giving it the same background as the start display, just to make the transition a bit smoother.

Copy this into main.xml on the bootstrap project:

android:background="@drawable/plum_blossoms"

Hmmm...doesn't seem to make any difference.

Wait, actually sometimes the app exits, and sometimes it doesn't. I'd like so pause for a few milliseconds to give the activity time to launch. Or how about calling finish on it from the license validation?

Intent i = new Intent(ValidateLicense.this.mActivity,
StartActivity.class);
ValidateLicense.this.mActivity.startActivity(i);

ValidateLicense.this.mActivity.finish();

Yes, that's just right.


Ok, how about problem 3? It's been bugging my for like 90 years. Let's look at the layout.

android:cacheColorHint="#00000000" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:textColor="@color/text_color"
android:layout_marginLeft="6dp" android:divider="#333000"
android:dividerHeight=".5dp" android:focusable="false">


Ok, but the divider doesn't cover the top or bottom.

I think it would have to be a manipulation of the progress bar. It would be when it's correct. It looks like I'm setting ti to transparent. I already have the drawable set up...




android:startColor="#00000000"
android:centerColor="#00000000"
android:centerY="0.75"
android:endColor="#00000000"
android:angle="270"
/>



What happens if I change to this?




android:startColor="#333000"
android:centerColor="#333000"
android:centerY="0.75"
android:endColor="#333000"
android:angle="270"
/>




No, that's wrong - it's black...should be gray.


Maybe I should make it mostly transparent

Ah, that's how I could do it. Set up a separate line like this:

android:background="#333000" />


And make it visible on correct, and the progress bar invisible on incorrect, and vice versa. But then it would move the the position of the questions. Well, I just need another line to make up the difference.

android:background="#333000" />
android:background="#333000" />

There's somewhere where I set the width of the progress bar.

Ah there it is:

android:layout_width="fill_parent" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_height="8dp" android:paddingLeft="6dp"
android:layout_marginRight="0dp" />

Ok, so, it should be this:


android:background="#00000000" />
android:background="#333000" />

Hmm. It seems to be some kind of an error. Clean? Yup, that works.

Let's see how it looks. Actually, not bad. All I really have to do is drop the extra blank bar, and put it underneath the highlight bar.

android:layout_width="fill_parent" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_height="8dp" android:paddingLeft="6dp"
android:layout_marginRight="0dp" />


android:layout_width="fill_parent" android:layout_height=".5dip"
android:background="#333000" />

Let's see how it it looks - the red line is the "countdown" line.




Yeah, that's just right. And that's a wrap on this guy.

No comments:

Post a Comment