Lots of code cleanup and improvements after inspection

Load Today tasks in a AsyncTask
Use of plurals instead of string
Menu icons change
No more tasks now displayed in the center of the screen
This commit is contained in:
bg45
2017-03-23 17:55:38 -04:00
parent 34cb77d6c4
commit 799ec9a058
97 changed files with 196 additions and 663 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "com.wismna.geoffroy.donext"
minSdkVersion 19
targetSdkVersion 25
versionCode 15
versionName "1.4.0"
versionCode 16
versionName "1.4.1"
}
buildTypes {
release {
@@ -26,7 +26,7 @@ dependencies {
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:percent:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'net.danlew:android.joda:2.9.7'
testCompile 'junit:junit:4.12'
}

View File

@@ -1,13 +0,0 @@
package com.wismna.geoffroy.donext;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

View File

@@ -22,7 +22,6 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@@ -6,6 +6,7 @@ import net.danlew.android.joda.JodaTimeAndroid;
/**
* Created by bg45 on 2017-03-15.
* Application class, used to initialize Joda Time
*/
public class DoNext extends Application {

View File

@@ -136,19 +136,7 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// Handles layout change button
MenuItem displayLayoutItem = menu.findItem(R.id.action_changeLayout);
if (displayLayoutItem == null) return false;
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String layoutType = sharedPref.getString("pref_conf_task_layout", "1");
switch (layoutType) {
case "1" :
displayLayoutItem.setIcon(R.drawable.ic_list_white_24dp);
break;
case "2" :
displayLayoutItem.setIcon(R.drawable.ic_view_list_white_24dp);
break;
}
// Handles today list
MenuItem todayListItem = menu.findItem(R.id.action_todayList);
@@ -232,8 +220,6 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
// Update the ViewPagerAdapter to refresh all tabs
mSectionsPagerAdapter.notifyDataSetChanged();
// Invalidate the menu to redraw the icon
invalidateOptionsMenu();
}
/** Called when the user clicks the Edit Lists button */

View File

@@ -49,23 +49,6 @@ public class TodayActivity extends AppCompatActivity
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem displayLayoutItem = menu.findItem(R.id.action_changeLayout);
if (displayLayoutItem == null) return false;
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String layoutType = sharedPref.getString("pref_conf_task_layout", "1");
switch (layoutType) {
case "1" :
displayLayoutItem.setIcon(R.drawable.ic_list_white_24dp);
break;
case "2" :
displayLayoutItem.setIcon(R.drawable.ic_view_list_white_24dp);
break;
}
return super.onPrepareOptionsMenu(menu);
}
/** Called when the user clicks on the Change Layout button */
public void changeLayout(MenuItem item) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
@@ -75,10 +58,9 @@ public class TodayActivity extends AppCompatActivity
editor.putString("pref_conf_task_layout", String.valueOf(layoutType % 2 + 1));
editor.apply();
// TODO: refresh the task list
// Update the ViewPagerAdapter to refresh all tabs
//mSectionsPagerAdapter.notifyDataSetChanged();
// Invalidate the menu to redraw the icon
invalidateOptionsMenu();
}

View File

