Deleted files related to ScrollingGridTimePicker
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user