Use rowSpan and columnSpan attributes for GridLayout contents
This commit is contained in:
parent
bc2446d586
commit
081dd76545
@ -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.
|
// 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
|
// So the next time we call show() on it, the input field will show the
|
||||||
// last inputted time.
|
// last inputted time.
|
||||||
/*NumpadTimePickerDialog.newInstance(EditAlarmActivity.this)
|
//NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER);
|
||||||
.show(getSupportFragmentManager(), TAG_TIME_PICKER);*/
|
|
||||||
ScrollingGridTimePickerDialog.newInstance(this, true).show(getSupportFragmentManager(), "tag");
|
ScrollingGridTimePickerDialog.newInstance(this, true).show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,8 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
|
|||||||
private String[] mValues;
|
private String[] mValues;
|
||||||
private boolean mIs24HourMode;
|
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) {
|
public static ScrollingGridTimePickerDialog newInstance(TimePicker.OnTimeSetListener callback, boolean is24HourMode) {
|
||||||
ScrollingGridTimePickerDialog ret = new ScrollingGridTimePickerDialog();
|
ScrollingGridTimePickerDialog ret = new ScrollingGridTimePickerDialog();
|
||||||
@ -50,15 +51,17 @@ public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
|
|||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
mGrid.setLayoutManager(new GridLayoutManager(view.getContext(), COLUMNS));
|
if (mGrid != null) {
|
||||||
mAdapter = new ScrollingGridAdapter(mValues, new View.OnClickListener() {
|
mGrid.setLayoutManager(new GridLayoutManager(view.getContext(), COLUMNS));
|
||||||
@Override
|
mAdapter = new ScrollingGridAdapter(mValues, new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
// TODO: If on hours, switch dataset to minutes values. Else, do nothing.
|
public void onClick(View v) {
|
||||||
mAdapter.notifyDataSetChanged();
|
// TODO: If on hours, switch dataset to minutes values. Else, do nothing.
|
||||||
}
|
mAdapter.notifyDataSetChanged();
|
||||||
});
|
}
|
||||||
mGrid.setAdapter(mAdapter);
|
});
|
||||||
|
mGrid.setAdapter(mAdapter);
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/one"
|
android:id="@+id/one"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="1"/>
|
android:text="1"/>
|
||||||
@ -11,6 +13,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/two"
|
android:id="@+id/two"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="2"/>
|
android:text="2"/>
|
||||||
@ -25,6 +29,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/four"
|
android:id="@+id/four"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="4"/>
|
android:text="4"/>
|
||||||
@ -32,6 +38,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/five"
|
android:id="@+id/five"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="5"/>
|
android:text="5"/>
|
||||||
@ -39,6 +47,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/six"
|
android:id="@+id/six"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="6"/>
|
android:text="6"/>
|
||||||
@ -46,6 +56,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/seven"
|
android:id="@+id/seven"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="7"/>
|
android:text="7"/>
|
||||||
@ -53,6 +65,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/eight"
|
android:id="@+id/eight"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="8"/>
|
android:text="8"/>
|
||||||
@ -60,6 +74,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/nine"
|
android:id="@+id/nine"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
android:text="9"/>
|
android:text="9"/>
|
||||||
@ -67,6 +83,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/zero"
|
android:id="@+id/zero"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
grid:layout_rowSpan="1"
|
||||||
|
grid:layout_columnSpan="1"
|
||||||
grid:layout_rowWeight="1"
|
grid:layout_rowWeight="1"
|
||||||
grid:layout_columnWeight="1"
|
grid:layout_columnWeight="1"
|
||||||
grid:layout_column="1"
|
grid:layout_column="1"
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/leftAlt"
|
android:id="@+id/leftAlt"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
app:layout_rowSpan="1"
|
||||||
|
app:layout_columnSpan="1"
|
||||||
app:layout_rowWeight="1"
|
app:layout_rowWeight="1"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
app:layout_column="0"/>
|
app:layout_column="0"/>
|
||||||
@ -14,6 +16,8 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/rightAlt"
|
android:id="@+id/rightAlt"
|
||||||
style="@style/grid_element_single"
|
style="@style/grid_element_single"
|
||||||
|
app:layout_rowSpan="1"
|
||||||
|
app:layout_columnSpan="1"
|
||||||
app:layout_rowWeight="1"
|
app:layout_rowWeight="1"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
app:layout_column="2"/>
|
app:layout_column="2"/>
|
||||||
@ -37,10 +41,10 @@
|
|||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/backspace"
|
android:id="@+id/backspace"
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:src="@drawable/ic_backspace_24dp"
|
android:src="@drawable/ic_backspace_24dp"
|
||||||
android:background="?selectableItemBackground"
|
android:background="?selectableItemBackground"
|
||||||
|
app:layout_rowSpan="1"
|
||||||
|
app:layout_columnSpan="1"
|
||||||
app:layout_rowWeight="1"
|
app:layout_rowWeight="1"
|
||||||
app:layout_columnWeight="1"
|
app:layout_columnWeight="1"
|
||||||
app:layout_column="2"/>
|
app:layout_column="2"/>
|
||||||
|
|||||||
@ -1,17 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- TOneverDO: Use LinearLayout because it doesn't obey LWM -->
|
<!-- TOneverDO: Use LinearLayout because it doesn't obey LWM -->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<ScrollView
|
||||||
android:id="@+id/grid"
|
android:id="@+id/grid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/scrolling_grid_height"
|
android:layout_height="@dimen/scrolling_grid_height"
|
||||||
android:scrollbars="vertical"
|
android:layout_alignParentTop="true">
|
||||||
android:scrollbarSize="@dimen/scrollbar_width"
|
|
||||||
android:fadeScrollbars="false"
|
<android.support.v7.widget.GridLayout
|
||||||
android:layout_alignParentTop="true"/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:alignmentMode="alignBounds"
|
||||||
|
app:columnCount="3">
|
||||||
|
|
||||||
|
<include layout="@layout/content_grid_layout_numpad"/>
|
||||||
|
<include layout="@layout/content_grid_layout_numpad"/>
|
||||||
|
|
||||||
|
</android.support.v7.widget.GridLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider"
|
android:id="@+id/divider"
|
||||||
|
|||||||
@ -22,8 +22,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="grid_element_single">
|
<style name="grid_element_single">
|
||||||
<item name="android:layout_width">0dp</item>
|
|
||||||
<item name="android:layout_height">0dp</item>
|
|
||||||
<item name="android:background">?android:attr/selectableItemBackground</item>
|
<item name="android:background">?android:attr/selectableItemBackground</item>
|
||||||
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
<item name="android:textSize">@dimen/grid_element_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user