@@ -1,5 +1,11 @@
package com.wismna.geoffroy.donext.adapters;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
/**
* Created by geoffroy on 15-11-28.
* Extension of FragmentStatePagerAdapter which intelligently caches
@@ -7,15 +13,9 @@ package com.wismna.geoffroy.donext.adapters;
* Usage involves extending from SmartFragmentStatePagerAdapter as you would any other PagerAdapter.
*/
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.SparseArray;
import android.view.ViewGroup;
public abstract class SmartFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
// Sparse array to keep track of registered fragments in memory
private SparseArray<Fragment> registeredFragments = new SparseArray<>();
private final SparseArray<Fragment> registeredFragments = new SparseArray<>();
public SmartFragmentStatePagerAdapter(FragmentManager fragmentManager) {
super(fragmentManager);

View File

@@ -33,7 +33,7 @@ public class TaskListRecyclerViewAdapter extends RecyclerView.Adapter<TaskListRe
}
private final List<TaskList> mValues;
private TaskListRecyclerViewAdapterListener mListener;
private final TaskListRecyclerViewAdapterListener mListener;
public TaskListRecyclerViewAdapter(List<TaskList> items,
TaskListRecyclerViewAdapterListener listener) {
@@ -110,7 +110,7 @@ public class TaskListRecyclerViewAdapter extends RecyclerView.Adapter<TaskListRe
notifyItemRemoved(position);
}
public void update(TaskList item, int position) {
private void update(TaskList item, int position) {
mValues.set(position, item);
notifyItemChanged(position);
}

View File

@@ -23,7 +23,7 @@ import java.util.List;
public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerViewAdapter.SimpleViewHolder> {
private List<Task> mValues;
private int viewType;
private final int viewType;
public TaskRecyclerViewAdapter(List<Task> items, int viewType) {
mValues = items;
@@ -52,7 +52,7 @@ public class TaskRecyclerViewAdapter extends RecyclerView.Adapter<TaskRecyclerVi
holder.mItem = mValues.get(position);
holder.mIdView.setText(String.valueOf(holder.mItem.getId()));
if(holder.mItem.getDueDate().isBefore(LocalDate.now()))
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm_black_24dp);
holder.mAlarmView.setImageResource(R.drawable.ic_access_alarm);
holder.mCycleView.setText(String.valueOf(holder.mItem.getCycle()));
holder.mTitleView.setText(holder.mItem.getName());
if (holder instanceof DetailedViewHolder)

View File

@@ -24,8 +24,8 @@ public class TaskDataAccess implements AutoCloseable {
}
private SQLiteDatabase database;
private DatabaseHelper dbHelper;
private String[] taskColumns = {
private final DatabaseHelper dbHelper;
private final String[] taskColumns = {
DatabaseHelper.COLUMN_ID, DatabaseHelper.TASKS_COLUMN_NAME,
DatabaseHelper.TASKS_COLUMN_DESC, DatabaseHelper.TASKS_COLUMN_PRIORITY,
DatabaseHelper.TASKS_COLUMN_CYCLE, DatabaseHelper.TASKS_COLUMN_DONE,
@@ -40,7 +40,7 @@ public class TaskDataAccess implements AutoCloseable {
open(writeMode);
}
public void open(MODE writeMode) throws SQLException {
private void open(MODE writeMode) throws SQLException {
if (writeMode == MODE.WRITE) database = dbHelper.getWritableDatabase();
else database = dbHelper.getReadableDatabase();
}
@@ -75,25 +75,10 @@ public class TaskDataAccess implements AutoCloseable {
return newTask;
}
@Deprecated
public int updateExpiredTasks(int action, long taskListId){
String column = DatabaseHelper.TASKS_COLUMN_DELETED;
if (action == 1)
column = DatabaseHelper.TASKS_COLUMN_DONE;
else if (action == 2)
column = DatabaseHelper.TASKS_COLUMN_DELETED;
ContentValues contentValues = new ContentValues();
contentValues.put(column, 1);
return database.update(DatabaseHelper.TASKS_TABLE_NAME, contentValues,
DatabaseHelper.TASKS_COLUMN_DUEDATE + " <= date('now','-1 day')" +
" AND " + DatabaseHelper.TASKS_COLUMN_LIST + " = " + taskListId, null);
}
public int updateTodayTasks(long id, boolean isTodayList){
public void updateTodayTasks(long id, boolean isTodayList){
ContentValues contentValues = new ContentValues();
contentValues.put(DatabaseHelper.TASKS_COLUMN_TODAYDATE, isTodayList? LocalDate.now().toString() : "");
return database.update(DatabaseHelper.TASKS_TABLE_NAME, contentValues,
database.update(DatabaseHelper.TASKS_TABLE_NAME, contentValues,
DatabaseHelper.COLUMN_ID + " == " + id, null);
}

View File

@@ -22,8 +22,8 @@ public class TaskListDataAccess implements AutoCloseable {
}
// Database fields
private SQLiteDatabase database;
private DatabaseHelper dbHelper;
private String[] taskListColumns =
private final DatabaseHelper dbHelper;
private final String[] taskListColumns =
{DatabaseHelper.COLUMN_ID, DatabaseHelper.TASKLIST_COLUMN_NAME,
DatabaseHelper.COLUMN_ORDER, DatabaseHelper.TASKLIST_COLUMN_VISIBLE};
@@ -45,14 +45,10 @@ public class TaskListDataAccess implements AutoCloseable {
}
public TaskList createTaskList(String name, int order) {
return createTaskList(name, order, true);
}
public TaskList createTaskList(String name, int order, Boolean visible) {
ContentValues values = new ContentValues();
values.put(DatabaseHelper.TASKLIST_COLUMN_NAME, name);
values.put(DatabaseHelper.COLUMN_ORDER, order);
values.put(DatabaseHelper.TASKLIST_COLUMN_VISIBLE, visible ? 1 : 0);
values.put(DatabaseHelper.TASKLIST_COLUMN_VISIBLE, 1);
long insertId = database.insert(DatabaseHelper.TASKLIST_TABLE_NAME, null,
values);
Cursor cursor = database.query(DatabaseHelper.TASKLIST_TABLE_NAME,
@@ -81,10 +77,6 @@ public class TaskListDataAccess implements AutoCloseable {
update(id, DatabaseHelper.TASKLIST_COLUMN_NAME, name);
}
public void updateVisibility(long id, boolean visible){
update(id, DatabaseHelper.TASKLIST_COLUMN_VISIBLE, visible ? 1 : 0);
}
public TaskList getTaskListByName(String name) {
Cursor cursor = getTaskListByNameCursor(name);
TaskList taskList = null;

View File

@@ -1,5 +1,6 @@
package com.wismna.geoffroy.donext.fragments;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
@@ -47,7 +48,8 @@ public class ConfirmDialogFragment extends DialogFragment {
Bundle args = getArguments();
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_task_confirmation, null);
// No need for a parent in a Dialog Fragment
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.fragment_task_confirmation, null);
builder.setView(view).setMessage(args.getString("message"))
.setPositiveButton(args.getInt("button"), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {

View File

@@ -32,9 +32,9 @@ import com.wismna.geoffroy.donext.R;
public abstract class DynamicDialogFragment extends DialogFragment {
private View mDialogView = null;
protected boolean mHasNeutralButton = false;
protected boolean mIsLargeLayout = false;
protected Fragment mContentFragment = new Fragment();
boolean mHasNeutralButton = false;
boolean mIsLargeLayout = false;
Fragment mContentFragment = new Fragment();
@Nullable
@Override

View File

@@ -1,256 +0,0 @@
package com.wismna.geoffroy.donext.fragments;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import com.wismna.geoffroy.donext.R;
import com.wismna.geoffroy.donext.dao.Task;
import com.wismna.geoffroy.donext.dao.TaskList;
import org.joda.time.LocalDate;
import java.util.List;
/**
* Created by geoffroy on 15-11-26.
* Represents a New or Edit Task dialog
*/
@Deprecated
public class TaskDialogFragment extends DialogFragment {
public Task getTask() {
return task;
}
/** The activity that creates an instance of this dialog fragment must
* implement this interface in order to receive event callbacks.
* Each method passes the DialogFragment in case the host needs to query it. */
interface NewTaskListener {
void onNewTaskDialogPositiveClick(DialogFragment dialog, View dialogView);
void onNewTaskDialogNeutralClick(DialogFragment dialog);
}
// Use this instance of the interface to deliver action events
private NewTaskListener mListener;
private Task task;
private List<TaskList> taskLists;
public static TaskDialogFragment newInstance(Task task, List<TaskList> taskLists, NewTaskListener newTaskListener) {
TaskDialogFragment fragment = new TaskDialogFragment();
fragment.task = task;
fragment.taskLists = taskLists;
fragment.mListener = newTaskListener;
fragment.setRetainInstance(true);
return fragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// This part is only needed on small layouts (large layouts use onCreateDialog)
if (!getArguments().getBoolean("layout")) {
View view = inflater.inflate(R.layout.fragment_task_form, container, false);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(setToolbarTitle(view));
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setHomeAsUpIndicator(android.R.drawable.ic_menu_close_clear_cancel);
}
setHasOptionsMenu(true);
setTaskValues(view);
return view;
}
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Inflate and set the layout for the dialog
LayoutInflater inflater = getActivity().getLayoutInflater();
final View view = inflater.inflate(R.layout.fragment_task_form, null);
setToolbarTitle(view);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Pass null as the parent view because its going in the dialog layout
builder.setView(view)
// Add action buttons
.setPositiveButton(R.string.new_task_save, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
onPositiveButtonClick(view);
}
})
.setNegativeButton(R.string.new_task_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Send the negative button event back to the host activity
// Canceled creation, nothing to do
//dialog.cancel();
onNegativeButtonClick();
}
});
if (task != null) {
builder.setNeutralButton(R.string.new_task_delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onNeutralButtonClick();
}
});
}
setTaskValues(view);
return builder.create();
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//super.onCreateOptionsMenu(menu, inflater);
menu.clear();
getActivity().getMenuInflater().inflate(R.menu.menu_dynamic_fragment, menu);
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
if (task == null) {
menu.removeItem(R.id.menu_neutral_button);
}
super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Determine which menu item was clicked
int id = item.getItemId();
View view = getView();
// Hide the keyboard if present
if (view != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
}
if (id == R.id.menu_positive_button) {
// handle save button click here
onPositiveButtonClick(view);
return true;
}
else if (id == R.id.menu_neutral_button) {
// handle delete button click here
onNeutralButtonClick();
return true;
}
else if (id == android.R.id.home) {
// handle close button click here
onNegativeButtonClick();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onDestroyView() {
Dialog dialog = getDialog();
// Stop the dialog from being dismissed on rotation, due to a bug with the compatibility library
// https://code.google.com/p/android/issues/detail?id=17423
if (dialog != null && getRetainInstance()) {
dialog.setDismissMessage(null);
}
super.onDestroyView();
}
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
Spinner spinner = (Spinner) view.findViewById(R.id.new_task_list);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<TaskList> adapter = new ArrayAdapter<>(
getActivity(), android.R.layout.simple_spinner_item, taskLists);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
// Auto set list value to current tab
Bundle args = getArguments();
int id = args.getInt("list");
spinner.setSelection(id);
CheckBox checkBox = (CheckBox) view.findViewById(R.id.new_task_today);
TextView todayLabel = (TextView) view.findViewById(R.id.new_task_today_label);
boolean isTodayActive = args.getBoolean("today");
checkBox.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
todayLabel.setVisibility(isTodayActive ? View.VISIBLE : View.GONE);
// Set other properties if they exist
if (task != null) {
EditText titleText = (EditText) view.findViewById(R.id.new_task_name);
titleText.setText(task.getName());
EditText descText = (EditText) view.findViewById(R.id.new_task_description);
descText.setText(task.getDescription());
SeekBar seekBar = (SeekBar) view.findViewById(R.id.new_task_priority);
seekBar.setProgress(task.getPriority());
// Set Due Date
LocalDate dueDate = task.getDueDate();
dueDatePicker.updateDate(dueDate.getYear(), dueDate.getMonthOfYear() - 1, dueDate.getDayOfMonth());
checkBox.setChecked(task.isToday());
}
else {
// Disallow past dates on new tasks
dueDatePicker.setMinDate(LocalDate.now().toDate().getTime());
}
}
private Toolbar setToolbarTitle(View view) {
Toolbar toolbar = (Toolbar) view.findViewById(R.id.dialog_toolbar);
toolbar.setTitle(getTag());
return toolbar;
}
protected void onPositiveButtonClick(View view) {
if (view == null) return;
EditText titleText = (EditText) view.findViewById(R.id.new_task_name);
// handle confirmation button click hereEditText titleText = (EditText) d.findViewById(R.id.new_task_name);
if (titleText.getText().toString().matches(""))
titleText.setError(getResources().getString(R.string.new_task_name_error));
else {
// Send the positive button event back to the host activity
mListener.onNewTaskDialogPositiveClick(TaskDialogFragment.this, view);
dismiss();
}
}
protected /*abstract*/ void onNeutralButtonClick() {
mListener.onNewTaskDialogNeutralClick(TaskDialogFragment.this);
}
protected /*abstract*/ void onNegativeButtonClick() {
dismiss();
}
}

View File

@@ -49,8 +49,7 @@ public class TaskListsFragment extends Fragment implements
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
taskListDataAccess = new TaskListDataAccess(getContext());
taskListDataAccess.open(TaskListDataAccess.MODE.WRITE);
taskListDataAccess = new TaskListDataAccess(getContext(), TaskListDataAccess.MODE.WRITE);
new GetTaskListsTask().execute(taskListDataAccess);
}

View File

@@ -187,21 +187,21 @@ public class TasksFragment extends Fragment implements
int totalCycles = taskRecyclerViewAdapter.getCycleCount();
TextView totalCyclesView = (TextView) view.findViewById(R.id.total_task_cycles);
if (totalCycles != 0)
totalCyclesView.setText(resources.getString(R.string.task_total_cycles, totalCycles, (totalCycles > 1 ? "s" : "")));
totalCyclesView.setText(resources.getQuantityString(R.plurals.task_total_cycles, totalCycles, totalCycles));
else totalCyclesView.setText("");
// Update total tasks
int totalTasks = taskRecyclerViewAdapter.getItemCount();
TextView totalTasksView = (TextView) view.findViewById(R.id.total_task_count);
if (totalTasks == 0) totalTasksView.setText(resources.getText(R.string.task_no_tasks));
else totalTasksView.setText(resources.getString(R.string.task_total, totalTasks, (totalTasks > 1 ? "s" : "")));
if (totalTasks == 0) view.findViewById(R.id.no_more_tasks).setVisibility(View.VISIBLE);
else totalTasksView.setText(resources.getQuantityString(R.plurals.task_total, totalTasks, totalTasks));
// Update remaining tasks
TextView remainingTasksView = (TextView) view.findViewById(R.id.remaining_task_count);
NoScrollingLayoutManager layoutManager = (NoScrollingLayoutManager) recyclerView.getLayoutManager();
int remainingTaskCount = totalTasks - layoutManager.findLastVisibleItemPosition() - 1;
if (remainingTaskCount == 0) remainingTasksView.setText("");
else remainingTasksView.setText(resources.getString(R.string.task_remaining, remainingTaskCount, (remainingTaskCount > 1 ? "s" : "")));
else remainingTasksView.setText(resources.getQuantityString(R.plurals.task_remaining, remainingTaskCount, remainingTaskCount));
//recyclerView.getViewTreeObserver().removeOnPreDrawListener(this);
return true;
@@ -214,89 +214,8 @@ public class TasksFragment extends Fragment implements
@Override
public void onPause() {
super.onPause();
if (snackbar != null) snackbar.dismiss();
}
/** Performs an action on a task: done, next or delete */
public void PerformTaskAction(final int itemPosition, final int direction) {
final long itemId = taskRecyclerViewAdapter.getItemId(itemPosition);
final Task task = taskRecyclerViewAdapter.getItem(itemPosition);
String action = "";
Resources resources = getResources();
taskRecyclerViewAdapter.remove(itemPosition);
switch (direction)
{
// Mark item as Done
case ItemTouchHelper.LEFT:
action = resources.getString(R.string.snackabar_action_done);
break;
// Increase task cycle count
case ItemTouchHelper.RIGHT:
action = resources.getString(R.string.snackabar_action_next);
task.setCycle(task.getCycle() + 1);
taskRecyclerViewAdapter.add(task, taskRecyclerViewAdapter.getItemCount());
break;
case -1:
FragmentManager manager = getFragmentManager();
DialogFragment dialog = (DialogFragment) manager.findFragmentByTag(getString(R.string.action_edit_task));
if (dialog != null) dialog.dismiss();
action = resources.getString(R.string.snackabar_action_deleted);
break;
}
// Setup the snack bar
snackbar = Snackbar.make(view, resources.getString(R.string.snackabar_label, action), Snackbar.LENGTH_LONG)
.setAction(resources.getString(R.string.snackabar_button), new View.OnClickListener() {
@Override
public void onClick(View v) {
// Undo adapter changes
switch (direction) {
// Nothing special to do for done
case ItemTouchHelper.LEFT:
break;
// Remove the last item
case ItemTouchHelper.RIGHT:
taskRecyclerViewAdapter.remove(taskRecyclerViewAdapter.getItemCount() - 1);
task.setCycle(task.getCycle() - 1);
break;
// Nothing special to do for delete
case -1:
break;
}
// Reset the first item
taskRecyclerViewAdapter.add(task, itemPosition);
recyclerView.scrollToPosition(0);
}
});
snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
// When clicked on undo, do not write to DB
if (event == DISMISS_EVENT_ACTION) return;
// Commit the changes to DB
try (TaskDataAccess taskDataAccess = new TaskDataAccess(view.getContext(), TaskDataAccess.MODE.WRITE)) {
switch (direction) {
// Mark item as Done
case ItemTouchHelper.LEFT:
taskDataAccess.setDone(itemId);
break;
// Increase task cycle count
case ItemTouchHelper.RIGHT:
taskDataAccess.increaseCycle(task.getCycle(), itemId);
break;
case -1:
// Commit the changes to DB
taskDataAccess.deleteTask(itemId);
}
}
}
}).show();
super.onPause();
}
@Override
@@ -456,4 +375,85 @@ public class TasksFragment extends Fragment implements
}
else PerformTaskAction(itemPosition, direction);
}
/** Performs an action on a task: done, next or delete */
private void PerformTaskAction(final int itemPosition, final int direction) {
final long itemId = taskRecyclerViewAdapter.getItemId(itemPosition);
final Task task = taskRecyclerViewAdapter.getItem(itemPosition);
String action = "";
Resources resources = getResources();
taskRecyclerViewAdapter.remove(itemPosition);
switch (direction)
{
// Mark item as Done
case ItemTouchHelper.LEFT:
action = resources.getString(R.string.snackabar_action_done);
break;
// Increase task cycle count
case ItemTouchHelper.RIGHT:
action = resources.getString(R.string.snackabar_action_next);
task.setCycle(task.getCycle() + 1);
taskRecyclerViewAdapter.add(task, taskRecyclerViewAdapter.getItemCount());
break;
case -1:
FragmentManager manager = getFragmentManager();
DialogFragment dialog = (DialogFragment) manager.findFragmentByTag(getString(R.string.action_edit_task));
if (dialog != null) dialog.dismiss();
action = resources.getString(R.string.snackabar_action_deleted);
break;
}
// Setup the snack bar
snackbar = Snackbar.make(view, resources.getString(R.string.snackabar_label, action), Snackbar.LENGTH_LONG)
.setAction(resources.getString(R.string.snackabar_button), new View.OnClickListener() {
@Override
public void onClick(View v) {
// Undo adapter changes
switch (direction) {
// Nothing special to do for done
case ItemTouchHelper.LEFT:
break;
// Remove the last item
case ItemTouchHelper.RIGHT:
taskRecyclerViewAdapter.remove(taskRecyclerViewAdapter.getItemCount() - 1);
task.setCycle(task.getCycle() - 1);
break;
// Nothing special to do for delete
case -1:
break;
}
// Reset the first item
taskRecyclerViewAdapter.add(task, itemPosition);
recyclerView.scrollToPosition(0);
}
});
snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
// When clicked on undo, do not write to DB
if (event == DISMISS_EVENT_ACTION) return;
// Commit the changes to DB
try (TaskDataAccess taskDataAccess = new TaskDataAccess(view.getContext(), TaskDataAccess.MODE.WRITE)) {
switch (direction) {
// Mark item as Done
case ItemTouchHelper.LEFT:
taskDataAccess.setDone(itemId);
break;
// Increase task cycle count
case ItemTouchHelper.RIGHT:
taskDataAccess.increaseCycle(task.getCycle(), itemId);
break;
case -1:
// Delete the task
taskDataAccess.deleteTask(itemId);
}
}
}
}).show();
}
}

