mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
Make HistoryView not editable by default
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user