If you're interested, I've fixed the bug by adding a penalty in
DashboardLayout's algorithm if the unwanted behavior is met.

The patch is here :

diff --git a/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
b/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
index 6e890ca..46b07b9 100644
--- a/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
+++ b/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
@@ -131,9 +131,12 @@ public class DashboardLayout extends ViewGroup {

             spaceDifference = Math.abs(vSpace - hSpace);
             if (rows * cols != visibleCount) {
-                spaceDifference *= UNEVEN_GRID_PENALTY_MULTIPLIER;
+               spaceDifference *= UNEVEN_GRID_PENALTY_MULTIPLIER;
+            } else if (rows * mMaxChildHeight > height || cols *
mMaxChildWidth > width) {
+               spaceDifference *= UNEVEN_GRID_PENALTY_MULTIPLIER;
             }

+
             if (spaceDifference < bestSpaceDifference) {
                 // Found a better whitespace squareness/ratio
                 bestSpaceDifference = spaceDifference;

Alexis

On 27 août, 09:53, Alexis Robert <[email protected]> wrote:
> Hi,
>
> I have a little problem withDashboardLayout(the one on iosched 2011
> mercurial repository) and as I really don't know what's wrong. I know
> I'm wrong somewhere, as this layout works for the I/O app, and I've
> tried to copy the situation of the I/O app everywhere I can, but
> nothing worked.
>
> When I'm in portrait, everything is fine 
> :http://img405.imageshack.us/img405/4851/device20110827093725.png
>
> But when I'm in landscape,DashboardLayoutbehaves weirdly
> :http://img231.imageshack.us/img231/3061/dashboardlandscape.png
>
> For the source code,
>
> -- home.xml --
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent" android:orientation="vertical">
>     <ImageView android:src="@drawable/orekitlogo"
> android:layout_height="wrap_content"
>                    android:layout_width="fill_parent"
> android:layout_margin="20dp"></ImageView>
>         <com.google.android.apps.iosched.ui.widget.DashboardLayout
> android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>                 <Button android:id="@+id/orbit_dashboard"
> android:text="@string/orbit_dashboard" style="@style/DashboardButton"
> android:drawableTop="@drawable/dashboard_orbit"/>
>                 <Button android:id="@+id/frame_dashboard"
> android:text="@string/frame_dashboard" style="@style/DashboardButton"
> android:drawableTop="@drawable/dashboard_frame"/>
>                 <Button android:id="@+id/date_dashboard"
> android:text="@string/date_dashboard" style="@style/DashboardButton"
> android:drawableTop="@drawable/dashboard_date"/>
>                 <Button android:id="@+id/event_dashboard"
> android:text="@string/event_dashboard" style="@style/DashboardButton"
> android:drawableTop="@drawable/dashboard_event"/>
>                 <Button android:id="@+id/maneuver_dashboard"
> android:text="@string/maneuver_dashboard"
> style="@style/DashboardButton"
> android:drawableTop="@drawable/dashboard_maneuver"/>
>         </com.google.android.apps.iosched.ui.widget.DashboardLayout>
> </LinearLayout>
>
> -- style.xml (stripped down to only useful parts) --
>
> <resources>
>         <style name="Theme" parent="android:style/Theme" />
>
>         <!--  Theme.Orekit is Theme.Light with no titlebar (and other things
> for the actionbar) -->
>     <style name="Theme.Orekit" parent="android:style/Theme.Light">
>         <item name="android:windowNoTitle">true</item>
>
>         <item name="actionbarButtonStyle">@style/ActionBarButton</item>
>         <item name="actionbarSeparatorStyle">@style/ActionBarSeparator</item>
>         <item name="actionbarTextSyle">@style/ActionBarText</item>
>     </style>
>
>     <style name="DashboardButton">
>         <item name="android:layout_width">wrap_content</item>
>         <item name="android:layout_height">wrap_content</item>
>         <item name="android:textStyle">bold</item>
>         <!-- <item name="android:background">@null</item> -->
>     </style>
> </styles>
>
> By the way, if I uncomment the <item
> name="android:background">@null</item> line, it gets even worse in
> portrait :http://img32.imageshack.us/img32/3713/dashboardportraitnobg.png
>
> Thanks a lot !!
>
> Alexis Robert

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to