View File

@@ -18,6 +18,7 @@ import com.wismna.geoffroy.donext.database.TaskDataAccess;
import org.joda.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
@@ -34,16 +35,12 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
void onTodayTasksUpdated();
}
private TodayFormDialogFragment.TodayTaskListener mListener;
private List<Task> tasks;
private final List<Task> mUpdatedTasks = new ArrayList<>();
public static TodayFormDialogFragment newInstance(Context context, TodayTaskListener todayTaskListener) {
TodayFormDialogFragment fragment = new TodayFormDialogFragment();
fragment.mListener = todayTaskListener;
// TODO: put this in an AsyncTask
try(TaskDataAccess taskDataAccess = new TaskDataAccess(context)) {
fragment.tasks = taskDataAccess.getAllTasks();
}
fragment.setRetainInstance(true);
return fragment;
}
@@ -53,19 +50,15 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContentFragment = new TodayFormContentFragment();
// Load the tasks asynchronously
new LoadTasks().execute(getActivity());
Bundle args = getArguments();
if (args != null) {
mIsLargeLayout = args.getBoolean("layout");
}
}
@Override
public void onStart() {
super.onStart();
setLayoutValues(getView());
}
private void setLayoutValues(View view) {
private void setLayoutValues(View view, List<Task> tasks) {
EditText editText = (EditText) view.findViewById(R.id.today_search);
final ListView listView = (ListView) view.findViewById(R.id.today_tasks);
final TodayArrayAdapter adapter = new TodayArrayAdapter(getActivity(), tasks);
@@ -77,6 +70,10 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
Task task = adapter.getItem(position);
if (task == null) return;
task.setTodayDate(task.isToday() ? "" : LocalDate.now().toString());
// Maintain a list of actually updated tasks to commit to DB
if (!mUpdatedTasks.contains(task)) mUpdatedTasks.add(task);
else mUpdatedTasks.remove(task);
// Refresh the view
adapter.notifyDataSetChanged();
}
});
@@ -101,8 +98,8 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
@Override
protected void onPositiveButtonClick(View view) {
mListener.onTodayTaskDialogPositiveClick(view);
// TODO: find a way to filter this list to only get changed tasks
new UpdateTasks().execute(tasks.toArray(new Task[tasks.size()]));
// Only commit the updated tasks to DB
new UpdateTasks().execute(mUpdatedTasks.toArray(new Task[mUpdatedTasks.size()]));
dismiss();
}
@@ -116,6 +113,21 @@ public class TodayFormDialogFragment extends DynamicDialogFragment {
dismiss();
}
private class LoadTasks extends AsyncTask<Context, Void, List<Task>> {
@Override
protected List<Task> doInBackground(Context... params) {
try(TaskDataAccess taskDataAccess = new TaskDataAccess(params[0])) {
return taskDataAccess.getAllTasks();
}
}
@Override
protected void onPostExecute(List<Task> tasks) {
super.onPostExecute(tasks);
setLayoutValues(getView(), tasks);
}
}
private class UpdateTasks extends AsyncTask<Task, Void, Integer> {
@Override
protected Integer doInBackground(Task... params) {

View File

@@ -11,7 +11,7 @@ import android.support.v7.widget.helper.ItemTouchHelper;
public class TaskListTouchHelper extends ItemTouchHelper.SimpleCallback {
public interface TaskListTouchHelperAdapter {
boolean onItemMove (int fromPosition, int toPosition);
boolean onItemMove(int fromPosition, int toPosition);
}
private final TaskListTouchHelperAdapter mAdapter;

View File

@@ -22,7 +22,7 @@ public class TaskTouchHelper extends ItemTouchHelper.SimpleCallback {
void onItemSwiped(int position, int direction);
}
private TaskTouchHelperAdapter mAdapter;
private final TaskTouchHelperAdapter mAdapter;
public TaskTouchHelper(TaskTouchHelperAdapter adapter){
// No drag moves, no swipes (except for 1st element, see getSwipeDirs method)

View File

@@ -11,13 +11,13 @@ import android.view.View;
* Listener class on RecyclerView to intercept touch events
*/
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
private final OnItemClickListener mListener;
public interface OnItemClickListener {
void onItemClick(View view, int position);
}
GestureDetector mGestureDetector;
private final GestureDetector mGestureDetector;
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
mListener = listener;

View File

@@ -15,7 +15,7 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
private Drawable mDivider;
private final Drawable mDivider;
/**
* Default divider will be used

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z" />
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11.5,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zm6.5,-6v-5.5c0,-3.07 -2.13,-5.64 -5,-6.32V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5v0.68c-2.87,0.68 -5,3.25 -5,6.32V16l-2,2v1h17v-1l-2,-2z" />
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-.25 1.97,-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01.25,-1.97.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM7.88,3.39L6.6,1.86 2,5.71l1.29,1.53 4.59,-3.85zM12.5,8L11,8v6l4.75,2.85 0.75,-1.23 -4,-2.37L12.5,8zM12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

View File

@@ -12,7 +12,6 @@
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" android:id="@+id/toolbar" />
</android.support.design.widget.AppBarLayout>
@@ -24,7 +23,7 @@
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:onClick="onNewTaskClick"
android:src="@drawable/ic_add_white_24dp" />
android:src="@drawable/ic_add" />
<LinearLayout
android:layout_width="wrap_content"

View File

@@ -58,6 +58,6 @@
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:onClick="onNewTaskClick"
android:src="@drawable/ic_add_white_24dp" />
android:src="@drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>

View File

@@ -30,6 +30,6 @@
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:onClick="onNewTaskClick"
android:src="@drawable/ic_add_white_24dp" />
android:src="@drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>

View File

@@ -7,7 +7,6 @@
android:id="@+id/task_confirmation_never"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/text_margin"
android:layout_marginStart="@dimen/text_margin"
android:layout_marginTop="10dp"
android:text="@string/task_confirmation_never_button" />

View File

@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<include layout="@layout/toolbar" android:id="@+id/dialog_toolbar" />
</android.support.design.widget.AppBarLayout>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:background="@android:color/background_light">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/text_margin"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".activities.MainActivity">
<TextView
android:id="@+id/new_task_list_label"
android:text="@string/new_task_list"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginTop="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/new_task_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_toEndOf="@id/new_task_list_label">
</Spinner>
<EditText
android:id="@+id/new_task_name"
android:hint="@string/new_task_name_hint"
android:maxLines="1"
android:inputType="text"
android:textSize="30sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/new_task_list"/>
<EditText
android:id="@+id/new_task_description"
android:hint="@string/new_task_description_hint"
android:gravity="top|start"
android:lines="3"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/new_task_name" />
<TextView
android:id="@+id/new_task_priority_label"
android:text="@string/new_task_priority"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_below="@id/new_task_description" />
<SeekBar
android:id="@+id/new_task_priority"
android:max="2"
android:progress="1"
android:layout_width="300dp"
android:layout_height="30dp"
android:layout_toEndOf="@id/new_task_priority_label"
android:layout_below="@id/new_task_description" />
<TextView
android:id="@+id/new_task_today_label"
android:text="@string/new_task_today"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_below="@id/new_task_priority" />
<CheckBox
android:id="@+id/new_task_today"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/new_task_today_label"
android:layout_below="@id/new_task_priority" />
<TextView
android:id="@+id/new_task_due_date_label"
android:text="@string/new_task_due_date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@id/new_task_today" />
<DatePicker
android:id="@+id/new_task_due_date"
android:datePickerMode="spinner"
android:calendarViewShown="false"
android:spinnersShown="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/new_task_due_date_label" />
</RelativeLayout>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@@ -9,7 +9,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical|start"
android:scaleType="center"
android:src="@drawable/ic_reorder_grey_500_24dp"
android:src="@drawable/ic_reorder"
android:contentDescription="@string/task_list_drag_handle"/>
<TextView
android:id="@+id/task_list_count"
@@ -23,6 +23,7 @@
android:layout_height="?listPreferredItemHeight"
android:layout_weight="2"
android:inputType="text"
android:hint="@string/task_list_edit_list_hint"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<Button
android:id="@+id/task_list_delete"

View File

@@ -16,7 +16,6 @@
android:id="@+id/new_task_list_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="75dp"
android:layout_marginStart="75dp">
<EditText
android:id="@+id/new_task_list_name"

View File

@@ -15,6 +15,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"/>
<TextView
android:id="@+id/no_more_tasks"
android:text="@string/task_no_tasks"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|center"
android:visibility="gone"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/task_list_view"
android:layout_width="match_parent"
@@ -31,7 +39,6 @@
android:id="@+id/task_list_background"
android:layout_marginLeft="@dimen/text_margin"
android:layout_marginRight="@dimen/text_margin"
android:layout_below="@id/total_task_cycles"
android:layout_height="70dp"
android:layout_width="match_parent"
android:background="@color/colorAccent"

View File

@@ -21,14 +21,14 @@
android:orderInCategory="20"
android:title="@string/action_changeLayout"
android:onClick="changeLayout"
android:icon="@drawable/ic_view_list_white_24dp"
android:icon="@drawable/ic_format_size_dark"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_editTabs"
android:orderInCategory="25"
android:title="@string/action_editTabs"
android:onClick="openTaskLists"
android:icon="@drawable/ic_create_new_folder_white_24dp"
android:icon="@drawable/ic_list_white_24dp"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_settings"

View File

@@ -6,6 +6,6 @@
android:orderInCategory="20"
android:title="@string/action_changeLayout"
android:onClick="changeLayout"
android:icon="@drawable/ic_view_list_white_24dp"
android:icon="@drawable/ic_format_size_dark"
app:showAsAction="always" />
</menu>

View File

@@ -4,8 +4,4 @@
<item>Simple</item>
<item>Détaillée</item>
</string-array>
<string-array name="settings_today_actions">
<item>Terminer</item>
<item>Réinitialiser</item>
</string-array>
</resources>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="task_total_cycles">
<item quantity="one">%1$d cycle</item>
<item quantity="other">%1$d cycles</item>
</plurals>
<plurals name="task_total">
<item quantity="one">%1$d tâche</item>
<item quantity="other">%1$d tâches</item>
</plurals>
<plurals name="task_remaining">
<item quantity="one">%1$d tâche%2$s restante</item>
<item quantity="other">%1$d tâche%2$s restantes</item>
</plurals>
</resources>

View File

@@ -7,28 +7,21 @@
<string name="action_changeLayout">Changer l\'apparence</string>
<string name="action_editTabs">Éditer les listes</string>
<string name="action_edit_task">Éditer</string>
<string name="action_newTab">Nouvelle liste</string>
<string name="action_new_task">Nouvelle tâche</string>
<string name="action_settings">Paramètres</string>
<string name="new_task_cancel">Annuler</string>
<string name="new_task_delete">Supprimer</string>
<string name="new_task_description">Description</string>
<string name="new_task_description_hint">Description de la tâche (optionnel)</string>
<string name="new_task_list">Liste</string>
<string name="new_task_name">Nom</string>
<string name="new_task_name_error">Le nom de la tâche ne peut pas être vide</string>
<string name="new_task_name_hint">Nom de la tâche</string>
<string name="new_task_priority">Priorité</string>
<string name="new_task_priority_high">Haute</string>
<string name="new_task_priority_low">Basse</string>
<string name="new_task_priority_normal">Normale</string>
<string name="new_task_save">Enregistrer</string>
<string name="settings_category_tasklists">Listes de tâche</string>
<string name="settings_category_tasks">Tâches</string>
<string name="settings_confirm_delete">Confirmation de suppression</string>
<string name="settings_confirm_donext">Confirmation sur suivant</string>
<string name="settings_confirm_markdone">Confirmation sur terminé</string>
<string name="settings_confirm_message">Changer l\'état de la tâche en</string>
<string name="settings_max_lists_label">Nombre de listes maximum</string>
<string name="settings_task_layout">Apparence des tâches</string>
<string name="snackabar_action_deleted">supprimée</string>
@@ -46,8 +39,6 @@
<string name="task_confirmation_next_button">Suivante</string>
<string name="task_confirmation_next_text">Passer à la tâche suivante?</string>
<string name="task_confirmation_no_button">Annuler</string>
<string name="task_confirmation_yes_button">Oui</string>
<string name="task_details_activity_title">Détails</string>
<string name="task_list_confirmation_delete">Supprimer la liste de tâches?</string>
<string name="task_list_delete">Supprimer</string>
<string name="task_list_drag_handle">Poignée de déplacement</string>
@@ -55,16 +46,9 @@
<string name="task_list_new_list_error">Le nom de la liste ne peut pas être vide</string>
<string name="task_list_new_list_hint">Nom de la liste</string>
<string name="task_no_tasks">Super! Aucune tâche en cours!</string>
<string name="task_remaining">%1$d tâche%2$s restante%2$s</string>
<string name="task_total">%1$d tâche%2$s</string>
<string name="task_total_cycles">%1$d cycle%2$s</string>
<string name="title_activity_task_list">TaskListActivity</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_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="task_list_today">Aujourd\'hui</string>
<string name="task_list_today_list_error">Le nom \"Aujourd\'hui\" est réservé. Vous pouvez activer la liste Aujourd\'hui dans les paramètres.</string>
<string name="settings_today_action_title">Action à entreprendre à la fin de la journée:</string>
<string name="new_task_due_date">Date de fin</string>
<string name="task_alarm">Task is past due date</string>
<string name="action_todayList">Vue Aujourd\'hui</string>
@@ -72,4 +56,5 @@
<string name="new_task_today">Ajouter la tâche à la vue Aujourd\'hui?</string>
<string name="today_search_hint">Rechercher…</string>
<string name="action_today_select">Choisissez des tâches</string>
<string name="task_list_edit_list_hint">Nom de la liste</string>
</resources>

View File

@@ -17,12 +17,4 @@
<item>1</item>
<item>2</item>
</string-array>
<string-array name="settings_today_actions">
<item>Done</item>
<item>Reset</item>
</string-array>
<string-array name="settings_today_action_values" translatable="false">
<item>1</item>
<item>2</item>
</string-array>
</resources>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="task_total_cycles">
<item quantity="one">%1$d cycle</item>
<item quantity="other">%1$d cycles</item>
</plurals>
<plurals name="task_total">
<item quantity="one">%1$d task</item>
<item quantity="other">%1$d tasks</item>
</plurals>
<plurals name="task_remaining">
<item quantity="one">%1$d more task</item>
<item quantity="other">%1$d more tasks</item>
</plurals>
</resources>

View File

@@ -1,10 +1,7 @@
<resources>
<string name="title_activity_task_list">TaskListActivity</string>
<!-- Activities and menu strings -->
<string name="app_name">DoNext</string>
<string name="action_settings">Settings</string>
<string name="action_newTab">New list</string>
<string name="action_editTabs">Edit lists</string>
<string name="action_about">About</string>
<string name="action_new_task">New task</string>
@@ -22,31 +19,20 @@
<string name="task_list_delete">Delete</string>
<string name="task_list_confirmation_delete">Delete task list?</string>
<string name="task_list_drag_handle">Drag handle</string>
<string name="task_list_today">Today</string>
<string name="task_list_today_list_error">Name \"Today\" is reserved. You may activate the Today list from the Settings.</string>
<!-- Strings related to new task dialog -->
<string name="new_task_list">List</string>
<string name="new_task_name">Name</string>
<string name="new_task_name_hint">New task name</string>
<string name="new_task_name_error">Task name cannot be blank</string>
<string name="new_task_description">Description</string>
<string name="new_task_description_hint">Optional task description</string>
<string name="new_task_priority">Priority</string>
<string name="new_task_priority_low">Low</string>
<string name="new_task_priority_normal">Normal</string>
<string name="new_task_priority_high">High</string>
<string name="new_task_due_date">Due date</string>
<string name="new_task_save">Save</string>
<string name="new_task_cancel">Cancel</string>
<string name="new_task_delete">Delete</string>
<!-- Strings related to task details activity -->
<string name="task_details_activity_title">Details</string>
<string name="task_no_tasks">Yay! No more tasks!</string>
<string name="task_total_cycles">%1$d cycle%2$s</string>
<string name="task_total">%1$d task%2$s</string>
<string name="task_remaining">%1$d more task%2$s</string>
<string name="task_alarm">Task is past due date</string>
<!-- String related to the SnackBar -->
@@ -63,14 +49,12 @@
<string name="task_confirmation_done_button">Done</string>
<string name="task_confirmation_next_button">Next</string>
<string name="task_confirmation_delete_button">Delete</string>
<string name="task_confirmation_yes_button">Yes</string>
<string name="task_confirmation_no_button">Cancel</string>
<string name="task_confirmation_never_button">Never ask again</string>
<!-- Strings related to Settings -->
<string name="settings_category_tasks">Tasks</string>
<string name="settings_category_tasklists">Task lists</string>
<string name="settings_confirm_message">Mark task as</string>
<string name="settings_confirm_donext">Confirm on next?</string>
<string name="settings_confirm_markdone">Confirm on done?</string>
<string name="settings_confirm_delete">Confirm on delete?</string>
@@ -78,7 +62,6 @@
<string name="settings_today_title">Today view</string>
<string name="settings_today_enable">Enable Today view?</string>
<string name="settings_today_desc">The Today view is a special way of showing your tasks. Select which tasks you want to do during the day and they will show up in this view. At the end of the day, the view is reset.</string>
<string name="settings_today_action_title">Action at the end of the day</string>
<string name="settings_max_lists_label">Maximum number of lists</string>
<!-- Strings related to About -->
@@ -92,4 +75,5 @@
<string name="new_task_today">Add task to Today View?</string>
<string name="today_search_hint">Search…</string>
<string name="action_today_select">Select tasks</string>
<string name="task_list_edit_list_hint">List name</string>
</resources>