mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Changed large layout screen partition from weight to percentageRelativeLayout to accomodate different behaviours in sdk version < 21
Due Date is now optional and has a check box
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "com.wismna.geoffroy.donext"
|
applicationId "com.wismna.geoffroy.donext"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 18
|
versionCode 19
|
||||||
versionName "1.4.3"
|
versionName "1.4.4"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -21,11 +21,11 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:25.3.0'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile 'com.android.support:design:25.3.0'
|
compile 'com.android.support:design:25.3.1'
|
||||||
compile 'com.android.support:support-v4:25.3.0'
|
compile 'com.android.support:support-v4:25.3.1'
|
||||||
compile 'com.android.support:percent:25.3.0'
|
compile 'com.android.support:percent:25.3.1'
|
||||||
compile 'com.android.support:recyclerview-v7:25.3.0'
|
compile 'com.android.support:recyclerview-v7:25.3.1'
|
||||||
compile 'com.google.android.gms:play-services-ads:10.2.1'
|
compile 'com.google.android.gms:play-services-ads:10.2.1'
|
||||||
compile 'net.danlew:android.joda:2.9.7'
|
compile 'net.danlew:android.joda:2.9.7'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
@@ -51,7 +51,8 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
|
|||||||
public void onBindViewHolder(final SimpleViewHolder holder, int position) {
|
public void onBindViewHolder(final SimpleViewHolder holder, int position) {
|
||||||
holder.mItem = mValues.get(position);
|
holder.mItem = mValues.get(position);
|
||||||
holder.mIdView.setText(String.valueOf(holder.mItem.getId()));
|
holder.mIdView.setText(String.valueOf(holder.mItem.getId()));
|
||||||
if(holder.mItem.getDueDate().isBefore(LocalDate.now()))
|
LocalDate dueDate = holder.mItem.getDueDate();
|
||||||
|
if(dueDate != null && dueDate.isBefore(LocalDate.now()))
|
||||||
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm);
|
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm);
|
||||||
holder.mCycleView.setText(String.valueOf(holder.mItem.getCycle()));
|
holder.mCycleView.setText(String.valueOf(holder.mItem.getCycle()));
|
||||||
holder.mTitleView.setText(holder.mItem.getName());
|
holder.mTitleView.setText(holder.mItem.getName());
|
||||||
|
@@ -96,7 +96,7 @@ public class Task {
|
|||||||
this.dueDate = LocalDate.parse(dueDate);
|
this.dueDate = LocalDate.parse(dueDate);
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
this.dueDate = LocalDate.now();
|
this.dueDate = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,13 +51,13 @@ public class TaskDataAccess implements AutoCloseable {
|
|||||||
|
|
||||||
/** Adds or update a task in the database */
|
/** Adds or update a task in the database */
|
||||||
public Task createOrUpdateTask(long id, String name, String description, int priority,
|
public Task createOrUpdateTask(long id, String name, String description, int priority,
|
||||||
long taskList, LocalDate date, boolean isTodayList) {
|
long taskList, String dueDate, boolean isTodayList) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_NAME, name);
|
values.put(DatabaseHelper.TASKS_COLUMN_NAME, name);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_DESC, description);
|
values.put(DatabaseHelper.TASKS_COLUMN_DESC, description);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_PRIORITY, priority);
|
values.put(DatabaseHelper.TASKS_COLUMN_PRIORITY, priority);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_LIST, taskList);
|
values.put(DatabaseHelper.TASKS_COLUMN_LIST, taskList);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_DUEDATE, date.toString());
|
values.put(DatabaseHelper.TASKS_COLUMN_DUEDATE, dueDate);
|
||||||
values.put(DatabaseHelper.TASKS_COLUMN_TODAYDATE, isTodayList? LocalDate.now().toString() : "");
|
values.put(DatabaseHelper.TASKS_COLUMN_TODAYDATE, isTodayList? LocalDate.now().toString() : "");
|
||||||
long insertId;
|
long insertId;
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
|
@@ -6,6 +6,7 @@ import android.support.v4.app.DialogFragment;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
@@ -95,8 +96,6 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setTaskValues(View view) {
|
private void setTaskValues(View view) {
|
||||||
// Get date picker
|
|
||||||
final DatePicker dueDatePicker = (DatePicker) view.findViewById(R.id.new_task_due_date);
|
|
||||||
|
|
||||||
// Populate spinner with task lists
|
// Populate spinner with task lists
|
||||||
Spinner spinner = (Spinner) view.findViewById(R.id.new_task_list);
|
Spinner spinner = (Spinner) view.findViewById(R.id.new_task_list);
|
||||||
@@ -118,6 +117,17 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
|
|||||||
checkBox.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
|
checkBox.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
|
||||||
todayLabel.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
|
todayLabel.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
|
// Get date picker
|
||||||
|
final DatePicker dueDatePicker = (DatePicker) view.findViewById(R.id.new_task_due_date);
|
||||||
|
// Handle due date spinner depending on check box
|
||||||
|
CheckBox setDueDate = (CheckBox) view.findViewById(R.id.new_task_due_date_set);
|
||||||
|
setDueDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
dueDatePicker.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Set other properties if they exist
|
// Set other properties if they exist
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
|
|
||||||
@@ -130,7 +140,10 @@ public class TaskFormDialogFragment extends DynamicDialogFragment {
|
|||||||
|
|
||||||
// Set Due Date
|
// Set Due Date
|
||||||
LocalDate dueDate = task.getDueDate();
|
LocalDate dueDate = task.getDueDate();
|
||||||
dueDatePicker.updateDate(dueDate.getYear(), dueDate.getMonthOfYear() - 1, dueDate.getDayOfMonth());
|
if (dueDate != null) {
|
||||||
|
setDueDate.setChecked(true);
|
||||||
|
dueDatePicker.updateDate(dueDate.getYear(), dueDate.getMonthOfYear() - 1, dueDate.getDayOfMonth());
|
||||||
|
}
|
||||||
|
|
||||||
checkBox.setChecked(task.isToday());
|
checkBox.setChecked(task.isToday());
|
||||||
}
|
}
|
||||||
|
@@ -274,6 +274,7 @@ public class TasksFragment extends Fragment implements
|
|||||||
EditText nameText = (EditText) dialogView.findViewById(R.id.new_task_name);
|
EditText nameText = (EditText) dialogView.findViewById(R.id.new_task_name);
|
||||||
EditText descText = (EditText) dialogView.findViewById(R.id.new_task_description);
|
EditText descText = (EditText) dialogView.findViewById(R.id.new_task_description);
|
||||||
SeekBar seekBar = (SeekBar) dialogView.findViewById(R.id.new_task_priority);
|
SeekBar seekBar = (SeekBar) dialogView.findViewById(R.id.new_task_priority);
|
||||||
|
CheckBox setDueDate = (CheckBox) dialogView.findViewById(R.id.new_task_due_date_set);
|
||||||
DatePicker dueDatePicker = (DatePicker) dialogView.findViewById(R.id.new_task_due_date);
|
DatePicker dueDatePicker = (DatePicker) dialogView.findViewById(R.id.new_task_due_date);
|
||||||
TaskList taskList = (TaskList) listSpinner.getSelectedItem();
|
TaskList taskList = (TaskList) listSpinner.getSelectedItem();
|
||||||
CheckBox todayList = (CheckBox) dialogView.findViewById(R.id.new_task_today);
|
CheckBox todayList = (CheckBox) dialogView.findViewById(R.id.new_task_today);
|
||||||
@@ -285,7 +286,11 @@ public class TasksFragment extends Fragment implements
|
|||||||
descText.getText().toString(),
|
descText.getText().toString(),
|
||||||
seekBar.getProgress(),
|
seekBar.getProgress(),
|
||||||
taskList.getId(),
|
taskList.getId(),
|
||||||
new LocalDate(dueDatePicker.getYear(), dueDatePicker.getMonth() + 1, dueDatePicker.getDayOfMonth()),
|
setDueDate.isChecked() ?
|
||||||
|
new LocalDate(dueDatePicker.getYear(),
|
||||||
|
dueDatePicker.getMonth() + 1,
|
||||||
|
dueDatePicker.getDayOfMonth()).toString()
|
||||||
|
: "",
|
||||||
isToday);
|
isToday);
|
||||||
|
|
||||||
Bundle args = dialog.getArguments();
|
Bundle args = dialog.getArguments();
|
||||||
|
@@ -25,24 +25,22 @@
|
|||||||
android:onClick="onNewTaskClick"
|
android:onClick="onNewTaskClick"
|
||||||
android:src="@drawable/ic_add" />
|
android:src="@drawable/ic_add" />
|
||||||
|
|
||||||
<LinearLayout
|
<android.support.percent.PercentRelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize">
|
||||||
android:orientation="horizontal">
|
|
||||||
<android.widget.ListView
|
<android.widget.ListView
|
||||||
android:id="@+id/list"
|
android:id="@+id/list"
|
||||||
android:layout_width="0dp"
|
app:layout_widthPercent="20%"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:choiceMode="singleChoice"
|
android:choiceMode="singleChoice"
|
||||||
android:listSelector="@drawable/tasklist_select"/>
|
android:listSelector="@drawable/tasklist_select"/>
|
||||||
<com.wismna.geoffroy.donext.widgets.NonSwipeableViewPager
|
<com.wismna.geoffroy.donext.widgets.NonSwipeableViewPager
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="0dp"
|
app:layout_widthPercent="80%"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.8"
|
android:layout_toEndOf="@id/list"
|
||||||
android:background="@android:color/background_light"
|
android:background="@android:color/background_light"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
</LinearLayout>
|
</android.support.percent.PercentRelativeLayout>
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
@@ -7,6 +7,7 @@
|
|||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:background="@android:color/background_light">
|
android:background="@android:color/background_light">
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/new_task_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/text_margin"
|
android:padding="@dimen/text_margin"
|
||||||
@@ -62,6 +63,13 @@
|
|||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_toEndOf="@id/new_task_priority_label"
|
android:layout_toEndOf="@id/new_task_priority_label"
|
||||||
android:layout_below="@id/new_task_description" />
|
android:layout_below="@id/new_task_description" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/new_task_today"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_below="@id/new_task_priority"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/new_task_today_label"
|
android:id="@+id/new_task_today_label"
|
||||||
android:text="@string/new_task_today"
|
android:text="@string/new_task_today"
|
||||||
@@ -69,26 +77,28 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="visible"
|
||||||
android:layout_below="@id/new_task_priority" />
|
android:layout_below="@id/new_task_priority" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/new_task_today"
|
android:id="@+id/new_task_due_date_set"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toEndOf="@id/new_task_today_label"
|
android:layout_below="@id/new_task_today"
|
||||||
android:layout_below="@id/new_task_priority" />
|
android:layout_alignParentEnd="true" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/new_task_due_date_label"
|
android:id="@+id/new_task_due_date_label"
|
||||||
android:text="@string/new_task_due_date"
|
android:text="@string/new_task_due_date"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:layout_width="200dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_below="@id/new_task_today" />
|
android:layout_below="@id/new_task_today" />
|
||||||
<DatePicker
|
<DatePicker
|
||||||
android:id="@+id/new_task_due_date"
|
android:id="@+id/new_task_due_date"
|
||||||
android:datePickerMode="spinner"
|
android:datePickerMode="spinner"
|
||||||
android:calendarViewShown="false"
|
android:calendarViewShown="false"
|
||||||
android:spinnersShown="true"
|
android:spinnersShown="true"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/new_task_due_date_label" />
|
android:layout_below="@id/new_task_due_date_label" />
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
<string name="settings_today_title">Vue Aujourd\'hui</string>
|
<string name="settings_today_title">Vue Aujourd\'hui</string>
|
||||||
<string name="settings_today_enable">Activer la vue Aujourd\'hui?</string>
|
<string name="settings_today_enable">Activer la vue Aujourd\'hui?</string>
|
||||||
<string name="settings_today_desc">La vue Aujourd\'hui est une façon particulière d\'organiser vos tâches. Choisissez quelles tâches vous voulez faire dans la journée et elles apparaîtront dans cette vue. À la fin de la journée, cette vue est réinitialisée.</string>
|
<string name="settings_today_desc">La vue Aujourd\'hui est une façon particulière d\'organiser vos tâches. Choisissez quelles tâches vous voulez faire dans la journée et elles apparaîtront dans cette vue. À la fin de la journée, cette vue est réinitialisée.</string>
|
||||||
<string name="new_task_due_date">Date de fin</string>
|
<string name="new_task_due_date">Mettre une date de fin?</string>
|
||||||
<string name="task_alarm">Task is past due date</string>
|
<string name="task_alarm">Task is past due date</string>
|
||||||
<string name="action_todayList">Vue Aujourd\'hui</string>
|
<string name="action_todayList">Vue Aujourd\'hui</string>
|
||||||
<string name="title_activity_today">Aujourd\'hui</string>
|
<string name="title_activity_today">Aujourd\'hui</string>
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
<string name="new_task_name_error">Task name cannot be blank</string>
|
<string name="new_task_name_error">Task name cannot be blank</string>
|
||||||
<string name="new_task_description_hint">Optional task description</string>
|
<string name="new_task_description_hint">Optional task description</string>
|
||||||
<string name="new_task_priority">Priority</string>
|
<string name="new_task_priority">Priority</string>
|
||||||
<string name="new_task_due_date">Due date</string>
|
<string name="new_task_due_date">Set a due date?</string>
|
||||||
<string name="new_task_save">Save</string>
|
<string name="new_task_save">Save</string>
|
||||||
<string name="new_task_cancel">Cancel</string>
|
<string name="new_task_cancel">Cancel</string>
|
||||||
<string name="new_task_delete">Delete</string>
|
<string name="new_task_delete">Delete</string>
|
||||||
|
Reference in New Issue
Block a user