From 081dd76545bd4f6c06062029564013a0714e9c26 Mon Sep 17 00:00:00 2001 From: Phillip Hsu Date: Sun, 17 Jul 2016 16:40:48 -0700 Subject: [PATCH] Use rowSpan and columnSpan attributes for GridLayout contents --- .../clock2/editalarm/EditAlarmActivity.java | 3 +-- .../ScrollingGridTimePickerDialog.java | 23 +++++++++-------- .../res/layout/content_grid_layout_numpad.xml | 18 +++++++++++++ .../res/layout/content_numpad_time_picker.xml | 8 ++++-- .../dialog_time_picker_scrolling_grid.xml | 25 +++++++++++++------ app/src/main/res/values/styles.xml | 2 -- 6 files changed, 56 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java b/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java index 8f7ffaf..45400b9 100644 --- a/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java +++ b/app/src/main/java/com/philliphsu/clock2/editalarm/EditAlarmActivity.java @@ -317,8 +317,7 @@ public class EditAlarmActivity extends BaseActivity implements // If we keep a reference to the dialog, we keep its previous state as well. // So the next time we call show() on it, the input field will show the // last inputted time. - /*NumpadTimePickerDialog.newInstance(EditAlarmActivity.this) - .show(getSupportFragmentManager(), TAG_TIME_PICKER);*/ + //NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER); ScrollingGridTimePickerDialog.newInstance(this, true).show(getSupportFragmentManager(), "tag"); } diff --git a/app/src/main/java/com/philliphsu/clock2/editalarm/ScrollingGridTimePickerDialog.java b/app/src/main/java/com/philliphsu/clock2/editalarm/ScrollingGridTimePickerDialog.java index bba6154..0af2c8c 100644 --- a/app/src/main/java/com/philliphsu/clock2/editalarm/ScrollingGridTimePickerDialog.java +++ b/app/src/main/java/com/philliphsu/clock2/editalarm/ScrollingGridTimePickerDialog.java @@ -22,7 +22,8 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog { private String[] mValues; private boolean mIs24HourMode; - @Bind(R.id.grid) RecyclerView mGrid; + @Nullable + @Bind(R.id.main_content) RecyclerView mGrid; public static ScrollingGridTimePickerDialog newInstance(TimePicker.OnTimeSetListener callback, boolean is24HourMode) { ScrollingGridTimePickerDialog ret = new ScrollingGridTimePickerDialog(); @@ -50,15 +51,17 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); - mGrid.setLayoutManager(new GridLayoutManager(view.getContext(), COLUMNS)); - mAdapter = new ScrollingGridAdapter(mValues, new View.OnClickListener() { - @Override - public void onClick(View v) { - // TODO: If on hours, switch dataset to minutes values. Else, do nothing. - mAdapter.notifyDataSetChanged(); - } - }); - mGrid.setAdapter(mAdapter); + if (mGrid != null) { + mGrid.setLayoutManager(new GridLayoutManager(view.getContext(), COLUMNS)); + mAdapter = new ScrollingGridAdapter(mValues, new View.OnClickListener() { + @Override + public void onClick(View v) { + // TODO: If on hours, switch dataset to minutes values. Else, do nothing. + mAdapter.notifyDataSetChanged(); + } + }); + mGrid.setAdapter(mAdapter); + } return view; } diff --git a/app/src/main/res/layout/content_grid_layout_numpad.xml b/app/src/main/res/layout/content_grid_layout_numpad.xml index e80f365..307fd4b 100644 --- a/app/src/main/res/layout/content_grid_layout_numpad.xml +++ b/app/src/main/res/layout/content_grid_layout_numpad.xml @@ -4,6 +4,8 @@