Deleted files related to ScrollingGridTimePicker

This commit is contained in:
Phillip Hsu 2016-07-20 20:34:58 -07:00
parent a07cf222b3
commit 886f10b06c
7 changed files with 0 additions and 264 deletions

View File

@ -322,7 +322,6 @@ public class EditAlarmActivity extends BaseActivity implements
// So the next time we call show() on it, the input field will show the
// last inputted time.
NumpadTimePickerDialog.newInstance(this).show(getSupportFragmentManager(), TAG_TIME_PICKER);
//ScrollingGridTimePickerDialog.newInstance(this, true).show(getSupportFragmentManager(), "tag");
}
private void setWeekDaysText() {

View File

@ -1,54 +0,0 @@
package com.philliphsu.clock2.editalarm;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.philliphsu.clock2.R;
/**
* Created by Phillip Hsu on 7/17/2016.
*/
public class ScrollingGridAdapter extends RecyclerView.Adapter<ScrollingGridAdapter.ViewHolder> {
private String[] mValues;
private View.OnClickListener mOnClickListener;
/**
* @param values the values to display
* @param listener a click listener so clients can be notified of when the View corresponding
* to a value was clicked, so they may call notifyDataSetChanged() if need be
*/
public ScrollingGridAdapter(String[] values, View.OnClickListener listener) {
mValues = values;
mOnClickListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_scrolling_grid_value, parent, false);
return new ViewHolder(view, mOnClickListener);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
TextView tv = (TextView) holder.itemView;
tv.setText(mValues[position]);
}
@Override
public int getItemCount() {
return mValues == null ? 0 : mValues.length;
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(View itemView, View.OnClickListener listener) {
super(itemView);
itemView.setOnClickListener(listener);
}
}
}

View File

@ -1,29 +0,0 @@
package com.philliphsu.clock2.editalarm;
import android.content.Context;
import android.support.v7.widget.GridLayout;
import android.util.AttributeSet;
/**
* Created by Phillip Hsu on 7/16/2016.
*/
public class ScrollingGridTimePicker extends GridLayout implements TimePicker {
public ScrollingGridTimePicker(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollingGridTimePicker(Context context) {
super(context);
}
@Override
public int hourOfDay() {
return 0;
}
@Override
public int minute() {
return 0;
}
}

View File

@ -1,72 +0,0 @@
package com.philliphsu.clock2.editalarm;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.philliphsu.clock2.R;
import butterknife.Bind;
/**
* Created by Phillip Hsu on 7/16/2016.
*/
public class ScrollingGridTimePickerDialog extends BaseTimePickerDialog {
private static final int COLUMNS = 3;
private ScrollingGridAdapter mAdapter;
private String[] mValues;
private boolean mIs24HourMode;
@Nullable
@Bind(R.id.main_content) RecyclerView mGrid;
public static ScrollingGridTimePickerDialog newInstance(TimePicker.OnTimeSetListener callback, boolean is24HourMode) {
ScrollingGridTimePickerDialog ret = new ScrollingGridTimePickerDialog();
ret.setOnTimeSetListener(callback);
ret.initialize(is24HourMode);
return ret;
}
public void initialize(boolean is24HourMode) {
mIs24HourMode = is24HourMode;
if (mIs24HourMode) {
mValues = new String[] {
"00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23"};
} else {
mValues = new String[] {
"1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11", "12"};
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
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;
}
@Override
protected int contentLayout() {
return R.layout.dialog_time_picker_scrolling_grid;
}
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:grid="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- We have to wrap this in a merge tag or else the GridLayout
attributes won't be picked up by the GridLayout that will be
the parent of this element. -->
<TextView
style="@style/hybrid_time_picker_grid_element"
android:text="01"/>
</merge>

View File

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- TOneverDO: Use LinearLayout because it doesn't obey LWM -->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The advantage in defining a single layout for an element
of this grid and including it N times, instead of defining each
element N times, is code deduplication and reduction. Now, whenever
we want to make changes to how grid elements appear, all we have
to do is go to the single element's layout and make the changes,
and all the following grid elements will be changed. -->
<android.support.v7.widget.GridLayout
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
app:columnCount="4">
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
</android.support.v7.widget.GridLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:listDividerAlertDialog"/>
<!-- We need to distribute excess space around the child views
without scaling them because they should have a fixed width.
LinearLayout and layout_weight cannot achieve this. A passable
workaround is to use LinearLayout with Spaces of layout_weight=1
to the left and right of each view, but the view will not be
exactly centered; besides, that leads to ugly duplicate code. -->
<android.support.v7.widget.GridLayout
android:id="@+id/ampm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:columnCount="2"
app:rowCount="1">
<include layout="@layout/content_hybrid_time_picker"/>
<include layout="@layout/content_hybrid_time_picker"/>
</android.support.v7.widget.GridLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/divider"
app:layout_anchorGravity="center"
app:fabSize="mini"
android:src="@drawable/ic_done_24dp"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:textSize="@dimen/grid_element_text_size"
android:gravity="center"
android:layout_gravity="center"/>