Make HistoryView not editable by default

This commit is contained in:
2016-03-08 07:56:40 -05:00
parent aa86826bdb
commit 5b151805ff
2 changed files with 10 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ public class HistoryEditorDialog extends DialogFragment
historyView = new HabitHistoryView(context, null); historyView = new HabitHistoryView(context, null);
historyView.setPadding(p, 0, p, 0); historyView.setPadding(p, 0, p, 0);
historyView.setHabit(habit); historyView.setHabit(habit);
historyView.setIsEditable(true);
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("History Editor") builder.setTitle("History Editor")

View File

@@ -67,12 +67,14 @@ public class HabitHistoryView extends ScrollableDataView
private boolean isBackgroundTransparent; private boolean isBackgroundTransparent;
private int textColor; private int textColor;
private boolean isEditable;
public HabitHistoryView(Context context, AttributeSet attrs) public HabitHistoryView(Context context, AttributeSet attrs)
{ {
super(context, attrs); super(context, attrs);
this.primaryColor = ColorHelper.palette[7]; this.primaryColor = ColorHelper.palette[7];
this.checkmarks = new int[0]; this.checkmarks = new int[0];
this.isEditable = false;
init(); init();
} }
@@ -353,6 +355,8 @@ public class HabitHistoryView extends ScrollableDataView
@Override @Override
public boolean onSingleTapUp(MotionEvent e) public boolean onSingleTapUp(MotionEvent e)
{ {
if(!isEditable) return false;
int pointerId = e.getPointerId(0); int pointerId = e.getPointerId(0);
float x = e.getX(pointerId); float x = e.getX(pointerId);
float y = e.getY(pointerId); float y = e.getY(pointerId);
@@ -397,4 +401,9 @@ public class HabitHistoryView extends ScrollableDataView
return date.getTimeInMillis(); return date.getTimeInMillis();
} }
public void setIsEditable(boolean isEditable)
{
this.isEditable = isEditable;
}
} }