From 1514568de48b1dc78b6847cf9f674b16100890cf Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 2 Mar 2012 20:15:45 -0800 Subject: [PATCH] Polished custom menu icons for all screen sizes and layouts (images still unpolished) --- .../layout-land/main_menu_popover_body.xml | 34 +++++++++++++++++++ astrid/res/layout/main_menu_popover.xml | 32 +---------------- astrid/res/layout/main_menu_popover_body.xml | 34 +++++++++++++++++++ .../layout/main_menu_popover_body_tablet.xml | 34 +++++++++++++++++++ .../res/layout/main_menu_popover_tablet.xml | 27 +++++++++++++++ astrid/res/layout/main_menu_row.xml | 4 +-- astrid/res/layout/main_menu_row_tablet.xml | 34 +++++++++++++++++++ .../astrid/activity/TaskListActivity.java | 8 ++++- .../todoroo/astrid/ui/MainMenuPopover.java | 11 ++++-- 9 files changed, 182 insertions(+), 36 deletions(-) create mode 100644 astrid/res/layout-land/main_menu_popover_body.xml create mode 100644 astrid/res/layout/main_menu_popover_body.xml create mode 100644 astrid/res/layout/main_menu_popover_body_tablet.xml create mode 100644 astrid/res/layout/main_menu_popover_tablet.xml create mode 100644 astrid/res/layout/main_menu_row_tablet.xml diff --git a/astrid/res/layout-land/main_menu_popover_body.xml b/astrid/res/layout-land/main_menu_popover_body.xml new file mode 100644 index 000000000..c0d6e70f1 --- /dev/null +++ b/astrid/res/layout-land/main_menu_popover_body.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + diff --git a/astrid/res/layout/main_menu_popover.xml b/astrid/res/layout/main_menu_popover.xml index f01d1cc78..04c62b34c 100644 --- a/astrid/res/layout/main_menu_popover.xml +++ b/astrid/res/layout/main_menu_popover.xml @@ -5,37 +5,7 @@ android:layout_height="wrap_content" android:paddingLeft="10dip"> - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/astrid/res/layout/main_menu_popover_body_tablet.xml b/astrid/res/layout/main_menu_popover_body_tablet.xml new file mode 100644 index 000000000..70e26c90b --- /dev/null +++ b/astrid/res/layout/main_menu_popover_body_tablet.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + diff --git a/astrid/res/layout/main_menu_popover_tablet.xml b/astrid/res/layout/main_menu_popover_tablet.xml new file mode 100644 index 000000000..252de068d --- /dev/null +++ b/astrid/res/layout/main_menu_popover_tablet.xml @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/astrid/res/layout/main_menu_row.xml b/astrid/res/layout/main_menu_row.xml index 280639daa..01fac18d1 100644 --- a/astrid/res/layout/main_menu_row.xml +++ b/astrid/res/layout/main_menu_row.xml @@ -2,8 +2,8 @@ + + + + + + + + + + diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index 8289fe2e8..9b169e444 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -226,7 +226,13 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener } private void createMainMenuPopover() { - mainMenuPopover = new MainMenuPopover(this, R.layout.main_menu_popover, (fragmentLayout != LAYOUT_SINGLE)); + int layout; + if (shouldUseThreePane(this)) + layout = R.layout.main_menu_popover_tablet; + else + layout = R.layout.main_menu_popover; + + mainMenuPopover = new MainMenuPopover(this, layout, (fragmentLayout != LAYOUT_SINGLE)); mainMenuPopover.setMenuListener(this); mainMenuPopover.setOnDismissListener(new OnDismissListener() { @Override diff --git a/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java b/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java index 192a560ba..b05d10b71 100644 --- a/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java +++ b/astrid/src/com/todoroo/astrid/ui/MainMenuPopover.java @@ -12,6 +12,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.timsu.astrid.R; +import com.todoroo.astrid.activity.AstridActivity; public class MainMenuPopover extends FragmentPopover { @@ -31,6 +32,7 @@ public class MainMenuPopover extends FragmentPopover { private final LinearLayout content; private final LinearLayout topFixed; private final LinearLayout bottomFixed; + private final int rowLayout; public void setMenuListener(MainMenuListener listener) { this.mListener = listener; @@ -39,6 +41,11 @@ public class MainMenuPopover extends FragmentPopover { public MainMenuPopover(Context context, int layout, boolean isTablet) { super(context, layout); + if (AstridActivity.shouldUseThreePane(context)) + rowLayout = R.layout.main_menu_row_tablet; + else + rowLayout = R.layout.main_menu_row; + inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); content = (LinearLayout) getContentView().findViewById(R.id.content); @@ -111,7 +118,7 @@ public class MainMenuPopover extends FragmentPopover { } private View setupItemWithParams(int title, int imageRes) { - View itemRow = inflater.inflate(R.layout.main_menu_row, null); + View itemRow = inflater.inflate(rowLayout, null); ImageView image = (ImageView) itemRow.findViewById(R.id.icon); image.setImageResource(imageRes); @@ -123,7 +130,7 @@ public class MainMenuPopover extends FragmentPopover { } private View setupItemWithParams(CharSequence title, Drawable imageDrawable) { - View itemRow = inflater.inflate(R.layout.main_menu_row, null); + View itemRow = inflater.inflate(rowLayout, null); ImageView image = (ImageView) itemRow.findViewById(R.id.icon); image.setImageDrawable(imageDrawable);